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 | ) |
Ravago Jones | 281800e | 2023-02-13 02:24:07 -0800 | [diff] [blame] | 26 | |
| 27 | def 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 | ) |