This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

STM32: Using the ST Standard Peripheral Library with Keil

There has been a great deal of grief discussed in a great many threads on both this and the ST forum about problems due to trying to use code written for one version of the ST Standard Peripheral Library with a different version. I have also suffered this myself.

Therefore, I thought it might be a good idea to pull this out into a separate thread, for easy reference.

Most of this post originally appeared in this thread: http://www.keil.com/forum/19587/
Other examples:
http://www.keil.com/forum/19540/
http://www.keil.com/forum/docs/thread19482.asp

The ST Standard Peripheral Library provides a set of functions for handling the peripherals on the STM32 Cortex-M3 family. The idea is to save the user (the new user, in particular) having to deal directly with the registers.

This is now a common practice among Cortex-M3 manufacturers (and others).

Keil include a version of the ST Standard Peripheral Library with both source & pre-built library as a standard part of the ARM toolset:

Source: Keil\ARM\Examples\ST\STM32F10xFWLib

Library: Keil\ARM\RVxx\LIB\ST

However, note that this is almost certainly not the latest version;
therefore it will not work with current examples on the ST site - or any other code written with any other library version.

AFAIK, ST only provide their "library" as source - not as a true, ready-built Library.

Therefore, my recommendation is that you include the necessary source files from the appropriate "library" version in your Project, and build them as part of the project.

If you wish, you could make a separate Group for the ST files:
www.keil.com/.../uv4_ca_create_file_groups.htm

This also has the advantage of giving you source-level debugging in the "library" functions.

To avoid any risk of confusion, I would delete the ready-built Library & sources from the Keil installation.