From 576d32adb161d9445928039622c42a55b9c2840d Mon Sep 17 00:00:00 2001 From: yelvlab Date: Sat, 20 Sep 2025 01:40:24 +0800 Subject: [PATCH] =?UTF-8?q?=E9=80=82=E9=85=8Dbootloader?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- LD/gd32e23x_flash.ld | 4 ++-- Src/command.c | 7 +++++++ 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/LD/gd32e23x_flash.ld b/LD/gd32e23x_flash.ld index 405de65..daa3170 100644 --- a/LD/gd32e23x_flash.ld +++ b/LD/gd32e23x_flash.ld @@ -12,8 +12,8 @@ _Min_Stack_Size = 0x400; /* required amount of stack */ /* Memories definition */ MEMORY { - FLASH (rx) : ORIGIN = 0x08000000, LENGTH = 16K - RAM (xrw) : ORIGIN = 0x20000000, LENGTH = 4K + FLASH (rx) : ORIGIN = 0x08002000, LENGTH = 32K + RAM (xrw) : ORIGIN = 0x20000000, LENGTH = 8K } /* Sections */ diff --git a/Src/command.c b/Src/command.c index 95af534..ec57ffb 100644 --- a/Src/command.c +++ b/Src/command.c @@ -17,6 +17,7 @@ #include #include "board_config.h" #include "gd32e23x_usart.h" +#include "gd32e23x_misc.h" #include "ultrasonic_analog.h" #include "systick.h" @@ -291,6 +292,12 @@ void handle_command(const uint8_t *frame, uint8_t len) { // send_response(RESP_TYPE_OK, (uint8_t *)"v23.0.0.3", 9); return; + case 9999u: + // M9999: 重启系统 + __disable_irq(); // 关闭全局中断(GD32E230 CMSIS标准函数) + nvic_system_reset(); // 系统复位(GD32E230标准库函数) + break; + default: // 其它无参数命令在此扩展(示例:M100)处理逻辑该如何待定 // send_response(RESP_TYPE_OK, s_report_status_ok, sizeof(s_report_status_ok));