您的位置:首页 > 文旅 > 美景 > 杰发科技Bootloader(3)—— 基于7801的APP切到Boot

杰发科技Bootloader(3)—— 基于7801的APP切到Boot

2024/10/6 5:56:23 来源:https://blog.csdn.net/qq_35697978/article/details/142056948  浏览:    关键词:杰发科技Bootloader(3)—— 基于7801的APP切到Boot

为了方便在APP中跳转到Boot重新进行升级,有两种办法,7840同样可以使用。

1. 调用reset接口进行复位,复位后会先进Boot,再自动跳转到App。

NVIC_SystemReset();

2. 直接使用跳转指令,参考Boot跳转到App代码,把跳转地址改一下即可,然后在App中调用JumpTOBoot。

代码如下:

#define IAP_BOOTLOAD_ADDRESS 0x8000000 /* define bootload start address */
typedef void (*pFunction)(void);
static pFunction s_jumpToApplication;void JumpTOBoot(void)
{uint32_t JumpAddress;if (((*(__IO uint32_t *)APP_ADDRESS) & 0x2FFE0000) == 0x20000000){__ASM("CPSID I");                                           // 关全局中断JumpAddress = *(__IO uint32_t *)(IAP_BOOTLOAD_ADDRESS + 4); // Jump to user applications_jumpToApplication = (pFunction)JumpAddress;               // Initialize user application's Stack Pointer__set_MSP(*(__IO uint32_t *)IAP_BOOTLOAD_ADDRESS);s_jumpToApplication(); /* jump to app */}else{printf("top of stack pointer is unvalid! enter Boot update!\r\n");return;}while (1);
}

版权声明:

本网仅为发布的内容提供存储空间,不对发表、转载的内容提供任何形式的保证。凡本网注明“来源:XXX网络”的作品,均转载自其它媒体,著作权归作者所有,商业转载请联系作者获得授权,非商业转载请注明出处。

我们尊重并感谢每一位作者,均已注明文章来源和作者。如因作品内容、版权或其它问题,请及时与我们联系,联系邮箱:809451989@qq.com,投稿邮箱:809451989@qq.com