Reputation: 1
I used a Cortex-M4 chip similar to STM32, and now I want to place some frequently used functions in the fast Flash area, so I wrote the following code:
.flash_zw0 : ALIGN(4)
{
*(.flash_ex)
} >FAST_FLASH AT> FLASH
After compilation, I saw that the functions in the. map file were stored according to the specified section, but when the program ran to the functions in that section, it would enter a hardfault。
When I am not using AT>:
.flash_zw0 : ALIGN(4)
{
*(.flash_ex)
} >FAST_FLASH
There won't be any issues with the program.
So I think the difference between VMA and LMA can cause program exceptions, but I don't know the reason and solution. The addresses of these two regions in memory are far apart, and I must map them, otherwise the generated bin file will be too large to upgrade.
This is the other part of my script file:
MEMORY
{
FAST_FLASH (rx) : ORIGIN = 0x08014000, LENGTH = 48k
FAST_FLASH_1 (rx) : ORIGIN = 0x08020000, LENGTH = 128k
FLASH_0 (irx) : ORIGIN = 0x0807f800, LENGTH = 2k
FLASH (rx) : ORIGIN = 0x08080000, LENGTH = 512K
RAM (xrw) : ORIGIN = 0x20000000, LENGTH = 96K
}
I hope to map the FAST_FLASH virtual memory address(VML) to the FLASH Load Memory Address(LMA).
Actually, whenever I use AT> for address mapping, the function will have problems.
Besides, my English is not very good:)
Upvotes: 0
Views: 120