AnsweredAssumed Answered

Bootloader and jumping to flash location

Question asked by jdcowpland on Mar 13, 2014
Latest reply on May 15, 2014 by teo.teo
Hi guys,

I've been working on a bootloader program which is loosely based around the FW_Upgrade demo for the STM32F4 discovery board. My Bootloader so far correctly finds a file on a USB stick and downloads it to flash in the right location(0x0800C000), but I'm having issues jumping to that location to run my downloaded program once I'm done putting it in flash. The demo from ST has the MCU reset after it has downloaded to flash and then jumps to the program. Is the reset necessary or can I just jump straight to the location in flash?

Also, how do I actually do the jump. I'm using the code from st which looks like this, but it doesn't seem to work: 
/* Check Vector Table: Test if user code is programmed starting from address
         "APPLICATION_ADDRESS" */
      if (((*(__IO uint32_t*)APPLICATION_ADDRESS) & 0x2FFE0000 ) == 0x20000000)
      {
        /* Jump to user application */
        JumpAddress = (APPLICATION_ADDRESS + 4);
        Jump_To_Application = (pFunction) JumpAddress;
        /* Initialize user application's Stack Pointer */
        __set_MSP(*(__IO uint32_t*) APPLICATION_ADDRESS);
        Jump_To_Application();
      }

Outcomes