开启了192k 所有RAM

This commit is contained in:
2026-08-30 15:38:40 +08:00
parent 67370888a1
commit 71c41fabb9
23 changed files with 947 additions and 290 deletions
+20
View File
@@ -0,0 +1,20 @@
---
description: Download (flash) the program to the STM32 via Keil MDK. Use ONLY when the user asks to flash, download, program, or burn the firmware to the MCU.
agent: build
---
Run the Keil MDK flash download by executing the download script with the bash tool. Use the absolute path, NOT relative cd:
```powershell
& "D:\Code\DTU 程序\STM32F4-Base\MDK-ARM\download.bat"
```
Then read the tail of `MDK-ARM/download_log.txt` and report the result.
This compiles the project then flashes the target via the configured debugger (ST-Link).
Exit code interpretation:
- 0 = download successful — PASS
- nonzero = download/build failed — see `MDK-ARM/download_log.txt` for details
Note: Since flashing overwrites the running firmware, confirm the debug probe is connected and the user is ready to flash before running this. If the user only wants to verify compilation (not flash), use `@build` instead.
+74
View File
@@ -0,0 +1,74 @@
---
description: Build → flash (download) → capture USART1 debug log → verify boot/test markers → iterate. The full automated test loop for the STM32F4-Base target.
agent: build
---
Run the full automated test loop: **build → download → capture serial debug → verify markers → report/iterate**.
Prerequisites (checked in step 0):
- `serial-mcp-server` CLI installed at `%LOCALAPPDATA%\serial-mcp-server\serial-mcp-server.exe` (Adancurusul/serial-mcp-server, v0.3.0).
- ST-Link probe connected; target powered. The USB-serial (CH340) may stay idle while flashing — ST-Link download does not conflict with the serial port.
## Procedure
### Step 0 — Pre-flight: serial-mcp-server binary + port
Verify the capture binary and target port exist:
```powershell
Test-Path "$env:LOCALAPPDATA\serial-mcp-server\serial-mcp-server.exe"
& "$env:LOCALAPPDATA\serial-mcp-server\serial-mcp-server.exe" list-ports --json
```
Read `.opencode/serial_config.json` for the authoritative `portName` (COM6) and match it in the list. If the binary is missing, build it from source (see `docs/测试说明/serial-mcp-server_串口调试.md`).
### Step 1 — Build verify
Run the build script (absolute path):
```powershell
& "D:\Code\DTU 程序\STM32F4-Base\MDK-ARM\build.bat"
```
Interpretation (per AGENTS.md): exit code 0 = PASS (0 errors, 0 warnings). 1/2+ = FAIL. If it fails, read `MDK-ARM/build_log.txt`, fix, and rerun `@build` until exit code 0 **before** touching the hardware.
### Step 2 — Flash + capture boot log (one orchestrated call)
Use `test/run_boot_test.ps1` which starts the capture (waits for first byte),
then flashes, then collects and verifies — all in one call so the capture never
times out before flashing:
```powershell
powershell -ExecutionPolicy Bypass -File "D:\Code\DTU 程序\STM32F4-Base\test\run_boot_test.ps1" `
-Port COM6 -BaudRate 115200 `
-DurationMs 30000 -InitialTimeoutMs 90000 -IdleTimeoutMs 8000 -MaxBytes 65536 `
-FlashCmd "D:\Code\DTU 程序\STM32F4-Base\MDK-ARM\download.bat" `
-Required "App init OK;Network Init;net init: OK" `
-Forbidden "FAIL;ERROR;HardFault" `
-OutDir "C:\Users\16241\AppData\Local\Temp\opencode"
```
Exit codes: **0 = PASS**, 1 = FAIL (marker miss / forbidden hit), 2 = capture/flash/parse error.
### Step 3 — Iterate
- **PASS** → report the verdict and which markers matched; done.
- **FAIL** → the `[MISS]`/`[HIT]` lines + the log tail show what went wrong. Fix the code, then loop again from **Step 1**. Do not skip the build step.
## Alternative: manual MCP capture (interactive debug)
For interactive command/response (not boot-log capture):
1. `serial_list_ports` → match `portName` from `.opencode/serial_config.json` (COM6).
2. `serial_open` (port=COM6, baud_rate=115200) → note the returned `connection_id`.
3. `serial_write` / `serial_read` (connection_id, timeout_ms) for command-response.
4. `serial_close` to release the port.
## Notes
- **串口端口**:以 `.opencode/serial_config.json` 为准(本机为 COM6)。每次连接前先读它。
- **⚠️ 无历史缓冲**:serial-mcp-server 的 `read` 只能读调用后的字节。抓开机日志必须走 `run_boot_test.ps1`(先采集等 first-byte → 再烧录触发)。
- **⚠️ EOF 陷阱**:COM 刚释放立即重开会报 `UnexpectedEof`(tokio-serial 读 0 字节)。`serial_capture.ps1` 内置自动重试;别裸跑 CLI capture。
- **参数**:`IdleTimeoutMs` 需 ≥ boot 自然静默间隙(本机 ~3-4s,用 8000);`InitialTimeoutMs` 需覆盖编译+烧录耗时(用 90000)。
- UI (LVGL) task `ui_task` 增加 `UI port init: OK` / `UI menu init: OK` 打印后,即可用 `-Required "UI port init: OK;UI menu init: OK"` 自动回归 UI 初始化。
- Full capture/analysis details: `docs/测试说明/serial-mcp-server_串口调试.md` and `docs/测试说明/自动化测试流程.md`.