Skip to content

Commit

Permalink
scripts: fix mkdefaults.py for non-*nix platforms
Browse files Browse the repository at this point in the history
Introduced in 2f38d93
  • Loading branch information
JamieDriver committed Oct 8, 2024
1 parent b042f1d commit 6b77769
Showing 1 changed file with 11 additions and 3 deletions.
14 changes: 11 additions & 3 deletions tools/mkdefaults.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,13 +58,21 @@
if cfg.startswith(CFG_TARGET + '='):
target_chip = cfg[len(CFG_TARGET) + 1:]

# Backup existing sdkconfig.default file
# Backup/remove existing sdkconfig files
if os.path.isfile('./sdkconfig.defaults'):
os.rename('./sdkconfig.defaults', './sdkconfig.defaults.orig')
if os.path.isfile('./sdkconfig'):
os.remove('./sdkconfig')

subprocess.check_call(f'idf.py set-target {target_chip}', shell=True)

# Remove recreated sdkconfig files
if os.path.isfile('./sdkconfig.defaults'):
os.remove('./sdkconfig.defaults')
if os.path.isfile('./sdkconfig'):
os.remove('./sdkconfig')

# Process tempfile with 'idf.py reconfigure write-defconfig' to create new sdkconfig.defaults
subprocess.check_call(f'idf.py set-target {target_chip} && rm -f sdkconfig sdkconfig.defaults',
shell=True)
subprocess.check_call(f'idf.py -D SDKCONFIG_DEFAULTS="{TEMPFILE}" reconfigure save-defconfig',
shell=True)

Expand Down

0 comments on commit 6b77769

Please sign in to comment.