1# SPDX-License-Identifier: Apache-2.0 2 3zephyr_include_directories(.) 4zephyr_sources_ifdef(CONFIG_PM power.c) 5zephyr_sources( 6 scfg.c 7 registers.c 8) 9 10# Check for disabling header CRC. 11if (NOT DEFINED CONFIG_NPCX_HEADER_ENABLE_HEADER_CRC) 12 set(NPCX_HEADER_HCRC "-nohcrc") 13endif() 14 15# Check for disabling firmware CRC. 16if (NOT DEFINED CONFIG_NPCX_HEADER_ENABLE_FIRMWARE_CRC) 17 set(NPCX_HEADER_FCRC "-nofcrc") 18endif() 19 20if (DEFINED CONFIG_NPCX_IMAGE_OUTPUT_BIN) 21 set(NPCX_BIN_NAME ${CONFIG_KERNEL_BIN_NAME}.npcx.bin) 22 string(TOUPPER "${SOC_NAME}" soc_name_upper) 23 set_property(GLOBAL APPEND PROPERTY extra_post_build_commands 24 COMMAND ${PYTHON_EXECUTABLE} ${SOC_${soc_name_upper}_DIR}/common/ecst/ecst.py 25 -i ${KERNEL_BIN_NAME} 26 -o ${NPCX_BIN_NAME} 27 ${NPCX_HEADER_HCRC} ${NPCX_HEADER_FCRC} 28 -chip ${CONFIG_NPCX_HEADER_CHIP} 29 -flashsize ${CONFIG_NPCX_HEADER_FLASH_SIZE} 30 -spiclkratio ${CONFIG_NPCX_HEADER_CORE_CLOCK_SPI_CLOCK_RATIO} 31 -spimaxclk ${CONFIG_NPCX_HEADER_SPI_MAX_CLOCK} 32 -spireadmode ${CONFIG_NPCX_HEADER_SPI_READ_MODE} 33 ) 34 if (DEFINED CONFIG_NPCX_IMAGE_OUTPUT_HEX) 35 set(NPCX_HEX_NAME ${CONFIG_KERNEL_BIN_NAME}.npcx.hex) 36 # Property magic which makes west flash choose right file. 37 set_property(TARGET runners_yaml_props_target PROPERTY hex_file "${CONFIG_KERNEL_BIN_NAME}.npcx.hex") 38 set_property(GLOBAL APPEND PROPERTY extra_post_build_commands 39 COMMAND $<TARGET_PROPERTY:bintools,elfconvert_command> 40 $<TARGET_PROPERTY:bintools,elfconvert_flag> 41 $<TARGET_PROPERTY:bintools,elfconvert_flag_intarget>binary 42 $<TARGET_PROPERTY:bintools,elfconvert_flag_outtarget>ihex 43 $<TARGET_PROPERTY:bintools,elfconvert_flag_infile>${NPCX_BIN_NAME} 44 $<TARGET_PROPERTY:bintools,elfconvert_flag_outfile>${NPCX_HEX_NAME} 45 $<TARGET_PROPERTY:bintools,elfconvert_flag_final> 46 ) 47 endif() 48endif() 49