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?
Broman3100 said:I need to use a library that relies on FLASH_Unlock
What library, exactly?
Broman3100 said: I get an error saying the function is invalid in C99
Copy & paste the full, unabridged build output, and show the section of source code where the error is reported.
(for the build output, just use steps 1 & 2).
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 ...
View all questions in Keil forum