Преглед на файлове

chore(gmsp): verify ISR binding/RAM audit/eFlash region — Wave 0 complete

Task 1: dmac_isr is DEAD CODE (discarded by linker). Actual IRQ4 handler
is DMA_IRQHandler from MCC library. MUST modify vector_table.h ISR24.
CRC16-CCITT NOT supported by HW — must use software implementation.

Task 2: RAM free=47.6KB (9KB crypto buffers fit). eFlash key storage
0x00470000-0x00470800 confirmed 100% free (firmware ends at 0x0041C098).
kennyh преди 1 седмица
родител
ревизия
bbd0a1c4c4
променени са 3 файла, в които са добавени 51 реда и са изтрити 10 реда
  1. 17 3
      .sisyphus/boulder.json
  2. 31 4
      .sisyphus/notepads/guomi-smart-card/learnings.md
  3. 3 3
      .sisyphus/plans/guomi-smart-card.md

+ 17 - 3
.sisyphus/boulder.json

@@ -2,11 +2,25 @@
   "active_plan": "D:\\work\\水务加密\\CUni360S-Z开发包V3.6\\Demo\\CUni360S-Z_Demo\\.sisyphus\\plans\\guomi-smart-card.md",
   "started_at": "2026-06-15T08:16:55.948Z",
   "session_ids": [
-    "ses_136683f36ffe0k6bqt14QCNg8b"
+    "ses_136683f36ffe0k6bqt14QCNg8b",
+    "ses_1359fd656ffeKxSgWPcnw18V9M",
+    "ses_1359f454bffeDNYFnRp4gqMdKT"
   ],
   "session_origins": {
-    "ses_136683f36ffe0k6bqt14QCNg8b": "direct"
+    "ses_136683f36ffe0k6bqt14QCNg8b": "direct",
+    "ses_1359fd656ffeKxSgWPcnw18V9M": "appended",
+    "ses_1359f454bffeDNYFnRp4gqMdKT": "appended"
   },
   "plan_name": "guomi-smart-card",
-  "agent": "atlas"
+  "agent": "atlas",
+  "task_sessions": {
+    "todo:1": {
+      "task_key": "todo:1",
+      "task_label": "1",
+      "task_title": "验证 dmac_isr 绑定 + SPI1 引脚确认",
+      "session_id": "ses_1359f454bffeDNYFnRp4gqMdKT",
+      "agent": "explore",
+      "updated_at": "2026-06-15T08:27:43.120Z"
+    }
+  }
 }

+ 31 - 4
.sisyphus/notepads/guomi-smart-card/learnings.md

@@ -12,13 +12,40 @@
 - TRNG must init first before any SM2 key generation
 - SM2/SM4/SHA share EDMAC channel — do not nest crypto operations
 
-## SPI/DMA Critical Details
+## SPI/DMA Critical Details (VERIFIED via .map file)
 - `dma_spitran()` binten hardcoded FALSE — interrupt branch is DEAD CODE
 - Must use `dma_spi_LLIReceive()` for continuous async receive
 - LLI `next_lli` points to itself for auto-loop
-- dmac_isr() reads DMA_STATTFR, sets dma_isr_flag, clears DMA_CLRTFR
-- SPI1+SPI2+PIT32 share IRQ3 (ISR23)
-- DMA completion interrupt goes through IRQ4 (dmac_isr)
+- **`dmac_isr()` from `dmac_drv.c` is DISCARDED by linker — NOT in binary**
+- **Actual IRQ4 handler = `DMA_IRQHandler` from `libCUni360S_mcc.a(mcc_bsp.o)` at 0x0041b2ac**
+- **MUST modify `vector_table.h` ISR24** to repoint IRQ4 to our own DMA handler
+- **Vector table is `void *const` in flash** — `interrupt_setup()` only sets EIC priority, NOT the vector
+- SPI1+SPI2+PIT32 share IRQ3 (ISR23 = PIT32_SPI1_SPI2_ISR)
+- DMA completion interrupt goes through IRQ4 (ISR24)
+- DMAC_INT_NUM = 0x24 = VecTable[36] = ISR24
+- SPI1 base = 0x70000000, SPIDR offset = 0x12 (verified in spi_reg.h and dmac_drv.c)
+- SPI instances spaced 0x10000 apart: SPI1=0x70000000, SPI2=0x70010000, SPI3=0x70020000
+
+## CRC Hardware (VERIFIED)
+- Hardware CRC engine does NOT support configurable polynomials
+- CRC_CR has NO polynomial field — only mode (CRC-8/16/32), source, endianness
+- **CRC16-CCITT (0x1021) MUST be implemented in SOFTWARE**
+- CRC0_BASE_ADDR = 0x78000000, CRC1_BASE_ADDR = 0x7c000000
+
+## RAM Budget (VERIFIED via .map file)
+- .data = 2,992 bytes (0xBB0) at 0x00800000-0x00800BB0
+- .bss = 6,740 bytes (0x1A54) at 0x00800BB0-0x00802604
+- Total used: 9,732 bytes (14.8%)
+- Free heap: 47,608 bytes (0xB9F8) from 0x00802604 to 0x0080DFFC
+- Stack: 8,192 bytes from 0x0080DFFC to 0x0080FFFC
+- _bss_end = 0x00802604, _end = 0x0080DFFC, STACK_LOCATION = 0x0080FFFC
+
+## eFlash Budget (VERIFIED via .map file)
+- Firmware end: 0x0041C098 (.text_entry + .rodata + .text + .data LMA)
+- .bin size = 114,840 bytes = 0x1C098 (matches)
+- Key storage 0x00470000-0x00470800 = 100% free, page-aligned (pages 896-899)
+- EFLASH_END per alg_drv.h = 0x0047F000 (4KB reserved at top)
+- 343KB gap between firmware end and key storage region
 
 ## eFlash Key Storage
 - EFLASH_SetWritePermission() is GLOBAL — no per-page protection

+ 3 - 3
.sisyphus/plans/guomi-smart-card.md

@@ -182,7 +182,7 @@ Wave FINAL (验证 — 4 tasks, 并行):
 
 ## TODOs
 
-- [ ] 0. Git 仓库初始化 + Remote 推送配置
+- [x] 0. Git 仓库初始化 + Remote 推送配置
 
   **What to do**:
   - 在项目根目录执行 `git init`
@@ -227,7 +227,7 @@ Wave FINAL (验证 — 4 tasks, 并行):
   - Files: 全部源码(除 Debug/ 和 .metadata/ 外)
   - Pre-commit: 无
 
-- [ ] 1. 验证 dmac_isr 绑定 + SPI1 引脚确认
+- [x] 1. 验证 dmac_isr 绑定 + SPI1 引脚确认
 
   **What to do**:
   - 检查 `Debug/*.map` 文件,确认 `dmac_isr` 是否被绑定到 IRQ4(`DMA_IRQHandler` 符号)
@@ -268,7 +268,7 @@ Wave FINAL (验证 — 4 tasks, 并行):
   - Files: 无代码变更(或修复 dmac_drv.c 命名)
   - Pre-commit: 无
 
-- [ ] 2. RAM 预算审计 + eFlash 存储区域确认
+- [x] 2. RAM 预算审计 + eFlash 存储区域确认
 
   **What to do**:
   - 从 `.map` 文件中提取当前 RAM 使用量(`.data` + `.bss` 总和)