Merge pull request #15100 from maribu/arm7-cast-align
cpu/arm7_common: Fix compilation with -Wcast-align
This commit is contained in:
commit
c6fe777388
@ -25,12 +25,16 @@
|
|||||||
#define STACK_MARKER (0x77777777)
|
#define STACK_MARKER (0x77777777)
|
||||||
#define REGISTER_CNT (12)
|
#define REGISTER_CNT (12)
|
||||||
|
|
||||||
__attribute__((used, section(".usr_stack"))) uint8_t usr_stack[USR_STACKSIZE];
|
__attribute__((used, section(".usr_stack"), aligned(4))) uint8_t usr_stack[USR_STACKSIZE];
|
||||||
__attribute__((used, section(".und_stack"))) uint8_t und_stack[UND_STACKSIZE];
|
__attribute__((used, section(".und_stack"), aligned(4))) uint8_t und_stack[UND_STACKSIZE];
|
||||||
__attribute__((used, section(".fiq_stack"))) uint8_t fiq_stack[FIQ_STACKSIZE];
|
__attribute__((used, section(".fiq_stack"), aligned(4))) uint8_t fiq_stack[FIQ_STACKSIZE];
|
||||||
__attribute__((used, section(".irq_stack"))) uint8_t irq_stack[ISR_STACKSIZE];
|
__attribute__((used, section(".irq_stack"), aligned(4))) uint8_t irq_stack[ISR_STACKSIZE];
|
||||||
__attribute__((used, section(".abt_stack"))) uint8_t abt_stack[ABT_STACKSIZE];
|
__attribute__((used, section(".abt_stack"), aligned(4))) uint8_t abt_stack[ABT_STACKSIZE];
|
||||||
__attribute__((used, section(".svc_stack"))) uint8_t svc_stack[ISR_STACKSIZE];
|
__attribute__((used, section(".svc_stack"), aligned(4))) uint8_t svc_stack[ISR_STACKSIZE];
|
||||||
|
|
||||||
|
#if (ISR_STACKSIZE % 4)
|
||||||
|
#error "ISR_STACKSIZE must be a multiple of 4"
|
||||||
|
#endif
|
||||||
|
|
||||||
void thread_yield_higher(void)
|
void thread_yield_higher(void)
|
||||||
{
|
{
|
||||||
@ -129,13 +133,14 @@ void *thread_isr_stack_pointer(void)
|
|||||||
/* This function returns the number of bytes used on the ISR stack */
|
/* This function returns the number of bytes used on the ISR stack */
|
||||||
int thread_isr_stack_usage(void)
|
int thread_isr_stack_usage(void)
|
||||||
{
|
{
|
||||||
uint32_t *ptr = (uint32_t*) &irq_stack[0];
|
uint32_t *ptr = (uint32_t *)(uintptr_t)&irq_stack[0];
|
||||||
|
uint32_t *end = (uint32_t *)(uintptr_t)&irq_stack[ISR_STACKSIZE];
|
||||||
|
|
||||||
while(((*ptr) == STACK_CANARY_WORD) && (ptr < (uint32_t*) &irq_stack[ISR_STACKSIZE])) {
|
while(((*ptr) == STACK_CANARY_WORD) && (ptr < end)) {
|
||||||
++ptr;
|
++ptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
ptrdiff_t num_used_words = (uint32_t*) &irq_stack[ISR_STACKSIZE] - ptr;
|
ptrdiff_t num_used_words = (uintptr_t)end - (uintptr_t)ptr;
|
||||||
|
|
||||||
return num_used_words;
|
return num_used_words;
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user