From a6259b5fca47321b08ec89f9e2532c5716cde498 Mon Sep 17 00:00:00 2001 From: yuquanjun Date: Tue, 8 Sep 2026 05:51:58 +0800 Subject: [PATCH] Release 0.2.4: package Boot with UI0902 flash-mode screen. EOF Co-authored-by: Cursor --- Global/Global.c | 2 +- tools/gen_ui0902_assets.py | 10 ++++++++-- tools/publish_k1_release.py | 40 ++++++++++++++++++++++++++++++------- 3 files changed, 42 insertions(+), 10 deletions(-) diff --git a/Global/Global.c b/Global/Global.c index fef79ed..0d8856b 100644 --- a/Global/Global.c +++ b/Global/Global.c @@ -101,7 +101,7 @@ int16_t MIC_VOL_MAP[11]= {-9000,-7000,-5000,-3000,-1000,1000,3000,5000,7000,9000 uint8_t TOUCH_AREA_NUM = (sizeof(Touch_Areas)/sizeof(Touch_AreaTypeDef)); -const uint8_t Version[3] = {0,2,3}; /* major.minor.patch — 0.2.3: local song HKTK load/play + tone addr logs */ +const uint8_t Version[3] = {0,2,4}; /* major.minor.patch — 0.2.4: Boot shows UI0902 flash-mode screen */ uint8_t Led = 8; bool PressFlag = 0; diff --git a/tools/gen_ui0902_assets.py b/tools/gen_ui0902_assets.py index bfa8f7a..8cbe9ac 100644 --- a/tools/gen_ui0902_assets.py +++ b/tools/gen_ui0902_assets.py @@ -61,8 +61,14 @@ def rgba_to_rgb565(im): def rgba_to_rgb565_opaque(im): - """Full-screen boot/charge: keep dark background pixels (no near-black punch-through).""" - im = im.convert("RGB") + """Full-screen boot/charge/flash: keep dark bg; flatten RGBA onto black (not white). + + Design exports like 烧录模式.png are mostly transparent with dark glyphs; a bare + convert('RGB') drops alpha and turns transparent into white — wrong on device. + """ + rgba = im.convert("RGBA") + bg = Image.new("RGBA", rgba.size, (0, 0, 0, 255)) + im = Image.alpha_composite(bg, rgba).convert("RGB") px = im.load() w, h = im.size out = bytearray(w * h * 2) diff --git a/tools/publish_k1_release.py b/tools/publish_k1_release.py index 951d071..017626e 100644 --- a/tools/publish_k1_release.py +++ b/tools/publish_k1_release.py @@ -1,11 +1,12 @@ # -*- coding: utf-8 -*- -"""Build K1 release zip: MCU .bin + ExtFlash resources + SoundWalkerIAP + docs. +"""Build K1 release zip: Boot + MCU APP + ExtFlash resources + SoundWalkerIAP + docs. External Flash has TWO regions that must both be present on a blank/erased chip: 0x00000000 tone pack (logo pad + Charg + 1/2/3.bin) -> *.tone.res / combined 0x00100000 UI0902 bitmaps (mode rows, boot logo, ...) -> *.ui0902.res / combined Prefer flashing the combined *.extflash.res @ 0x0 for colleague upgrades. +Boot must also be updated so USB IAP wait screen can show UI0902_FLASH_MODE. """ from __future__ import annotations @@ -19,15 +20,26 @@ from pathlib import Path REPO = Path(r"C:\Users\qjyu\Documents\SoundWalker\一诺国际吉他") PROJ = REPO / "Code" / "YNGJ-GT1-M - AT32F403ARCT7" EXE_BIN = PROJ / "project" / "IAR_V7.4" / "YNGJ-GT1-M" / "Exe" / "YNGJ-GT1-M.bin" +BOOT_BIN = ( + PROJ + / "AT32F403ARCT7_BOOT" + / "project" + / "IAR_V7.4" + / "AT32F403ARCT7_BOOT" + / "Exe" + / "AT32F403ARCT7_BOOT.bin" +) TONE_BIN = PROJ / "tools" / "out" / "extflash_tone_0903.bin" UI0902_BIN = PROJ / "tools" / "out" / "ui0902_res.bin" MAP_TXT = REPO / "Doc" / "音色文件" / "0903" / "FLASH_MAP.txt" IAP_DIR = REPO / "升级" / "MCU主控升级" OUT_ROOT = REPO / "tools" / "out" -FW_VER = "0.2.3" +FW_VER = "0.2.4" TONE_RES_VER = "0903" UI0902_RES_BASE = 0x00100000 +BOOT_FLASH_ADDR = 0x08000000 +APP_FLASH_ADDR = 0x08008000 def git_info(cwd: Path) -> tuple[str, str]: @@ -58,6 +70,8 @@ def build_combined_extflash(tone: bytes, ui: bytes) -> bytes: def main() -> None: + if not BOOT_BIN.is_file(): + raise SystemExit(f"missing Boot bin: {BOOT_BIN}") if not EXE_BIN.is_file(): raise SystemExit(f"missing MCU bin: {EXE_BIN}") if not TONE_BIN.is_file(): @@ -86,12 +100,15 @@ def main() -> None: ui_data = UI0902_BIN.read_bytes() combined = build_combined_extflash(tone_data, ui_data) + boot_name = f"AT32F403ARCT7_BOOT_v{FW_VER}_{stamp}.bin" mcu_name = f"YNGJ-GT1-M_MCU_v{FW_VER}_{stamp}.bin" comb_name = f"extflash_ALL_tone0903_ui0902_{stamp}.res" + boot_dst = pkg / boot_name mcu_dst = pkg / mcu_name comb_dst = pkg / comb_name + shutil.copy2(BOOT_BIN, boot_dst) shutil.copy2(EXE_BIN, mcu_dst) comb_dst.write_bytes(combined) shutil.copy2(iap, pkg / "SoundWalkerIAP.exe") @@ -99,6 +116,7 @@ def main() -> None: if MAP_TXT.is_file(): shutil.copy2(MAP_TXT, pkg / "FLASH_MAP.txt") + shutil.copy2(boot_dst, OUT_ROOT / boot_name) shutil.copy2(mcu_dst, OUT_ROOT / mcu_name) shutil.copy2(comb_dst, OUT_ROOT / "extflash_ALL_tone0903_ui0902.res") # Keep build intermediates under tools/out for local rebuilds; not shipped in package. @@ -115,12 +133,15 @@ def main() -> None: f"Git subject {subject}", f"FW version {FW_VER}", "", - "==== 整机升级请刷这两项 ====", - f" 1) {mcu_name} -> MCU APP", - f" 2) {comb_name} -> 外部 Flash 从 0x0 起整包", + "==== 整机升级请刷这三项 ====", + f" 1) {boot_name} -> Bootloader @ 0x{BOOT_FLASH_ADDR:08X}", + f" 2) {mcu_name} -> MCU APP @ 0x{APP_FLASH_ADDR:08X}", + f" 3) {comb_name} -> 外部 Flash 从 0x0 起整包", " (= 音色区 + 填充 + UI0902 图片区)", "", "建议步骤:", + " - 先刷 Boot(否则 USB 烧录等待画面仍是旧红字「升级模式」)", + " - 再刷 APP", " - 先整片擦除外部 Flash,再刷上述 ALL .res @ 0x00000000", " - 勿只刷音色区,否则模式选择页会花屏(UI 图在 0x100000)", "", @@ -128,13 +149,18 @@ def main() -> None: " 0x00000000 音色/充电图 (toneRes)", " logo pad + Charg@0xCB70 + 1.bin@0x1B8F0 + 2.bin(HKTK/2s) + 3.bin", " 0x00100000 UI0902 图片 (模式选择、开机 Logo、充电、烧录模式、设置/调音台等)", + " 0x001D2000 UI0902_FLASH_MODE 烧录模式全屏图(Boot 读取)", "", + f" {boot_name} size={boot_dst.stat().st_size} @ 0x{BOOT_FLASH_ADDR:08X}", + f" sha256={sha256(boot_dst)}", + f" {mcu_name} size={mcu_dst.stat().st_size} @ 0x{APP_FLASH_ADDR:08X}", + f" sha256={sha256(mcu_dst)}", f" {comb_name} size={comb_dst.stat().st_size} @ 0x00000000", f" sha256={sha256(comb_dst)}", "", - f"MCU: {mcu_name} size={mcu_dst.stat().st_size} sha256={sha256(mcu_dst)}", - "", "说明:", + " - Boot 进入 USB IAP 时显示 UI0902_FLASH_MODE;资源未烧录时白字黑底兜底。", + " - 烧录模式图来源:K1标准界面图 0904/烧录模式.png。", " - 开机全屏 Logo、关机充电全屏画面在 UI0902,不在音色包里的 logo.bin/Charg.bin 占位。", " - AutoBand 0x9EB5F 本版未重排。", "",