I'm working through the book Embedded Systems Architecture by Daniele Lacamera. In Chapter 4, The Boot-Up Procedure, we create the Interrupt Vector Table (for an ARM Cortex M4) like this:
__attribute__ ((section(".isr_vector"))) void (* const ivt[])(void) =
{
(void (*)(void))END_STACK,
isr_reset,
// Other ISRs
};
It wasn't shown how END_STACK
was extern
ed, so I did it like this:
extern uint32_t END_STACK;
The linker script is similar to the following:
MEMORY
{
FLASH (rx) : ORIGIN = 0x00000000, LENGTH = 256K
RAM (rwx) : ORIGIN = 0x20000000, LENGTH = 48K
}
END_STACK = ORIGIN(RAM) + LENGTH(RAM)
I'm getting the following error:
arm-none-eabi-gcc -c main.c interrupt_vector.c -O0 -g -mthumb -mcpu=cortex-m4 -ffreestanding
interrupt_vector.c:14:5: error: initializer element is not constant
(void (*)(void))END_STACK,
^
What is a proper way to handle this? Is it possible to cast this to an address of a function or should I create a new section solely for the Stack Pointer?
I've tried sprinkling const
in the extern
and cast, but cannot resolve the error.