|
| 1 | +load("//bazel:defs.bzl", "otp_header_parse", "picotool_binary_data_header") |
| 2 | + |
1 | 3 | package(default_visibility = ["//visibility:public"])
|
2 | 4 |
|
| 5 | +picotool_binary_data_header( |
| 6 | + name = "rp2350_rom", |
| 7 | + src = "bootrom.end.bin", |
| 8 | + out = "rp2350.rom.h", |
| 9 | +) |
| 10 | + |
| 11 | +# TODO: Make it possible to build the prebuilt from source. |
| 12 | +picotool_binary_data_header( |
| 13 | + name = "xip_ram_perms_elf", |
| 14 | + src = "//xip_ram_perms:xip_ram_perms_prebuilt", |
| 15 | + out = "xip_ram_perms_elf.h", |
| 16 | +) |
| 17 | + |
| 18 | +cc_library( |
| 19 | + name = "xip_ram_perms", |
| 20 | + srcs = ["xip_ram_perms.cpp"], |
| 21 | + hdrs = [ |
| 22 | + "xip_ram_perms.h", |
| 23 | + "xip_ram_perms_elf.h", |
| 24 | + ], |
| 25 | + deps = [ |
| 26 | + "//bazel:data_locs", |
| 27 | + "//lib/whereami", |
| 28 | + ], |
| 29 | +) |
| 30 | + |
| 31 | +filegroup( |
| 32 | + name = "data_locs_header", |
| 33 | + srcs = ["data_locs.h"], |
| 34 | +) |
| 35 | + |
| 36 | +otp_header_parse( |
| 37 | + name = "otp_header", |
| 38 | + src = "@pico-sdk//src/rp2350/hardware_regs:otp_data_header", |
| 39 | + out = "rp2350.json.h", |
| 40 | +) |
| 41 | + |
3 | 42 | cc_binary(
|
4 | 43 | name = "picotool",
|
5 | 44 | srcs = [
|
6 | 45 | "cli.h",
|
7 | 46 | "clipp/clipp.h",
|
8 |
| - "elf.h", |
9 | 47 | "main.cpp",
|
10 |
| - "picoboot_connection/picoboot_connection.c", |
11 |
| - "picoboot_connection/picoboot_connection.h", |
12 |
| - "picoboot_connection/picoboot_connection_cxx.cpp", |
13 |
| - "picoboot_connection/picoboot_connection_cxx.h", |
| 48 | + "otp.cpp", |
| 49 | + "otp.h", |
| 50 | + "rp2350.json.h", |
| 51 | + "rp2350.rom.h", |
| 52 | + "xip_ram_perms.cpp", |
14 | 53 | ],
|
15 | 54 | copts = select({
|
16 |
| - "@platforms//os:windows": [], |
| 55 | + "@rules_cc//cc/compiler:msvc-cl": [ |
| 56 | + "/std:c++20", |
| 57 | + ], |
17 | 58 | "//conditions:default": [
|
18 | 59 | "-fexceptions",
|
19 | 60 | "-Wno-delete-non-abstract-non-virtual-dtor",
|
20 | 61 | "-Wno-reorder-ctor",
|
21 | 62 | "-Wno-unused-variable",
|
| 63 | + "-Wno-unused-but-set-variable", |
22 | 64 | ],
|
23 | 65 | }),
|
24 |
| - # TODO: There's probably a nicer way to do share this with CMake. |
25 | 66 | defines = [
|
26 |
| - 'PICOTOOL_VERSION=\\"1.1.3-rc1\\"', |
| 67 | + # TODO: There's probably a nicer way to share the version with CMake. |
| 68 | + 'PICOTOOL_VERSION=\\"2.0.0\\"', |
27 | 69 | 'SYSTEM_VERSION=\\"host\\"',
|
28 | 70 | 'COMPILER_INFO=\\"local\\"',
|
| 71 | + "SUPPORT_A0=0", |
| 72 | + "SUPPORT_A2=1", |
| 73 | + "PICOTOOL_CODE_OTP=0", |
| 74 | + # TODO: Make it possible to compile from source. |
| 75 | + "USE_PRECOMPILED=1", |
29 | 76 | ],
|
30 | 77 | # Windows does not behave nicely with the automagic force_dynamic_linkage_enabled.
|
31 | 78 | dynamic_deps = select({
|
32 | 79 | "@rules_libusb//:force_dynamic_linkage_enabled": ["@libusb//:libusb_dynamic"],
|
33 | 80 | "//conditions:default": [],
|
34 | 81 | }),
|
35 |
| - includes = ["picoboot_connection"], |
36 | 82 | deps = [
|
| 83 | + ":xip_ram_perms", |
| 84 | + "//bazel:data_locs", |
| 85 | + "//bintool", |
| 86 | + "//elf", |
| 87 | + "//elf2uf2", |
| 88 | + "//errors", |
| 89 | + "//lib/nlohmann_json:json", |
| 90 | + "//picoboot_connection", |
37 | 91 | "@libusb",
|
38 |
| - "@pico-sdk//src/common/boot_picoboot:boot_picoboot", |
39 |
| - "@pico-sdk//src/common/boot_uf2:boot_uf2", |
40 |
| - "@pico-sdk//src/common/pico_base:platform_defs", |
41 |
| - "@pico-sdk//src/common/pico_binary_info:pico_binary_info", |
| 92 | + "@pico-sdk//src/common/boot_picobin_headers", |
| 93 | + "@pico-sdk//src/common/boot_picoboot_headers", |
| 94 | + "@pico-sdk//src/common/boot_uf2_headers", |
| 95 | + "@pico-sdk//src/common/pico_base_headers", |
| 96 | + "@pico-sdk//src/common/pico_binary_info", |
| 97 | + "@pico-sdk//src/common/pico_usb_reset_interface_headers", |
| 98 | + "@pico-sdk//src/rp2350/hardware_regs:otp_data", |
| 99 | + "@pico-sdk//src/rp2_common/pico_bootrom:pico_bootrom_headers", |
42 | 100 | "@pico-sdk//src/rp2_common/pico_stdio_usb:reset_interface_headers",
|
43 | 101 | ],
|
44 | 102 | )
|
0 commit comments