(STM32F10x, IAR EW ) Self Upgrade bootloader through RS232, how to execute program in RAM after copy from FLASH

Viewed 2648

I am working in STM32F103RBT6, I want to upgrade my bootloader program which i put in 0x08000000~0x08003fff, i use all other flash memory for Application code. Through the RS232, I want to upgrade the bootloader. So i am thinking to copy the code to RAM--> execute the original bootloader in RAM --> Download the New bootloader. What i did is:

startAddr == 0x20000000
NVIC_SetVectorTable(NVIC_VectTab_RAM, 0x0); 

JumpAddress = *(__IO UINT32*)(startAddr + 4 ); 
Jump_To_Application =  (pFunction)JumpAddress;   
__set_MSP(*(__IO UINT32*) startAddr);
Jump_To_Application();  

It doesn't work.

The question is :

  1. Can i just copy the code to 0x20000000~. Should i divide the RAM into Two parts but how?

  2. How can i set my Vector table location, and where can i set it? how can i deal with the "VECT_TAB_OFFSET".

It will be extremely grateful if you can give me some solution or any commands. Thanks a lot.

1 Answers
Related