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
  • "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
    

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

Children