AnsweredAssumed Answered

STM32L4 bootloader on internal flash jumping to application on external flash

Question asked by kenney.jacob on Mar 16, 2017
Latest reply on Mar 17, 2017 by Clive One

I'm working with an STM32L476ZG with an external flash connected through the FMC interface set up as NOR Flash memory starting at address 0x64000000. I wrote a custom bootloader to write code to this external flash address and I am now working to jump to application but am running into problems. I currently have the bootloader and main application built so before the jump the bootloader will set the vector table to the base of the external flash and the main application agrees in the System_Init. My jump procedure is as follows:


JumpAddress = *(__IO uint32_t*) (EXT_FLASH_START_ADDRESS+4);
Jump_To_Application = (pFunction) JumpAddress;
//Initialize user application's Stack Pointer
__set_MSP(*(__IO uint32_t*) (EXT_FLASH_START_ADDRESS));




where EXT_FLASH_START_ADDRESS is 0x64000000, APP_OFFSET is 0x00000000, JumpAddress is a uint32_t, and Jump_To_Application is defined as pFunction.

I have __enable_irq(); as the first thing that gets done in main on the actual application code.


I was wondering if there were additional steps I would need to take for trying to run in external flash? I have this bootloader set up similar to another project I've worked on in the past but that was using exclusively the internal flash. From debugging, it looks like I manage to set the new stack pointer correctly and I jump to what I believe is the right address to start execution. It manages to go a few steps further and then sits in one spot which I believe is an infinite loop.