mirror of
https://github.com/pelgraine/Meck.git
synced 2026-03-28 17:42:44 +01:00
* merge-bin.py script
This commit is contained in:
48
merge-bin.py
Normal file
48
merge-bin.py
Normal file
@@ -0,0 +1,48 @@
|
|||||||
|
#!/usr/bin/python3
|
||||||
|
|
||||||
|
# Adds PlatformIO post-processing to merge all the ESP flash images into a single image.
|
||||||
|
|
||||||
|
import os
|
||||||
|
|
||||||
|
Import("env", "projenv")
|
||||||
|
|
||||||
|
board_config = env.BoardConfig()
|
||||||
|
firmware_bin = "${BUILD_DIR}/${PROGNAME}.bin"
|
||||||
|
merged_bin = os.environ.get("MERGED_BIN_PATH", "${BUILD_DIR}/${PROGNAME}-merged.bin")
|
||||||
|
|
||||||
|
|
||||||
|
def merge_bin_action(source, target, env):
|
||||||
|
flash_images = [
|
||||||
|
*env.Flatten(env.get("FLASH_EXTRA_IMAGES", [])),
|
||||||
|
"$ESP32_APP_OFFSET",
|
||||||
|
source[0].get_abspath(),
|
||||||
|
]
|
||||||
|
merge_cmd = " ".join(
|
||||||
|
[
|
||||||
|
'"$PYTHONEXE"',
|
||||||
|
'"$OBJCOPY"',
|
||||||
|
"--chip",
|
||||||
|
board_config.get("build.mcu", "esp32"),
|
||||||
|
"merge_bin",
|
||||||
|
"-o",
|
||||||
|
merged_bin,
|
||||||
|
"--flash_mode",
|
||||||
|
board_config.get("build.flash_mode", "dio"),
|
||||||
|
"--flash_freq",
|
||||||
|
"${__get_board_f_flash(__env__)}",
|
||||||
|
"--flash_size",
|
||||||
|
board_config.get("upload.flash_size", "4MB"),
|
||||||
|
*flash_images,
|
||||||
|
]
|
||||||
|
)
|
||||||
|
env.Execute(merge_cmd)
|
||||||
|
|
||||||
|
|
||||||
|
env.AddCustomTarget(
|
||||||
|
name="mergebin",
|
||||||
|
dependencies=firmware_bin,
|
||||||
|
actions=merge_bin_action,
|
||||||
|
title="Merge binary",
|
||||||
|
description="Build combined image",
|
||||||
|
always_build=True,
|
||||||
|
)
|
||||||
@@ -26,6 +26,7 @@ build_src_filter = +<*.cpp> +<helpers/*.cpp>
|
|||||||
extends = arduino_base
|
extends = arduino_base
|
||||||
platform = espressif32
|
platform = espressif32
|
||||||
monitor_filters = esp32_exception_decoder
|
monitor_filters = esp32_exception_decoder
|
||||||
|
extra_scripts = merge-bin.py
|
||||||
build_src_filter = ${arduino_base.build_src_filter}
|
build_src_filter = ${arduino_base.build_src_filter}
|
||||||
|
|
||||||
[Heltec_stick_lite]
|
[Heltec_stick_lite]
|
||||||
|
|||||||
Reference in New Issue
Block a user