*This content has been reposted with the approval of the original author.
Although APM32F072 provides ISP program to burn program through Uart port, as long as jump to 0x1FFFC800 in the application program, the program upgrade can be completed through Uart port without changing the potential of boot foot. But this does not facilitate our on-demand online upgrade process. So we still customize the bootloader and app to achieve it.
The Bootloader 4k IROM configuration is as follows
The 124k IROM configuration is as follows
The remaining flash areas are used to store parameters and flag bits of online upgrades.
The Bootloader only needs to add this part of code to realize the jump. Before the jump, pay attention to close the Bootloader. So you can interrupt the code.
In order to let the BootLoader recognize whether to upgrade the program or jump to the normal app running, I pass the FlagOnlineUpdate flag for judging. If the value is not 0x5AA5, the FLASH location will be changed to 0x5AA5 after the upgrade.
If an App needs to be upgraded online, it only needs to erase the flash value 0x5AA5 in FLAGUPDATE_ADDR, and then reset it through NVIC_SystemReset, and enter the BootLoader for program upgrade.
One thing to note about App is that the offset address of the interrupt vector table needs to be modified. Otherwise, when the interrupt is triggered, the interrupt will return to the BootLoader, and the interrupt function of the app engineering cannot be run normally.
Comments
Please log in or sign up to comment.