2016-11-15 05:56 PM
I have problem after relocating, my interrupt stop working.
A brief explanation about my firmware i) the bootloader (0x08000000) ii) the main application (0x08004000) In my bootloader, I relocate the code as shown below:pFunction jump_to_application;
uint32_t jump_address;
#define APPLICATION_ADDRESS 0x08004000
if (((*(__IO uint32_t*)APPLICATION_ADDRESS) & 0x2FFE0000) == 0x20000000) {
jump_address = *(__IO uint32_t*) (APPLICATION_ADDRESS + 4);
jump_to_application = (pFunction) jump_address;
_set_MSP(*(__IO uint32_t*) APPLICATION_ADDRESS);
jump_to_application();
}
and in my main app, I offset the vector table as
NVIC_SetVectorTable(NVIC_VectTab_FLASH, 0x4000);
When i try debug for my bootloader, it is able to relocate to the main app, and the interrupt is working.
But, when I power off and power it on, the bootloader can relocate to the main app, but the interrupt in the main app is not working.
May I know how can I solve this problem?
2016-11-15 07:00 PM
I managed to fix the problem, but I still dont understand why
SysTick_Config(SystemCoreClock / 1000);
I have enable the SysTick as shown above, but before I jump to my app, I dint not disable this.
Now, I changed my code to disable it first before jump, and it works.
SysTick->LOAD = 0;
SysTick->VAL = 0;
SysTick->CTRL = 0;
I have no idea, why this problem happens, and I have similar board using STM32F4 and STM32F2 series, and I jump without disable this and it still works fine.
Anyone can enlight me on this?