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 :-)
OK, so thanks to a few pointers, I am down to 2 linker errors... :-)
linking... LD3070-100.axf: Error: L6218E: Undefined symbol FLASH_ErasePage (referred from eeprom.o). LD3070-100.axf: Error: L6218E: Undefined symbol FLASH_ProgramHalfWord (referred from eeprom.o). Target not created
in stm32f10x_flash.h which I have included in the ST eeprom.c file, I have on line 310
FLASH_Status FLASH_ErasePage(uint32_t Page_Address);
on line 313
FLASH_Status FLASH_ProgramWord(uint32_t Address, uint32_t Data);
Any idea why the linker doesn't find these? it finds the rest!
hopefully I have given enough info this time :-)
the linker does not look for func():, it looks fr func(){
Erik
But do you have an _implementation_ of these functions in your project? The error suggests that you do not. Maybe you forgot to add a source file...?
Because they are just declarations (prototypes); the Linker needs the actual Definitions - either from a Library, or from sources that are built as part of your project.
This is standard 'C' stuff!
c-faq.com/.../decldef.html
That should be a semicolon - not a colon!
ie,
"the linker does not look for func(); - it looks for func(){...}"
And, to be pendantic, the linker doesn't look for source files at all; it looks only at the resulting object files - the compiler's output from those sources.
OK, calm down, so I didnt explain very well.......again
On line 208 in stm32f10x_flash.c is the function:
FLASH_Status FLASH_ErasePage(uint32_t Page_Address) { FLASH_Status status = FLASH_COMPLETE; /* Check the parameters */ assert_param(IS_FLASH_ADDRESS(Page_Address)); /* Wait for last operation to be completed */ status = FLASH_WaitForLastOperation(EraseTimeout); if(status == FLASH_COMPLETE) { /* if the previous operation is completed, proceed to erase the page */ FLASH->CR|= CR_PER_Set; FLASH->AR = Page_Address; FLASH->CR|= CR_STRT_Set; /* Wait for last operation to be completed */ status = FLASH_WaitForLastOperation(EraseTimeout); if(status != FLASH_TIMEOUT) { /* if the erase operation is completed, disable the PER Bit */ FLASH->CR &= CR_PER_Reset; } } /* Return the Erase Status */ return status; }
so they are in the header files, and in the .c file. Yes its basic c stuff, but whats there is correct, its me not explaining properly (again), but I am trying!!
but they are not found, any ideas?
... that FLASH_Status FLASH_ErasePage(uint32_t Page_Address) is not included because of the blasted "universality ifs"
a simple test would be FLASH_Status FLASH_ErasePage(uint32_t Page_Address) { $#!^ it's not included
this would give you a compile error if the function is not 'iffed out' (assuming that the module is included, other means will tell you that).
stm32f10x_flash.c is part of the ST Standard Peripheral Library.
IF you've downloaded the EEPROM Emulation example from the ST site, it will be using the latest version of the ST Standard Peripheral Library. As previously noted, that is likely to be not the same as the version of the ST Standard Peripheral Library included with your Keil installation - therefore, it will not work with that!
If you want to use examples from the ST site, then you really should also use the the ST Standard Peripheral Library from the ST site - this is exactly the kind of grief that you will get if you try to mix "new" ST examples with "old(er)" ST libraries.
Been there, done that!
"the blasted 'universality ifs'"
ST fundamentally changed the library organisation; so the 'universality ifs' (among other things) are entirely different - therefore anything written for one version is doomed to failure with the other.
There is a superficial look of similarity - which leads to the false expectation that it could be made to work.
I wasted a couple of days on this last summer; my conclusion: just don't do it!
Either stick completely to the latest stuff (Library & examples) downloaded from the ST site;
Or stick completely to the (older) stuff included with the Keil installation.
Don't try to mix-and-match.
Happy days lol, if I have to convert my application to the latest ST libraries, how do I ensure I'm using the correct ones? I.e. What version number or file naming should I be looking for to ensure they are at least the later release?
Thanks :-)
ST put their version number in the file header comment:
/** ****************************************************************************** * @file stm32f10x_adc.c * @author MCD Application Team * @version V3.1.0 * @date 06/19/2009 * @brief This file provides all the ADC firmware functions. ****************************************************************************** * @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> */
* @file EEPROM_Emulation/src/eeprom.c * @author MCD Application Team * @version V3.1.0 * @date 07/27/2009 * @brief This file provides all the EEPROM emulation firmware functions.
****************************************************************************** * @file EEPROM_Emulation/src/main.c * @author MCD Application Team * @version V3.1.0 * @date 07/27/2009 * @brief Main program body ******************************************************************************
What version number do the 'newer' ones start at? is it 2.0? 3.0 etc, just so I have some idea what I am looking for.
Thanks.
Just make sure that whatever version the sample is, you use the same version of Library.
hmmmmm, well so far I have the following:
stm32f10x.h version 3.4.0 dated 10/15/2010 system_stm32f10x.h version 3.4.0 dated 10/15/2010 etc
but for some reason I have core_cm3.h dated V2.01 but it is dated 6 December 2010, in fact all of the other 'core' files are dated the same
I think my problem is my STM32_Init.c file which includes stm32f10x_lib.h, all the additional files seem to be version 2.0.1 :-)
Where can I get the latest version of the STM32_init.c from? as it doesn't seem to be part of the ST library?
Perhaps it's time to get "someone" to come in and sit down with you, and work through this in person...?
maybe you are right, I'll give our ST FAE a call - thanks for the suggestion :-)