搜尋此網誌

STM32 bootloader into 3 section.

#include


#define FW_START 0x80000000



static const uint16_t launch_fw_code[] =

{

0xF850, 0xDB04, /* LDR.W SP, [R0], #4 */

0x6800, /* LDR.W R0, [R0] */

0x4700, /* BX R0 */

};



int main(void)

{

((void (*)(uint32_t))(1+ (int)launch_fw_code))(FW_START); // type_A

((void (*)(uint32_t))(1+(unsigned int)launch_fw_code))(FW_START); // type_B

((void (*)(uint32_t))(1+ launch_fw_code))(FW_START); // type_C



return 0;

}