CubeMX: SPI4 + SDMMC1/FatFs + I2S6, audio BSP et debug VS Code (Linux)

Regeneration CubeMX (Appli) preparant le driver ST67W611M1 et la carte SD :
- SPI4 (PE12/13/14, CS PF8) + DMA GPDMA1 canaux 4/5, SPI_RDY (PD12/EXTI12),
  CHIP_EN (PD13) et BOOT (PD15) pour la X-NUCLEO-67W61M1 sur l'Arduino
- SDMMC1 + FatFs (appels d'init non generes dans main, IRQ SDMMC1 prio 14),
  PM14 en open-drain ; I2S6_CK sur PA5 pour liberer PC12 (SDMMC1_CK)
- HAL UART retire ; USE_BSP_COM_FEATURE=0
- Audio preserve : ADF 4/16/24, prio IRQ 2, DMA canal 0 en priorite haute,
  GPDMA1_Channel2_IRQHandler deplace dans audio_irq.c (hors fichiers generes),
  BSP_MX_I2S6_Init (renommage dans le BSP pour eviter le conflit avec CubeMX)
- Middlewares/ST/ST67W6X_Network_Driver, FatFs et sources HAL SPI/SD ajoutes
  (driver ST67 pas encore integre au build)

Build et debug sous Linux :
- gcc/toolchain-env.sh, gdbserver.sh, arm-gdb.sh : outils de STM32CubeIDE par
  glob ; flash.sh les retrouve ; ruby_compat.rb pour Ruby >= 3.2 (TouchGFX)
- makefile_appli : sources SD/SPI/FatFs/audio_irq ; chmod +x des .out TouchGFX
- Objets de build (*.o, *.d, *.su) retires de l'index (deja dans .gitignore)
- AGENTS.md : toolchain Linux, configs VS Code (cppdbg et ST stlinkgdbtarget),
  pieges de l'extension ST (.settings/ide.store.json, preRunCommands reset)

Verifie sur carte : audio OK, debug Appli/Boot OK.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
thomasandClaude Sonnet 5.5 committed 2026-10-23 22:49:06 +02:00
1 parent b119a6abd7
commit 66bb319423
1092 files changed
+172728 -133236

No files matched your search

+14 -5
View File
@@ -56,6 +56,8 @@ This project uses a **dual-project architecture**:
TouchGFX 4.26.1 + STM32CubeMX are only needed to regenerate code.
On Linux, `arm-none-eabi-gcc` comes from STM32CubeIDE (`~/st/stm32cubeide_*/plugins/com.st.stm32cube.ide.mcu.externaltools.gnu-tools-for-stm32.*/tools/bin`, GCC 14.3); `~/.bashrc` adds it to `PATH`. The build also needs `ruby` (TouchGFX text/video conversion) and the executable bit on `Appli/Middlewares/ST/touchgfx/framework/tools/{imageconvert,fontconvert}/build/linux/*.out`. Build outputs (`*.o`, `*.d`, `*.su` in `*/TouchGFX/build` and `STM32CubeIDE/*/Debug`) are git-ignored and untracked.
### Build Commands
Run from the repository root (the makefiles `cd` to the root themselves):
@@ -95,12 +97,19 @@ STM32_Programmer_CLI -c port=SWD ap=1 mode=UR -el gcc/MX66UW1G45G_STM32H7S78-DK.
Only one tool can hold the ST-Link at a time: stop any debug session before flashing.
### VS Code (`.vscode/`)
### VS Code (`.vscode/`, git-ignored)
- `tasks.json`: Build All (default, Cmd+Shift+B), Build Boot/Appli, Clean, Flash Boot/Appli/All, Build + Flash Boot/Appli/All, Board: Probe/Reset/Verify, Generate compile_commands.json. All tasks call the commands above.
- `launch.json` (Cortex-Debug, `servertype: stlink`): Debug Boot, Debug Appli (builds, flashes via GDB with the external loader, stops at Appli `main()`), Debug Appli (no flash), Attach Appli.
- `settings.json`: Cortex-Debug tool paths, IntelliSense from `compile_commands.json`.
- `c_cpp_properties.json`: uses `compile_commands.json`.
Linux setup (uses the `ms-vscode.cpptools` extension, no Cortex-Debug needed; tools come from STM32CubeIDE in `~/st`):
- `gcc/toolchain-env.sh`: sourced by the helpers below; adds `arm-none-eabi-gcc/gdb` to `PATH` and exports `ST_GDBSERVER` / `ST_PROGRAMMER_BIN` (globs, so CubeIDE updates do not break it).
- `gcc/gdbserver.sh <boot|appli>`: starts `ST-LINK_gdbserver -p 61234 --swd --halt -m 1 -k -cp <programmer>` (+ `-el` external loader for `appli`). Kills a stale server first.
- `gcc/arm-gdb.sh`: wrapper around `arm-none-eabi-gdb` (VS Code `miDebuggerPath` cannot glob).
- `tasks.json`: Build All (default, Ctrl+Shift+B) / Boot / Appli, Clean, Flash Boot/Appli/All, Build + Flash All, Board: Probe/Reset/Verify, `gdbserver: Boot|Appli` (background), `Debug prep: ...` (build + gdbserver, used as `preLaunchTask`), Kill gdbserver, Generate compile_commands.json.
- `launch.json` (`cppdbg`, `miDebuggerServerAddress: localhost:61234`): **Debug Boot** (build, `load`, `monitor reset`, hw break on `main`), **Debug Appli** (build, `load` via the external loader, reset, stops at Appli `main()`), **Debug Appli (no flash)** (reset only).
- `launch.json` also has three `stlinkgdbtarget` configs (they need `deviceName: STM32H7S7L8H6H` = CMSIS pack variant / `Mcu.CPN`, and `deviceCore: Cortex-M7`; the ST extension cannot infer them for this Makefile project) (**ST Debug Boot / Appli / Appli (no flash)**) for the STMicroelectronics VS Code extensions (`stm32cube-ide-debug-stlink-gdbserver`, `-registers`, `-rtos`): they start their own ST-LINK server from `~/.local/share/stm32cube/bundles` (no `gdbserver:` task needed), and give the peripheral **Registers** view (SVD `~/STMicroelectronics/STM32Cube/STM32CubeProgrammer/SVD/STM32H7S.svd`), the **FreeRTOS** threads view (`serverRtos`, `ARM_CM7`) and Live Watch. Validated headless (DAP driven by script: server, RTOS proxy, GDB client and Live Watch all start; flash `load` not exercised). **Required, git-ignored file** `.settings/ide.store.json` at the repo root: `{"device": "STM32H7S7L8H6H", "core": "Cortex-M7", "tz": "TZ-disabled"}`. The extension looks for it by walking up from the ELF directory; without it the ST-LINK server step is silently skipped and launch fails with "No GDB Server running" ("project settings not found" in the log). The ST configs need `"preRunCommands": ["monitor reset"]`: after `load` the extension starts at the ELF `Reset_Handler`, but external flash is only memory-mapped once Boot has run, so without the reset Appli faults on its first instruction (SIGTRAP in Boot's handler, black screen). Other notes: the extension's CMSIS pack root `~/.local/share/stm32cube/packs` should contain `STMicroelectronics/stm32h7xx_dfp/1.3.0`; the `ST Debug Appli (no flash)` variant only has a symbol file, so it sets `program` (the RTOS proxy needs the ELF; without it the proxy dies and GDB times out).
- `settings.json` / `extensions.json`: IntelliSense from `compile_commands.json`.
macOS keeps the Cortex-Debug (`servertype: stlink`) setup described under "Debugging". `pkill -x ST-LINK_gdbserver` does NOT work (process name truncated to 15 chars): use `pkill -f '[S]T-LINK_gdbserver'`.
Keep `AGENTS.md`, `.vscode/tasks.json`, `.vscode/launch.json` and `gcc/flash.sh` consistent when changing any build/flash/debug command.