mirror of
https://github.com/meshtastic/firmware.git
synced 2026-06-06 10:29:27 +00:00
66ff1536f3
CI / setup (all) (push) Waiting to run
CI / setup (check) (push) Waiting to run
CI / version (push) Waiting to run
CI / check (push) Blocked by required conditions
CI / build (push) Blocked by required conditions
CI / build-debian-src (push) Waiting to run
CI / package-pio-deps-native-tft (push) Waiting to run
CI / test-native (push) Waiting to run
CI / docker (alpine, native, linux/amd64) (push) Waiting to run
CI / docker (alpine, native, linux/arm64) (push) Waiting to run
CI / docker (alpine, native-tft, linux/amd64) (push) Waiting to run
CI / docker (debian, native, linux/amd64) (push) Waiting to run
CI / docker (debian, native, linux/arm/v7) (push) Waiting to run
CI / docker (debian, native, linux/arm64) (push) Waiting to run
CI / docker (debian, native-tft, linux/amd64) (push) Waiting to run
CI / gather-artifacts (esp32) (push) Blocked by required conditions
CI / gather-artifacts (esp32c3) (push) Blocked by required conditions
CI / gather-artifacts (esp32c6) (push) Blocked by required conditions
CI / gather-artifacts (esp32s3) (push) Blocked by required conditions
CI / gather-artifacts (nrf52840) (push) Blocked by required conditions
CI / gather-artifacts (rp2040) (push) Blocked by required conditions
CI / gather-artifacts (rp2350) (push) Blocked by required conditions
CI / gather-artifacts (stm32) (push) Blocked by required conditions
CI / release-artifacts (push) Blocked by required conditions
CI / release-firmware (esp32) (push) Blocked by required conditions
CI / release-firmware (esp32c3) (push) Blocked by required conditions
CI / release-firmware (esp32c6) (push) Blocked by required conditions
CI / release-firmware (esp32s3) (push) Blocked by required conditions
CI / release-firmware (nrf52840) (push) Blocked by required conditions
CI / release-firmware (rp2040) (push) Blocked by required conditions
CI / release-firmware (rp2350) (push) Blocked by required conditions
CI / release-firmware (stm32) (push) Blocked by required conditions
CI / publish-firmware (push) Blocked by required conditions
51 lines
1.7 KiB
Python
Executable File
51 lines
1.7 KiB
Python
Executable File
#!/usr/bin/env python3
|
|
# trunk-ignore-all(ruff/F821)
|
|
# trunk-ignore-all(flake8/F821): For SConstruct imports
|
|
|
|
import sys
|
|
from os.path import basename
|
|
|
|
Import("env")
|
|
|
|
|
|
# Custom HEX from ELF
|
|
# Convert hex to uf2 for nrf52
|
|
def nrf52_hex_to_uf2(source, target, env):
|
|
hex_path = target[0].get_abspath()
|
|
# When using merged hex, drop 'merged' from uf2 filename
|
|
uf2_path = hex_path.replace(".merged.", ".")
|
|
uf2_path = uf2_path.replace(".hex", ".uf2")
|
|
env.Execute(
|
|
env.VerboseAction(
|
|
f'"{sys.executable}" ./bin/uf2conv.py "{hex_path}" -c -f 0xADA52840 -o "{uf2_path}"',
|
|
f"Generating UF2 file from {basename(hex_path)}",
|
|
)
|
|
)
|
|
|
|
|
|
def nrf52_mergehex(source, target, env):
|
|
hex_path = target[0].get_abspath()
|
|
merged_hex_path = hex_path.replace(".hex", ".merged.hex")
|
|
merge_with = None
|
|
if "wio-sdk-wm1110" == str(env.get("PIOENV")):
|
|
merge_with = env.subst("$PROJECT_DIR/bin/s140_nrf52_7.3.0_softdevice.hex")
|
|
else:
|
|
print("merge_with not defined for this target")
|
|
|
|
if merge_with is not None:
|
|
env.Execute(
|
|
env.VerboseAction(
|
|
f'"$PROJECT_DIR/bin/mergehex" -m "{hex_path}" "{merge_with}" -o "{merged_hex_path}"',
|
|
"Merging HEX with SoftDevice",
|
|
)
|
|
)
|
|
print(f'Merged file saved at "{basename(merged_hex_path)}"')
|
|
nrf52_hex_to_uf2([hex_path, merge_with], [env.File(merged_hex_path)], env)
|
|
|
|
|
|
# if WM1110 target, merge hex with softdevice 7.3.0
|
|
if "wio-sdk-wm1110" == env.get("PIOENV"):
|
|
env.AddPostAction("$BUILD_DIR/${PROGNAME}.hex", nrf52_mergehex)
|
|
else:
|
|
env.AddPostAction("$BUILD_DIR/${PROGNAME}.hex", nrf52_hex_to_uf2)
|