How do I debug STM32N6 ModelZoo firmware in CubeIDE after flashing with stm32ai_main.py?
Hi everyone,
Can someone help me figure out the correct workflow for debugging custom ModelZoo firmware on the STM32N6570-DK using STM32CubeIDE?
I am currently working with the stm32ai-modelzoo-services repository, specifically modifying the Object Detection example to add H.264 video encoding and audio recording triggers. Because this uses the ST Edge AI deployment pipeline, I am building and flashing the board entirely via the Python CLI:
Bash
python stm32ai_main.py --config-name custom_deploy.yaml
This script works perfectly. It handles the First Stage Bootloader (FSBL) sequence, flashes the external memory, and the board boots and runs my custom code without any issues.
My question is: how do I actually attach CubeIDE to this running target so I can step through my modified C code?
I want to use breakpoints in main.c, watch variables, and view the call stack. However, when I try to create a standard Debug Configuration in CubeIDE pointing to the .elf generated by the Python script, the ST-LINK GDB server crashes with this error:
Plaintext
Failed to start GDB server
Target not halted after reset.
Force halt.
Failed to halt target.
Reason: Target not halted.
I suspect that standard IDE reset/halt commands are interrupting the FSBL sequence before the XIP external memory is mapped, causing the crash. Also, when I try tweaking the debug configurations to bypass the download/reset, the CubeIDE UI often throws parameter errors when linking the external .elf.
Does anyone know the recommended steps to solve this? Specifically:
-
How exactly should the Debug Configuration (Reset behavior, Startup tab, External Loaders) be set up to safely attach to a running XIP session on the STM32N6?
-
Is there a pre-configured
.launchfile or a specific ST guide for debugging Python-flashed ModelZoo binaries?
Thanks in advance for any guidance!
reference repo - https://github.com/STMicroelectronics/stm32ai-modelzoo-services/tree/main
