| | |
| | | //uart_receive(UART_ID1, trx_buf, 1, uart_receive_callback); |
| | | SerialPutString("MK8000-BootLoader-V1.1启动\r\n"); |
| | | //Serial0PutString("MK8000-BootLoader-V1.0启动\r\n"); |
| | | delay_ms(200); |
| | | while(1) |
| | | { |
| | | wdt_ping(WDT_ID0);//喂狗 |
| | |
| | | APP_byte = tmp; |
| | | if(APP_byte==0XBBBB) |
| | | { |
| | | uart_close(UART_ID1); |
| | | delay_ms(200); |
| | | memcpy((void *)SRAM_BASE, (void *)APP_CONFIG_APPLICATION_ADDRESS, APP_CONFIG_APPLICATION_SIZE);//size太大导致覆盖没法跳转 |
| | | __set_MSP(*(uint32_t *)SRAM_BASE); |
| | | typedef void (*p_entry_t)(void); |
| | |
| | | { |
| | | |
| | | SerialPutString("进入OTA,升级启动\r\n"); |
| | | uart_close(UART_ID1); |
| | | delay_ms(1000); |
| | | memcpy((void *)SRAM_BASE, (void *)OTA_ADRESS, APP_CONFIG_APPLICATION_SIZE);//size太大导致覆盖没法跳转 |
| | | __set_MSP(*(uint32_t *)SRAM_BASE); |
| | | typedef void (*p_entry_t)(void); |
| | |
| | | } |
| | | else //不是则跳转到APP,注意F0和其他系列的跳转有些不一样,跳转部分可参考原子哥代码 |
| | | { |
| | | uart_close(UART_ID1); |
| | | delay_ms(200); |
| | | //Delay_ms(1000); |
| | | /* Test if user code is programmed starting from address "APP_CONFIG_APPLICATION_ADDRESS" */ |
| | | //Serial0PutString("跳转APPhehe\r\n"); |
| | |
| | | ((p_entry_t) (*(uint32_t *)(SRAM_BASE + 4) + SRAM_BASE))(); |
| | | //IAP_JumpTo(SRAM_BASE); |
| | | } |
| | | delay_ms(200); |
| | | /* USER CODE BEGIN 3 */ |
| | | |
| | | } |