From 919fd8f2a8fc0dc9f99ff83ab13f46adbc5518b4 Mon Sep 17 00:00:00 2001 From: WXK <287788329@qq.com> Date: 星期三, 02 四月 2025 17:08:13 +0800 Subject: [PATCH] 最新boot,测试可以用,支持升级 ota,注意跳转延时不要动 --- dualboots_Gai_youhua/src/customboot/customboot.c | 12 ++++++++++-- 1 files changed, 10 insertions(+), 2 deletions(-) diff --git a/dualboots_Gai_youhua/src/customboot/customboot.c b/dualboots_Gai_youhua/src/customboot/customboot.c index 7df4ab3..a80d654 100644 --- a/dualboots_Gai_youhua/src/customboot/customboot.c +++ b/dualboots_Gai_youhua/src/customboot/customboot.c @@ -183,6 +183,7 @@ //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);//喂狗 @@ -221,6 +222,8 @@ 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); @@ -255,8 +258,10 @@ } else if(updata_byte == 0xCCCC)//OTA { - - SerialPutString("进入OTA,升级启动\r\n"); + + 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); @@ -265,6 +270,8 @@ } 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"); @@ -274,6 +281,7 @@ ((p_entry_t) (*(uint32_t *)(SRAM_BASE + 4) + SRAM_BASE))(); //IAP_JumpTo(SRAM_BASE); } + delay_ms(200); /* USER CODE BEGIN 3 */ } -- Gitblit v1.9.3