1load("//bazel:defs.bzl", "compatible_with_rp2")
2load("pico_flash_region.bzl", "generated_pico_flash_region")
3
4package(default_visibility = ["//visibility:public"])
5
6# This produces a small fragment of a linker script that is INCLUDEed from
7# the other linker scripts. For example:
8#
9#     FLASH(rx) : ORIGIN = 0x10000000, LENGTH = 4194304
10#
11# TODO: Make this a configurable flag.
12generated_pico_flash_region(
13    name = "default_flash_region",
14    flash_region_size = select({
15        "//bazel/constraint:rp2350": 4 * 1024 * 1024,
16        "//conditions:default": 2 * 1024 * 1024,
17    }),
18)
19
20cc_library(
21    name = "pico_standard_link",
22    target_compatible_with = compatible_with_rp2(),
23    deps = select({
24        # When PICO_BARE_METAL is enabled, don't automagically add link-time
25        # dependencies.
26        "//bazel/constraint:pico_baremetal_enabled": [],
27        "//conditions:default": [
28            "//bazel/config:PICO_BOOT_STAGE2_LINK_IMAGE",
29            "//bazel/config:PICO_CMSIS_PATH",
30            "//bazel/config:PICO_DEFAULT_BINARY_INFO",
31            "//bazel/config:PICO_DEFAULT_LINKER_SCRIPT",
32            "//src/rp2_common/pico_bit_ops",
33            "//src/rp2_common/pico_bootrom",
34            "//src/rp2_common/pico_clib_interface:pico_clib_interface_link",
35            "//src/rp2_common/pico_crt0",
36            "//src/rp2_common/pico_cxx_options:PICO_CXX_ENABLE_EXCEPTIONS",
37            "//src/rp2_common/pico_mem_ops",
38            "//src/rp2_common/pico_runtime:pico_runtime_link",
39            "//src/rp2_common/pico_runtime_init:pico_runtime_init_link",
40        ],
41    }),
42)
43