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.
If you wish, you could make a separate Group for the ST files:
in the 3 large professional cases have been involved with (coming in "after the fact") it was done that way.
thus it seem that the most experienced users do so. I definitely would.
Erik
Including the sources makes source-level debugging work.
Including the sources, makes sure the source code repository is complete - no sudden oops 5 years later when the project have been using a precompiled library and a compiler change made that library unusable.
Including the sources speeds up any bug fix needed - library code isn't spared from bugs.
Including the sources means there will be source repository tags in the library code too, allowing a diff command to see all changes between to application versions - including the updates to the library.
Locking library source to application source means that the application doesn't need a full retesting if there is a library update. Unless there is a known problem, the application can continue using an older version of the library code.
Must be more advantages too.
The only real disadvantage is that when a new library is received, the changes must be distributed to all projects using the library - but that can be done first when a new version needs to be produced.
The ST documentation is, well, not always that great. I have had cases where I needed to be able to step into ST library functions to see what was really going on...
I've just downloaded the latest Eval (MDK v4.22) to check:
The supplied ST Library is v2.0.1, dated 2008 - so that is very long out-of-date indeed!!
Sounds like someone at Keil should be taken by the ear, then.
Releasing the compiler with a library from 2008, that differs a lot from the current, costs Keil's customers huge amount of money and time.
Most probably, Keil uses the old library to avoid having to update their examples. Instead, every customer has to do that work. Again. And again. And again.
"Sounds like someone at Keil should be taken by the ear, then."
Indeed!
"...costs Keil's customers huge amount of money and time"
As can be seen from the posts both here & on the ST forum.
It also hurts ST's customers - at least one recently said he was abandoning the STM32 because of this!
"Most probably, Keil uses the old library to avoid having to update their examples"
I don't think Keil's own examples use the library...?
<quote>at least one recently said he was abandoning the STM32 because of this!<\quote>
no staminer?
always yo're freind.
Zeusti.
Yes, I think so.
Perhaps it's a cunning ploy to weed-out the lightweights who are just going to be a burden on support...?
But I think it backfires in just generating a load of unnecessary work for support!
That is, in fact, exactly what the Template project provided by ST does!
View all questions in Keil forum