cancel
Showing results for 
Search instead for 
Did you mean: 

STM32CubeIDE: using linked folders.

mreed
Associate III
  • * This should be in MCU, Sorry * * 🤔

I'm trying to use a linked folder. We have several software bases that we want to use the same includes (they are all on the same hardware). On AC6 I did this by creating a linked folder. The folder only existed in 1 of the projects but was accessed by all projects.

In STM32CubeIDE I can create the link without issue, and the editor uses the link to locate and display files. But the makefile ignores it. So all the makes fail. I could hand-modify the makefile, but since it's generated I don't want to do that. I could also add an include in the tool settings of the 'C Build' properties.

What do you suggest? :man:

1 ACCEPTED SOLUTION

Accepted Solutions
mreed
Associate III

Think I figured it out.

The compile errors displayed in the editor are misleading.

When I looked through the compiler output I found that the include file was failing, because it was missing an include.

The directories were not identical, the original HAL libraries had been modified to make the includes work. When I replaced them with a less altered version of the HAL library the missing includes caused compiles to fail.

The editor would indicate that there were issues in the source file, but the issues were in the include.

View solution in original post

7 REPLIES 7
mreed
Associate III

Adding the includes to the 'C/C++ Build' did not help. They are now listed there, but the makefile is unchanged. Does not make sense 🤔

TDK
Guru

> So all the makes fail.

What is the error message? If it fails due to includes not found, you need to add those to the include path. If it fails due to missing compilation blocks, you need to add those to the source folders.

Linked directories/files should work. AC6/SW4STM32 and CubeIDE (and many others) use the same underlying Eclipse framework.

If you feel a post has answered your question, please click "Accept as Solution".
mreed
Associate III

It fails due to missing includes, kind of. It seems to find the include file, but none of the structures in the includes are defined. I have added the linked folder to the include path. In the editor it finds the missing include files, macros, structures with no problem. But when the builds it's always the same,

error: unknown type name 'HAL_StatusTypeDef'

I've added #ifdefs to see if the file is included, it is. But the structures are not defined.

Pavel A.
Evangelist III

Which makefile?

Both AC6 and CubeIDE are Eclipse CDT, CubeIDE is newer (CDT v 10.2)

If you use managed "external" builder, the makefiles are artifact of the builder, they are automatically generated when the project is refreshed. With "internal" builder, there's no any makefiles visible at all.

But if you've created the project as unmanaged makefile, then this makefile is your responsibility.

Do not let Cube clobber it when it re-generates its stuff.

TDK
Guru

> error: unknown type name 'HAL_StatusTypeDef'

Seems like you're just missing the correct include prior to using this definition. If it was a problem with finding the include files, the error message would say so.

Should #include "stm32f4xx.h" at the top of your file, or similar for your family.

If you feel a post has answered your question, please click "Accept as Solution".
mreed
Associate III

Before the include directory was linked, the builds worked without issue. The directories are the same.

I'm trying to take a project that had the HAL libraries included in the project and I replaced the HAL libraries with a link to the same HAL libraries but now they are in a different project.

I've done this before on a different project, using the AC6 platform. On the AC6 platform I just added the HAL folder as a link in a different project. I never had any issues. So I've been asked to do the same to this project. But now, using STM32CubeIDE it doesn't work.

But, after posting I realized that it's not just not including the .h file. It does include the file, because all the Macros work. But for some reason none of the structures work. That's just weird.

mreed
Associate III

Think I figured it out.

The compile errors displayed in the editor are misleading.

When I looked through the compiler output I found that the include file was failing, because it was missing an include.

The directories were not identical, the original HAL libraries had been modified to make the includes work. When I replaced them with a less altered version of the HAL library the missing includes caused compiles to fail.

The editor would indicate that there were issues in the source file, but the issues were in the include.