Keil seems to be ignoring the comments when building. The full error is:
RTE/Device/STM32F072RBTx/system_stm32f0xx.c(48): warning: In file included from...C:/Users/admiralk/AppData/Local/Arm/Packs/Keil/STM32F0xx_DFP/2.1.1/Drivers/CMSIS/Device/ST/STM32F0xx/Include\stm32f0xx.h(255): error: 'stm32f0xx_hal.h' file not found #include "stm32f0xx_hal.h" ^~~~~~~~~~~~~~~~~
The bit throwing the error:
#if defined (USE_HAL_DRIVER) #include "stm32f0xx_hal.h" #endif /* USE_HAL_DRIVER */
And where it is commented out:
#if !defined (USE_HAL_DRIVER) /** * @brief Comment the line below if you will not use the peripherals drivers. In this case, these drivers will not be included and the application code will be based on direct access to peripherals registers */ /*#define USE_HAL_DRIVER */ #endif /* USE_HAL_DRIVER */
Unless I am missing something, or this got defined somewhere else, I should not be getting an error.
I am trying to work through the lessons from here: https://www.st.com/content/st_com/en/support/learning/stm32-education/stm32-moocs/Moving_from_8_to_32_bits_workshop_MOOC.html
I realize that is kind of old, so maybe I am not finding a checkbox to tick, or untick, somewhere? The direct access part is the main reason for me following the lessons. I can skip it for now, but would really like to know how to get it working.
Thanks, Kirk
Happy New Year.
I was thinking it was something like that, but everything looks fine from what I can tell.
I do not see anything that changes it in the linker options either.
It is probably something simple, but I do not know where else to look.
I have encoutered the same problem after updating the STM32F0-DFP to Version 2.1.1. Even though the USE_HAL_DRIVER directive is defined nowhere, it still tries to include stm32f0xx_hal.h. The STM32L0-DFP ist also affected in the latest update.
There are three solutions:
1. Every time you create a project, comment out #include "stm32f0xx_hal.h".
2. Every time you create a project, open "Options for target" and switch to the C/C++ Tab. There, add the global define PRE_INCLUDE_GLOBAL_H. This prevents Keil from including stm32f0xx_hal.h
3. Downgrade your DFP to V2.1.0 with the Pack installer. I have used this version for various projects without any problems. The changes in V2.1.1 mostly affect HAL users, so if you only use CMSIS (like me), you can safely downgrade without loosing functionality.
To downgrade, open the pack installer and install V2.1.0 of the DFP. Afterwards, I would recommend removing V2.1.1. Keil always tries to use the latest version of the installed DFP when you create a new project, so if you do not uninstall V2.1.1, you have to change the configuration every time you create a new project.
After clicking "Remove" an V2.1.1, the button might change to "Unpack". You can either leave it like this or do Right click -> Delete Pack. This will remove the downloaded files from your computer.
If you still choose to keep V2.1.1 installed, click on "Select Software Packs..." after creating a new project. Then, uncheck "Use latest version of all installed Software Packs" and select V2.1.0 of the DFP.
The buttons for the Pack installer and for selecting the software packs are located in the toolbar (two icons on the right):
I would recommend downgrading to V2.1.0 and wait until ST releases an update which fixes the issue. This is also what I did, but I guess it could take a while until ST releases an update. There is also a thread on the ST community (can not find it at the moment) about this exact issue and nobody from ST seemed to care.
I hope this helped! :-)
Thanks beerwema .
I went with #2 and that did the trick. I will need to look around and see what that actually does, but it is good for now. I had a feeling it was something that got added in an update as that made the most sense. The next project does use HAL libraries, so downgrading did not seem like the bets option at the moment. When I started this, the package manager had problems connecting and I had to download the packages and manually install them.
Anyway, Hopefully that is the last of my troubles, at least for a while.
Thanks again, Kirk