Thank you for the hint about the “inc” folder @ivankravets. PIO has been incredibly intuitive and easy to use. Most of the time I dont read the documentation unless I have a specific need or purpose.
( I really should take the time and read it… )
I’ve one additional question regarding the project folders generated by STM32CubeMX. For some platforms like STM32 F7x, enabling LwIP and FreeRTOS generates their sources under Middlewares/ and are not in a flat-directory structure. A part of that directory tree for LwIP library is attached below.
I felt that converting them into a flat-directory i.e. placing all of their headers/source files inside lib/ to be a tedious task since that would involve changing their source files’ include statements too. Is there any better way to include/configure such libraries using platformio.ini commands? lib_extra_dirs kind of statements didn’t help much.
Hi @Krishna_Chaitanya, thanks for your reply. I meant lib_extra_dirs in my previous comment.
Following was my configuration and error received while building. Would I need any additional configuration file, like package.json?
Can you post a complete directory tree structure of your entire project.
From what I am able to see and understand, your errors are because of improper paths in the include directives and the lib_extra_dirs directives.
As you say, I understand that the headers/sources from third-party libraries are not included/linked during compilation. Would like to see how lib_extra_dirs directives may solve for that. More like a CPPPATH inclusion issue.
Not sure whether I understood it right, correct me if I’ve understood it wrong. I set
lib_extra_dirs = …/Middlewares/Third_Party/LwIP, …/Middlewares/Third_Party/FreeRTOS
which is relative to Inc/ folder. Didn’t work as well.
Actually from your earlier posts, you referenced the extra libs search path to your home directory, not the inc folder, not even wrt your project folder.
the ‘~’ in your lib_extra_dirs path references wrt your user home folder.
Secondly, I meant when you include the freertos.h and the opt.h files in your source, give their path with respect to the inc folder.
i.e #include “Middlewares/Third_Party/Freertos/freertos.h” #include “Middlewares/Third_Party/lwip/opt.h”
that is assuming the files are in those respective folders. If they are in a sub folder, reference as such.
Hope this makes it clear.
I’m bit confused as to how to use lib_extra_dirs properly. Have tried /Middlewares/Third_Party/LwIP and Middlewares/Third_Party/LwIP combinations in vain. Might be better to look at how Platformio includes/builds external sources.
My guess is that the overall build system expects a flat-directory i.e. where all .c and .h files are placed in the parent library directory which the user wants to compile and get linked to actual project sources.
Also if I do as you suggest, I may have to modify all relevant includes to Middlewares/Third_Party/LwIP/… etc., as their folder structure isn’t flat. Have attached below the structure inside Middlewares/Thiurd_Party/LwIP/src. Editing the header-includes would be bit tedious, isn’t it?
Then in your application source files, where the freertos and the lwip headers are included, modify them to #include "Middlewares/Third_Party/…"to the respective paths for the lwip.h and freertos.h files.