Generate UF2 by default

This commit is contained in:
valeros 2021-04-30 18:31:52 +03:00
parent 1790e0fcbe
commit a2bb00cbaf

View File

@ -38,6 +38,19 @@ def BeforeUpload(target, source, env): # pylint: disable=W0613,W0621
env.Replace(UPLOAD_PORT=env.WaitForNewSerialPort(before_ports)) env.Replace(UPLOAD_PORT=env.WaitForNewSerialPort(before_ports))
def generate_uf2(target, source, env):
elf_file = target[0].get_path()
env.Execute(
" ".join(
[
join(platform.get_package_dir("tool-rp2040tools") or "", "elf2uf2"),
'"%s"' % elf_file,
'"%s"' % elf_file.replace(".elf", ".uf2"),
]
)
)
env = DefaultEnvironment() env = DefaultEnvironment()
platform = env.PioPlatform() platform = env.PioPlatform()
board = env.BoardConfig() board = env.BoardConfig()
@ -112,6 +125,10 @@ else:
AlwaysBuild(env.Alias("nobuild", target_firm)) AlwaysBuild(env.Alias("nobuild", target_firm))
target_buildprog = env.Alias("buildprog", target_firm, target_firm) target_buildprog = env.Alias("buildprog", target_firm, target_firm)
env.AddPostAction(
target_elf, env.VerboseAction(generate_uf2, "Generating UF2 image")
)
# #
# Target: Print binary size # Target: Print binary size
# #