Type: DirPath | Multiple: No | Default: “<Project>/src

The src_dir is the path to the directory where the source code of the project is located. It is used by the pio run command to compile and upload the code to the device. By default, the src_dir is set to src, which means the source code is located in a directory named src in the root directory of the project.

You can customize the base directory by setting the PLATFORMIO_SRC_DIR environment variable. This variable should contain the absolute path to the directory where the source code is located.


To include or exclude specific source files from the build process, use the build_src_filter option in the “platformio.ini” (Project Configuration File). The build_src_filter option can take a list of file patterns in glob syntax. Only the source files that match the specified patterns will be included in the build process.