Question
Jumping to Application
Posted on May 13, 2014 at 16:53
Hi, I'm quite new with the ARM and STM32 world.
I'm developing an application wich has to load a bootloader and, at a certain point, jump to the main application. I'm using the STM32F4-Disco. The bootload is quite complex, using FreeRTOS and STemWin, comunicating to an external device with USART periph. Using a USB OTG drive which han an image.bin file on it (which is the main app code), I load it to a flash memory sector that for me is APPLICATION_ADDRESS (uint32_t)0x08080000 and then press a button on the touch-LCD for jumping to the loaded code. The jumping function is: cmd_Jump_To_Application(APPLICATION_ADDRESS) void cmd_Jump_To_Application(uint32_t start_Address) { USART_DeInit(USART2); USART_DeInit(USART1); RCC_APB2PeriphResetCmd(RCC_APB2Periph_USART1, ENABLE); RCC_APB2PeriphResetCmd(RCC_APB2Periph_USART1, DISABLE); RCC_APB1PeriphResetCmd(RCC_APB1Periph_USART2, ENABLE); RCC_APB1PeriphResetCmd(RCC_APB1Periph_USART2, DISABLE); RCC_DeInit(); __disable_irq(); uint32_t addressToJump = *(__IO uint32_t*) (start_Address + 4); pFunction Jump_To_Application = (pFunction) addressToJump; /* Initialize application's Stack Pointer */ __set_MSP(*(__IO uint32_t*) start_Address); /* Call Reset Handler */ Jump_To_Application(); } Assuming that the downloading part to flash memory is right (I ported from the FW_Upgrade example, and debugging I can see what I expect in the application sector), there is something wrong. When I press the jump button I get a white screen and everything freezing and I can't start the main application. I'm missing something for sure, maybe about stack or some other vector adress\init, but I can't understand what. Some suggestions? Thanks!