cancel
Showing results for 
Search instead for 
Did you mean: 

STM32CubeMX does not generate a project that can be compiled with TrueStudio

Henry Senanian
Associate
Posted on February 19, 2018 at 18:15

Generating a project from CubeMX with TrueStudio selected in Project Settings, the generated project fails to compile. The links to HAL drivers aren't there and the same is true for any third party drivers like lwip/freeRTOS.

To reproduce:

1. Generate project for TrueStudio.

2. Import project into workspace.

3. Compile.

Versions:

STM32CubeMX v4.24.0

Atollic TrueStudio 9.0

#atollic #truestudio #code-generation #stm32cubemx #generator #bug
5 REPLIES 5
Ramazan Gülcan
Associate III
Posted on February 20, 2018 at 09:32

Hi,

I've tested it for a simple application, and the compilation was successful.

There may be another problem.

0690X00000609iHQAQ.png
Khouloud GARSI
Lead II
Posted on February 20, 2018 at 13:03

Hi

hsenani

‌,

I tried to reproduce your issue, but the compilation was done successfully and the needed third party files were generated under 'Middlewares\Third_Party' folder.

For further investigation, you may share you 'ioc' file.

Khouloud.

Hrvoje Brezak
Associate II
Posted on February 20, 2018 at 14:41

Hi all,

I have ran into what I believe is the same issue. Also, found the source and solution (albeit temporary).

Previously, I have been using Atollic Lite with CubeMX without issues. I have created projects and tracked them using git. I switched to Atollic TrueSTUDIO for STM32 9.0.0 version as soon as it was released and experienced no issues.

However, recently I have updated my STM32CubeMX to version 4.24.0 and also updated firmware package I use to STM32Cube FW_F4 V1.19.0. It seems that creating new projects with these updated versions causes no issues ( to me at least).

Today I opened one of my older projects in Cube. Cube asked me if I wanted to migrate to newer firmware version and I selected yes. I re-generated the project files and got the same behavior as described by first poster above. There is a bunch of 'undefined reference' errors related to basic HAL drivers and also third party libraries that look like this:

/home/hrvoje/projects/mastering_freeRTOS/Debug/../Src/gpio.c:120: undefined reference to `HAL_GPIO_Init'

/home/hrvoje/projects/mastering_freeRTOS/Debug/../Src/freertos.c:101: undefined reference to `osThreadCreate'

(keep in mind this code worked just moments before re-generating files in Cube, therefore libraries were properly included before. I have re-checked all compiler and linker settings, as well as most if not all of build configuration settings and they have not changed)

Using git tools I have tracked the cause of the errors down. Updated version of CubeMX changes several files during migrating and re-generating files. Among them is .project. The following is added to .project:

<linkedResources>

<link>

<name>Middlewares/FreeRTOS</name>

<type>2</type>

<locationURI>virtual:/virtual</locationURI>

</link>

<link>

<name>Drivers</name>

<type>2</type>

<locationURI>virtual:/virtual</locationURI>

</link>

<link>

<name>Drivers/CMSIS</name>

<type>2</type>

<locationURI>virtual:/virtual</locationURI>

</link>

<link>

<name>Application</name>

<type>2</type>

<locationURI>virtual:/virtual</locationURI>

</link>

<link>

<name>Middlewares</name>

<type>2</type>

<locationURI>virtual:/virtual</locationURI>

</link>

</linkedResources>

Removing this code (which is added into .project by CubeMX in one single line) fixes the compilation error.

Using git I was able to check out older versions of each file CubeMX has changed and tested them one by one. Once code quoted above is removed from .project, compiler works without issues.

EDIT: I have just tried the same procedure - re-generating the same project with CubeMX - but this time I chose not to migrate the project but continue using older firmware for STM32F4. Again Cube added the quoted code above to .project and compilation failed. Removing those lines - compilation works!

Therefore it would seem that source of this bug is in updated CubeMX itself, not in the firmware.

Posted on February 20, 2018 at 17:41

Hey

garsi.khouloud

,

Thanks for the response. I am thinking that possibly my issues lies in the way I open the project. I generate the project and then I import the project into my workspace using File -> Import in Truestudio. Is this the wrong way to do so?

I have also uploaded the *.ioc file

https://1drv.ms/u/s!AjdmK-KWufftlNxh2VPh85uGbhjrOw

.

EDIT: There is a pretty easy work-around. All I do is delete the virtual folder for Third Party Middlewares (FreeRTOS, LWIP) and add it back in as a linked folder and it complies ok. For HAL driver files, they seem to missing entirely so I just add a linked folder to the HAL driver folder.

EDIT2: To clarify, the HAL driver files are only missing from the project but they do exist in the project directory.

Nawres GHARBI
ST Employee
Posted on May 21, 2018 at 15:51

Hi, 

Please test with the 4.25.1, there was an issue with MW in the 4.24.0