From 3eaf215ccc1d4058a355a03784495f7bc9cca996 Mon Sep 17 00:00:00 2001 From: James Gartrell Date: Wed, 28 Oct 2026 01:05:06 -0700 Subject: [PATCH 1/3] Fix python tool paths to work on both windows and macosx --- platform.txt | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/platform.txt b/platform.txt index 99dc0a102..709592f43 100644 --- a/platform.txt +++ b/platform.txt @@ -109,8 +109,9 @@ recipe.objcopy.hex.pattern="{compiler.path}{compiler.elf2hex.cmd}" {compiler.elf recipe.objcopy.zip.pattern="{tools.nrfutil.cmd}" dfu genpkg --dev-type 0x0052 --sd-req {build.sd_fwid} --application "{build.path}/{build.project_name}.hex" "{build.path}/{build.project_name}.zip" ## Create uf2 file -#recipe.objcopy.uf2.pattern=python "{runtime.platform.path}/tools/uf2conv/uf2conv.py" -f 0xADA52840 -c -o "{build.path}/{build.project_name}.uf2" "{build.path}/{build.project_name}.hex" -recipe.objcopy.uf2.pattern=python "{runtime.platform.path}/tools/uf2conv/uf2_wrap.py" "{runtime.platform.path}/tools/uf2conv/uf2conv.py" "{build.board}" "{build.path}" "{build.source.path}" "{build.project_name}" +#recipe.objcopy.uf2.pattern="{tools.python.cmd}" "{runtime.platform.path}/tools/uf2conv/uf2conv.py" -f 0xADA52840 -c -o "{build.path}/{build.project_name}.uf2" "{build.path}/{build.project_name}.hex" +recipe.objcopy.uf2.pattern="{tools.python.cmd}" "{runtime.platform.path}/tools/uf2conv/uf2_wrap.py" "{runtime.platform.path}/tools/uf2conv/uf2conv.py" "{build.board}" "{build.path}" "{build.source.path}" "{build.project_name}" + ## Save bin recipe.output.tmp_file_bin={build.project_name}.bin @@ -129,6 +130,14 @@ recipe.size.regex.data=^(?:\.data|\.bss)\s+([0-9]+).* recipe.output.tmp_file={build.project_name}.hex recipe.output.save_file={build.project_name}.{build.variant}.hex +#*************************************************** +# Select python executable on mac or windows +#*************************************************** + +tools.python.cmd=python +tools.python.cmd.windows=python.exe +tools.python.cmd.macosx=python3 + #*************************************************** # adafruit-nrfutil for uploading # https://github.com/adafruit/Adafruit_nRF52_nrfutil From 56112f40f6f11661e3861da271876cfa1f1b5ca7 Mon Sep 17 00:00:00 2001 From: James Gartrell Date: Wed, 28 Oct 2026 01:10:47 -0700 Subject: [PATCH 2/3] All Seeeduino boards have USB-C and support .uf2 --- platform.txt | 4 +--- tools/uf2conv/uf2_wrap.py | 36 ------------------------------------ 2 files changed, 1 insertion(+), 39 deletions(-) delete mode 100644 tools/uf2conv/uf2_wrap.py diff --git a/platform.txt b/platform.txt index 709592f43..17cf913ab 100644 --- a/platform.txt +++ b/platform.txt @@ -109,9 +109,7 @@ recipe.objcopy.hex.pattern="{compiler.path}{compiler.elf2hex.cmd}" {compiler.elf recipe.objcopy.zip.pattern="{tools.nrfutil.cmd}" dfu genpkg --dev-type 0x0052 --sd-req {build.sd_fwid} --application "{build.path}/{build.project_name}.hex" "{build.path}/{build.project_name}.zip" ## Create uf2 file -#recipe.objcopy.uf2.pattern="{tools.python.cmd}" "{runtime.platform.path}/tools/uf2conv/uf2conv.py" -f 0xADA52840 -c -o "{build.path}/{build.project_name}.uf2" "{build.path}/{build.project_name}.hex" -recipe.objcopy.uf2.pattern="{tools.python.cmd}" "{runtime.platform.path}/tools/uf2conv/uf2_wrap.py" "{runtime.platform.path}/tools/uf2conv/uf2conv.py" "{build.board}" "{build.path}" "{build.source.path}" "{build.project_name}" - +recipe.objcopy.uf2.pattern="{tools.python.cmd}" "{runtime.platform.path}/tools/uf2conv/uf2conv.py" -f 0xADA52840 -c -o "{build.path}/{build.project_name}.uf2" "{build.path}/{build.project_name}.hex" ## Save bin recipe.output.tmp_file_bin={build.project_name}.bin diff --git a/tools/uf2conv/uf2_wrap.py b/tools/uf2conv/uf2_wrap.py deleted file mode 100644 index 75b53337f..000000000 --- a/tools/uf2conv/uf2_wrap.py +++ /dev/null @@ -1,36 +0,0 @@ -import sys -import subprocess - - -def main(uf2_file: str, board_id: str, build_path: str, output_path: str, project_name: str): - if board_id == "TRACKER_T1000_E_LORAWAN": - try: - command = [ - "python", - uf2_file, - "-f", - "0xADA52840", - "-c", - "-o", - f"{output_path}/{project_name}.uf2", - f"{build_path}/{project_name}.hex", - ] - subprocess.run(command, check=True) - except subprocess.CalledProcessError as e: - print(f"Error executing uf2convert.py: {e}") - else: - print( - f"Skipping UF2 conversion for board '{board_id}'" - ) - - -if __name__ == "__main__": - if len(sys.argv) != 6: - print(sys.argv) - print( - "Usage: python script.py " - ) - sys.exit(1) - - uf2_file, board_id, build_path, output_path, project_name = sys.argv[1:] - main(uf2_file, board_id, build_path, output_path, project_name) From f72787e840dcc0071db211e21973275e730b59bf Mon Sep 17 00:00:00 2001 From: James Gartrell Date: Wed, 28 Oct 2026 01:12:42 -0700 Subject: [PATCH 3/3] Use raw string for regex in python to fix syntax warning --- tools/uf2conv/uf2conv.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/uf2conv/uf2conv.py b/tools/uf2conv/uf2conv.py index 4a1455e04..e6bf8c481 100644 --- a/tools/uf2conv/uf2conv.py +++ b/tools/uf2conv/uf2conv.py @@ -174,7 +174,7 @@ def get_drives(): "get", "DeviceID,", "VolumeName,", "FileSystem,", "DriveType"]) for line in r.split('\n'): - words = re.split('\s+', line) + words = re.split(r'\s+', line) if len(words) >= 3 and words[1] == "2" and words[2] == "FAT": drives.append(words[0]) else: