summaryrefslogtreecommitdiff
path: root/core
diff options
context:
space:
mode:
authorRandall Spangler <rspangler@chromium.org>2012-04-19 14:24:36 -0700
committerRandall Spangler <rspangler@chromium.org>2012-04-19 14:29:07 -0700
commit24dafefb3a63c9e2111ff87c4595ceaff7182d20 (patch)
tree2f971102a85b7436ee1275b31264b70bdc59f5a3 /core
parentff8926b5e357fe4cc82473af7603f3d273d1971a (diff)
downloadchrome-ec-24dafefb3a63c9e2111ff87c4595ceaff7182d20.tar.gz
Move externs from .lds file into a header file
Fewer magic externs = good. Signed-off-by: Randall Spangler <rspangler@chromium.org> BUG=none TEST=if it boots, it works Change-Id: Ifadeb1701400c5492c40d2eaf8f68f2d70189648
Diffstat (limited to 'core')
-rw-r--r--core/cortex-m/atomic.h10
-rw-r--r--core/cortex-m/ec.lds.S1
-rw-r--r--core/cortex-m/link_defs.h30
-rw-r--r--core/cortex-m/task.c7
4 files changed, 39 insertions, 9 deletions
diff --git a/core/cortex-m/atomic.h b/core/cortex-m/atomic.h
index a6fff4be08..9e214a41a2 100644
--- a/core/cortex-m/atomic.h
+++ b/core/cortex-m/atomic.h
@@ -1,12 +1,14 @@
-/* Copyright (c) 2011 The Chromium OS Authors. All rights reserved.
+/* Copyright (c) 2012 The Chromium OS Authors. All rights reserved.
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
/* Atomic operations for ARMv7 */
-#ifndef __ATOMIC_H
-#define __ATOMIC_H
+#ifndef __CROS_EC_ATOMIC_H
+#define __CROS_EC_ATOMIC_H
+
+#include "common.h"
/**
* Implements atomic arithmetic operations on 32-bit integers.
@@ -62,4 +64,4 @@ static inline uint32_t atomic_read_clear(uint32_t *addr)
return ret;
}
-#endif /* __ATOMIC_H */
+#endif /* __CROS_EC_ATOMIC_H */
diff --git a/core/cortex-m/ec.lds.S b/core/cortex-m/ec.lds.S
index 048b540c02..3b80f28093 100644
--- a/core/cortex-m/ec.lds.S
+++ b/core/cortex-m/ec.lds.S
@@ -31,6 +31,7 @@ SECTIONS
#endif
. = ALIGN(4);
.rodata : {
+ /* Symbols defined here are declared in link_defs.h */
__irqprio = .;
*(.rodata.irqprio)
__irqprio_end = .;
diff --git a/core/cortex-m/link_defs.h b/core/cortex-m/link_defs.h
new file mode 100644
index 0000000000..9279f42804
--- /dev/null
+++ b/core/cortex-m/link_defs.h
@@ -0,0 +1,30 @@
+/* Copyright (c) 2012 The Chromium OS Authors. All rights reserved.
+ * Use of this source code is governed by a BSD-style license that can be
+ * found in the LICENSE file.
+ *
+ * Symbols from linker definitions
+ */
+
+#ifndef __CROS_EC_LINK_DEFS_H
+#define __CROS_EC_LINK_DEFS_H
+
+#include "console.h"
+#include "hooks.h"
+#include "host_command.h"
+#include "task.h"
+
+extern const struct console_command __cmds[];
+extern const struct console_command __cmds_end[];
+
+extern const struct hook_data __hooks_init[];
+extern const struct hook_data __hooks_init_end[];
+extern const struct hook_data __hooks_freq_change[];
+extern const struct hook_data __hooks_freq_change_end[];
+
+extern const struct host_command __hcmds[];
+extern const struct host_command __hcmds_end[];
+
+extern const struct irq_priority __irqprio[];
+extern const struct irq_priority __irqprio_end[];
+
+#endif /* __CROS_EC_LINK_DEFS_H */
diff --git a/core/cortex-m/task.c b/core/cortex-m/task.c
index 376ce69ebe..168191ae0b 100644
--- a/core/cortex-m/task.c
+++ b/core/cortex-m/task.c
@@ -1,16 +1,15 @@
-/* Copyright (c) 2011 The Chromium OS Authors. All rights reserved.
+/* Copyright (c) 2012 The Chromium OS Authors. All rights reserved.
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
/* Task scheduling / events module for Chrome EC operating system */
-#include <stdint.h>
-
#include "config.h"
#include "atomic.h"
#include "console.h"
#include "cpu.h"
+#include "link_defs.h"
#include "task.h"
#include "timer.h"
#include "uart.h"
@@ -319,8 +318,6 @@ void task_trigger_irq(int irq)
static void __nvic_init_irqs(void)
{
/* Get the IRQ priorities section from the linker */
- extern struct irq_priority __irqprio[];
- extern struct irq_priority __irqprio_end[];
int irq_count = __irqprio_end - __irqprio;
int i;