Hello, I use STM32F401RE Nucleo board and Keil MDK5 IDE. In my application I need to store user data in flash memory.
The sectors implementation in STM32f401 is as following: Sector 0 0x0800 0000 - 0x0800 3FFF 16 Kbytes Sector 1 0x0800 4000 - 0x0800 7FFF 16 Kbytes Sector 2 0x0800 8000 - 0x0800 BFFF 16 Kbytes Sector 3 0x0800 C000 - 0x0800 FFFF 16 Kbytes Sector 4 0x0801 0000 - 0x0801 FFFF 64 Kbytes Sector 5 0x0802 0000 - 0x0803 FFFF 128 Kbytes Sector 6 0x0804 0000 - 0x0805 FFFF 128 Kbytes Sector 7 0x0806 0000 - 0x0807 FFFF 128 Kbytes
I want to use the smaller first sectors (sectors 0 and 1) for user data and the next sectors for the application. I edited the scatter file as following but it does not work. After rebuilding and running, the application does not run from the address 0x8008000. it runs from another address and run an old code.
This is the scatter file: ; ************************************************************* ; *** Scatter-Loading Description File generated by uVision *** ; *************************************************************
LR_IROM2 0x08008000 0x00078000 { ; load region size_region ER_IROM2 0x08008000 0x00078000 { ; load address = execution address *.o (RESET, +First) *(InRoot$$Sections) .ANY (+RO) } RW_IRAM1 0x20000000 0x00018000 { ; RW data .ANY (+RW +ZI) } }
LR_IROM1 0x08000000 0x00008000 { ER_IROM1 0x08000000 0x00008000 { ; load address = execution address .ANY (+RO) } }
and I also Edited the programming algorithm to begin from 0x08008000 and size 0x78000
Any Advice???
The processor doesn't function as you imagine, the vectors need to be at 0x08000000 for it to execute from FLASH. Review the appropriate manuals until you understand the details.