【发布时间】:2021-11-21 07:36:07
【问题描述】:
我正在研究 STM32F429NI 评估板,我有一个让 LED 闪烁的代码。我希望闪烁 LED 代码出现在外部或闪存中,并且驻留在内部闪存的引导加载程序必须将控制权转移到 STM32F429NI 的外部或闪存。
STM32F429NI评估板参考手册:https://www.st.com/en/microcontrollers-microprocessors/stm32f429ni.html#documentation
我遵循的步骤是:
void jump_to_external_flash(uint32_t address)
{
uint32_t msp_value = *(__IO uint32_t*)address;
void (*reset_handler)(void);
SysTick->CTRL = 0;
SysTick->LOAD = 0;
SysTick->VAL = 0;
HAL_DeInit();
__set_MSP(msp_value);
uint32_t rst_handler_addr = *(__IO uint32_t*)(address + 0x4);
reset_handler = (void*) rst_handler_addr;
reset_handler();
}
在led闪烁链接脚本的代码中
MEMORY
{
RAM (xrw) : ORIGIN = 0x20000000, LENGTH = 192K
CCMRAM (xrw) : ORIGIN = 0x10000000, LENGTH = 64K
FLASH (rx) : ORIGIN = 0x60000000, LENGTH = 64MB
}
【问题讨论】:
标签: arm stm32 bootloader stm32f4 flash-memory