cancel
Showing results for 
Search instead for 
Did you mean: 

How to Debug at headless

u1kano
Associate III

I am trying to debug firmware using STM32CubeIDE. The operation in the IDE is to select Run > Debug, is it possible to automate this operation and run it in headless mode?

It will be very helpful if you could provide me with specific commands or a reference manual.
Thank you.

 

My environmental information is following:

Windows11

STM32CubeIDE: 1.12.1

5 REPLIES 5
allenmack
Associate II

@u1kano wrote:

I am trying to debug firmware using STM32CubeIDE. The operation in the IDE is to select Run > Debug, is it possible to automate this operation and run it in headless mode?

It will be very helpful if you could provide me with specific commands or a reference manual.
Thank you.

 

My environmental information is following:

Windows11

STM32CubeIDE: 1.12.1 


Yes, it is possible to automate debugging operations with STM32CubeIDE using command-line tools, though STM32CubeIDE itself does not natively support a fully headless mode. For automation, you can use STM32CubeProgrammer (previously known as ST-Link Utility) which supports command-line operations. locksmith sherman

thank you for your reply.
Upon reviewing the headless-build script below, it appears that it calls stm32cubeidec.exe to execute the build. Is it possible to perform Run > Debug using stm32cubeidec.exe in the same manner?

Headless-build script:
<STM32CubeIDE InstallDir>\STM32CubeIDE_1.12.1\STM32CubeIDE\headless-build.bat

set basedir=%~dp0
"%basedir%"stm32cubeidec.exe --launcher.suppressErrors -nosplash -application org.eclipse.cdt.managedbuilder.core.headlessbuild %*

 

BarryWhit
Lead II

What exactly would you like to do from the command-line? download a compiled program to the chip? Reset the chip? halt/run the MCU? do you want to debug your program directly via a gdb session? what?

- If someone's post helped resolve your issue, please thank them by clicking "Accept as Solution".
- Please post an update with details once you've solved your issue. Your experience may help others.
u1kano
Associate III

Let me provide some additional information about my environment.
CubeIDE(Windows11) - ST-Link/v2 - device
STM32CubeIDE:Version: 1.12.1 Build: 16088_20230420_1057 (UTC)
ST-LINK FW: V2J41S7
Device: STM32H7Ax/7Bx

@allenmack 

I understood that STM32CubeIDE itself does not natively support a fully headless mode.

I have not yet tried executing with STM32CubeProgrammer. Could you please tell me how to replicate the CubeIDE's Run > Debug function using STM32CubeProgrammer via the command line?


@BarryWhit 
I want to do is the following:

- Download the compiled program (ELF file) to the debugger.
- Directly debug the program using a gdb session.
- Capture the output of Google Test results within the program via SWO.

BarryWhit
Lead II

You can download new firmware using the CLI version of the CubeProgrammer, or using the gdb `load` command. If you examine the progress log for what the CubeIDE does when you run/Debug and compare it to the output of CubeProgrammerCLI you'll see that the IDE actually uses that itself to program the chip.

 

Your other threads show that you've already figured out how to launch the gdb-server and connect to it with gdb.

 

As for SWO capture, I asked for more information and suggested you do some tests to debug the issue, but you've not responded to any of this. I think you have too many overlapping threads going at once.

- If someone's post helped resolve your issue, please thank them by clicking "Accept as Solution".
- Please post an update with details once you've solved your issue. Your experience may help others.