AnsweredAssumed Answered

Issues jumping to app from custom bootloader

Question asked by cicerom on Feb 25, 2016
Latest reply on Feb 25, 2016 by cicerom
Hi all,

I've done a couple of bootloaders in my days on the STM32F3 and F1's, but I can't seem to get this one to work for some reason.

STM32F411RE (512KB Flash, 128KB RAM)
IDE: SW4STM32

Memory map is as follows:
Sector 0 (0x08000000-0x08003FFF 16KB) for the bootloader
Sector 1 (0x08004000-0x08007FFF 16KB) for non-vol memory
Sectors 2-4 (0x08008000-0x0801FFFF 96KB) for my app

I do check the CRCs after copying the fw into the correct spaces and it all seems to check out.  When I jump to the app its not entering properly, and my LCD (regular 2x16 parallel) doesn't work, but UART comms works.  Its as though its half initialised and running regular code but not quite.

In my bootloader after copying and checking CRC's, I jump using this code:
APP_START is 0x08008000

/* Jump to user application */
      HAL_DeInit();
    JumpAddress = *(__IO u32*) (APP_START + 4);
    Jump_To_Application = (pFunction) JumpAddress;
    /* Initialize user application's Stack Pointer */
    __set_MSP(*(__IO u32*) APP_START);
    Jump_To_Application();

 In my main app, the linker moves the fw:
/* Specify the memory areas  */
MEMORY
{
FLASH (rx)      : ORIGIN = 0x08008000, LENGTH = 512K-0x8000
RAM (xrw)      : ORIGIN = 0x20000000, LENGTH = 128K
}

In system_stm32f4xx.c I also move the Vectors (MAKE_BOOTLOADABLE is defined):
/*!< Uncomment the following line if you need to relocate your vector Table in
     Internal SRAM. */
/* #define VECT_TAB_SRAM */
#ifdef MAKE_BOOTLOADABLE
  #define VECT_TAB_OFFSET  0x8000 /*!< Vector Table base offset field.
                                   This value must be a multiple of 0x200. */
#else
  #define VECT_TAB_OFFSET  0x00
#endif

 I'm not sure what else I'm meant to be doing?

Outcomes