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

error: 'stm32f0xx_hal.h' file not found, when not using HAL libraries.

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