AnsweredAssumed Answered

Issue when setting Vector table register

Question asked by Scott Dev on Apr 30, 2018
Latest reply on May 1, 2018 by Scott Dev


  I have a booloader application that loads in new firmware in a different part of the flash. After updated I reset the processor and the newly uploaded application doesnt start. I think I must not be updating the vector table correctly because if I simply use the same vector table as the bootloader it works (the small uploaded test application doesnt use interupts). Here is my code in the bootloader.


#define APPLICATION_ADDRESS  (uint32_t)0x08002030

typedef  void (*pFunction)(void);


int boot_NewApp(void)

     pFunction JumpToApplication;
    uint32_t JumpAddress;


    // Get the application stack pointer (First entry in the application vector table)
    JumpAddress = *(__IO uint32_t*) (APPLICATION_ADDRESS + 4);


    // Get the application entry point (Second entry in the application vector table)
    JumpToApplication = (pFunction) JumpAddress;


    // Reconfigure vector table offset register to match the application location


    // Set the application stack pointer
     __set_MSP(*(__IO uint32_t*) APPLICATION_ADDRESS);


    // Start the application






If I comment out the "SCB->VTOR = APPLICATION_ADDRESS;" line, it works as expected by using the bootloader vector table.


Can anyone please let me know what I am doing wrong?