AnsweredAssumed Answered

From StdPeriphLib to HAL. PreProcessor AUTO definition

Question asked by Ijaz Ahmad on Feb 13, 2018
Latest reply on Feb 14, 2018 by Ijaz Ahmad


I have a very strange error while migrating from Standard Peripheral Libraries to HAL libraries. 

what I did was:

1. I created new Keil project for STM32F407 Discovery.

2. Added Device startup file (And CMSIS dependency)




Now in Keil Project, when I include File STM32F4xx.h from standard peripheral library (This ONE) and compile the code without defining target in Keil pre-processor (STM32F40_41xxx), I get the missing target error at line 112 (Here) which is obvious.



But Now if I include the same file (name wise) from HAL libraries (This ONE) and doesn't define target preprocessor, I don't get any error.. at line 193(HERE)???  It EVEN includes the relevant header file at Line-150. i.e.


#elif defined(STM32F407xx)

       #include "stm32f407xx.h"


which means the preprocessor STM32F407xx is already defined some where OR the file from HAL is defining it somewhere. I tried to dig out but couldn't find its definition in whole project or include/sub-included file..!!!!


So How is it possible that for one file (StdperiphLib) the preprocessor STM32F407xx is defined and for other its not??


Kindly help.



GPIO-Blinky... Both the header files are inside project folder in different folders. Give path to which is needs to be included at a time.


Note: i am not using CubeMX.