1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950 |
- #include "bootloader.h"
- #include "dev_iap.h"
- #include "global.h"
- #include <stdint.h>
- void boot_goto_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;
- }
|