2017-02-16 02:06 AM
I am working with the STM32F045-microcontroller and I write my source code in Eclipse and I build with GNU ARM C/C++ Cross Compiler and I debug using GDB OpenOCD Debugging with ST-LINK/V2. I have placed the interrupt vector table in RAM and it works fine:
__attribute__ ((section('.isr_vector_ram'),used))
uint32_t __isr_vectors_ram[sizeof(__isr_vectors)/sizeof(__isr_vectors[0])];void moveISRtableToRAM(void) {
memcpy(__isr_vectors_ram, __isr_vectors, sizeof(__isr_vectors)); SCB->VTOR = (uint32_t)__isr_vectors_ram;}However, I run into problems when I modify it:
void mySoftwareIntHandler(void) {
}
#define SKIP_Cortex_M_Core_Handlers_OFFSET 17
__isr_vectors_ram[SKIP_
Cortex
_
M
_
Core_
Handlers_OFFSET
+ CAN2_RX1_IRQn] = (uint32_t)mySoftwareIntHandler;My code crashes when I try the above. Does anybody know what's wrong?
2017-02-16 02:57 AM
Not aware that the F0 Cortex-M0 parts supported changing VTOR. Are you using an F405?
If the code is faulting look at the addresses being written too. Confirm the compiler and linker create the addresses you expect. Do it will manual inspection and math, or have it printf () the values out for you to see. Make sure the subroutines address is ODD and that it points where expected, compare with .MAP output.