I'm using STMF105 and have a problem when I try to jump from bootloader to application.
Bootloader jumped fine when my application was with FreeRTOS, and now jumps fine only when I do blink tests in chibiOS.
Application runs fine when I load it from GDB, but when I run "monitor reset halt" bootloader fails to jump.
Application:
Inside chconf.h:
Code: Select all
#define CORTEX_VTOR_INIT 0x00006000 In linker file:
Code: Select all
flash : org = 0x08006000, len = 128k - 24kBootloader does only jump AND does not use chibi os:
Code: Select all
//mainAppStartAddress is 0x08006000
void _jumpToApp(void){
/* Disable global interrupt */
__disable_irq();
__set_CONTROL(0);
uint32_t *pMem = (uint32_t *)mainAppStartAddress;
/* First address is the stack pointer initial value */
__set_MSP(*pMem); // Set stack pointer
/* Now get main app entry point address */
pMem++;
void (*pMainApp)(void) = (void (*)(void))(*pMem);
pMainApp();
}Maybe I have to set explicitly the main stack pointer in Application main(), or I should enable interrupts?
I've tried various scenarious with __enable_irq() and set_MSP inside application main but with no luck.
Please advice.
Thank you in advance!