cancel
Showing results for 
Search instead for 
Did you mean: 

How to add new folders and get them compiled in CubeIDE?

dchen
Associate II

Hi,

I am trying to add new folders in CubeIDE and get them compiled.

Taking STM32CubeU5 as an example.

I imported a GPIO example, under the file tree, it will show:

--include

--Application

--Startup

--User

--Drivers

--BSP

--CMSIS

--STM32U5xx_HAL_Driver

Now, what I want to do is to change the folders under Application folder:

--Application

--api

--inc

--src

--test

--inc

--src (contains main.c)

In order to make this structure work, how do I modify the project settings?

Thank you for the help

1 ACCEPTED SOLUTION

Accepted Solutions
HCohe.1
Associate III

Your Makefile will need to include compiler options to include debugging information in the .o and .elf files and will also want to disable or reduce compiler optimizations. Here's a snippet that I used:

# debug build?
DEBUG ?= yes
# optimization
ifeq ($(DEBUG),yes)
OPT = -O0 -ggdb3 -gdwarf
else
OPT = -Os
endif

View solution in original post

4 REPLIES 4
dchen
Associate II

Also I have a working project, and would like to import it into CubeIDE by the option"Existing Code as Makefile Project". How do I configure it so that I can use ST-Link for debugging?

Please see the CubeIDE User manual (UM2609) ch. 3.8. This will create new makefile-based Eclipse project and let you debug the executable produced by your makefile.

HCohe.1
Associate III

Your Makefile will need to include compiler options to include debugging information in the .o and .elf files and will also want to disable or reduce compiler optimizations. Here's a snippet that I used:

# debug build?
DEBUG ?= yes
# optimization
ifeq ($(DEBUG),yes)
OPT = -O0 -ggdb3 -gdwarf
else
OPT = -Os
endif

JMala.3
Associate III

The easy method is to add the folders outside the IDE, and once you have the structure you want, just right click on the project in project explorer, select refresh and the newly added files will be added to your project