diff --git a/cpu/cc2538/cc2538.lds b/cpu/cc2538/cc2538.lds index a2dd0d209..60a37c796 100644 --- a/cpu/cc2538/cc2538.lds +++ b/cpu/cc2538/cc2538.lds @@ -64,7 +64,7 @@ SECTIONS .text : { _text = .; - KEEP(*(.vectors)) + *(.vectors) *(.text*) *(.rodata*) _etext = .; diff --git a/cpu/cc2538/dev/nvic.h b/cpu/cc2538/dev/nvic.h index 6c7563680..8f2f68259 100644 --- a/cpu/cc2538/dev/nvic.h +++ b/cpu/cc2538/dev/nvic.h @@ -54,7 +54,8 @@ #ifdef NVIC_CONF_VTABLE_ADDRESS #define NVIC_VTABLE_ADDRESS NVIC_CONF_VTABLE_ADDRESS #else -#define NVIC_VTABLE_ADDRESS 0x200000 +extern void(*const vectors[])(void); +#define NVIC_VTABLE_ADDRESS ((uint32_t)&vectors) #endif /** @} */ /*---------------------------------------------------------------------------*/ diff --git a/cpu/cc2538/startup-gcc.c b/cpu/cc2538/startup-gcc.c index 35c2329d2..d3d6ec401 100644 --- a/cpu/cc2538/startup-gcc.c +++ b/cpu/cc2538/startup-gcc.c @@ -94,22 +94,7 @@ void pka_isr(void); /* Allocate stack space */ static unsigned long stack[512] __attribute__ ((section(".stack"))); /*---------------------------------------------------------------------------*/ -/* Linker construct indicating .text section location */ -extern uint8_t _text[0]; -/*---------------------------------------------------------------------------*/ -__attribute__ ((section(".flashcca"), used)) -const flash_cca_lock_page_t __cca = { - FLASH_CCA_BOOTLDR_CFG, /* Boot loader backdoor configuration */ - FLASH_CCA_IMAGE_VALID, /* Image valid */ - &_text, /* Vector table located at the start of .text */ - /* Unlock all pages and debug */ - { 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, - 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, - 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, - 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF } -}; -/*---------------------------------------------------------------------------*/ -__attribute__ ((section(".vectors"), used)) +__attribute__((__section__(".vectors"))) void(*const vectors[])(void) = { (void (*)(void))((unsigned long)stack + sizeof(stack)), /* Stack pointer */ @@ -277,6 +262,18 @@ void(*const vectors[])(void) = default_handler, /* 162 MACTimer */ }; /*---------------------------------------------------------------------------*/ +__attribute__((__section__(".flashcca"), __used__)) +const flash_cca_lock_page_t flash_cca_lock_page = { + FLASH_CCA_BOOTLDR_CFG, /* Boot loader backdoor configuration */ + FLASH_CCA_IMAGE_VALID, /* Image valid */ + &vectors, /* Vector table */ + /* Unlock all pages and debug */ + { 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, + 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, + 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, + 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF } +}; +/*---------------------------------------------------------------------------*/ /* Linker constructs indicating .data and .bss segment locations */ extern uint8_t _ldata; extern uint8_t _data;