Skip to main content
Wayne Taylor
Associate
April 11, 2018
Question

Bootloader jump to user code

  • April 11, 2018
  • 2 replies
  • 1326 views
Posted on April 11, 2018 at 15:22

I am able to jump from User code into the built-in bootloader without any issues, I am also able to upload the new .bin file using the UART and ST FLASHER Demonstrator, however when I tick the Jump to user code option, I can see that I leave the bootloader however the user code does not start until the device is reset. After reading through the application notes I found a note mentioning 'The Jump to the application works only if the user application sets the vector table correctly to point to the application address.' Now in my code I have added the following line to the start of my code :

SCB->VTOR = FLASH_BASE | 0x0000; which I think sets the pointer to 0x080000000.

Or am I missing something?

    This topic has been closed for replies.

    2 replies

    Tesla DeLorean
    Guru
    April 11, 2018
    Posted on April 11, 2018 at 15:54

    Probably similar code in SystemInit()

    The boot loader might enable the Watchdog, or you're crashing/failing in your code some where, perhaps making an assumption about reset conditions.

    Would suggest adding some simple signs-of-life code in the front of Reset_Handler, to drive a GPIO or output character to USART.

    Tips, Buy me a coffee, or three.. PayPal VenmoUp vote any posts that you find helpful, it shows what's working..
    Wayne Taylor
    Associate
    April 12, 2018
    Posted on April 12, 2018 at 09:57

    I think you are correct on SystemInit().

    The bootloader does indeed enable the watchdog, however according to AN3155 the bootloader '• it initializes the registers of the peripherals used by the bootloader to their default reset values'  The code works flawlessly after a reboot, and if uploaded via ST-Link, but with the way I code anything is possible.

    I'm not really sure of how to add code ahead of the Reset_Handler, unless I edit the startup file?

    I'm really quite stumped by this, as the device appears completely lifeless, like it is being pointed to an incorrect location by the bootloader.

    Frank Voorburg
    Associate II
    April 11, 2018
    Posted on April 11, 2018 at 17:37

    Hello Wayne,

    In addition to what Clive One said, make sure you initialize the vector table base address, before initializing any other peripherals that might cause in interrupt to fire.

    -Frank

    Wayne Taylor
    Associate
    April 12, 2018
    Posted on April 12, 2018 at 09:57

    HI Frank,

    I will check on that but I'm fairly certain I am doing so.