2018-04-30 08:56 AM
Hi
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
SCB->VTOR = APPLICATION_ADDRESS;// Set the application stack pointer
__set_MSP(*(__IO uint32_t*) APPLICATION_ADDRESS);// Start the application
JumpToApplication();while(1);
}
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?
Regards
Scott
2018-05-01 01:00 PM
I only had the data sheet and the reference manual
And what's written on the very first page of the reference manual?
(which I couldnt see any reference on the VTOR register)
Then how did you know you need to use it?
Okay, I know I am pushing this now beyond reason, but you get the point.
JW
2018-05-01 04:51 PM
I downloaded a bootloader example on the stm web site which describes VTOR register. Also, years ago I designed a lot of systems using the 68000 and it’s VBR which does the same job, so I knew the stm32 must have the same process.
Scott