| load("@rules_cc//cc:cc_library.bzl", "cc_library") |
| load("//bazel/util:pico_linker_scripts.bzl", "linker_scripts") |
| |
| package( |
| default_visibility = [ |
| "//src/rp2350:__subpackages__", |
| "//src/rp2_common:__pkg__", |
| ], |
| ) |
| |
| cc_library( |
| name = "pico_platform_internal", |
| hdrs = [ |
| "include/pico/asm_helper.S", |
| "include/pico/platform.h", |
| "include/pico/platform/cpu_regs.h", |
| ], |
| includes = ["include"], |
| target_compatible_with = ["//bazel/constraint:rp2350"], |
| |
| # Be extra careful about who references this for now; if users depend on |
| # this but not `pico_platform` they'll end up with undefined symbols. |
| # It's generally safe for anything that circularly depends on |
| # //src/rp2_common:pico_platform to be added to this allowlist because |
| # that implicitly means the transitive dependencies of pico_platform will |
| # get linked in. |
| visibility = [ |
| "//src/rp2_common:__pkg__", |
| ], |
| deps = [ |
| "//src/rp2350/hardware_regs", |
| "//src/rp2350/hardware_regs:platform_defs", |
| "//src/rp2_common/pico_platform_common:pico_platform_common_headers", |
| "//src/rp2_common/pico_platform_compiler", |
| "//src/rp2_common/pico_platform_panic:pico_platform_panic_headers", |
| "//src/rp2_common/pico_platform_sections", |
| ], |
| ) |
| |
| cc_library( |
| name = "pico_platform", |
| srcs = ["platform.c"], |
| includes = ["include"], |
| target_compatible_with = ["//bazel/constraint:rp2350"], |
| deps = [ |
| ":pico_platform_internal", |
| "//src/common/pico_base_headers", |
| "//src/rp2350/hardware_regs", |
| "//src/rp2350/hardware_regs:platform_defs", |
| "//src/rp2_common/hardware_base", |
| "//src/rp2_common/pico_platform_common", |
| "//src/rp2_common/pico_platform_compiler", |
| "//src/rp2_common/pico_platform_panic", |
| "//src/rp2_common/pico_platform_sections", |
| "//src/rp2_common/pico_standard_link", |
| ], |
| ) |
| |
| exports_files( |
| [ |
| "memmap_copy_to_ram.ld", |
| "memmap_default.ld", |
| "memmap_no_flash.ld", |
| "memmap_xip_ram.ld", |
| ], |
| ) |
| |
| linker_scripts( |
| name = "memmap_default", |
| link_scripts = ["memmap_default.ld"], |
| ) |
| |
| linker_scripts( |
| name = "memmap_copy_to_ram", |
| link_scripts = ["memmap_copy_to_ram.ld"], |
| ) |
| |
| linker_scripts( |
| name = "memmap_no_flash", |
| link_scripts = ["memmap_no_flash.ld"], |
| ) |
| |
| linker_scripts( |
| name = "memmap_xip_ram", |
| link_scripts = ["memmap_xip_ram.ld"], |
| ) |
| |
| cc_library( |
| name = "default_linker_script", |
| target_compatible_with = ["//bazel/constraint:rp2350"], |
| visibility = [ |
| "//src/rp2_common/pico_standard_link:__pkg__", |
| ], |
| # The order of the linker scripts below is important. |
| # Prevent buildifier from reordering them. |
| # buildifier: leave-alone |
| deps = [ |
| "//src/rp2_common/pico_crt0:no_warn_rwx_flag", |
| "//src/rp2350/pico_platform/script_include:rp2350_linker_scripts", |
| "//src/rp2_common/pico_standard_link/script_include:rp2_linker_scripts", |
| "//src/rp2_common/pico_standard_link:default_flash_region", |
| "//src/rp2_common/pico_standard_link:default_psram_region", |
| "memmap_default", |
| ], |
| ) |
| |
| # 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 |
| cc_library( |
| name = "copy_to_ram_linker_script", |
| target_compatible_with = ["//bazel/constraint:rp2350"], |
| visibility = [ |
| "//src/rp2_common/pico_standard_link:__pkg__", |
| ], |
| # The order of the linker scripts below is important. |
| # Prevent buildifier from reordering them. |
| # buildifier: leave-alone |
| deps = [ |
| "//src/rp2_common/pico_crt0:no_warn_rwx_flag", |
| "//src/rp2350/pico_platform/script_include:rp2350_linker_scripts", |
| "//src/rp2_common/pico_standard_link/script_include:rp2_linker_scripts", |
| "//src/rp2_common/pico_standard_link:default_flash_region", |
| "//src/rp2_common/pico_standard_link:default_psram_region", |
| "memmap_copy_to_ram", |
| ], |
| ) |
| |
| # 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 |
| cc_library( |
| name = "no_flash_linker_script", |
| target_compatible_with = ["//bazel/constraint:rp2350"], |
| visibility = [ |
| "//src/rp2_common/pico_standard_link:__pkg__", |
| ], |
| # The order of the linker scripts below is important. |
| # Prevent buildifier from reordering them. |
| # buildifier: leave-alone |
| deps = [ |
| "//src/rp2_common/pico_crt0:no_warn_rwx_flag", |
| "//src/rp2350/pico_platform/script_include:rp2350_linker_scripts", |
| "//src/rp2_common/pico_standard_link/script_include:rp2_linker_scripts", |
| "//src/rp2_common/pico_standard_link:default_psram_region", |
| "memmap_no_flash", |
| ], |
| ) |
| |
| # PICO_BUILD_DEFINE: PICO_XIP_RAM, whether this is a 'xip_ram' build, type=bool, default=0, but dependent on CMake options, group=pico_standard_link |
| cc_library( |
| name = "xip_ram_linker_script", |
| target_compatible_with = ["//bazel/constraint:rp2350"], |
| visibility = [ |
| "//src/rp2_common/pico_standard_link:__pkg__", |
| ], |
| # The order of the linker scripts below is important. |
| # Prevent buildifier from reordering them. |
| # buildifier: leave-alone |
| deps = [ |
| "//src/rp2_common/pico_crt0:no_warn_rwx_flag", |
| "//src/rp2350/pico_platform/script_include:rp2350_linker_scripts", |
| "//src/rp2_common/pico_standard_link/script_include:rp2_linker_scripts", |
| "//src/rp2_common/pico_standard_link:default_psram_region", |
| "memmap_xip_ram", |
| ], |
| ) |