diff --git a/platformio/project/config.py b/platformio/project/config.py index f138f26c..c583c0d2 100644 --- a/platformio/project/config.py +++ b/platformio/project/config.py @@ -348,7 +348,7 @@ class ProjectConfigBase: if option in self.BUILTIN_VARS: return self.BUILTIN_VARS[option]() # SCons varaibles - return f"${option}" + return f"${{{option}}}" # handle system environment variables if section == "sysenv": diff --git a/tests/project/test_config.py b/tests/project/test_config.py index c15aa7bc..02741b95 100644 --- a/tests/project/test_config.py +++ b/tests/project/test_config.py @@ -660,12 +660,14 @@ data_dir = $PROJECT_DIR/assets build_flags = -D UTIME=${UNIX_TIME} -I ${PROJECTSRC_DIR}/hal + -Wl,-Map,${BUILD_DIR}/${PROGNAME}.map test_testing_command = ${platformio.packages_dir}/tool-simavr/bin/simavr -m atmega328p -f 16000000L + ${UPLOAD_PORT and "-p "+UPLOAD_PORT} ${platformio.build_dir}/${this.__env__}/firmware.elf """ ) @@ -674,9 +676,14 @@ test_testing_command = os.path.join("$PROJECT_DIR", "assets") ) assert config.get("env:myenv", "build_flags")[0][-10:].isdigit() - assert config.get("env:myenv", "build_flags")[1] == "-I $PROJECTSRC_DIR/hal" + assert config.get("env:myenv", "build_flags")[1] == "-I ${PROJECTSRC_DIR}/hal" + assert ( + config.get("env:myenv", "build_flags")[2] + == "-Wl,-Map,${BUILD_DIR}/${PROGNAME}.map" + ) testing_command = config.get("env:myenv", "test_testing_command") - assert "$" not in " ".join(testing_command) + assert "$" not in testing_command[0] + assert testing_command[5] == '${UPLOAD_PORT and "-p "+UPLOAD_PORT}' def test_extends_order(tmp_path: Path):