Add bazel build, and some CMake function docs

This commit is contained in:
William Vinnicombe 2025-09-15 14:07:13 +01:00
parent 71c3dadd97
commit 27d41e67e6
8 changed files with 100 additions and 2 deletions

View file

@ -11,6 +11,7 @@ cc_library(
"queue.c",
],
hdrs = [
"include/pico/util/bitset.h",
"include/pico/util/datetime.h",
"include/pico/util/pheap.h",
"include/pico/util/queue.h",

View file

@ -0,0 +1,19 @@
load("//bazel:defs.bzl", "compatible_with_rp2")
package(default_visibility = ["//visibility:public"])
cc_library(
name = "hardware_rosc",
srcs = ["rosc.c"],
hdrs = ["include/hardware/rosc.h"],
includes = ["include"],
target_compatible_with = compatible_with_rp2(),
deps = [
"//src/common/pico_base_headers",
"//src/rp2_common:hardware_regs",
"//src/rp2_common:hardware_structs",
"//src/rp2_common:pico_platform_internal",
"//src/rp2_common:platform_defs",
"//src/rp2_common/hardware_clocks:hardware_clocks_headers",
],
)

View file

@ -1 +1,2 @@
pico_simple_hardware_target(rosc)
pico_simple_hardware_target(rosc)
pico_mirrored_target_link_libraries(hardware_rosc INTERFACE hardware_clocks)

View file

@ -0,0 +1,22 @@
load("//bazel:defs.bzl", "compatible_with_rp2")
package(default_visibility = ["//visibility:public"])
cc_library(
name = "pico_low_power",
srcs = ["low_power.c"],
hdrs = ["include/pico/low_power.h"],
includes = ["include"],
target_compatible_with = compatible_with_rp2(),
deps = [
"//src/common/pico_time",
"//src/rp2_common:hardware_structs",
"//src/rp2_common:pico_platform",
"//src/rp2_common/hardware_clocks",
"//src/rp2_common/hardware_rosc",
"//src/rp2_common/hardware_xosc",
"//src/rp2_common/hardware_irq",
"//src/rp2_common/hardware_timer",
"//src/rp2_common/pico_aon_timer",
],
)

View file

@ -17,6 +17,17 @@ pico_mirrored_target_link_libraries(pico_low_power INTERFACE
pico_aon_timer
)
# pico_set_persistent_data_loc(TARGET PERSISTENT_DATA_LOC)
# \brief\ Set the persistent data location for the target
#
# This sets the target property PICO_TARGET_PERSISTENT_DATA_LOC to the given value,
# and also sets the target property PICO_TARGET_HEAP_LOC and PICO_TARGET_HEAP_LIMIT
# to the appropriate values based on the persistent data location.
#
# It also sets PICO_CRT0_PIN_XIP_SRAM=1 to pin the XIP_SRAM,
# if the persistent data is stored in XIP_SRAM on RP2350.
#
# \param\ PERSISTENT_DATA_LOC The persistent data location to set
function(pico_set_persistent_data_loc TARGET PERSISTENT_DATA_LOC)
if (NOT PICO_RP2350)
message(FATAL_ERROR "pico_set_persistent_data_loc is only supported on RP2350")

View file

@ -61,6 +61,12 @@ if (NOT TARGET pico_standard_link)
endif()
endfunction()
# pico_add_linker_constants(TARGET)
# \brief\ Add custom linker script constants to the target
#
# This reads target properties PICO_TARGET_PERSISTENT_DATA_LOC, PICO_TARGET_HEAP_LOC,
# and PICO_TARGET_HEAP_LIMIT and writes them to a linker script constant file, which
# is included by the linker script
function(pico_add_linker_constants TARGET)
set(pico_ld_constants_dir ${CMAKE_BINARY_DIR}/pico_ld_constants/${TARGET})

View file

@ -0,0 +1,38 @@
load("//bazel:defs.bzl", "compatible_with_rp2")
package(default_visibility = ["//visibility:public"])
cc_binary(
name = "hello_sleep",
testonly = True,
srcs = ["hello_sleep.c"],
target_compatible_with = compatible_with_rp2(),
deps = [
"//src/rp2_common/pico_stdlib",
"//src/rp2_common/pico_low_power",
"//src/rp2_common/pico_status_led",
],
)
cc_binary(
name = "hello_sleep_gpio",
testonly = True,
srcs = ["hello_sleep_gpio.c"],
target_compatible_with = compatible_with_rp2(),
deps = [
"//src/rp2_common/pico_stdlib",
"//src/rp2_common/pico_low_power",
"//src/rp2_common/pico_status_led",
],
)
cc_binary(
name = "rtc_clksrc",
testonly = True,
srcs = ["rtc_clksrc.c"],
target_compatible_with = compatible_with_rp2(),
deps = [
"//src/rp2_common/pico_stdlib",
"//src/rp2_common/pico_status_led",
],
)

View file

@ -486,7 +486,7 @@ function(pico_embed_pt_in_binary TARGET PTFILE)
)
endfunction()
# pico_encrypt_binary(TARGET AESFILE IVFILE [SIGFILE <file>] [EMBED] [MBEDTLS] [OTP_KEY_PAGE <page>])
# pico_encrypt_binary(TARGET AESFILE IVFILE [SIGFILE <file>] [EMBED] [MBEDTLS] [OTP_KEY_PAGE <page>] [NO_CLEAR])
# \brief_nodesc\ Encrypt the taget binary
#
# Encrypt the target binary with the given AES key (should be a binary