1package(default_visibility = ["//visibility:public"])
2
3exports_files(
4    [
5        "memmap_copy_to_ram.ld",
6        "memmap_default.ld",
7        "memmap_no_flash.ld",
8    ]
9)
10
11# It's possible to set linker scripts globally or on a per-binary basis.
12#
13# Setting globally:
14#   * Set --@pico-sdk//bazel/config:PICO_DEFAULT_LINKER_SCRIPT to point to your
15#     desired linker script.
16#
17# Setting per-binary:
18#   * Set --@pico-sdk//bazel/config:PICO_DEFAULT_LINKER_SCRIPT=@pico-sdk//bazel:empty_cc_lib
19#   * Manually add your desired linker script to each cc_binary.
20cc_library(
21    name = "default_linker_script",
22    linkopts = ["-T$(location memmap_default.ld)"],
23    target_compatible_with = ["//bazel/constraint:rp2350"],
24    deps = [
25        "memmap_default.ld",
26        "//src/rp2_common/pico_crt0:no_warn_rwx_flag",
27        "//src/rp2_common/pico_standard_link:default_flash_region",
28    ],
29)
30
31# PICO_BUILD_DEFINE: PICO_COPY_TO_RAM, whether this is a 'copy_to_ram' build, type=bool, default=0, but dependent on CMake options, group=pico_standard_link
32cc_library(
33    name = "copy_to_ram_linker_script",
34    defines = ["PICO_COPY_TO_RAM=1"],
35    linkopts = ["-T$(location memmap_copy_to_ram.ld)"],
36    target_compatible_with = ["//bazel/constraint:rp2350"],
37    deps = [
38        "memmap_copy_to_ram.ld",
39        "//src/rp2_common/pico_crt0:no_warn_rwx_flag",
40        "//src/rp2_common/pico_standard_link:default_flash_region",
41    ],
42)
43
44# PICO_BUILD_DEFINE: PICO_NO_FLASH, whether this is a 'no_flash' build, type=bool, default=0, but dependent on CMake options, group=pico_standard_link
45cc_library(
46    name = "no_flash_linker_script",
47    defines = ["PICO_NO_FLASH=1"],
48    linkopts = ["-T$(location memmap_no_flash.ld)"],
49    target_compatible_with = ["//bazel/constraint:rp2350"],
50    deps = [
51        "memmap_no_flash.ld",
52        "//src/rp2_common/pico_crt0:no_warn_rwx_flag",
53    ],
54)
55