思路:.bin文件放置到后背区,然后设置标志位,最后重启。
比如:
#define FLASH_PAGE_SIZE 0x800 //2048, 2k per page.
#define BOOTLOADER_EXEC_ADDR 0x08000000 // start address of on-chip Flash, bootloader MAX is 32kB
#define APP_EXEC_ADDR 0x08008000 //address start (integral multiple of 0x200 plus + 0x08000000)
#define APP_MAX_SIZE 0x30000 // firmware is about 120kB, 160K at max assigned for it
#define APP_BAKUP_ADDR (APP_EXEC_ADDR+APP_MAX_SIZE)
#define NEW_RU_FLAG (APP_EXEC_ADDR-0x800) // 2kB, one Page, writable only after Erased