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 EEPROM Emulation conversion to Keil

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 :-)

Parents
  • 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!

Reply
  • 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!

Children
  • 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 :-)

  • job done, all sorted on my own :-)

    note to self, always delete old library files..... then they cannot be included in error!