Hi All
Before I start, a quick note as to why I am trying to do this - I have tried using the standard STM libs and definitions, but found them to be not as well written and easy to follow as the ones supplied by Keil, the same applies to the examples, so i have a working project, written around the Keil definitions etc, which I now need to add EEPROM emulation or Flash storage of a few variables. What I dont want to have to do is convert the whole project over to ST, just because I cant figure out how to add this!
I have included the ST eeprom.c but get a few errors, some of the functions it calls are not found, but I guess I can locate these in the ST Lib files. However what I cant find are PAGE_SIZE (which I cant even 'find in files' in the ST demo, which does compile) so i am very confused and not sure best which way to turn.
My warnings and errors are as follows:
eeprom.c(63): error: #20: identifier "PAGE_SIZE" is undefined eeprom.c(72): warning: #223-D: function "FLASH_ErasePage" declared implicitly eeprom.c(82): warning: #223-D: function "FLASH_ErasePage" declared implicitly eeprom.c(89): warning: #223-D: function "FLASH_ProgramHalfWord" declared implicitly eeprom.c(136): warning: #223-D: function "FLASH_ProgramHalfWord" declared implicitly eeprom.c(143): warning: #223-D: function "FLASH_ErasePage" declared implicitly eeprom.c(153): warning: #223-D: function "FLASH_ErasePage" declared implicitly eeprom.c(160): warning: #223-D: function "FLASH_ProgramHalfWord" declared implicitly eeprom.c(193): warning: #223-D: function "FLASH_ErasePage" declared implicitly eeprom.c(227): warning: #223-D: function "FLASH_ProgramHalfWord" declared implicitly eeprom.c(234): warning: #223-D: function "FLASH_ErasePage" declared implicitly eeprom.c(283): error: #20: identifier "PAGE_SIZE" is undefined eeprom.c(355): warning: #223-D: function "FLASH_ErasePage" declared implicitly eeprom.c(355): warning: #188-D: enumerated type mixed with another type eeprom.c(364): warning: #223-D: function "FLASH_ProgramHalfWord" declared implicitly eeprom.c(364): warning: #188-D: enumerated type mixed with another type eeprom.c(373): error: #20: identifier "PAGE_SIZE" is undefined eeprom.c(373): warning: #188-D: enumerated type mixed with another type eeprom.c(396): error: #20: identifier "PAGE_SIZE" is undefined eeprom.c(476): error: #20: identifier "PAGE_SIZE" is undefined eeprom.c(488): warning: #223-D: function "FLASH_ProgramHalfWord" declared implicitly eeprom.c(488): warning: #188-D: enumerated type mixed with another type eeprom.c(495): warning: #188-D: enumerated type mixed with another type eeprom.c(537): error: #20: identifier "PAGE_SIZE" is undefined eeprom.c(542): error: #20: identifier "PAGE_SIZE" is undefined eeprom.c(553): warning: #223-D: function "FLASH_ProgramHalfWord" declared implicitly eeprom.c(553): warning: #188-D: enumerated type mixed with another type eeprom.c(590): warning: #223-D: function "FLASH_ErasePage" declared implicitly eeprom.c(590): warning: #188-D: enumerated type mixed with another type eeprom.c(598): warning: #188-D: enumerated type mixed with another type
which isn't so bad as its essentially the same few many times, its as I add more ST demo code that I have problems.
Any help or suggestions would be very much appreciated, please try to refrain from the pointed "isn't it obvious" style answers, I am new to ARM, and the reason I ask is because I am stuck and need some help - I hope to reciprocate in the near future :-)
What, exactly, do you mean by that?
I thought Keil just supplied ST's Standard Peripheral Library?
"PAGE_SIZE (which I cant even 'find in files' in the ST demo, which does compile)"
Is it defined in the Project properties?
"I am new to ARM"
Do you have experience with other embedded microcontrollers?
I have used many 8 bit micros 6809, 8051, 6502 etc in assembler and C, just not arm
Its not set in the project options, or anywhere else in the project, hence my confusion, I presume that maybe the linker generated it from a macro, but I cannot find a reference to it.
I forgot to say, the libs you get from Keil do appear to be very different from the ones you can download from the ST website, these are generally based around the open source compilers.
Again, what "libs", exactly, are you referring to?
They are Compiler errors - so it must be somewhere in either a source file (.c or .h) or on the compiler's command line (eg, from the Project settings).
The ST libraries provided by Keil are outdated.
the ones you can download from the ST website, these are generally based around the open source compilers. not really, they are "compiler independent" (Keil, IAR, Raisonance, ....).
Erik
Indeed.
Two things to note here:
1. They are ST libraries - not Keil Libraries;
2. ST significantly changed the way they organised their library - so examples designed for use with the "current" Library (as found on the ST site) will not work with the "old" library (as redistributed by Keil).
So, if these are the "libs" that the OP is referring to, then he is onto a loser trying to mix them with "current" examples from the ST site.
my.st.com/.../DispForm.aspx
"which I cant even 'find in files' in the ST demo, which does compile"
By "the ST demo", do you mean www.st.com/.../an2594.zip ?
That defines PAGE_SIZE in eeprom.h:
/** ****************************************************************************** * @file EEPROM_Emulation/inc/eeprom.h * @author MCD Application Team * @version V3.1.0 * @date 07/27/2009 * @brief This file contains all the functions prototypes for the EEPROM * emulation firmware library. ****************************************************************************** * @copy * * THE PRESENT FIRMWARE WHICH IS FOR GUIDANCE ONLY AIMS AT PROVIDING CUSTOMERS * WITH CODING INFORMATION REGARDING THEIR PRODUCTS IN ORDER FOR THEM TO SAVE * TIME. AS A RESULT, STMICROELECTRONICS SHALL NOT BE HELD LIABLE FOR ANY * DIRECT, INDIRECT OR CONSEQUENTIAL DAMAGES WITH RESPECT TO ANY CLAIMS ARISING * FROM THE CONTENT OF SUCH FIRMWARE AND/OR THE USE MADE BY CUSTOMERS OF THE * CODING INFORMATION CONTAINED HEREIN IN CONNECTION WITH THEIR PRODUCTS. * * <h2><center>© COPYRIGHT 2009 STMicroelectronics</center></h2> */ /* Define to prevent recursive inclusion -------------------------------------*/ #ifndef __EEPROM_H #define __EEPROM_H /* Includes ------------------------------------------------------------------*/ #include "stm32f10x.h" /* Exported constants --------------------------------------------------------*/ /* Define the STM32F10Xxx Flash page size depending on the used STM32 device */ #if defined (STM32F10X_LD) || defined (STM32F10X_MD) #define PAGE_SIZE (uint16_t)0x400 /* Page size = 1KByte */ #elif defined (STM32F10X_HD) || defined (STM32F10X_CL) #define PAGE_SIZE (uint16_t)0x800 /* Page size = 2KByte */ #endif
OK, fair cop.... however, in my defence:
in eeprom.c, we have
#include "eeprom.h"
so why do I get the error if the .h is included?
Secondly, I did use the uvision 'find in files' to search for it, and it wasn't found in anything but output files.
Sorry for not having found it on my own, sometimes we all need a little help with something very stupid, which is staring us in the face....
I didn't realise about the ST libraries though (I won't call them 'libs' ever again... knuckles slapped far too many times in this thread for that one!), but as I said at the start, I'm new to ARM, new to Keil, so its very easy to get waylayed.
Thanks for all the pointers though (no pun intended), I've learned quite a bit from this thread (mainly, think long and hard before posting to the Keil forum, pedantry is alive and well).
Note that those definitions of PAGE_SIZE are buried within #if clauses - so, if you haven't defined the correct symbol(s) to satisfy those #if conditions, PAGE_SIZE will not be defined.
I agree with you that ST's code leaves a lot to be desired - see rant here: www.8052.com/.../174319
In this particular case, it would have been better to have had a "none of the above" clause - to catch this situation where the correct symbol(s) are missing; eg,
#if defined TOM // 'TOM' is defined - configure appopriately #elif defined *** // '***' is defined - configure appopriately #elif defined HARRY // 'HARRY' is defined - configure appopriately #else // None of the above - give an error to alert the user #error One of TOM or *** or HARRY must be defined! #endif
"I did use the uvision 'find in files' to search"
The uVision 'find in files' is a bit lame, IMO.
:-(
"I won't call them 'libs' ever again"
Calling them "libs" wasn't the problem - it was knowing exactly what you were referring to.
It just does a folder search - there is no "search all files in project" option.
"as I said at the start, I'm new to ARM, new to Keil"
You didn't mention being new to Keil. But this stuff is not specific to ARM or Keil - it's pretty general 'C' stuff.
"think long and hard before posting to the Keil forum, pedantry is alive and well"
Not just the Keil forum! You need to remember that nobody knows anything about you or your project other than what you clearly and explicitly explain in your posts.
Anyhow, Good luck with you new ARM experience...
again, very valid points!
The ST rant really does say it all, much of what I have had to write is identical to any other micro, or PC code to that matter, as soon as you talk to hardware it all falls over.
I am the sole engineer here (and a hardware engineer at that), I taught myself C back in the late 1980's having written in assembler for many years prior to that, so my 'terminology' is not always correct, as I have no reason to explain what I do except in situations like this :-) So thanks for the help, I will try to ask better in future.
So far I am very impressed with the ST32f103, a bit of hair pulling, but I have SPI, USB, USART etc all working well, I only have this and the ADC to get to grips with.
Thanks :-)
ps why does my flag show as American? As ARM are very local to me here, and they own Keil, why do we not have a Union Jack?
ps why does my flag show as American? ,/i>
The good old captain will not like to hear this, but if things go on the way they do, soon you will have a standard Chinese flag instead...
That forum feature has never worked!
"I am the sole engineer here (and a hardware engineer at that)"
Have you checked the Consultants Database...?
http://www.keil.com/condb/consultant.asp?id=1027
;-)
so, if you haven't defined the correct symbol(s) to satisfy those #if conditions ST has tried to make code that can handle any compiler, any ST chip, any clock and any .... thus it is extremely messy. One example: I have had to modify the ST code since the possible combination of #ifs could not be set to the processor and clock that was used.
In this particular case, it would have been better to have had a "none of the above" clause - to catch this situation where the correct symbol(s) are missing
that should be SOP anywhere.