1if(CONFIG_NXP_MONOLITHIC_WIFI OR CONFIG_NXP_MONOLITHIC_BT OR CONFIG_NXP_MONOLITHIC_IEEE802154)
2	set(hal_blobs_dir ${ZEPHYR_HAL_NXP_MODULE_DIR}/zephyr/blobs/rw61x)
3
4	set(signed_binary_blobs_list)
5	set(binary_blobs_list)
6	set(output_includes_list)
7
8	if(CONFIG_NXP_MONOLITHIC_WIFI)
9		list(APPEND output_includes_list ${ZEPHYR_BINARY_DIR}/include/generated/rw61x_wifi_fw.bin.inc)
10
11		set(signed_binary_blob_name rw61x_sb_wifi_a2.bin)
12
13		list(APPEND signed_binary_blobs_list ${hal_blobs_dir}/${signed_binary_blob_name})
14
15		zephyr_library_sources(${CMAKE_CURRENT_LIST_DIR}/rw61x_cpu1.c)
16	endif()
17	if(CONFIG_NXP_MONOLITHIC_IEEE802154)
18		list(APPEND output_includes_list ${ZEPHYR_BINARY_DIR}/include/generated/rw61x_combo_fw.bin.inc)
19
20		set(signed_binary_blob_name rw61x_sb_combo_a2.bin)
21
22		list(APPEND signed_binary_blobs_list ${hal_blobs_dir}/${signed_binary_blob_name})
23
24		zephyr_library_sources(${CMAKE_CURRENT_LIST_DIR}/rw61x_cpu2.c)
25	elseif(CONFIG_NXP_MONOLITHIC_BT)
26		list(APPEND output_includes_list ${ZEPHYR_BINARY_DIR}/include/generated/rw61x_ble_fw.bin.inc)
27
28		set(signed_binary_blob_name rw61x_sb_ble_a2.bin)
29
30		list(APPEND signed_binary_blobs_list ${hal_blobs_dir}/${signed_binary_blob_name})
31
32		zephyr_library_sources(${CMAKE_CURRENT_LIST_DIR}/rw61x_cpu2.c)
33	endif()
34
35	list(LENGTH signed_binary_blobs_list count)
36	math(EXPR count "${count}-1")
37	foreach(i RANGE ${count})
38		list(GET signed_binary_blobs_list ${i} signed_binary_blob)
39		if(EXISTS ${signed_binary_blob})
40			list(APPEND binary_blobs_list ${signed_binary_blob})
41		elseif(CONFIG_NXP_WIFI_BUILD_ONLY_MODE)
42			message(WARNING "Couldn't find signed firmware ! ${signed_binary_blob}")
43			list(APPEND binary_blobs_list "NOTFOUND")
44		else()
45			message(FATAL_ERROR "Couldn't find signed firmware ! ${signed_binary_blob}")
46		endif()
47
48	endforeach()
49
50	list(LENGTH binary_blobs_list count)
51	math(EXPR count "${count}-1")
52	foreach(i RANGE ${count})
53		list(GET binary_blobs_list ${i} binary_blob)
54		list(GET output_includes_list ${i} output_include)
55		message(STATUS " generate include of binary blob: ${binary_blob}")
56		if(${binary_blob} STREQUAL "NOTFOUND")
57			file(TOUCH ${output_include})
58		else()
59			generate_inc_file_for_target(${ZEPHYR_CURRENT_LIBRARY} ${binary_blob} ${output_include})
60		endif()
61	endforeach()
62endif()
63