@@ -125,7 +125,7 @@ if (CONFIG_CHIP_ROTATING_DEVICE_ID)
125
125
matter_add_gn_arg_bool("chip_enable_additional_data_advertising" TRUE )
126
126
endif ()
127
127
128
- if (CONFIG_WIFI_W91)
128
+ if (CONFIG_WIFI_W91)
129
129
matter_add_gn_arg_string("chip_mdns" "minimal" )
130
130
elseif (CONFIG_NET_L2_OPENTHREAD)
131
131
matter_add_gn_arg_string("chip_mdns" "platform" )
@@ -160,12 +160,11 @@ include(${TELINK_COMMON}/common.cmake)
160
160
161
161
set (BLOCK_SIZE "1024" )
162
162
163
- # get code-partition mcuboot_partition size
164
- dt_nodelabel(dts_partition_path NODELABEL "boot_partition" )
165
- dt_reg_size(mcuboot_size PATH ${dts_partition_path} )
166
- math (EXPR boot_blocks "${mcuboot_size} / ${BLOCK_SIZE} " OUTPUT_FORMAT DECIMAL)
167
-
168
163
if (CONFIG_BOOTLOADER_MCUBOOT)
164
+ dt_nodelabel(dts_partition_path NODELABEL "boot_partition" )
165
+ dt_reg_size(mcuboot_size PATH ${dts_partition_path} )
166
+ math (EXPR boot_blocks "${mcuboot_size} / ${BLOCK_SIZE} " OUTPUT_FORMAT DECIMAL)
167
+
169
168
add_custom_target (build_mcuboot ALL
170
169
COMMAND
171
170
west build -b ${BASE_BOARD} -d build_mcuboot ${ZEPHYR_BASE} /../bootloader/mcuboot/boot/zephyr
@@ -183,31 +182,30 @@ if (CONFIG_BOOTLOADER_MCUBOOT)
183
182
184
183
add_dependencies (merge_mcuboot ${ZEPHYR_FINAL_EXECUTABLE} )
185
184
186
- if (CONFIG_CHIP_OTA_IMAGE_BUILD)
187
- chip_ota_image(chip-ota-image
188
- INPUT_FILES ${PROJECT_BINARY_DIR} /zephyr.signed.bin
189
- OUTPUT_FILE ${PROJECT_BINARY_DIR} /zephyr-ota.bin
190
- )
185
+ if (CONFIG_CHIP_OTA_IMAGE_BUILD)
186
+ chip_ota_image(chip-ota-image
187
+ INPUT_FILES ${PROJECT_BINARY_DIR} /zephyr.signed.bin
188
+ OUTPUT_FILE ${PROJECT_BINARY_DIR} /zephyr-ota.bin
189
+ )
191
190
192
- add_dependencies (chip-ota-image ${ZEPHYR_FINAL_EXECUTABLE} )
193
- endif ()
191
+ add_dependencies (chip-ota-image ${ZEPHYR_FINAL_EXECUTABLE} )
192
+ endif ()
194
193
endif ()
195
194
196
- # get code-partition factory_partition address
197
- dt_nodelabel(dts_partition_path NODELABEL "factory_partition" )
198
- dt_reg_addr(factory_size PATH ${dts_partition_path} )
199
- math (EXPR factory_blocks "${factory_size} / ${BLOCK_SIZE} " OUTPUT_FORMAT DECIMAL)
200
-
201
195
if (CONFIG_CHIP_FACTORY_DATA_MERGE_WITH_FIRMWARE)
202
- add_custom_target (merge_factory_data ALL
203
- COMMAND
204
- dd if=${PROJECT_BINARY_DIR} /factory/factory_data.bin of=${PROJECT_BINARY_DIR} /zephyr.bin bs=${BLOCK_SIZE} seek=${factory_blocks}
205
- )
206
- if (CONFIG_CHIP_OTA_IMAGE_BUILD)
207
- add_dependencies (merge_factory_data merge_mcuboot)
208
- else ()
209
- add_dependencies (merge_factory_data ${ZEPHYR_FINAL_EXECUTABLE} )
210
- endif ()
196
+ dt_nodelabel(dts_partition_path NODELABEL "factory_partition" )
197
+ dt_reg_addr(factory_size PATH ${dts_partition_path} )
198
+ math (EXPR factory_blocks "${factory_size} / ${BLOCK_SIZE} " OUTPUT_FORMAT DECIMAL)
199
+
200
+ add_custom_target (merge_factory_data ALL
201
+ COMMAND
202
+ dd if=${PROJECT_BINARY_DIR} /factory/factory_data.bin of=${PROJECT_BINARY_DIR} /zephyr.bin bs=${BLOCK_SIZE} seek=${factory_blocks}
203
+ )
204
+ if (CONFIG_CHIP_OTA_IMAGE_BUILD)
205
+ add_dependencies (merge_factory_data merge_mcuboot)
206
+ else ()
207
+ add_dependencies (merge_factory_data ${ZEPHYR_FINAL_EXECUTABLE} )
208
+ endif ()
211
209
endif ()
212
210
213
211
# ==============================================================================
@@ -218,4 +216,27 @@ if (CONFIG_CHIP_FACTORY_DATA_BUILD)
218
216
telink_generate_factory_data()
219
217
endif ()
220
218
219
+ if (CONFIG_SOC_SERIES_RISCV_TELINK_W91 AND CONFIG_TELINK_W91_FETCH_N22_BIN)
220
+ dt_nodelabel(flash_path NODELABEL "flash" )
221
+ dt_reg_size(flash_size PATH ${flash_path} )
222
+ math (EXPR flash_blocks "${flash_size} / ${BLOCK_SIZE} " OUTPUT_FORMAT DECIMAL)
223
+
224
+ add_custom_target (merge_n22 ALL
225
+ COMMAND
226
+ [ -f ${PROJECT_BINARY_DIR} /n22.bin ] && (
227
+ dd if=/dev/zero bs=${BLOCK_SIZE} count=${flash_blocks} | tr '\\000' '\\377' > ${PROJECT_BINARY_DIR} /merged.bin &&
228
+ dd if=${PROJECT_BINARY_DIR} /zephyr.bin of=${PROJECT_BINARY_DIR} /merged.bin conv=notrunc &&
229
+ dd if=${PROJECT_BINARY_DIR} /n22.bin of=${PROJECT_BINARY_DIR} /merged.bin bs=${BLOCK_SIZE} seek=${flash_blocks} conv=notrunc
230
+ ) || true
231
+ )
232
+
233
+ if (CONFIG_CHIP_FACTORY_DATA_MERGE_WITH_FIRMWARE)
234
+ add_dependencies (merge_n22 merge_factory_data)
235
+ elseif (CONFIG_CHIP_OTA_IMAGE_BUILD)
236
+ add_dependencies (merge_n22 merge_mcuboot)
237
+ else ()
238
+ add_dependencies (merge_n22 ${ZEPHYR_FINAL_EXECUTABLE} )
239
+ endif ()
240
+ endif ()
241
+
221
242
endif () # CONFIG_CHIP
0 commit comments