Skip to content

Commit

Permalink
rg_tool: Only rebuild the bootloader if necessary
Browse files Browse the repository at this point in the history
  • Loading branch information
ducalex committed Jan 8, 2025
1 parent f87bdce commit 3dbcfcd
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions rg_tool.py
Original file line number Diff line number Diff line change
Expand Up @@ -99,8 +99,10 @@ def build_image(output_file, apps, img_format="esp32", fatsize=0):
table_bin = f.read()

print("Building bootloader...")
run([IDF_PY, "bootloader"], cwd=os.path.join(os.getcwd(), list(apps)[0]))
with open(os.path.join(os.getcwd(), list(apps)[0], "build", "bootloader", "bootloader.bin"), "rb") as f:
bootloader_file = os.path.join(os.getcwd(), list(apps)[0], "build", "bootloader", "bootloader.bin")
if not os.path.exists(bootloader_file):
run([IDF_PY, "bootloader"], cwd=os.path.join(os.getcwd(), list(apps)[0]))
with open(bootloader_file, "rb") as f:
bootloader_bin = f.read()

if img_format == "esp32s3":
Expand Down Expand Up @@ -241,6 +243,7 @@ def monitor_app(app, port, baudrate=115200):
if command in ["install"]:
print("=== Step: Flashing entire image to device ===\n")
# Should probably show a warning here and ask for confirmation...
img_file = ("%s_%s_%s.img" % (PROJECT_NAME, PROJECT_VER, args.target)).lower()
flash_image(img_file, args.port, args.baud)

if command in ["flash", "run", "profile"]:
Expand Down

0 comments on commit 3dbcfcd

Please sign in to comment.