aboutsummaryrefslogtreecommitdiffstats
path: root/ports
diff options
context:
space:
mode:
Diffstat (limited to 'ports')
-rw-r--r--ports/ARM7-AT91SAM7X/chcore.c2
-rw-r--r--ports/ARM7-LPC214x/chcore.c2
-rw-r--r--ports/ARM7/chcore.h33
3 files changed, 27 insertions, 10 deletions
diff --git a/ports/ARM7-AT91SAM7X/chcore.c b/ports/ARM7-AT91SAM7X/chcore.c
index af8bad20f..709db25be 100644
--- a/ports/ARM7-AT91SAM7X/chcore.c
+++ b/ports/ARM7-AT91SAM7X/chcore.c
@@ -24,7 +24,7 @@
/*
* System idle thread loop.
*/
-void _IdleThread(void *p) {
+void _idle(void *p) {
while (TRUE) {
// Note, it is disabled because it causes trouble with the JTAG probe.
diff --git a/ports/ARM7-LPC214x/chcore.c b/ports/ARM7-LPC214x/chcore.c
index 8803c47e3..01f3e2d68 100644
--- a/ports/ARM7-LPC214x/chcore.c
+++ b/ports/ARM7-LPC214x/chcore.c
@@ -24,7 +24,7 @@
/*
* System idle thread loop.
*/
-void _IdleThread(void *p) {
+void _idle(void *p) {
while (TRUE) {
// Note, it is disabled because it causes trouble with the JTAG probe.
diff --git a/ports/ARM7/chcore.h b/ports/ARM7/chcore.h
index daf8df77c..86f138669 100644
--- a/ports/ARM7/chcore.h
+++ b/ports/ARM7/chcore.h
@@ -20,8 +20,16 @@
#ifndef _CHCORE_H_
#define _CHCORE_H_
+/**
+ * Macro defining the ARM7 architecture.
+ */
#define CH_ARCHITECTURE_ARM7
+/*
+ * 32 bit stack alignment.
+ */
+typedef uint32_t stkalign_t;
+
typedef void *regarm;
/*
@@ -113,13 +121,22 @@ extern "C" {
#else /* !THUMB */
#define INT_REQUIRED_STACK 0
#endif /* !THUMB */
-#define StackAlign(n) ((((n) - 1) | 3) + 1)
-#define UserStackSize(n) StackAlign(sizeof(Thread) + \
- sizeof(struct intctx) + \
- sizeof(struct extctx) + \
- (n) + \
- INT_REQUIRED_STACK)
-#define WorkingArea(s, n) uint32_t s[UserStackSize(n) >> 2];
+
+/*
+ * Enforces a 32 bit alignment for a stack area size value.
+ */
+#define STACK_ALIGN(n) ((((n) - 1) | sizeof(stkalign_t)) + 1)
+
+#define THD_WA_SIZE(n) STACK_ALIGN(sizeof(Thread) + \
+ sizeof(struct intctx) + \
+ sizeof(struct extctx) + \
+ (n) + \
+ INT_REQUIRED_STACK)
+
+/*
+ * Declares a 32bit aligned thread working area.
+ */
+#define WORKING_AREA(s, n) stkalign_t s[THD_WA_SIZE(n)];
#ifdef THUMB
#define chSysSwitchI chSysSwitchI_thumb
@@ -154,7 +171,7 @@ extern "C" {
#ifdef __cplusplus
extern "C" {
#endif
- void _IdleThread(void *p) __attribute__((noreturn));
+ void _idle(void *p) __attribute__((weak, noreturn));
void chSysHalt(void);
void chSysSwitchI(Thread *otp, Thread *ntp);
void chSysPuts(char *msg);