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.
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!