dsh-stm32 0.1.3 → 0.1.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (231) hide show
  1. package/README.md +115 -43
  2. package/README_EN.md +106 -38
  3. package/assets/README.md +85 -0
  4. package/assets/VERSION +1 -0
  5. package/assets/device/c0/chips.json +1108 -0
  6. package/assets/device/f0/chips.json +1570 -0
  7. package/assets/device/f1/chips.json +1238 -0
  8. package/assets/device/f1/svd/100.json +943 -0
  9. package/assets/device/f1/svd/101.json +901 -0
  10. package/assets/device/f1/svd/102.json +522 -0
  11. package/assets/device/f1/svd/103.json +1139 -0
  12. package/assets/device/f1/svd/105.json +1117 -0
  13. package/assets/device/f1/svd/107.json +1195 -0
  14. package/assets/device/f2/chips.json +674 -0
  15. package/assets/device/f3/chips.json +1318 -0
  16. package/assets/device/f4/chips.json +2942 -0
  17. package/assets/device/f7/chips.json +1710 -0
  18. package/assets/device/g0/chips.json +2102 -0
  19. package/assets/device/g4/chips.json +2494 -0
  20. package/assets/device/h5/chips.json +898 -0
  21. package/assets/device/h7/chips.json +2639 -0
  22. package/assets/device/l0/chips.json +2494 -0
  23. package/assets/device/l1/chips.json +1234 -0
  24. package/assets/device/l4/chips.json +2130 -0
  25. package/assets/device/l4+/chips.json +856 -0
  26. package/assets/device/l5/chips.json +226 -0
  27. package/assets/device/u0/chips.json +688 -0
  28. package/assets/device/u3/chips.json +310 -0
  29. package/assets/device/u5/chips.json +1195 -0
  30. package/assets/device/wba/chips.json +506 -0
  31. package/assets/device/wl/chips.json +184 -0
  32. package/assets/headers/f1/stm32f100xb.h +5972 -0
  33. package/assets/headers/f1/stm32f100xe.h +6587 -0
  34. package/assets/headers/f1/stm32f101x6.h +5315 -0
  35. package/assets/headers/f1/stm32f101xb.h +5446 -0
  36. package/assets/headers/f1/stm32f101xe.h +6503 -0
  37. package/assets/headers/f1/stm32f101xg.h +6713 -0
  38. package/assets/headers/f1/stm32f102x6.h +6448 -0
  39. package/assets/headers/f1/stm32f102xb.h +6570 -0
  40. package/assets/headers/f1/stm32f103x6.h +10109 -0
  41. package/assets/headers/f1/stm32f103xb.h +10240 -0
  42. package/assets/headers/f1/stm32f103xe.h +11767 -0
  43. package/assets/headers/f1/stm32f103xg.h +11951 -0
  44. package/assets/headers/f1/stm32f105xc.h +14340 -0
  45. package/assets/headers/f1/stm32f107xc.h +15253 -0
  46. package/assets/headers/f1/stm32f1xx.h +273 -0
  47. package/assets/headers/f1/system_stm32f1xx.h +96 -0
  48. package/assets/ioc/family/C0.ioc +82 -0
  49. package/assets/ioc/family/F0.ioc +71 -0
  50. package/assets/ioc/family/F2.ioc +91 -0
  51. package/assets/ioc/family/F3.ioc +94 -0
  52. package/assets/ioc/family/F4.ioc +91 -0
  53. package/assets/ioc/family/F7.ioc +102 -0
  54. package/assets/ioc/family/G0.ioc +90 -0
  55. package/assets/ioc/family/G4.ioc +110 -0
  56. package/assets/ioc/family/H5.ioc +116 -0
  57. package/assets/ioc/family/H7.ioc +133 -0
  58. package/assets/ioc/family/L0.ioc +92 -0
  59. package/assets/ioc/family/L1.ioc +87 -0
  60. package/assets/ioc/family/L4+.ioc +92 -0
  61. package/assets/ioc/family/L4.ioc +93 -0
  62. package/assets/ioc/family/L5.ioc +91 -0
  63. package/assets/ioc/family/U0.ioc +103 -0
  64. package/assets/ioc/family/U3.ioc +113 -0
  65. package/assets/ioc/family/U5.ioc +102 -0
  66. package/assets/ioc/family/WBA.ioc +100 -0
  67. package/assets/ioc/family/WL.ioc +93 -0
  68. package/assets/ioc/minimal/STM32F100C8Tx.ioc +113 -0
  69. package/assets/ioc/minimal/STM32F100RCTx.ioc +113 -0
  70. package/assets/ioc/minimal/STM32F101C4Tx.ioc +113 -0
  71. package/assets/ioc/minimal/STM32F101C8Tx.ioc +113 -0
  72. package/assets/ioc/minimal/STM32F101RCTx.ioc +113 -0
  73. package/assets/ioc/minimal/STM32F101RFTx.ioc +113 -0
  74. package/assets/ioc/minimal/STM32F102C4Tx.ioc +113 -0
  75. package/assets/ioc/minimal/STM32F102C8Tx.ioc +113 -0
  76. package/assets/ioc/minimal/STM32F103C4Tx.ioc +113 -0
  77. package/assets/ioc/minimal/STM32F103C8Tx.ioc +113 -0
  78. package/assets/ioc/minimal/STM32F103RCTx.ioc +113 -0
  79. package/assets/ioc/minimal/STM32F103RFTx.ioc +113 -0
  80. package/assets/ioc/minimal/STM32F105RCTx.ioc +113 -0
  81. package/assets/ioc/minimal/STM32F107RCTx.ioc +113 -0
  82. package/assets/ld/f1/STM32F100C8Tx_FLASH.ld +249 -0
  83. package/assets/ld/f1/STM32F100RCTx_FLASH.ld +249 -0
  84. package/assets/ld/f1/STM32F101C4Tx_FLASH.ld +249 -0
  85. package/assets/ld/f1/STM32F101C8Tx_FLASH.ld +249 -0
  86. package/assets/ld/f1/STM32F101RCTx_FLASH.ld +249 -0
  87. package/assets/ld/f1/STM32F101RFTx_FLASH.ld +249 -0
  88. package/assets/ld/f1/STM32F102C4Tx_FLASH.ld +249 -0
  89. package/assets/ld/f1/STM32F102C8Tx_FLASH.ld +249 -0
  90. package/assets/ld/f1/STM32F103C4Tx_FLASH.ld +249 -0
  91. package/assets/ld/f1/STM32F103C8Tx_FLASH.ld +249 -0
  92. package/assets/ld/f1/STM32F103RCTx_FLASH.ld +249 -0
  93. package/assets/ld/f1/STM32F103RFTx_FLASH.ld +249 -0
  94. package/assets/ld/f1/STM32F105RCTx_FLASH.ld +249 -0
  95. package/assets/ld/f1/STM32F107RCTx_FLASH.ld +249 -0
  96. package/assets/manifest.json +1130 -0
  97. package/assets/startup/f1/startup_stm32f100xb.s +407 -0
  98. package/assets/startup/f1/startup_stm32f100xe.s +449 -0
  99. package/assets/startup/f1/startup_stm32f101x6.s +322 -0
  100. package/assets/startup/f1/startup_stm32f101xb.s +338 -0
  101. package/assets/startup/f1/startup_stm32f101xe.s +423 -0
  102. package/assets/startup/f1/startup_stm32f101xg.s +439 -0
  103. package/assets/startup/f1/startup_stm32f102x6.s +330 -0
  104. package/assets/startup/f1/startup_stm32f102xb.s +346 -0
  105. package/assets/startup/f1/startup_stm32f103x6.s +348 -0
  106. package/assets/startup/f1/startup_stm32f103xb.s +364 -0
  107. package/assets/startup/f1/startup_stm32f103xe.s +470 -0
  108. package/assets/startup/f1/startup_stm32f103xg.s +466 -0
  109. package/assets/startup/f1/startup_stm32f105xc.s +463 -0
  110. package/assets/startup/f1/startup_stm32f107xc.s +472 -0
  111. package/assets/templates/family/C0.ioc +82 -0
  112. package/assets/templates/family/F0.ioc +71 -0
  113. package/assets/templates/family/F2.ioc +91 -0
  114. package/assets/templates/family/F3.ioc +94 -0
  115. package/assets/templates/family/F4.ioc +91 -0
  116. package/assets/templates/family/F7.ioc +102 -0
  117. package/assets/templates/family/G0.ioc +90 -0
  118. package/assets/templates/family/G4.ioc +110 -0
  119. package/assets/templates/family/H5.ioc +116 -0
  120. package/assets/templates/family/H7.ioc +133 -0
  121. package/assets/templates/family/L0.ioc +92 -0
  122. package/assets/templates/family/L1.ioc +87 -0
  123. package/assets/templates/family/L4+.ioc +92 -0
  124. package/assets/templates/family/L4.ioc +93 -0
  125. package/assets/templates/family/L5.ioc +91 -0
  126. package/assets/templates/family/U0.ioc +103 -0
  127. package/assets/templates/family/U3.ioc +113 -0
  128. package/assets/templates/family/U5.ioc +102 -0
  129. package/assets/templates/family/WB.ioc +81 -0
  130. package/assets/templates/family/WBA.ioc +100 -0
  131. package/assets/templates/family/WL.ioc +93 -0
  132. package/docs/reading-guide.md +110 -42
  133. package/lib/commands/register.js +1 -1
  134. package/lib/data/chips.js +3 -3
  135. package/lib/data/clock-db.js +830 -0
  136. package/lib/data/clock-f1.js +12 -45
  137. package/lib/data/cmsis-sources.js +371 -18
  138. package/lib/data/db-presets.js +252 -0
  139. package/lib/data/device-facts.js +113 -26
  140. package/lib/data/family.js +515 -0
  141. package/lib/data/firmware-packages.js +595 -12
  142. package/lib/data/firmware-pins.js +128 -0
  143. package/lib/data/install-guides.js +2 -2
  144. package/lib/data/ioc-presets.js +248 -0
  145. package/lib/data/ioc-schema.js +1058 -0
  146. package/lib/data/rm-topics/stm32c0.json +227 -0
  147. package/lib/data/rm-topics.js +103 -0
  148. package/lib/data/search-roots.js +59 -4
  149. package/lib/data/serial-config.js +430 -0
  150. package/lib/data/stm32f1.js +15 -14
  151. package/lib/data/svd.js +32 -16
  152. package/lib/data/toolchain-config.js +0 -14
  153. package/lib/engine/assets.js +191 -456
  154. package/lib/engine/breakpoints.js +66 -11
  155. package/lib/engine/clock-derived.js +101 -0
  156. package/lib/engine/clock-direct.js +313 -0
  157. package/lib/engine/clock-plan.js +96 -52
  158. package/lib/engine/clock-pllmn.js +319 -0
  159. package/lib/engine/cmake-sources.js +67 -13
  160. package/lib/engine/cube-mx-guard.js +44 -0
  161. package/lib/engine/cube-programmer.js +137 -0
  162. package/lib/engine/cubemx-db.js +273 -0
  163. package/lib/engine/debug-session.js +423 -17
  164. package/lib/engine/debug.js +25 -6
  165. package/lib/engine/doctor.js +239 -19
  166. package/lib/engine/download.js +242 -0
  167. package/lib/engine/facts-acquire.js +416 -0
  168. package/lib/engine/facts.js +134 -0
  169. package/lib/engine/fetch.js +1 -1
  170. package/lib/engine/firmware-install.js +333 -39
  171. package/lib/engine/firmware-official.js +499 -0
  172. package/lib/engine/flash.js +290 -21
  173. package/lib/engine/gdb-mi.js +476 -0
  174. package/lib/engine/generate.js +9 -2
  175. package/lib/engine/hal-chip.js +124 -41
  176. package/lib/engine/ioc-plan.js +1244 -60
  177. package/lib/engine/ioc-rules.js +698 -0
  178. package/lib/engine/ioc-verify.js +706 -0
  179. package/lib/engine/ioc.js +43 -4
  180. package/lib/engine/msys2-install.js +241 -92
  181. package/lib/engine/probe-error.js +25 -6
  182. package/lib/engine/probe-session.js +50 -14
  183. package/lib/engine/probe.js +22 -5
  184. package/lib/engine/register-clock.js +41 -0
  185. package/lib/engine/register-gpio.js +132 -0
  186. package/lib/engine/register-linker.js +37 -13
  187. package/lib/engine/register-template.js +125 -40
  188. package/lib/engine/regs.js +41 -8
  189. package/lib/engine/rm-extract.js +144 -0
  190. package/lib/engine/rm-sources.js +360 -0
  191. package/lib/engine/rm-text.js +56 -0
  192. package/lib/engine/rtt.js +188 -30
  193. package/lib/engine/scaffold.js +185 -18
  194. package/lib/engine/serial.js +1692 -0
  195. package/lib/engine/tar.js +235 -3
  196. package/lib/engine/toolchain-gate.js +0 -4
  197. package/lib/engine/watch.js +227 -0
  198. package/lib/index.js +16 -2
  199. package/lib/skill/stm32-workflow.js +2 -2
  200. package/lib/tools/assets.js +39 -108
  201. package/lib/tools/cache.js +2 -2
  202. package/lib/tools/debug-session.js +2 -2
  203. package/lib/tools/doctor.js +61 -5
  204. package/lib/tools/download.js +303 -0
  205. package/lib/tools/firmware-install.js +31 -6
  206. package/lib/tools/flash.js +32 -4
  207. package/lib/tools/generate.js +22 -0
  208. package/lib/tools/ioc-inspect.js +1 -1
  209. package/lib/tools/ioc-plan.js +56 -2
  210. package/lib/tools/ioc-verify.js +237 -0
  211. package/lib/tools/project-create.js +41 -5
  212. package/lib/tools/regs.js +8 -8
  213. package/lib/tools/route-plan.js +1 -1
  214. package/lib/tools/rtt.js +157 -34
  215. package/lib/tools/serial.js +737 -0
  216. package/lib/tools/watch.js +256 -0
  217. package/package.json +5 -4
  218. package/templates/openocd/stm32c0x.cfg +83 -0
  219. package/templates/openocd/stm32u0x.cfg +64 -0
  220. package/templates/register/CMakeLists.txt +2 -2
  221. package/templates/register/Core/Inc/rtt.h +37 -2
  222. package/templates/register/Core/Src/main.c +17 -25
  223. package/templates/register/Core/Src/rtt.c +85 -9
  224. package/templates/scaffold/RTT.md +6 -2
  225. package/templates/scaffold/STM32F103XX_FLASH.ld +3 -0
  226. package/templates/scaffold/openocd.cfg +5 -3
  227. package/templates/scaffold/vscode/launch.json +8 -4
  228. package/templates/serial/bridge.ps1 +477 -0
  229. package/docs/development-notes.md +0 -2487
  230. package/docs/dsh-stm32-plugin-/350/247/204/346/240/274.md +0 -673
  231. package/docs/logic-audit.md +0 -607
@@ -14,13 +14,16 @@
14
14
  */
15
15
  import { existsSync, readdirSync } from "node:fs";
16
16
  import { sourceUrls } from "./cmsis-sources.js";
17
- /** codeload 直连是首选;GHProxy 走镜像;api.github.com 的 tarball 会 302 到 codeload,作最后兜底。 */
17
+ import { FIRMWARE_ARCHIVE_PINS, FIRMWARE_CORE_PINS } from "./firmware-pins.js";
18
+ /**
19
+ * 归档只有一条官方地址(P0-2):codeload 直连。
20
+ *
21
+ * 为什么砍掉 ghproxy / api 兜底:同一个 commit 经不同入口打包,gzip 头与顶层目录名不同,
22
+ * 字节哈希对不上——一个 sha256 不能同时校验三条链路。留着它们要么是「校验形同虚设」,
23
+ * 要么是「第二条永远失败」。ghproxy 还是第三方中间人,没有理由让固件包依赖它。
24
+ */
18
25
  function archiveUrls(repo, ref) {
19
- return [
20
- "https://codeload.github.com/STMicroelectronics/" + repo + "/tar.gz/refs/heads/" + ref,
21
- "https://ghproxy.net/https://github.com/STMicroelectronics/" + repo + "/archive/refs/heads/" + ref + ".tar.gz",
22
- "https://api.github.com/repos/STMicroelectronics/" + repo + "/tarball/refs/heads/" + ref,
23
- ];
26
+ return ["https://codeload.github.com/STMicroelectronics/" + repo + "/tar.gz/refs/heads/" + ref];
24
27
  }
25
28
  export const FIRMWARE_FAMILIES = {
26
29
  F1: {
@@ -58,6 +61,569 @@ export const FIRMWARE_FAMILIES = {
58
61
  },
59
62
  ],
60
63
  },
64
+ F2: {
65
+ family: "F2",
66
+ packageBase: "STM32Cube_FW_F2",
67
+ defaultVersion: "1.9.3",
68
+ halDir: "Drivers/STM32F2xx_HAL_Driver",
69
+ deviceDir: "Drivers/CMSIS/Device/ST/STM32F2xx",
70
+ coreRepo: "STM32CubeF2",
71
+ coreRef: "master",
72
+ coreIncludeDir: "Drivers/CMSIS/Include",
73
+ coreHeaders: ["cmsis_compiler.h", "cmsis_gcc.h", "cmsis_version.h", "mpu_armv7.h", "core_cm3.h"],
74
+ archives: [
75
+ {
76
+ id: "hal",
77
+ label: "HAL 驱动(stm32f2xx-hal-driver)",
78
+ repo: "stm32f2xx-hal-driver",
79
+ ref: "master",
80
+ dirs: [
81
+ { from: "Inc", to: "Drivers/STM32F2xx_HAL_Driver/Inc" },
82
+ { from: "Src", to: "Drivers/STM32F2xx_HAL_Driver/Src" },
83
+ ],
84
+ urls: archiveUrls("stm32f2xx-hal-driver", "master"),
85
+ },
86
+ {
87
+ id: "device",
88
+ label: "CMSIS 设备支持(cmsis-device-f2)",
89
+ repo: "cmsis-device-f2",
90
+ ref: "master",
91
+ dirs: [
92
+ { from: "Include", to: "Drivers/CMSIS/Device/ST/STM32F2xx/Include" },
93
+ { from: "Source", to: "Drivers/CMSIS/Device/ST/STM32F2xx/Source" },
94
+ ],
95
+ urls: archiveUrls("cmsis-device-f2", "master"),
96
+ },
97
+ ],
98
+ },
99
+ F3: {
100
+ family: "F3",
101
+ packageBase: "STM32Cube_FW_F3",
102
+ defaultVersion: "1.11.5",
103
+ halDir: "Drivers/STM32F3xx_HAL_Driver",
104
+ deviceDir: "Drivers/CMSIS/Device/ST/STM32F3xx",
105
+ coreRepo: "STM32CubeF3",
106
+ coreRef: "master",
107
+ coreIncludeDir: "Drivers/CMSIS/Include",
108
+ coreHeaders: ["cmsis_compiler.h", "cmsis_gcc.h", "cmsis_version.h", "mpu_armv7.h", "core_cm4.h"],
109
+ archives: [
110
+ {
111
+ id: "hal",
112
+ label: "HAL 驱动(stm32f3xx-hal-driver)",
113
+ repo: "stm32f3xx-hal-driver",
114
+ ref: "master",
115
+ dirs: [
116
+ { from: "Inc", to: "Drivers/STM32F3xx_HAL_Driver/Inc" },
117
+ { from: "Src", to: "Drivers/STM32F3xx_HAL_Driver/Src" },
118
+ ],
119
+ urls: archiveUrls("stm32f3xx-hal-driver", "master"),
120
+ },
121
+ {
122
+ id: "device",
123
+ label: "CMSIS 设备支持(cmsis-device-f3)",
124
+ repo: "cmsis-device-f3",
125
+ ref: "master",
126
+ dirs: [
127
+ { from: "Include", to: "Drivers/CMSIS/Device/ST/STM32F3xx/Include" },
128
+ { from: "Source", to: "Drivers/CMSIS/Device/ST/STM32F3xx/Source" },
129
+ ],
130
+ urls: archiveUrls("cmsis-device-f3", "master"),
131
+ },
132
+ ],
133
+ },
134
+ F7: {
135
+ family: "F7",
136
+ packageBase: "STM32Cube_FW_F7",
137
+ defaultVersion: "1.17.4",
138
+ halDir: "Drivers/STM32F7xx_HAL_Driver",
139
+ deviceDir: "Drivers/CMSIS/Device/ST/STM32F7xx",
140
+ coreRepo: "STM32CubeF7",
141
+ coreRef: "master",
142
+ coreIncludeDir: "Drivers/CMSIS/Include",
143
+ // F7 这份 CMSIS 的 core_cm7.h 只 include cmsis_version/cmsis_compiler/mpu_armv7;
144
+ // 实测仓库里没有 cachel1_armv7.h(H7 才有),别照 H7 抄成六个头,否则安装必 404。
145
+ coreHeaders: ["cmsis_compiler.h", "cmsis_gcc.h", "cmsis_version.h", "mpu_armv7.h", "core_cm7.h"],
146
+ archives: [
147
+ {
148
+ id: "hal",
149
+ label: "HAL 驱动(stm32f7xx-hal-driver)",
150
+ repo: "stm32f7xx-hal-driver",
151
+ ref: "master",
152
+ dirs: [
153
+ { from: "Inc", to: "Drivers/STM32F7xx_HAL_Driver/Inc" },
154
+ { from: "Src", to: "Drivers/STM32F7xx_HAL_Driver/Src" },
155
+ ],
156
+ urls: archiveUrls("stm32f7xx-hal-driver", "master"),
157
+ },
158
+ {
159
+ id: "device",
160
+ label: "CMSIS 设备支持(cmsis-device-f7)",
161
+ repo: "cmsis-device-f7",
162
+ ref: "master",
163
+ dirs: [
164
+ { from: "Include", to: "Drivers/CMSIS/Device/ST/STM32F7xx/Include" },
165
+ { from: "Source", to: "Drivers/CMSIS/Device/ST/STM32F7xx/Source" },
166
+ ],
167
+ urls: archiveUrls("cmsis-device-f7", "master"),
168
+ },
169
+ ],
170
+ },
171
+ G0: {
172
+ family: "G0",
173
+ packageBase: "STM32Cube_FW_G0",
174
+ defaultVersion: "1.6.2",
175
+ halDir: "Drivers/STM32G0xx_HAL_Driver",
176
+ deviceDir: "Drivers/CMSIS/Device/ST/STM32G0xx",
177
+ coreRepo: "STM32CubeG0",
178
+ coreRef: "master",
179
+ coreIncludeDir: "Drivers/CMSIS/Include",
180
+ coreHeaders: ["cmsis_compiler.h", "cmsis_gcc.h", "cmsis_version.h", "mpu_armv7.h", "core_cm0plus.h"],
181
+ archives: [
182
+ {
183
+ id: "hal",
184
+ label: "HAL 驱动(stm32g0xx-hal-driver)",
185
+ repo: "stm32g0xx-hal-driver",
186
+ ref: "master",
187
+ dirs: [
188
+ { from: "Inc", to: "Drivers/STM32G0xx_HAL_Driver/Inc" },
189
+ { from: "Src", to: "Drivers/STM32G0xx_HAL_Driver/Src" },
190
+ ],
191
+ urls: archiveUrls("stm32g0xx-hal-driver", "master"),
192
+ },
193
+ {
194
+ id: "device",
195
+ label: "CMSIS 设备支持(cmsis-device-g0)",
196
+ repo: "cmsis-device-g0",
197
+ ref: "master",
198
+ dirs: [
199
+ { from: "Include", to: "Drivers/CMSIS/Device/ST/STM32G0xx/Include" },
200
+ { from: "Source", to: "Drivers/CMSIS/Device/ST/STM32G0xx/Source" },
201
+ ],
202
+ urls: archiveUrls("cmsis-device-g0", "master"),
203
+ },
204
+ ],
205
+ },
206
+ L1: {
207
+ family: "L1",
208
+ packageBase: "STM32Cube_FW_L1",
209
+ defaultVersion: "1.10.6",
210
+ halDir: "Drivers/STM32L1xx_HAL_Driver",
211
+ deviceDir: "Drivers/CMSIS/Device/ST/STM32L1xx",
212
+ coreRepo: "STM32CubeL1",
213
+ coreRef: "master",
214
+ coreIncludeDir: "Drivers/CMSIS/Include",
215
+ coreHeaders: ["cmsis_compiler.h", "cmsis_gcc.h", "cmsis_version.h", "mpu_armv7.h", "core_cm3.h"],
216
+ archives: [
217
+ {
218
+ id: "hal",
219
+ label: "HAL 驱动(stm32l1xx-hal-driver)",
220
+ repo: "stm32l1xx-hal-driver",
221
+ ref: "master",
222
+ dirs: [
223
+ { from: "Inc", to: "Drivers/STM32L1xx_HAL_Driver/Inc" },
224
+ { from: "Src", to: "Drivers/STM32L1xx_HAL_Driver/Src" },
225
+ ],
226
+ urls: archiveUrls("stm32l1xx-hal-driver", "master"),
227
+ },
228
+ {
229
+ id: "device",
230
+ label: "CMSIS 设备支持(cmsis-device-l1)",
231
+ repo: "cmsis-device-l1",
232
+ ref: "master",
233
+ dirs: [
234
+ { from: "Include", to: "Drivers/CMSIS/Device/ST/STM32L1xx/Include" },
235
+ { from: "Source", to: "Drivers/CMSIS/Device/ST/STM32L1xx/Source" },
236
+ ],
237
+ urls: archiveUrls("cmsis-device-l1", "master"),
238
+ },
239
+ ],
240
+ },
241
+ L4: {
242
+ family: "L4",
243
+ packageBase: "STM32Cube_FW_L4",
244
+ defaultVersion: "1.18.2",
245
+ halDir: "Drivers/STM32L4xx_HAL_Driver",
246
+ deviceDir: "Drivers/CMSIS/Device/ST/STM32L4xx",
247
+ coreRepo: "STM32CubeL4",
248
+ coreRef: "master",
249
+ coreIncludeDir: "Drivers/CMSIS/Include",
250
+ coreHeaders: ["cmsis_compiler.h", "cmsis_gcc.h", "cmsis_version.h", "mpu_armv7.h", "core_cm4.h"],
251
+ archives: [
252
+ {
253
+ id: "hal",
254
+ label: "HAL 驱动(stm32l4xx-hal-driver)",
255
+ repo: "stm32l4xx-hal-driver",
256
+ ref: "master",
257
+ dirs: [
258
+ { from: "Inc", to: "Drivers/STM32L4xx_HAL_Driver/Inc" },
259
+ { from: "Src", to: "Drivers/STM32L4xx_HAL_Driver/Src" },
260
+ ],
261
+ urls: archiveUrls("stm32l4xx-hal-driver", "master"),
262
+ },
263
+ {
264
+ id: "device",
265
+ label: "CMSIS 设备支持(cmsis-device-l4)",
266
+ repo: "cmsis-device-l4",
267
+ ref: "master",
268
+ dirs: [
269
+ { from: "Include", to: "Drivers/CMSIS/Device/ST/STM32L4xx/Include" },
270
+ { from: "Source", to: "Drivers/CMSIS/Device/ST/STM32L4xx/Source" },
271
+ ],
272
+ urls: archiveUrls("cmsis-device-l4", "master"),
273
+ },
274
+ ],
275
+ },
276
+ U0: {
277
+ family: "U0",
278
+ packageBase: "STM32Cube_FW_U0",
279
+ defaultVersion: "1.2.0",
280
+ halDir: "Drivers/STM32U0xx_HAL_Driver",
281
+ deviceDir: "Drivers/CMSIS/Device/ST/STM32U0xx",
282
+ coreRepo: "STM32CubeU0",
283
+ coreRef: "main",
284
+ coreIncludeDir: "Drivers/CMSIS/Include",
285
+ coreHeaders: ["cmsis_compiler.h", "cmsis_gcc.h", "cmsis_version.h", "mpu_armv7.h", "core_cm0plus.h"],
286
+ archives: [
287
+ {
288
+ id: "hal",
289
+ label: "HAL 驱动(stm32u0xx-hal-driver)",
290
+ repo: "stm32u0xx-hal-driver",
291
+ ref: "main",
292
+ dirs: [
293
+ { from: "Inc", to: "Drivers/STM32U0xx_HAL_Driver/Inc" },
294
+ { from: "Src", to: "Drivers/STM32U0xx_HAL_Driver/Src" },
295
+ ],
296
+ urls: archiveUrls("stm32u0xx-hal-driver", "main"),
297
+ },
298
+ {
299
+ id: "device",
300
+ label: "CMSIS 设备支持(cmsis-device-u0)",
301
+ repo: "cmsis-device-u0",
302
+ ref: "main",
303
+ dirs: [
304
+ { from: "Include", to: "Drivers/CMSIS/Device/ST/STM32U0xx/Include" },
305
+ { from: "Source", to: "Drivers/CMSIS/Device/ST/STM32U0xx/Source" },
306
+ ],
307
+ urls: archiveUrls("cmsis-device-u0", "main"),
308
+ },
309
+ ],
310
+ },
311
+ C0: {
312
+ family: "C0",
313
+ packageBase: "STM32Cube_FW_C0",
314
+ defaultVersion: "1.4.1",
315
+ halDir: "Drivers/STM32C0xx_HAL_Driver",
316
+ deviceDir: "Drivers/CMSIS/Device/ST/STM32C0xx",
317
+ coreRepo: "STM32CubeC0",
318
+ coreRef: "main",
319
+ coreIncludeDir: "Drivers/CMSIS/Include",
320
+ coreHeaders: ["cmsis_compiler.h", "cmsis_gcc.h", "cmsis_version.h", "mpu_armv7.h", "core_cm0plus.h"],
321
+ archives: [
322
+ {
323
+ id: "hal",
324
+ label: "HAL 驱动(stm32c0xx-hal-driver)",
325
+ repo: "stm32c0xx-hal-driver",
326
+ ref: "main",
327
+ dirs: [
328
+ { from: "Inc", to: "Drivers/STM32C0xx_HAL_Driver/Inc" },
329
+ { from: "Src", to: "Drivers/STM32C0xx_HAL_Driver/Src" },
330
+ ],
331
+ urls: archiveUrls("stm32c0xx-hal-driver", "main"),
332
+ },
333
+ {
334
+ id: "device",
335
+ label: "CMSIS 设备支持(cmsis-device-c0)",
336
+ repo: "cmsis-device-c0",
337
+ ref: "main",
338
+ dirs: [
339
+ { from: "Include", to: "Drivers/CMSIS/Device/ST/STM32C0xx/Include" },
340
+ { from: "Source", to: "Drivers/CMSIS/Device/ST/STM32C0xx/Source" },
341
+ ],
342
+ urls: archiveUrls("cmsis-device-c0", "main"),
343
+ },
344
+ ],
345
+ },
346
+ H5: {
347
+ family: "H5",
348
+ packageBase: "STM32Cube_FW_H5",
349
+ defaultVersion: "1.5.1",
350
+ halDir: "Drivers/STM32H5xx_HAL_Driver",
351
+ deviceDir: "Drivers/CMSIS/Device/ST/STM32H5xx",
352
+ coreRepo: "STM32CubeH5",
353
+ coreRef: "main",
354
+ coreIncludeDir: "Drivers/CMSIS/Include",
355
+ coreHeaders: ["cmsis_compiler.h", "cmsis_gcc.h", "cmsis_version.h", "mpu_armv8.h", "core_cm33.h"],
356
+ archives: [
357
+ {
358
+ id: "hal",
359
+ label: "HAL 驱动(stm32h5xx_hal_driver)",
360
+ repo: "stm32h5xx_hal_driver",
361
+ ref: "main",
362
+ dirs: [
363
+ { from: "Inc", to: "Drivers/STM32H5xx_HAL_Driver/Inc" },
364
+ { from: "Src", to: "Drivers/STM32H5xx_HAL_Driver/Src" },
365
+ ],
366
+ urls: archiveUrls("stm32h5xx_hal_driver", "main"),
367
+ },
368
+ {
369
+ id: "device",
370
+ label: "CMSIS 设备支持(cmsis_device_h5)",
371
+ repo: "cmsis_device_h5",
372
+ ref: "main",
373
+ dirs: [
374
+ { from: "Include", to: "Drivers/CMSIS/Device/ST/STM32H5xx/Include" },
375
+ { from: "Source", to: "Drivers/CMSIS/Device/ST/STM32H5xx/Source" },
376
+ ],
377
+ urls: archiveUrls("cmsis_device_h5", "main"),
378
+ },
379
+ ],
380
+ },
381
+ U5: {
382
+ family: "U5",
383
+ packageBase: "STM32Cube_FW_U5",
384
+ defaultVersion: "1.8.0",
385
+ halDir: "Drivers/STM32U5xx_HAL_Driver",
386
+ deviceDir: "Drivers/CMSIS/Device/ST/STM32U5xx",
387
+ coreRepo: "STM32CubeU5",
388
+ coreRef: "main",
389
+ coreIncludeDir: "Drivers/CMSIS/Include",
390
+ coreHeaders: ["cmsis_compiler.h", "cmsis_gcc.h", "cmsis_version.h", "mpu_armv8.h", "core_cm33.h"],
391
+ archives: [
392
+ {
393
+ id: "hal",
394
+ label: "HAL 驱动(stm32u5xx_hal_driver)",
395
+ repo: "stm32u5xx_hal_driver",
396
+ ref: "main",
397
+ dirs: [
398
+ { from: "Inc", to: "Drivers/STM32U5xx_HAL_Driver/Inc" },
399
+ { from: "Src", to: "Drivers/STM32U5xx_HAL_Driver/Src" },
400
+ ],
401
+ urls: archiveUrls("stm32u5xx_hal_driver", "main"),
402
+ },
403
+ {
404
+ id: "device",
405
+ label: "CMSIS 设备支持(cmsis_device_u5)",
406
+ repo: "cmsis_device_u5",
407
+ ref: "main",
408
+ dirs: [
409
+ { from: "Include", to: "Drivers/CMSIS/Device/ST/STM32U5xx/Include" },
410
+ { from: "Source", to: "Drivers/CMSIS/Device/ST/STM32U5xx/Source" },
411
+ ],
412
+ urls: archiveUrls("cmsis_device_u5", "main"),
413
+ },
414
+ ],
415
+ },
416
+ WBA: {
417
+ family: "WBA",
418
+ packageBase: "STM32Cube_FW_WBA",
419
+ defaultVersion: "1.7.0",
420
+ halDir: "Drivers/STM32WBAxx_HAL_Driver",
421
+ deviceDir: "Drivers/CMSIS/Device/ST/STM32WBAxx",
422
+ coreRepo: "STM32CubeWBA",
423
+ coreRef: "main",
424
+ coreIncludeDir: "Drivers/CMSIS/Include",
425
+ coreHeaders: ["cmsis_compiler.h", "cmsis_gcc.h", "cmsis_version.h", "mpu_armv8.h", "core_cm33.h"],
426
+ archives: [
427
+ {
428
+ id: "hal",
429
+ label: "HAL 驱动(stm32wbaxx_hal_driver)",
430
+ repo: "stm32wbaxx_hal_driver",
431
+ ref: "main",
432
+ dirs: [
433
+ { from: "Inc", to: "Drivers/STM32WBAxx_HAL_Driver/Inc" },
434
+ { from: "Src", to: "Drivers/STM32WBAxx_HAL_Driver/Src" },
435
+ ],
436
+ urls: archiveUrls("stm32wbaxx_hal_driver", "main"),
437
+ },
438
+ {
439
+ id: "device",
440
+ label: "CMSIS 设备支持(cmsis_device_wba)",
441
+ repo: "cmsis_device_wba",
442
+ ref: "main",
443
+ dirs: [
444
+ { from: "Include", to: "Drivers/CMSIS/Device/ST/STM32WBAxx/Include" },
445
+ { from: "Source", to: "Drivers/CMSIS/Device/ST/STM32WBAxx/Source" },
446
+ ],
447
+ urls: archiveUrls("cmsis_device_wba", "main"),
448
+ },
449
+ ],
450
+ },
451
+ L5: {
452
+ family: "L5",
453
+ packageBase: "STM32Cube_FW_L5",
454
+ defaultVersion: "1.5.0",
455
+ halDir: "Drivers/STM32L5xx_HAL_Driver",
456
+ deviceDir: "Drivers/CMSIS/Device/ST/STM32L5xx",
457
+ coreRepo: "STM32CubeL5",
458
+ coreRef: "master",
459
+ coreIncludeDir: "Drivers/CMSIS/Include",
460
+ coreHeaders: ["cmsis_compiler.h", "cmsis_gcc.h", "cmsis_version.h", "mpu_armv8.h", "core_cm33.h"],
461
+ archives: [
462
+ {
463
+ id: "hal",
464
+ label: "HAL 驱动(stm32l5xx_hal_driver)",
465
+ repo: "stm32l5xx_hal_driver",
466
+ ref: "master",
467
+ dirs: [
468
+ { from: "Inc", to: "Drivers/STM32L5xx_HAL_Driver/Inc" },
469
+ { from: "Src", to: "Drivers/STM32L5xx_HAL_Driver/Src" },
470
+ ],
471
+ urls: archiveUrls("stm32l5xx_hal_driver", "master"),
472
+ },
473
+ {
474
+ id: "device",
475
+ label: "CMSIS 设备支持(cmsis_device_l5)",
476
+ repo: "cmsis_device_l5",
477
+ ref: "master",
478
+ dirs: [
479
+ { from: "Include", to: "Drivers/CMSIS/Device/ST/STM32L5xx/Include" },
480
+ { from: "Source", to: "Drivers/CMSIS/Device/ST/STM32L5xx/Source" },
481
+ ],
482
+ urls: archiveUrls("cmsis_device_l5", "master"),
483
+ },
484
+ ],
485
+ },
486
+ WB: {
487
+ family: "WB",
488
+ packageBase: "STM32Cube_FW_WB",
489
+ defaultVersion: "1.23.0",
490
+ halDir: "Drivers/STM32WBxx_HAL_Driver",
491
+ deviceDir: "Drivers/CMSIS/Device/ST/STM32WBxx",
492
+ coreRepo: "STM32CubeWB",
493
+ coreRef: "master",
494
+ coreIncludeDir: "Drivers/CMSIS/Include",
495
+ coreHeaders: ["cmsis_compiler.h", "cmsis_gcc.h", "cmsis_version.h", "mpu_armv7.h", "core_cm4.h"],
496
+ archives: [
497
+ {
498
+ id: "hal",
499
+ label: "HAL 驱动(stm32wbxx_hal_driver)",
500
+ repo: "stm32wbxx_hal_driver",
501
+ ref: "master",
502
+ dirs: [
503
+ { from: "Inc", to: "Drivers/STM32WBxx_HAL_Driver/Inc" },
504
+ { from: "Src", to: "Drivers/STM32WBxx_HAL_Driver/Src" },
505
+ ],
506
+ urls: archiveUrls("stm32wbxx_hal_driver", "master"),
507
+ },
508
+ {
509
+ id: "device",
510
+ label: "CMSIS 设备支持(cmsis_device_wb)",
511
+ repo: "cmsis_device_wb",
512
+ ref: "master",
513
+ dirs: [
514
+ { from: "Include", to: "Drivers/CMSIS/Device/ST/STM32WBxx/Include" },
515
+ { from: "Source", to: "Drivers/CMSIS/Device/ST/STM32WBxx/Source" },
516
+ ],
517
+ urls: archiveUrls("cmsis_device_wb", "master"),
518
+ },
519
+ ],
520
+ },
521
+ WL: {
522
+ family: "WL",
523
+ packageBase: "STM32Cube_FW_WL",
524
+ defaultVersion: "1.3.0",
525
+ halDir: "Drivers/STM32WLxx_HAL_Driver",
526
+ deviceDir: "Drivers/CMSIS/Device/ST/STM32WLxx",
527
+ coreRepo: "STM32CubeWL",
528
+ coreRef: "main",
529
+ coreIncludeDir: "Drivers/CMSIS/Include",
530
+ coreHeaders: ["cmsis_compiler.h", "cmsis_gcc.h", "cmsis_version.h", "mpu_armv7.h", "core_cm4.h"],
531
+ archives: [
532
+ {
533
+ id: "hal",
534
+ label: "HAL 驱动(stm32wlxx_hal_driver)",
535
+ repo: "stm32wlxx_hal_driver",
536
+ ref: "main",
537
+ dirs: [
538
+ { from: "Inc", to: "Drivers/STM32WLxx_HAL_Driver/Inc" },
539
+ { from: "Src", to: "Drivers/STM32WLxx_HAL_Driver/Src" },
540
+ ],
541
+ urls: archiveUrls("stm32wlxx_hal_driver", "main"),
542
+ },
543
+ {
544
+ id: "device",
545
+ label: "CMSIS 设备支持(cmsis_device_wl)",
546
+ repo: "cmsis_device_wl",
547
+ ref: "main",
548
+ dirs: [
549
+ { from: "Include", to: "Drivers/CMSIS/Device/ST/STM32WLxx/Include" },
550
+ { from: "Source", to: "Drivers/CMSIS/Device/ST/STM32WLxx/Source" },
551
+ ],
552
+ urls: archiveUrls("cmsis_device_wl", "main"),
553
+ },
554
+ ],
555
+ },
556
+ H7: {
557
+ family: "H7",
558
+ packageBase: "STM32Cube_FW_H7",
559
+ defaultVersion: "1.11.0",
560
+ halDir: "Drivers/STM32H7xx_HAL_Driver",
561
+ deviceDir: "Drivers/CMSIS/Device/ST/STM32H7xx",
562
+ coreRepo: "STM32CubeH7",
563
+ coreRef: "master",
564
+ coreIncludeDir: "Drivers/CMSIS/Include",
565
+ // CM7 的 core_cm7.h 会 include cachel1_armv7.h(L1 cache 维护):漏了它编译直接 fatal error。
566
+ coreHeaders: ["cmsis_compiler.h", "cmsis_gcc.h", "cmsis_version.h", "mpu_armv7.h", "cachel1_armv7.h", "core_cm7.h"],
567
+ archives: [
568
+ {
569
+ id: "hal",
570
+ label: "HAL 驱动(stm32h7xx_hal_driver)",
571
+ repo: "stm32h7xx_hal_driver",
572
+ ref: "master",
573
+ dirs: [
574
+ { from: "Inc", to: "Drivers/STM32H7xx_HAL_Driver/Inc" },
575
+ { from: "Src", to: "Drivers/STM32H7xx_HAL_Driver/Src" },
576
+ ],
577
+ urls: archiveUrls("stm32h7xx_hal_driver", "master"),
578
+ },
579
+ {
580
+ id: "device",
581
+ label: "CMSIS 设备支持(cmsis_device_h7)",
582
+ repo: "cmsis_device_h7",
583
+ ref: "master",
584
+ dirs: [
585
+ { from: "Include", to: "Drivers/CMSIS/Device/ST/STM32H7xx/Include" },
586
+ { from: "Source", to: "Drivers/CMSIS/Device/ST/STM32H7xx/Source" },
587
+ ],
588
+ urls: archiveUrls("cmsis_device_h7", "master"),
589
+ },
590
+ ],
591
+ },
592
+ U3: {
593
+ family: "U3",
594
+ packageBase: "STM32Cube_FW_U3",
595
+ defaultVersion: "1.2.0",
596
+ halDir: "Drivers/STM32U3xx_HAL_Driver",
597
+ deviceDir: "Drivers/CMSIS/Device/ST/STM32U3xx",
598
+ coreRepo: "STM32CubeU3",
599
+ coreRef: "main",
600
+ coreIncludeDir: "Drivers/CMSIS/Include",
601
+ coreHeaders: ["cmsis_compiler.h", "cmsis_gcc.h", "cmsis_version.h", "mpu_armv8.h", "core_cm33.h"],
602
+ archives: [
603
+ {
604
+ id: "hal",
605
+ label: "HAL 驱动(stm32u3xx-hal-driver)",
606
+ repo: "stm32u3xx-hal-driver",
607
+ ref: "main",
608
+ dirs: [
609
+ { from: "Inc", to: "Drivers/STM32U3xx_HAL_Driver/Inc" },
610
+ { from: "Src", to: "Drivers/STM32U3xx_HAL_Driver/Src" },
611
+ ],
612
+ urls: archiveUrls("stm32u3xx-hal-driver", "main"),
613
+ },
614
+ {
615
+ id: "device",
616
+ label: "CMSIS 设备支持(cmsis-device-u3)",
617
+ repo: "cmsis-device-u3",
618
+ ref: "main",
619
+ dirs: [
620
+ { from: "Include", to: "Drivers/CMSIS/Device/ST/STM32U3xx/Include" },
621
+ { from: "Source", to: "Drivers/CMSIS/Device/ST/STM32U3xx/Source" },
622
+ ],
623
+ urls: archiveUrls("cmsis-device-u3", "main"),
624
+ },
625
+ ],
626
+ },
61
627
  };
62
628
  /** 从型号(STM32F103C8T6)或族名(F1)里认族;认不出返回空串。 */
63
629
  export function firmwareFamilyOf(text) {
@@ -127,11 +693,28 @@ export function firmwarePlanFor(request) {
127
693
  }
128
694
  const tags = firmwareVersionTags(family, version);
129
695
  const dirName = spec.packageBase + "_V" + version;
130
- const coreTargets = spec.coreHeaders.map((header) => ({
131
- path: header,
132
- urls: sourceUrls(spec.coreRepo, spec.coreRef, spec.coreIncludeDir + "/" + header),
133
- minBytes: 500,
134
- }));
696
+ const missingPins = [];
697
+ const archives = spec.archives.map((archive) => {
698
+ const pin = FIRMWARE_ARCHIVE_PINS[archive.repo + "@" + archive.ref];
699
+ if (pin === undefined)
700
+ missingPins.push(archive.repo + "@" + archive.ref);
701
+ return { ...archive, sha256: pin?.sha256 ?? "", bytes: pin?.bytes ?? 0 };
702
+ });
703
+ const coreTargets = spec.coreHeaders.map((header) => {
704
+ const key = spec.coreRepo + "@" + spec.coreRef + "/" + spec.coreIncludeDir + "/" + header;
705
+ const pin = FIRMWARE_CORE_PINS[key];
706
+ if (pin === undefined)
707
+ missingPins.push(key);
708
+ return {
709
+ path: header,
710
+ urls: sourceUrls(spec.coreRepo, spec.coreRef, spec.coreIncludeDir + "/" + header),
711
+ minBytes: 500,
712
+ ...(pin === undefined ? {} : { sha256: pin.sha256 }),
713
+ };
714
+ });
715
+ if (missingPins.length > 0) {
716
+ return emptyPlan("固件包清单缺 sha256(" + missingPins.join("、") + ")。请先跑 scripts/firmware/pin-firmware.mjs 并提交 src/data/firmware-pins.ts。", family, version);
717
+ }
135
718
  const license = [
136
719
  "# 第三方声明",
137
720
  "",
@@ -157,7 +740,7 @@ export function firmwarePlanFor(request) {
157
740
  packageXml: packageXmlText(tags),
158
741
  halDir: spec.halDir,
159
742
  deviceDir: spec.deviceDir,
160
- archives: spec.archives,
743
+ archives,
161
744
  coreTargets,
162
745
  license,
163
746
  };