cancel
Showing results for 
Search instead for 
Did you mean: 

How do I debug an externally built executable?

AIsma
Associate II

I built an elf executable for the STM32H743ZI. I did not create this executable from within STM32CubeIDE. Still, I would like to debug it from within STM32CubeIDE. How do I load the elf file in the STM32CubeIDE and debug the executable on a target (STM32H743ZI). Can this be done?

1 ACCEPTED SOLUTION

Accepted Solutions
Ethan HUANG
ST Employee

The procedure described in the attached PDF works for me.

I used STM32CubeIDE v1.0.0 to generate "external ELF" and then used STM32CubeIDE v1.0.2 to debug this external ELF.

Regards,

Ethan

View solution in original post

5 REPLIES 5

I think there is an Atollic type method using the debugger script to pull in, or associate, multiple files with the debug session. I think it was in the context of debugging a loader and application in a single session. The search here is frustrating, I will try and dig it out

In Keil it was possible to create a shell project, build it, then substitute the .AXF (ELF), and download and debug the project you want to look at. Keil also provides for a LOAD directive in the debugger command line, or debugger script.

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..
Ethan HUANG
ST Employee

The procedure described in the attached PDF works for me.

I used STM32CubeIDE v1.0.0 to generate "external ELF" and then used STM32CubeIDE v1.0.2 to debug this external ELF.

Regards,

Ethan

BSter.1
Associate

I found a different way that I prefer.

  • File-> New-> C/C++ Project->
    • Select ‘C Managed Build’
    • Next > ->
      • Project name: <this can be anything as long as there is not already a project in the workspace with the same name>
      • Unselect ‘Use default location’ <This and the next step are optional, but I wanted to keep my STM32CubeIDE files 'close-to' my other files for the project>
      • Location-> <I created a ‘STM32CubeIDEProject’ subfolder of the project to use simply because I didn't want the STM32CubeIDE files to be intermixed with my other project file>
      • Select ‘Project type:-> Executable-> Empty Project’
      • Select ‘Toolchains:-> MCU ARM GCC’
      • Next >->
        • Next >->
          • <Select the MCU used -STM32H743ZI for this specific question>
          • Finish->
          • Answer ‘OK’ to override the project settings
  • Select the new project name in ‘Project Explorer’->
    • Project-> Properties-> Run/Debug Settings->
      • New…->
        • Select ‘STM32 Cortex-M C/C++ Application’
        • OK
      • Main->
        • Select ‘Disable auto build’
        • C/C++ Application: <browse to ELF file you built>
        • Apply
        • OK
      • Apply and Close

AT THIS POINT, THE PROJECT CAN BE DEBUGGED

Cartu38 OpenDev
Lead II

Even better File > Import > STM32 Cortex M executable

0693W00000Hp0jGQAR.jpg

BSter.1
Associate

Absolutely true! Definitely the easiest way to solve the problem posed in the question.

My problem was a little different - I wanted to also be able to build my project via my own makefile using the STM32CubeIDE. Hence the new project creation in my answer. But I'm VERY glad someone else answered this as well - it took way too long for me to determine the solution.