Skip to content

Commit a2bb00c

Browse files
committed
Generate UF2 by default
1 parent 1790e0f commit a2bb00c

File tree

1 file changed

+17
-0
lines changed

1 file changed

+17
-0
lines changed

builder/main.py

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,19 @@ def BeforeUpload(target, source, env): # pylint: disable=W0613,W0621
3838
env.Replace(UPLOAD_PORT=env.WaitForNewSerialPort(before_ports))
3939

4040

41+
def generate_uf2(target, source, env):
42+
elf_file = target[0].get_path()
43+
env.Execute(
44+
" ".join(
45+
[
46+
join(platform.get_package_dir("tool-rp2040tools") or "", "elf2uf2"),
47+
'"%s"' % elf_file,
48+
'"%s"' % elf_file.replace(".elf", ".uf2"),
49+
]
50+
)
51+
)
52+
53+
4154
env = DefaultEnvironment()
4255
platform = env.PioPlatform()
4356
board = env.BoardConfig()
@@ -112,6 +125,10 @@ def BeforeUpload(target, source, env): # pylint: disable=W0613,W0621
112125
AlwaysBuild(env.Alias("nobuild", target_firm))
113126
target_buildprog = env.Alias("buildprog", target_firm, target_firm)
114127

128+
env.AddPostAction(
129+
target_elf, env.VerboseAction(generate_uf2, "Generating UF2 image")
130+
)
131+
115132
#
116133
# Target: Print binary size
117134
#

0 commit comments

Comments
 (0)