cancel
Showing results for 
Search instead for 
Did you mean: 

ST-Libs, CMSIS, newlib - advice requested

mail239955
Associate II
Posted on June 25, 2014 at 12:14

Hi,

I am trying to understand the differences between the different libs for the stm32F4xx development.

As newbie its not easy to get the overview.

Here are the terms I want to understand:

1) CMSIS:

Standardization lib for general arm-development independent from ST. Used for manufacturer independent development. Lowest lib-hierarchy layer. Correct ?

2)Standard peripheral lib:

''old'' library from ST for stm32 development, reference to CMSIS. One lib-hierachy level above CMSIS.

Used by the most tutorials found in the web. Correct ?

3)STM32Cube:

''new'' library from ST for stm32 development, references to CMSIS. One lib-hierachy level above CMSIS.

Replaces the ''standard peripheral lib'' and is recommended for new designs. Correct ?

4)Examples using ''standard peripheral lib''

Examples using the ''old'' lib cannot be run with the ''stm32Cube'' libs out-of-the-box. Examples need to be modified using the ''stm32Cube'' functions. Correct ?

5)Eclipse GNU-ARM-Plugin

The actual Eclipse-GNU-ARM-Plugin comes with ''stm32Cube'' and not with ''standard peripheral lib''. So ''old - std-periph-lib''  examples will not run out of the box. Correct ?

6)newlib

What is newlib ?

When using the GNU-ARM-Plugin templates in eclipse for e.g. STM32F429, there are functions called _start(), __initialize_hardware() etc....  The documentaiton says, this is part of ''newlib''.

How is this ''newlib'' related to ''stm32cube'' or the ''standard peripheral lib'' lib ?

2 REPLIES 2
rigomate2
Associate II
Posted on June 26, 2014 at 15:22

1: Correct

2: Correct

3: Correct

4: Correct

5: I am not aware of that, I am pretty sure I use the latest version of it, and it generates the project with the legacy standard peripheral lib.

6: Briefly said: the GCC compiler and the GCC standard lib requires some functions, that would not exist on a bare cpu, without running a full blown OS. Say linux for example.

Because of this some standard C functions would not work, and to keep maintenance simple, these so called stubs have been made, which are found in the newlib c library.

These are usually things like __exit() (maybe not exactly, but something like this) which is called after a program exists the running state on linux. Of course there is no program termination in an embedded system, but still it needs to exist, as the toolchain would throw errors, as it can't link it/find it.

So newlib is a little hack that makes the GCC's standard C library work on bare metal.

mail239955
Associate II
Posted on June 26, 2014 at 21:46

Great, thanks!

This gives me confidence I understood the thing correctly !

I also have an idea now, why newlib and its ''stubs'' are necessary.

Thanks again !