From f7d516d1358fb49ad9239bb8b24a487093390967 Mon Sep 17 00:00:00 2001 From: unknown Date: Tue, 26 Jul 2022 23:58:48 +0200 Subject: [PATCH] Try and use correct compiler and UF2 conversion for zephyr --- builder/main.py | 36 ++++++++++++++++++++++++++++-------- platform.py | 1 + 2 files changed, 29 insertions(+), 8 deletions(-) diff --git a/builder/main.py b/builder/main.py index c027b5d..af37e2a 100644 --- a/builder/main.py +++ b/builder/main.py @@ -117,15 +117,35 @@ def BeforeUpload(target, source, env): # pylint: disable=W0613,W0621 def generate_uf2(target, source, env): elf_file = target[0].get_path() - env.Execute( - " ".join( - [ - "elf2uf2", - '"%s"' % elf_file, - '"%s"' % elf_file.replace(".elf", ".uf2"), - ] + print("Framework is :" + str(env["PIOFRAMEWORK"])) + if "zephyr" in env["PIOFRAMEWORK"]: + FRAMEWORK_DIR = env.PioPlatform().get_package_dir("framework-zephyr") + env.Execute( + " ".join( + [ + "$PYTHONEXE", + '"%s"' % join(FRAMEWORK_DIR, "scripts", "uf2conv.py"), + "-c", + "-f", + "RP2040", + "-b", + board.get("upload.offset_address", "0x10000000"), + "-o", + '"%s"' % elf_file.replace(".elf", ".uf2"), + '"%s"' % elf_file, + ] + ) + ) + else: + env.Execute( + " ".join( + [ + "elf2uf2", + '"%s"' % elf_file, + '"%s"' % elf_file.replace(".elf", ".uf2"), + ] + ) ) - ) env = DefaultEnvironment() diff --git a/platform.py b/platform.py index 94eab8f..a64009e 100644 --- a/platform.py +++ b/platform.py @@ -59,6 +59,7 @@ class RaspberrypiPlatform(PlatformBase): if p in ("tool-cmake", "tool-dtc", "tool-ninja"): self.packages[p]["optional"] = False self.packages["toolchain-gccarmnoneeabi"]["version"] = "~1.80201.0" + self.packages.pop("toolchain-rp2040-earlephilhower", None) if not IS_WINDOWS: self.packages["tool-gperf"]["optional"] = False