Electronic – STM32F103 Systick Interrupt stopped working when debugging in ram – (Coocox IDE)

interruptsstm32stm32f10x

I tried debugging my code in ram in order to increase the flash's life (only rated at 10k writes minimum)

Anyways, I have tied the boot0 and boot1 pins to 3.3v and set the compiler to debug from ram like so:

Compiler "debug in ram" settings

When I debug my code this way, my SysTick_Handler doesn't run. If I debug from flash everything works just fine.

I can't figure out what is going on, and how can I get my SysTick interrupt to work in ram debug mode ?

P.S: I tried asking this in the coocox forum, but haven't got any help there.

Best Answer

You need to relocate the vector table — right now, the processor is probably still using the copy of the vector table in FLASH, which will point into an old version of your code in FLASH. (Or, if you've erased FLASH since you started developing in SRAM, the vector table in use will be blank.)

If you're using the STM32 Standard Peripheral Library (SPL), you can define the VECT_TAB_SRAM macro to have it set the appropriate flags to use a vector table in SRAM. If you're going the bare-metal route, you need to set the TBLOFF field of VTOR to point to the base of SRAM (0x02000000 on STM32F1).