We are running a survey to help us improve the experience for all of our members. If you see the survey appear, please take the time to tell us about your experience if you can.
I need to use a library that relies on FLASH_Unlock and functions following it, however upon calling that function I get an error saying the function is invalid in C99. The library I use has an example file which is written in mdk v4 and works just fine. Is there a way I can use FLASH_Unlock() function?
I use eeprom emulation library for stm32f0xx. ( https://www.st.com/content/st_com/en/products/embedded-software/mcu-mpu-embedded-software/stm32-embedded-software/stm32-standard-peripheral-library-expansion/stsw-stm32117.html )
../Src/main.c(69): warning: #223-D: function "FLASH_Unlock" declared implicitly
This is the main error I get, I also get multiple other errors which is because FLASH_Unlock doesnt work f.ex:
..\Src\eeprom.c(160): warning: #223-D: function "FLASH_ErasePage" declared implicitly FlashStatus = FLASH_ErasePage(PAGE1_BASE_ADDRESS); ..\Src\eeprom.c(162): error: #20: identifier "FLASH_COMPLETE" is undefined if (FlashStatus != FLASH_COMPLETE) ..\Src\eeprom.c(167): warning: #223-D: function "FLASH_ProgramHalfWord" declared implicitly FlashStatus = FLASH_ProgramHalfWord(PAGE0_BASE_ADDRESS, VALID_PAGE); ..\Src\eeprom.c(179): error: #20: identifier "FLASH_COMPLETE" is undefined if (FlashStatus != FLASH_COMPLETE) ..\Src\eeprom.c(192): error: #20: identifier "FLASH_COMPLETE" is undefined if (FlashStatus != FLASH_COMPLETE) ..\Src\eeprom.c(200): warning: #223-D: function "FLASH_ErasePage" declared implicitly FlashStatus = FLASH_ErasePage(PAGE1_BASE_ADDRESS);
This is ST's code - nothing to do with ARM.
The message does not say anything about the function being invalid in C99!
"implicitly declared" means that you have failed to provide an explicit declaration - ie, either a prototype or definition of that function.
With all those "undefined" errors, you have probably omitted to include a required header file.
Or, perhaps, not correctly configured the project - so that the appropriate target-specific options are not defined.
You need to go back to the ST documentation on how to properly set up a project using this library.
ST should provide an example to get you started ...
Likely because you are not including one or more .H file.
The settings for the Include Path pull from the wrong, or inappropriate place. ie not consistent with the .C file providing the functionality. The .C and .H need to be contemporaneous.
The settings for the C/C++ command line don't define USE_STDPERIPH_DRIVER, etc