Exclude STM32 HAL libraries from compiling and linking when building project

Is there any way I can exclude or skip the compilation and linking of STM32 HAL libraries when building my project because I don’t use them much in my project and compile all of them seems like a waste

What framework do you use? (as specified in your platformio.ini)

I use stm32cube framework

PlatformIO has no option to configure that via platformio.ini. The linker would throw out any data or function that is not referenced anyways.

Sorry for the late reply but thanks for your answer. It just that it still bothers me a bit when having to wait for all the HAL files to compile, but I guess it doesn’t affect the program

stm32cube didn’t work for me, so I switched again to no framework. Auto generated code from cube ide, and then an automated script that copies the libraries to platformio/lib.

Not 100% clean but works very well, and I can make configuration changes in cube ide (using the .ioc file) and automatic propogation to platformio using a script.