cancel
Showing results for 
Search instead for 
Did you mean: 

Add my own library project to STMCubeIDE

FMarr.2
Associate III

Hi,

I started from scratch and successfully created STM3232H7B3I-DK project as in Workshop2020.

Now i added a project library, it compiles and produces .a file but i have this message:

libModuleA.a: file not recognized: File format not recognized.

I suppose I have to setup the correct toolchain but i do not know how.

The current toolchain is Cross GCC CDT internal builder.

Many thanks if someone can help.

Regards

1 ACCEPTED SOLUTION

Accepted Solutions
EJOHA
Senior

The Project properties "C/C++ Build">"Settings"> contains a "Tool Settings" tab. Here the "MCU Settings" node contains configuration of the Floating point ABI.

The easiest way to create a library project and get it work is to crate this as a new STM32 project using "File">"New">"STM32 Project". Select "Static library" instead of "Executable" binary type.

View solution in original post

9 REPLIES 9
EJOHA
Senior

Hi FMarr.2,

Did you try to follow the guide in STM32CubeIDE User Guide on how to include libraries in projects?

See chapter 2.5.8

Instead of using "libModuleA.a" as the name in "C Linker">"Libraries" please only use "ModuleA"

FMarr.2
Associate III

Hi,

Thanks for reply.

Sorry I probably did not explain myself correctly.

I want to add a library Project to my workspace.

The only way i found to compile it is to choose GCC CDT internal builder. Incuding g++ in the path.

It produces the file, the file libModuleA is found but not recognize as a library file.

The g++ i found in C:\TouchGFX\4.13.0\env\MinGW\bin\g++.exe

I modified the output exetension from .so to .a . Can I ??

I attach the Library project if you want

Thanks very much

FMarr.2
Associate III

Update:

Instead of creating a shared library, i create a static library (it is not what i want, just try)

there i can select MCU ARM GCC, in the build artifacts estention modified to a.

Build. OK.

Link fails with this message

error: STM32H7B3I-DK-1.1.08.elf uses VFP register arguments, C:\Progetti\STM_ModuleB\Debug\libModuleB.a(CMachine.o) does not.

Am i moving in the right direction?

FMarr.2
Associate III

Update

It seems i am not settings the correct MCU settings like -mfloat-abi=hard.

But i do not know how to do.

EJOHA
Senior

The Project properties "C/C++ Build">"Settings"> contains a "Tool Settings" tab. Here the "MCU Settings" node contains configuration of the Floating point ABI.

The easiest way to create a library project and get it work is to crate this as a new STM32 project using "File">"New">"STM32 Project". Select "Static library" instead of "Executable" binary type.

FMarr.2
Associate III

Yes, it is what i am doing as i wrote previously. But the combo box where select Floating-point unit is empty.

and there is this error to solve

error: STM32H7B3I-DK-1.1.08.elf uses VFP register arguments, C:\Progetti\STM_ModuleB\Debug\libModuleB.a(CMachine.o) does not.

EJOHA
Senior

I assume the empty combo box is when you open properties for the library project. There might be a problem to do this if the library project was created as a "C/C++ project" instead of a STM32 library project.

Did you try to open the settings and make the change in the executable project?

If it does not work please try to create a STM32 library project and insert your library files into this.

FMarr.2
Associate III

It works, thanks

EJOHA
Senior

Good to hear!