12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849 |
- #include "boot.h"
- #include "iap.h"
- #include <stdint.h>
- void run_app(void)
- {
- pFunction Jump_To_Application;
- __IO uint32_t JumpAddress;
- // CAN_DeInit(CAN1);
- if (((*(__IO uint32_t *)APP_START_ADDR) & 0x2FFE0000) == 0x20000000)
- {
- JumpAddress = *(__IO uint32_t *)(APP_START_ADDR + 4);
- Jump_To_Application = (pFunction)JumpAddress;
- __set_MSP(*(__IO uint32_t *)APP_START_ADDR);
- Jump_To_Application();
- }
- }
- uint8_t check_addr_sp(uint32_t addr)
- {
- int ret;
- if (((*(uint32_t *)addr) & 0x2FFE0000) == 0x20000000) // 检查栈顶地址是否合法
- {
- ret = VALID;
- }
- else
- {
- ret = INVALID;
- }
- return ret;
- }
- uint8_t check_addr_pc(uint32_t addr)
- {
- int ret;
- if (((*(uint32_t *)(addr + 4)) & 0xFF000000) == 0x08000000) // 检查中断向量表地址是否合法
- {
- ret = VALID;
- }
- else
- {
- ret = INVALID;
- }
- return ret;
- }
|