From b6da450f8a62d71bd978b79c478d405b6aa22a1c Mon Sep 17 00:00:00 2001 From: hulk Date: Fri, 2 Oct 2026 23:21:47 +0800 Subject: [PATCH] =?UTF-8?q?build:=20=E6=81=A2=E5=A4=8D=E6=AD=A3=E5=BC=8F?= =?UTF-8?q?=E5=8F=91=E5=B8=83=E5=B8=83=E5=B1=80=200x08002000/54K=20+=20VEC?= =?UTF-8?q?T=5FTAB=5FOFFSET=3D0x2000?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 调试裸机布局(0x08000000/VTOR=0)仅限本地临时修改,不进仓库; --- AGENTS.md | 11 +++++++---- LD/gd32e23x_flash.ld | 2 +- Src/system_gd32e23x.c | 2 +- 3 files changed, 9 insertions(+), 6 deletions(-) diff --git a/AGENTS.md b/AGENTS.md index 812caf4..4223771 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -35,11 +35,14 @@ GD32E230 电涡流传感器节点固件:LDC1612(电涡流/电感数字转换 - 传感器:LDC1612 @0x2B(40MHz 外部时钟),TMP112 @0x49(ADD0=GND) - 调试宏(均默认关闭):DEBUG_VERBOSE / COM_DEBUG / LDC_DEBUG / EDDY_DRIVE_CURRENT_DETECTION -## 内存布局(当前调试阶段,2026-10-02 用户确认) +## 内存布局(仓库默认 = 正式发布布局) -- **APP 直接链接在 0x08000000,VECT_TAB_OFFSET=0x00(Src/system_gd32e23x.c), - 不考虑 Bootloader**;正式发布时再切回 Bootloader 布局(0x08002000/54K + OTA 打包, - 参见 hulk-mcu-firmware skill) +- **APP 链接在 0x08002000(54K),VECT_TAB_OFFSET=0x2000(Src/system_gd32e23x.c), + 前置 8KB Bootloader**;OTA/Ymodem 打包(_UPDATE.bin/_BL.bin)基于此布局, + 详见 hulk-mcu-firmware skill +- 调试阶段如需脱离 Bootloader 裸机运行(直接烧 0x08000000):临时把 + `LD/gd32e23x_flash.ld` 的 ORIGIN 改为 0x08000000、VECT_TAB_OFFSET 改为 0x00, + **仅限本地临时修改,不要提交推送**(否则烧 _BL 镜像时 Bootloader 会覆盖 APP 头部) - 修改布局需同时改 `LD/gd32e23x_flash.ld` 的 ORIGIN 与 VECT_TAB_OFFSET ## 开发进度 diff --git a/LD/gd32e23x_flash.ld b/LD/gd32e23x_flash.ld index 6d606aa..e122724 100644 --- a/LD/gd32e23x_flash.ld +++ b/LD/gd32e23x_flash.ld @@ -12,7 +12,7 @@ _Min_Stack_Size = 0x400; /* required amount of stack */ /* Memories definition */ MEMORY { - FLASH (rx) : ORIGIN = 0x08000000, LENGTH = 54K + FLASH (rx) : ORIGIN = 0x08002000, LENGTH = 54K RAM (xrw) : ORIGIN = 0x20000000, LENGTH = 8K } diff --git a/Src/system_gd32e23x.c b/Src/system_gd32e23x.c index 480e817..2cf55f1 100644 --- a/Src/system_gd32e23x.c +++ b/Src/system_gd32e23x.c @@ -41,7 +41,7 @@ #define __HXTAL (HXTAL_VALUE) /* high speed crystal oscillator frequency */ #define __SYS_OSC_CLK (__IRC8M) /* main oscillator frequency */ -#define VECT_TAB_OFFSET (uint32_t)0x00 /* vector table base offset */ +#define VECT_TAB_OFFSET (uint32_t)0x2000 /* vector table base offset */ /* select a system clock by uncommenting the following line */ //#define __SYSTEM_CLOCK_8M_HXTAL (__HXTAL)