cancel
Showing results for 
Search instead for 
Did you mean: 

How to set --fdebug-prefix-map in the STM32CubeIDE

ADhan.1
Associate II

Hi,

I'm building my project inside a Docker container that has STM32CubeIDE installed using the command:

headless-build.sh -build demo-nucleo-f334r8 -importAll /app

The project builds fine, and I'm able to successfully flash my board with the generated images. However, when I try to run a debug session on my Host machine (OSX and Windows 10) with the generated .elf file(from the Docker build) I get the following error

"Can't find a source file at "/app/Debug/../Core/Src/main.c" "

I tried using the -fdebug-prefix-map flag as follows:

-fdebug-prefix-map=$(@D)=.

to strip away the Docker directory prefix, however this does not seem to be having any effect.

Is there a way to use a debug image built inside a docker container with a debug session on the host machine?

Note: If I build my project inside a docker container using arm-none-eabi-gcc v9.3.1 and include the -fdebug-prefix-map flag in my Makefile, I'm able to run arm-none-eabi-gbd with the generated .elf image on my host machine and debug as normal, so I know the flag works with arm-none-eabi-gcc, I just can't get it to work with the STM32CUBEIde. Thank you!

best,

Akbar

1 ACCEPTED SOLUTION

Accepted Solutions
ADhan.1
Associate II

I figured it out. I was being a little too fancy with my automatic variables. The flag should be:

-fdebug-prefix-map=/app=.

Note: /app is where I mount the project from my host computer into the docker container. For users mounting it in a different location, you would need to change the mapping.

View solution in original post

1 REPLY 1
ADhan.1
Associate II

I figured it out. I was being a little too fancy with my automatic variables. The flag should be:

-fdebug-prefix-map=/app=.

Note: /app is where I mount the project from my host computer into the docker container. For users mounting it in a different location, you would need to change the mapping.