cancel
Showing results for 
Search instead for 
Did you mean: 

Why are there no linker-settings in the static-lib project

OBorg.1
Associate III

If I create a STM32 static-lib project there are no linker settings available.

Why?

Please refer the attached image.

1 ACCEPTED SOLUTION

Accepted Solutions
mattias norlander
ST Employee

Hi,

A "static library" project is just a collection of object-files in a zip-file.

The C Linker is therefore not involved in the build process at all.

Normally the build process for a static library includes only the:

  1. C Pre-processor to expand all C macros / includes (tool: arm-none-eabi-cpp.exe)
  2. C Compiler - build each compilation unit (compilation unit = .c-file into .o-file) (tool: arm-none-eabi-gcc.exe)
  3. Archiver - create a .a-file (.a-file = archive) containing all object-files (tool: arm-none-eabi-ar.exe)

The object-files contains the instructions for each function that is built by the library project.

Careful the .o-file is in binary format you will need to use "objdump" to translate back to assembler...

The purpose is to allow customers to build static libraries to be shared across projects or MCUs...

But - I would not use that project type in the screenshot at all. It is a legacy project. Instead refer to the UM2609 as advised by @KDJEM.1​ and use the approach shown in the chapter mentioned. That project type has the ability to set the "mcpu=cortex-m?" flag per build configuration which truly enables sharing code in libraries cross products/projects.

View solution in original post

4 REPLIES 4
KDJEM.1
ST Employee

H @OBorg.1​,

When create the STM32 static library project, please make sure to follow properly the steps as described in the User Manual UM2609 available on our Website and precisely Section 2.2.2 Creating a new STM32 static library project.

When your question is answered, please close this topic by choosing Select as Best. This will help other users find that answer faster.

Thank you

Kaouthar

To give better visibility on the answered topics, please click on Accept as Solution on the reply which solved your issue or answered your question.

OBorg.1
Associate III

0693W00000UoAn9QAF.jpgOk-good hint, thx for the quick answer.

But I am still wondering about the purpose of the static-lib option in the STM32 project wizard (please refer to the attached image).

If the flow in the user manual is recommended... what is the purpose of the wizard's option?

mattias norlander
ST Employee

Hi,

A "static library" project is just a collection of object-files in a zip-file.

The C Linker is therefore not involved in the build process at all.

Normally the build process for a static library includes only the:

  1. C Pre-processor to expand all C macros / includes (tool: arm-none-eabi-cpp.exe)
  2. C Compiler - build each compilation unit (compilation unit = .c-file into .o-file) (tool: arm-none-eabi-gcc.exe)
  3. Archiver - create a .a-file (.a-file = archive) containing all object-files (tool: arm-none-eabi-ar.exe)

The object-files contains the instructions for each function that is built by the library project.

Careful the .o-file is in binary format you will need to use "objdump" to translate back to assembler...

The purpose is to allow customers to build static libraries to be shared across projects or MCUs...

But - I would not use that project type in the screenshot at all. It is a legacy project. Instead refer to the UM2609 as advised by @KDJEM.1​ and use the approach shown in the chapter mentioned. That project type has the ability to set the "mcpu=cortex-m?" flag per build configuration which truly enables sharing code in libraries cross products/projects.

OBorg.1
Associate III

Hi,

Thx for the great support, I will follow your suggestions. 👍