Austin Schuh | 0a96ea3 | 2022-01-01 22:29:30 -0800 | [diff] [blame] | 1 | def 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 Schrader | 33b5e80 | 2022-02-06 22:17:41 -0800 | [diff] [blame^] | 10 | toolchains = ["//tools/cpp:cc_toolchain_make_variables"], |
Austin Schuh | 0a96ea3 | 2022-01-01 22:29:30 -0800 | [diff] [blame] | 11 | ) |
| 12 | |
| 13 | def 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 | ) |