Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

sysbuild: fast_pair: Separate provisioning data generation #20630

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions cmake/sysbuild/fast_pair_hex.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -143,6 +143,10 @@ function(fast_pair_hex_dts)
)
endfunction()

if(NOT DEFINED FP_MODEL_ID OR NOT DEFINED FP_ANTI_SPOOFING_KEY)
message(FATAL_ERROR "Automatic Fast Pair provisioning data generation is enabled but `FP_MODEL_ID` or `FP_ANTI_SPOOFING_KEY` were not provided.")
endif()

if(SB_CONFIG_PARTITION_MANAGER)
fast_pair_hex_pm()
else()
Expand Down
8 changes: 0 additions & 8 deletions subsys/bluetooth/services/fast_pair/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -38,11 +38,3 @@ if(CONFIG_BT_FAST_PAIR_FMDN)
add_subdirectory(fmdn)
target_link_libraries(fast_pair PRIVATE fmdn)
endif()

zephyr_get(FP_DATA_PRESENT MERGE SYSBUILD)

if(NOT FP_DATA_PRESENT AND TARGET zephyr_interface)
zephyr_compile_definitions(
FP_DATA_NOT_PRESENT
)
endif()
4 changes: 0 additions & 4 deletions subsys/bluetooth/services/fast_pair/fp_registration_data.c
Original file line number Diff line number Diff line change
Expand Up @@ -46,10 +46,6 @@ static const uint8_t fp_magic[] = {0xFA, 0x57, 0xFA, 0x57};
#define FP_DATA_SIZE (FP_END_OFF - FP_DATA_START)
#define FP_OFFSET_TO_DATA_IDX(_offset) ((_offset) - FP_DATA_START)

#ifdef FP_DATA_NOT_PRESENT
#error "Fast Pair provisioning data was not provided with `FP_MODEL_ID` and `FP_ANTI_SPOOFING_KEY`"
#endif

BUILD_ASSERT(FP_END_OFF <= FP_PARTITION_SIZE, "Fast Pair registration data partition is too small");

static bool is_enabled;
Expand Down
23 changes: 12 additions & 11 deletions sysbuild/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -506,19 +506,20 @@ function(${SYSBUILD_CURRENT_MODULE_NAME}_pre_cmake)

if(SB_CONFIG_BT_FAST_PAIR)
set_config_bool(${DEFAULT_IMAGE} CONFIG_BT_FAST_PAIR y)
else()
set_config_bool(${DEFAULT_IMAGE} CONFIG_BT_FAST_PAIR n)
endif()

if(DEFINED FP_MODEL_ID AND DEFINED FP_ANTI_SPOOFING_KEY)
if(SB_CONFIG_PARTITION_MANAGER)
include(${ZEPHYR_NRF_MODULE_DIR}/cmake/sysbuild/fast_pair_hex.cmake)
endif()

set(FP_DATA_PRESENT "y" CACHE INTERNAL "Fast Pair provisioning data provided" FORCE)
else()
message(WARNING "Fast Pair support is enabled but `FP_MODEL_ID` or `FP_ANTI_SPOOFING_KEY` were not provided, this is likely to cause a build error")
set(FP_DATA_PRESENT "n" CACHE INTERNAL "Fast Pair provisioning data provided" FORCE)
if(SB_CONFIG_BT_FAST_PAIR_PROVISIONING_DATA_GENERATE)
if(SB_CONFIG_PARTITION_MANAGER)
include(${ZEPHYR_NRF_MODULE_DIR}/cmake/sysbuild/fast_pair_hex.cmake)
endif()
else()
set_config_bool(${DEFAULT_IMAGE} CONFIG_BT_FAST_PAIR n)
if(SB_CONFIG_BT_FAST_PAIR)
message(WARNING "Fast Pair support is enabled but automatic Fast Pair provisioning data generation is disabled. "
"If FP_MODEL_ID and FP_ANTI_SPOOFING_KEY were provided, they will be ignored. "
"This means that the Fast Pair provisioning data must be generated manually.")
endif()
endif()

if(SB_CONFIG_WIFI_NRF70)
Expand Down Expand Up @@ -655,7 +656,7 @@ function(${SYSBUILD_CURRENT_MODULE_NAME}_post_cmake)
set_property(GLOBAL PROPERTY DOMAIN_APP_APP ${DEFAULT_IMAGE})

# Include any files that need to merge files with uicr_merged.hex before including suit
if(FP_DATA_PRESENT AND NOT SB_CONFIG_PARTITION_MANAGER)
if(SB_CONFIG_BT_FAST_PAIR_PROVISIONING_DATA_GENERATE AND NOT SB_CONFIG_PARTITION_MANAGER)
include(${ZEPHYR_NRF_MODULE_DIR}/cmake/sysbuild/fast_pair_hex.cmake)
endif()

Expand Down
13 changes: 9 additions & 4 deletions sysbuild/Kconfig.bt_fast_pair
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,12 @@
config BT_FAST_PAIR
bool "Bluetooth Fast Pair support"
help
Enable this option to generate a Fast Pair provisioning data hex file and enable
Bluetooth Fast Pair support in the main image. Note that ``FP_MODEL_ID`` and
``FP_ANTI_SPOOFING_KEY`` variables must be supplied when configuring the application for
this functionality to be available.
Enable this option to enable Bluetooth Fast Pair support in the main image.

config BT_FAST_PAIR_PROVISIONING_DATA_GENERATE
bool "Generate Fast Pair provisioning data"
default y if BT_FAST_PAIR
help
Enable this option to generate a Fast Pair provisioning data hex file.
Note that ``FP_MODEL_ID`` and ``FP_ANTI_SPOOFING_KEY`` variables must be supplied when
configuring the application for this functionality to be available.