1# Copyright (c) 2023 Intel Corporation
2#
3# SPDX-License-Identifier: Apache-2.0
4#
5
6if(CONFIG_PM)
7set_property(GLOBAL APPEND PROPERTY extra_post_build_commands
8  COMMAND ${CMAKE_OBJCOPY} -O binary --remove-section=aon
9      ${ZEPHYR_BINARY_DIR}/${KERNEL_ELF_NAME} ${PROJECT_BINARY_DIR}/ish_kernel.bin
10
11  COMMAND ${CMAKE_OBJCOPY} -O binary --only-section=aon
12      ${ZEPHYR_BINARY_DIR}/${KERNEL_ELF_NAME} ${PROJECT_BINARY_DIR}/ish_aon.bin
13
14  COMMAND ${PYTHON_EXECUTABLE} ${CMAKE_CURRENT_LIST_DIR}/build_ish_firmware.py
15  -k ${PROJECT_BINARY_DIR}/ish_kernel.bin
16  -a ${PROJECT_BINARY_DIR}/ish_aon.bin
17  -o ${PROJECT_BINARY_DIR}/ish_fw.bin
18)
19else()
20set_property(GLOBAL APPEND PROPERTY extra_post_build_commands
21  COMMAND ${PYTHON_EXECUTABLE} ${CMAKE_CURRENT_LIST_DIR}/build_ish_firmware.py
22  ARGS -k ${PROJECT_BINARY_DIR}/${CONFIG_KERNEL_BIN_NAME}.bin
23  -o ${PROJECT_BINARY_DIR}/ish_fw.bin
24)
25endif()
26