We are running a survey to help us improve the experience for all of our members. If you see the survey appear, please take the time to tell us about your experience if you can.
This question seems to have been asked several times, like http://www.keil.com/forum/18689/. What I want to know is how to burn the program in a customized flash address. I am using STM32F407 and it has 12 flash sectors, 0 ~11. sector 0 starting address 0x08000000 is by default where the program starts. If I want to make the program be burned in sector 11, starting address 0x080E0000, how can I realize it? Following are the steps I have tried but failed.
1. change Option for target -> target -> IROM1 to 0x080E0000 2. change Option for target -> linker -> R/O base to 0x080E0000 3. change Option for target -> debug -> setting -> flash download address to 0x080E0000 4. change FLASH_BASE and VECT_TAB_OFFSET values in SystemInit()
So how I can tell ResetHandler the new address of my main() function which is now in sector 11?
Isn't there any mechanism to place some vector table or jump commands at 0x08000000 so that it can jump to the new address?
PM0214 Programming manual STM32F3 and STM32F4 Series Cortex-M4 programming manual 2.3.4 Vector table On system reset, the vector table is fixed at address 0x00000000. Privileged software can write to the VTOR to relocate the vector table start address to a different memory location, in the range 0x00000080 to 0x3FFFFF80, see Vector table offset register (VTOR) on page 212.
STM32F4 boot concepts and vector table relocation electronics.stackexchange.com/.../stm32f4-boot-concepts-and-vector-table-relocation
Relocate the vector table with MDK-ARM sphinx.wordpress.com/.../
NVIC_VectorTable_Relocation NVIC Vector Table Relocation example tech.munts.com/.../readme.txt
Just remember that the vector table doesn't get relocated until someone/something instructs it to relocate - and the program at an "odd" target address can't patch the vector table since it doesn't even get started unless the vector table has already been remapped or a boot loader picks up from a known start address and then jump into the program.