I am using Platform IO to build images for teensy and esp32 platforms.
I have multiple targets placed in src folder as:
I have platorm.ini places at the top level folder pointing to a pre-buld script that used to setup src_dir as follows.
env[‘PROJECTSRC_DIR’] = env[‘PROJECT_DIR’] + “\src\” + env[“PIOENV”]
This used to work until recently, and would pick up the correct project when tried to build individually from Platform IO environment in visual studio code, or I could do build all by clicking platformIO build.
With a latest update to platformIO, sometime last week I think, this project src directory setting no longer seems to work.
As I look for src_dir settings, I can see that there is mention of PLATFORMIO_SRC_DIR that can be set to individual src directory. But I couldn’t find a way to do that from pre-build script. Only the env variables seems to be able to be set in script, not a platformio variable.
I do not really want to use a separate platform.ini for each project. What changes in the latest release has broken this? Is there still a way I can do this through script?
As you can see in the image attached, when I build env:teensy_board1, it is not just building teensy_board1 environment, other board folders are included as well.
Whatever setting I am doing in adj_src_dir.py doesn’t seem to take effect, this used to work earlier. Build works if I have src_dir setup directly in in [platformio] inside platform.ini. But I want to continue using the same platform.ini for the 3 boards as I have been doing, taking care of src_dir setting from pre-run extra build script.
Just wanted to point out that both these environment variables are required to get my esp32 projects to build successfully. I use same folder structure as I have in my teensy projects for esp32 board also.
By setting only PROJECT_SRC_DIR, ESP32 build was not picking up the right sdkconfig.h from individual project src folder. It was trying to pick the file from src folder directly though I had sdkconfig.h files separately in src/esp32_board1 folder.
Since I saw PROJECTSRC_DIR also in the environment dump file pointing to src folder, I decided to change that also in my script to be same as PROJECT_SRC_DIR. By doing that, the build is picking up sdkconfig.h from the right folder.
So it seems both environment variables are being used, is this intentional or is subject to change in later releases?
Well, please don’t hate me then… I’ve submitted a PR for the espressif32 platform package , to change PROJECTSRC_DIR to PROJECT_SRC_DIR since it’s supposed to be a legacy variable… and if that’s accepted, I’ll check out all the other platform packages and fix them too for consistency… betcha it’s the only one though!