blob: 5e9dfaee7a2921634e9cf6f7cc566d60073d7192 [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,
10 toolchains = ["@bazel_tools//tools/cpp:current_cc_toolchain"],
11 )
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 )