summaryrefslogtreecommitdiff
path: root/src/stm32f4
diff options
context:
space:
mode:
authorKeith Packard <keithp@keithp.com>2019-02-04 22:38:23 -0800
committerKeith Packard <keithp@keithp.com>2019-02-18 13:08:23 -0800
commitd6c3c3618a708d2a1a7948454710e6ae21c2a426 (patch)
tree710bccaa175928f81ae71d515671e95a3821a3c9 /src/stm32f4
parent63a44b9c169d042fb1a3997620477e7f00bb0918 (diff)
altos: Declare task stack as union of uint8_t and uint32_t
Support -Wcast-align and -Wpointer-arith while still allowing architectures to pick whether they want an 8-bit or 32-bit stack. Signed-off-by: Keith Packard <keithp@keithp.com>
Diffstat (limited to 'src/stm32f4')
-rw-r--r--src/stm32f4/ao_arch.h3
-rw-r--r--src/stm32f4/ao_arch_funcs.h8
2 files changed, 4 insertions, 7 deletions
diff --git a/src/stm32f4/ao_arch.h b/src/stm32f4/ao_arch.h
index 73dc3e93..7dd4c80d 100644
--- a/src/stm32f4/ao_arch.h
+++ b/src/stm32f4/ao_arch.h
@@ -38,9 +38,6 @@
#define AO_ROMCONFIG_SYMBOL __attribute__((section(".romconfig"))) const
-#define ao_arch_task_members\
- uint32_t *sp; /* saved stack pointer */
-
#define ao_arch_naked_declare __attribute__((naked))
#define ao_arch_naked_define
diff --git a/src/stm32f4/ao_arch_funcs.h b/src/stm32f4/ao_arch_funcs.h
index b1ffb5b6..8ff31b4a 100644
--- a/src/stm32f4/ao_arch_funcs.h
+++ b/src/stm32f4/ao_arch_funcs.h
@@ -84,7 +84,7 @@ ao_arch_irq_check(void) {
static inline void
ao_arch_init_stack(struct ao_task *task, void *start)
{
- uint32_t *sp = (uint32_t *) ((void*) task->stack + AO_STACK_SIZE);
+ uint32_t *sp = &task->stack32[AO_STACK_SIZE>>2];
uint32_t a = (uint32_t) start;
int i;
@@ -110,7 +110,7 @@ ao_arch_init_stack(struct ao_task *task, void *start)
/* BASEPRI with interrupts enabled */
ARM_PUSH32(sp, 0);
- task->sp = sp;
+ task->sp32 = sp;
}
static inline void ao_arch_save_regs(void) {
@@ -142,12 +142,12 @@ static inline void ao_arch_save_regs(void) {
static inline void ao_arch_save_stack(void) {
uint32_t *sp;
asm("mov %0,sp" : "=&r" (sp) );
- ao_cur_task->sp = (sp);
+ ao_cur_task->sp32 = (sp);
}
static inline void ao_arch_restore_stack(void) {
/* Switch stacks */
- asm("mov sp, %0" : : "r" (ao_cur_task->sp) );
+ asm("mov sp, %0" : : "r" (ao_cur_task->sp32) );
#ifdef AO_NONMASK_INTERRUPTS
/* Restore BASEPRI */