1# Copyright (c) 2022 Cypress Semiconductor Corporation.
2#
3# SPDX-License-Identifier: Apache-2.0
4
5set(hal_dir               ${ZEPHYR_HAL_INFINEON_MODULE_DIR})
6set(hal_cat1cm0p_dir      ${hal_dir}/cat1cm0p)
7set(hal_blobs_dir         ${hal_dir}/zephyr/blobs/img/cat1cm0p/COMPONENT_CM0P_SLEEP)
8set(blob_gen_dir          ${ZEPHYR_BINARY_DIR}/include/generated)
9set(blob_gen_inc_file     ${blob_gen_dir}/psoc6_cm0p_sleep.bin.inc)
10
11if(CONFIG_SOC_DIE_PSOC6_01)
12    set(blob_bin_file ${hal_blobs_dir}/psoc6_01_cm0p_sleep.bin)
13endif()
14
15if(CONFIG_SOC_DIE_PSOC6_02)
16    set(blob_bin_file ${hal_blobs_dir}/psoc6_02_cm0p_sleep.bin)
17endif()
18
19if(CONFIG_SOC_DIE_PSOC6_03)
20    set(blob_bin_file ${hal_blobs_dir}/psoc6_03_cm0p_sleep.bin)
21endif()
22
23if(CONFIG_SOC_DIE_PSOC6_04)
24    set(blob_bin_file ${hal_blobs_dir}/psoc6_04_cm0p_sleep.bin)
25endif()
26
27# Generate Include binaries and add source of psoc6_cm0p_sleep.c
28if(EXISTS ${blob_bin_file})
29    # Generate Include binaries
30    generate_inc_file_for_target(app ${blob_bin_file} ${blob_gen_inc_file})
31
32    # psoc6_cm0p_sleep.c - template c-array file, which include generated
33    # blob include file.
34    zephyr_library_sources(${hal_cat1cm0p_dir}/COMPONENT_CM0P_SLEEP/psoc6_cm0p_sleep.c)
35else()
36    message(WARNING "Can't find CM0+ binaries, please execute: \'west blobs fetch hal_infineon\' ")
37endif()
38