|
1 | 1 | # |
2 | | -# Copyright (c) 2022-2023 Nordic Semiconductor |
| 2 | +# Copyright (c) 2022-2024 Nordic Semiconductor |
3 | 3 | # |
4 | 4 | # SPDX-License-Identifier: LicenseRef-Nordic-5-Clause |
5 | 5 | # |
6 | 6 |
|
7 | | -function(fast_pair_hex) |
| 7 | +function(fast_pair_hex_pm) |
8 | 8 | set(fp_partition_name bt_fast_pair) |
9 | 9 |
|
10 | 10 | set( |
@@ -47,4 +47,76 @@ function(fast_pair_hex) |
47 | 47 | ) |
48 | 48 | endfunction() |
49 | 49 |
|
50 | | -fast_pair_hex() |
| 50 | +function(fast_pair_hex_dts) |
| 51 | + include(${CMAKE_CURRENT_LIST_DIR}/suit_utilities.cmake) |
| 52 | + |
| 53 | + if(NOT SB_CONFIG_SOC_SERIES_NRF54HX) |
| 54 | + message(FATAL_ERROR "Fast Pair data provisioning using DTS partitions is only supported" |
| 55 | + "for nRF54H series.") |
| 56 | + endif() |
| 57 | + |
| 58 | + set(fp_partition_name bt_fast_pair_partition) |
| 59 | + |
| 60 | + sysbuild_dt_nodelabel( |
| 61 | + bt_fast_pair_partition_nodelabel |
| 62 | + IMAGE |
| 63 | + ${DEFAULT_IMAGE} |
| 64 | + NODELABEL |
| 65 | + "${fp_partition_name}" |
| 66 | + ) |
| 67 | + sysbuild_dt_reg_addr( |
| 68 | + bt_fast_pair_partition_relative_address |
| 69 | + IMAGE |
| 70 | + ${DEFAULT_IMAGE} |
| 71 | + PATH |
| 72 | + "${bt_fast_pair_partition_nodelabel}" |
| 73 | + ) |
| 74 | + |
| 75 | + # This part assumes that the Fast Pair partition resides in MRAM1x. |
| 76 | + # TODO: Rewrite it to be more generic and support other memory regions. |
| 77 | + sysbuild_dt_nodelabel(mram1x_nodelabel IMAGE ${DEFAULT_IMAGE} NODELABEL "mram1x") |
| 78 | + sysbuild_dt_reg_addr(mram1x_address IMAGE ${DEFAULT_IMAGE} PATH "${mram1x_nodelabel}") |
| 79 | + |
| 80 | + math( |
| 81 | + EXPR |
| 82 | + bt_fast_pair_partition_address |
| 83 | + "${mram1x_address} + ${bt_fast_pair_partition_relative_address}" |
| 84 | + OUTPUT_FORMAT |
| 85 | + HEXADECIMAL) |
| 86 | + |
| 87 | + set( |
| 88 | + fp_provisioning_data_hex |
| 89 | + ${CMAKE_BINARY_DIR}/modules/nrf/subsys/bluetooth/services/fast_pair/fp_provisioning_data.hex |
| 90 | + ) |
| 91 | + |
| 92 | + set(fp_provisioning_data_address ${bt_fast_pair_partition_address}) |
| 93 | + |
| 94 | + add_custom_command( |
| 95 | + OUTPUT |
| 96 | + ${fp_provisioning_data_hex} |
| 97 | + COMMAND |
| 98 | + ${PYTHON_EXECUTABLE} ${ZEPHYR_NRF_MODULE_DIR}/scripts/nrf_provision/fast_pair/fp_provision_cli.py |
| 99 | + -o ${fp_provisioning_data_hex} -a ${fp_provisioning_data_address} |
| 100 | + -m ${FP_MODEL_ID} -k ${FP_ANTI_SPOOFING_KEY} |
| 101 | + COMMENT |
| 102 | + "Generating Fast Pair provisioning data hex file" |
| 103 | + USES_TERMINAL |
| 104 | + ) |
| 105 | + |
| 106 | + add_custom_target( |
| 107 | + ${fp_partition_name}_target |
| 108 | + ALL |
| 109 | + DEPENDS |
| 110 | + "${fp_provisioning_data_hex}" |
| 111 | + ) |
| 112 | + |
| 113 | + suit_add_merge_hex_file(FILES ${fp_provisioning_data_hex} |
| 114 | + DEPENDENCIES ${fp_partition_name}_target |
| 115 | + ) |
| 116 | +endfunction() |
| 117 | + |
| 118 | +if(SB_CONFIG_PARTITION_MANAGER) |
| 119 | + fast_pair_hex_pm() |
| 120 | +else() |
| 121 | + fast_pair_hex_dts() |
| 122 | +endif() |
0 commit comments