2024-04-30 02:02 PM - last edited on 2024-05-13 01:12 AM by SofLit
Hey all,
I'm attempting to implement the EEPROM emulation library into a pre-existing project with little success. I've added the eeprom.c file to the project as well as the header include to the main.c but even prior to implementing the code, attempting to compile/build throws an error that the "FLASH_Status" identifier is undefined. This variable is found inside the stm32f10x_flash header. I've added it from the StdPeriph file into the project but the compiler can't seem to locate it.
This process if fairly new to be so I presume I'm missing some simple step to implement the library, any assistance would be appreciated.
processor is an STM32F103
programming in IAR Embedded Workbench
Solved! Go to Solution.
2024-05-01 01:45 PM - edited 2024-05-01 01:46 PM
Hello,
Searching in my archive I found the attached SPL library v3.1.0
FLASH_status is defined as enumeration in stm32f10x_flash.h:
typedef enum
{
FLASH_BUSY = 1,
FLASH_ERROR_PG,
FLASH_ERROR_WRP,
FLASH_COMPLETE,
FLASH_TIMEOUT
}FLASH_Status;
platform_config.h is part of the user application needs to be under Project\XXX\inc.
See for example this FW for Smartcard interface.
2024-04-30 02:12 PM
Which version, from whence?
Mixing SPL and HAL is probably not advisable.
The compiler would need to know the include paths, and you'd need to include the file directly, or via the #include trees and USE_STDPERIPH define.
If you're using HAL for the project, use the HAL version of the EEPROM Emulation
2024-04-30 02:12 PM
Hello,
Question: are you using the standard library which is a too old and depricated library (no more supported)?
This is an example based on the HAL implementation from STM32CubeF1 in github:
2024-04-30 02:26 PM
I am using the library from 2009 that is called out in the appnote for this specific processor. The code I am attempting to adapt it into is nearly as old, 2010, and hasn't been upgraded for newer generation IDEs. I don't know if the version I downloaded is a HAL implementation but I will review this citation for any additional details or simply attempt to implement the library in the same process. Thank you
2024-04-30 02:30 PM
Version 3.1.0 from here
I'm not well read on the differences between SPL and HAL but the version has an example file that can be opened and built in the flavor of IAR my project is running on. So both the example project and my project work on their own with this compiler and IDE but I'm not able to integrate them. The undefined error is especially odd to me since it's an STM defined enum, I just don't understand how to get the workspace to look in the specific file.
2024-04-30 02:33 PM
See also this thread:
https://community.st.com/t5/stm32-mcus-products/eeprom-emulation-firmware-library/td-p/660430
2024-05-01 07:17 AM
Implementing the older version of the eeprom.c file definitely feels closer, on 2 errors now from the 25 previously, however I appear to be lacking the necessary stm32f10x_lib.h header. The platform_config.h header is also not in my CMSIS or periph project folders. Let me know if you have any additional advice on this or if I'm just backed up against some unknown incompatibility between this library and the project file I'm working with.
2024-05-01 10:39 AM
See also this thread. I think you are in the same situation :).
2024-05-01 11:47 AM
STM32F1 SPL / Standard Peripheral Library v3.6.0
https://www.st.com/en/embedded-software/stsw-stm32054.html
You can perhaps look at what other files are in your project and if they shed some light on the library versions.
I was using Keil (perhaps uVision 3 or 4) to build SPL code, earlier, contemporary, versions of the IAR or KEIL tools would be better suited to building these things, IAR 7 and 8 likely changed enough things it wouldn't load/compile without issues. Could likely make a build with straight GNU/GCC tools, not sure of expectations CubeIDE would add, as not contemporary, and about zero interest there to maintain backward compatibility, or for legacy tools / code.
2024-05-01 12:57 PM
Project is built and maintained in IAR v5 and the SPL in the project folder appears to be v3.1.0 which is the same version as the SPL provided in the 2009 (v3.1) eeprom library as well. This seems to indicate the v2.0 library utilized an older version of the SPL. The difference here is the flash header in the newer version (of the eeprom) attempts to access is in my SPL folder, I can explicitly add it to the project and locate the FLASH_status variable through the search field, the compiler just can't seem to locate it during the build.