Skip to main content
Associate III
July 31, 2026
Question

How do I debug STM32N6 ModelZoo firmware in CubeIDE after flashing with stm32ai_main.py?

  • July 31, 2026
  • 2 replies
  • 61 views

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 .launch file 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

2 replies

Associate
July 31, 2026

I think your suspicion about the FSBL/XIP sequence is worth checking. Instead of letting CubeIDE reset and download the target, try using an Attach to Running Target style configuration with reset/download disabled, then connect after the ModelZoo application has booted and external memory is mapped.

Also make sure the exact .elf used for flashing is loaded for symbols only, while the target memory is left untouched. If the target must stay running through the FSBL before attaching, that should avoid the “Target not halted” issue caused by an early reset/halt.

It would also be useful to check the generated linker script and external-loader configuration used by stm32ai_main.py, since CubeIDE needs to match the same memory layout for debugging.

vedantggAuthor
Associate III
August 5, 2026

Hey, thanks for the information! I was able to get the debugging working.

However, I'm now struggling with code profiling on the STM32N6. I tried using the SWV profiling feature, but it doesn't seem to be working—the entire profiling table remains blank.

Do you have any idea what might be causing this or how I can get it working?