2020-06-01 02:42 PM
I wanted to compile all the HAL library sources so that I could make a one archive of all the files. I found this as this project which build HAL sources for F4 series (but the version of the HAL code is much old) I tried to generate HAL code from cubeMX but when though I explicitly mention to include all the source library files and change the auto generated makefile to compile all the sources it doesn't compile all the source files. Anybody have an idea or a hint about how to achieve my requirement? Thanks
P.S. I even tried with system workbench but the compilation takes place only for the default set of files. But instead I need to compile all the files
2020-06-01 03:00 PM
How would you normally generate static libraries?
General problem is that ST has CPU and board level dependencies baked in, and these are acheived via pre-processor directives, and not resolved at link time.
You'd need to get all of the defines in order, and have stm32fxyz_hal_conf.h enable all the modules compatible with your platform, compile all the library source files, and then get the linker to combine them into a library.
2020-06-01 04:07 PM
Thank you very much. I was able to get around the problem. However I have a follow up question. The object files generated for few modules does not seem to have any content though their underline implementation does contain code. For example 'stm32l4xx_hal_rng_ex' and 'stm32l4xx_hal_cryp' does not have any content as I observed through GDB. (and the file very small) Do you have any idea about a reason behind this?
2020-06-01 04:32 PM
>The object files generated for few modules does not seem to have any content
This is because all these files are guarded by #ifdef:
#ifdef HAL_????_MODULE_ENABLED
Provide stm32xxx_hal_conf.h with all these symbols defined, for each module you want to include in the library.
-- pa
2020-06-01 05:22 PM
I already had defined those modules. For example, I had already defined HAL_CRYP_MODULE_ENABLED is defined in stm32xxx_hal_conf file
2020-06-01 05:29 PM
All these modules are already defined in my HAL_conf.h file
2020-06-01 05:55 PM
So I did for one of MCU from F4 series, and cypt module produce the object file. The only reason I am thinking is maybe these modules, (for example cypto module) is not supported in STM32L4xx MCU that I selected but there in the STM32F4xx MCU. Other than that, maybe there is a bug somewhere in the source codes generated from the CubeMX.