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.
Vermouth贝尔摩德 is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.