Add env-specific suffix to distinguish "sdkconfig" files

Resolve #539
This commit is contained in:
valeros
2021-06-23 14:25:46 +03:00
parent b073ed8440
commit 46b0e6126a
+15 -6
View File
@@ -79,6 +79,10 @@ BUILD_DIR = env.subst("$BUILD_DIR")
PROJECT_DIR = env.subst("$PROJECT_DIR")
PROJECT_SRC_DIR = env.subst("$PROJECT_SRC_DIR")
CMAKE_API_REPLY_PATH = os.path.join(".cmake", "api", "v1", "reply")
SDKCONFIG_PATH = board.get(
"build.esp-idf.sdkconfig_path",
os.path.join(PROJECT_DIR, "sdkconfig.%s" % env.subst("$PIOENV")),
)
def get_project_lib_includes(env):
@@ -105,7 +109,6 @@ def is_cmake_reconfigure_required(cmake_api_reply_dir):
os.path.join(PROJECT_SRC_DIR, "CMakeLists.txt"),
]
cmake_preconf_dir = os.path.join(BUILD_DIR, "config")
sdkconfig = os.path.join(PROJECT_DIR, "sdkconfig")
for d in (cmake_api_reply_dir, cmake_preconf_dir):
if not os.path.isdir(d) or not os.listdir(d):
@@ -114,9 +117,9 @@ def is_cmake_reconfigure_required(cmake_api_reply_dir):
return True
if not os.path.isfile(os.path.join(BUILD_DIR, "build.ninja")):
return True
if os.path.isfile(sdkconfig) and os.path.getmtime(sdkconfig) > os.path.getmtime(
cmake_cache_file
):
if os.path.isfile(SDKCONFIG_PATH) and os.path.getmtime(
SDKCONFIG_PATH
) > os.path.getmtime(cmake_cache_file):
return True
if any(
os.path.getmtime(f) > os.path.getmtime(cmake_cache_file)
@@ -501,7 +504,7 @@ def generate_project_ld_script(sdk_config, ignore_targets=None):
args = {
"script": os.path.join(FRAMEWORK_DIR, "tools", "ldgen", "ldgen.py"),
"config": os.path.join(PROJECT_DIR, "sdkconfig"),
"config": SDKCONFIG_PATH,
"fragments": " ".join(['"%s"' % f for f in project_files.get("lf_files")]),
"kconfig": os.path.join(FRAMEWORK_DIR, "Kconfig"),
"env_file": os.path.join("$BUILD_DIR", "config.env"),
@@ -699,7 +702,7 @@ def build_bootloader():
"-DPYTHON_DEPS_CHECKED=1",
"-DPYTHON=" + env.subst("$PYTHONEXE"),
"-DIDF_PATH=" + FRAMEWORK_DIR,
"-DSDKCONFIG=" + os.path.join(PROJECT_DIR, "sdkconfig"),
"-DSDKCONFIG=" + SDKCONFIG_PATH,
"-DLEGACY_INCLUDE_COMMON_HEADERS=",
"-DEXTRA_COMPONENT_DIRS="
+ os.path.join(FRAMEWORK_DIR, "components", "bootloader"),
@@ -1147,10 +1150,16 @@ project_codemodel = get_cmake_code_model(
"-DPYTHON_DEPS_CHECKED=1",
"-DEXTRA_COMPONENT_DIRS:PATH=" + ";".join(extra_components),
"-DPYTHON=" + env.subst("$PYTHONEXE"),
"-DSDKCONFIG=" + SDKCONFIG_PATH,
]
+ click.parser.split_arg_string(board.get("build.cmake_extra_args", "")),
)
# At this point the sdkconfig file should be generated by the underlying build system
assert os.path.isfile(SDKCONFIG_PATH), (
"Missing auto-generated SDK configuration file `%s`" % SDKCONFIG_PATH
)
if not project_codemodel:
sys.stderr.write("Error: Couldn't find code model generated by CMake\n")
env.Exit(1)