1load("//bazel:defs.bzl", "compatible_with_rp2")
2
3package(default_visibility = ["//visibility:public"])
4
5# Picotool needs this (transitively through
6# //src/rp2_common/pico_bootrom:pico_bootrom_headers), so we can't strictly
7# constrain compatibility.
8cc_library(
9    name = "pico_flash_headers",
10    hdrs = ["include/pico/flash.h"],
11    includes = ["include"],
12    visibility = ["//src/rp2_common/pico_bootrom:__pkg__"],
13    deps = [
14        "//src:pico_platform_internal",
15    ],
16)
17
18cc_library(
19    name = "pico_flash",
20    srcs = ["flash.c"],
21    defines = select({
22        "//bazel/constraint:pico_freertos_unset": ["PICO_FREERTOS_LIB=0"],
23        "//conditions:default": ["PICO_FREERTOS_LIB=1"],
24    }),
25    target_compatible_with = compatible_with_rp2(),
26    deps = [
27        ":pico_flash_headers",
28        "//src/common/pico_time",
29        "//src/rp2_common:pico_platform",
30        "//src/rp2_common/hardware_exception",
31        "//src/rp2_common/hardware_flash",
32        "//src/rp2_common/hardware_sync",
33        "//src/rp2_common/pico_multicore",
34    ] + select({
35        "//bazel/constraint:pico_freertos_unset": [],
36        "//conditions:default": ["//bazel/config:PICO_FREERTOS_LIB"],
37    }),
38)
39