blob: b668ce0151c8ea53fd1c860c413c8c292452270e [file] [log] [blame]
Austin Schuh0a96ea32022-01-01 22:29:30 -08001def bin_from_elf(name, target_compatible_with = None):
2 native.genrule(
3 name = name,
4 srcs = ["%s.elf" % name],
5 outs = ["%s.bin" % name],
6 cmd = "$(OBJCOPY) -Obinary $< $@",
7 executable = True,
8 output_to_bindir = True,
9 target_compatible_with = target_compatible_with,
Philipp Schrader33b5e802022-02-06 22:17:41 -080010 toolchains = ["//tools/cpp:cc_toolchain_make_variables"],
Austin Schuh0a96ea32022-01-01 22:29:30 -080011 )
12
13def uf2_from_elf(name, target_compatible_with = None):
14 native.genrule(
15 name = name,
16 srcs = ["%s.elf" % name],
17 outs = ["%s.uf2" % name],
18 cmd = "$(location //third_party/pico-sdk/tools/elf2uf2) $< $@",
19 executable = True,
20 output_to_bindir = True,
21 target_compatible_with = target_compatible_with,
22 tools = [
23 "//third_party/pico-sdk/tools/elf2uf2",
24 ],
25 )
Ravago Jones281800e2023-02-13 02:24:07 -080026
27def pioasm(name, src, out, target_compatible_with = None):
28 native.genrule(
29 name = name,
30 srcs = [src],
31 outs = [out],
32 cmd = "$(location //third_party/pico-sdk/tools/pioasm) -o c-sdk $< $@",
33 executable = True,
34 output_to_bindir = True,
35 target_compatible_with = target_compatible_with,
36 tools = [
37 "//third_party/pico-sdk/tools/pioasm",
38 ],
39 )