cancel
Showing results for 
Search instead for 
Did you mean: 

How do I specify HW target (e.g. STM32L072) to debug Makefile project

Pieter Conradie
Associate III

Hi everyone!

I am able to successfully create a new Makefile project in a directory containing existing code. It work seamlessly and I am able to build the code without a hitch but when I try to debug the actual hardware target (e.g. STM32L072RBTx) I hit a brick wall and I don't know how to proceed further.

When I launch the "Debug Configurations" dialog, I get an error dialog: "Project setup issue: Not able to get mcu target. Reason: Build configuration is not valid. Described mcu target is not supported". See attached screenshot:

0690X000009Yck1QAC.png

How do I specify the HW target (after creating a Makefile project)? Any hints / tips / links would be much appreciated!

Thanks in advance,

Pieter

https://piconomix.com

1 ACCEPTED SOLUTION

Accepted Solutions
Ethan HUANG
ST Employee

Hi Pieter,

Here is how I dealt with Makefile project for your reference:

https://github.com/ethanhuanginst/STM32CubeIDE-Workshop-2019/tree/master/hands-on/02_stm32_hp141_lcd

NOTE: This was tested over STM32CubeIDE v.1,0.0 and not tested over the latest v1.0.1.

View solution in original post

6 REPLIES 6
hansd56
Senior II

Hi, not a specialist with make projects. I think you will still need a startupfile.s, linkerfile and you have to generate an .elf file with highest debug options and no optimization.

The link command from my tests with a project:

arm-none-eabi-g++ -o "AProPrinterGUI.elf" @"objects.list" $(USER_OBJS) $(LIBS) -mcpu=cortex-m7 -T"../STM32F746NG_FLASH.ld" --specs=nosys.specs -Wl,-Map="AProPrinterGUI.map" -Wl,--gc-sections -static -L../Middlewares/ST/TouchGFX/touchgfx/lib/core/cortex_m7/gcc --specs=nano.specs -mfpu=fpv5-sp-d16 -mfloat-abi=hard -mthumb -Wl,--start-group -lc -lm -lstdc++ -lsupc++ -Wl,--end-group

The .elf creation

post-build:

   arm-none-eabi-objcopy.exe -O ihex "AProPrinterGUI.elf" "AProPrinterGUI.hex"

   -@echo ' '

My best guess is they get it from the .elf file. I hope this helps.

Hi @hands56,

Sorry if I did not make this clear. My project build successfully and generates an ELF file. This is not the problem.

My problem is that I am unable to get debugging working. For that I have to specify the HW target somewhere in the IDE. The IDE is complaining that it is "unable to get the MCU target".

So this is more of a support question for the STM32CubeIDE development team, unless someone already knows how to do this.

Best regards,

Pieter

hansd56
Senior II

Even an IDE generated project is a make file project. Where is your .elf reference in the C/C++ Application?0690X000009YdNIQA0.jpg

Pieter Conradie
Associate III

Hi @hands56,

I did some more digging. I found that in order to debug STM32 I had to add a project nature:

0690X000009YdYBQA0.png

I'm not very familiar on what a "project nature" is exactly, but it looks like I need it.

I also manually edited the ".cproject" file and updated the following lines to specify the MCU target:

<option id="com.st.stm32cube.ide.mcu.gnu.managedbuild.option.target_mcu.1716657407" name="Mcu" superClass="com.st.stm32cube.ide.mcu.gnu.managedbuild.option.target_mcu" value="STM32L072RBTx" valueType="string"/>
							<option id="com.st.stm32cube.ide.mcu.gnu.managedbuild.option.target_cpuid.1015595930" name="CpuId" superClass="com.st.stm32cube.ide.mcu.gnu.managedbuild.option.target_cpuid" value="0" valueType="string"/>
							<option id="com.st.stm32cube.ide.mcu.gnu.managedbuild.option.target_coreid.241682417" name="CpuCoreId" superClass="com.st.stm32cube.ide.mcu.gnu.managedbuild.option.target_coreid" value="0" valueType="string"/>
							<option id="com.st.stm32cube.ide.mcu.gnu.managedbuild.option.target_board.1761731627" name="Board" superClass="com.st.stm32cube.ide.mcu.gnu.managedbuild.option.target_board" value="genericBoard" valueType="string"/>

This made the error dialog go away and an "STM32 MCU Debugging" configuration appeared:

0690X000009Yde9QAC.png

Success! I can program and debug my target hardware.

I did notice this though:

0690X000009YdeTQAS.png

Manually editing the ".cproject" file feels like a dirty hack to me and not sustainable long term. I am going to create a new thread question where I try to solve it using a different approach by creating an STM32 project and trying to change it from a Managed CDT project nature to an unmanaged Makefile project nature.

Regards,

Pieter

P.S. If someone finds this question and found an elegant solution, please post here.

Ethan HUANG
ST Employee

Hi Pieter,

Here is how I dealt with Makefile project for your reference:

https://github.com/ethanhuanginst/STM32CubeIDE-Workshop-2019/tree/master/hands-on/02_stm32_hp141_lcd

NOTE: This was tested over STM32CubeIDE v.1,0.0 and not tested over the latest v1.0.1.

Pieter Conradie
Associate III

Hi Ethan,

Your answer is perfect, thanks :) FYI, I got to a similar solution and posted it here:

https://community.st.com/s/question/0D50X0000B43qejSQA/how-do-i-change-an-stm32-project-to-a-non-managed-makefile-mcu-project

Best regards,

Pieter

https://piconomix.com