#Copyright(c) 2024 by Aerospace C.Power (Chongqing) Microelectronics. ALL RIGHTS RESERVED. #This Information is proprietary to Aerospace C.Power (Chongqing) Microelectronics and MAY NOT #be copied by any method or incorporated into another program without #the express written consent of Aerospace C.Power. This Information or any portion #thereof remains the property of Aerospace C.Power. The Information contained herein #is believed to be accurate and Aerospace C.Power assumes no responsibility or #liability for its use in any way and conveys no license or title under #any patent or copyright and makes no representation or warranty that this #Information is free from patent or copyright infringement. import("//build/buildcfg.gni") module_name = get_path_info(rebase_path("."), "name") kernel_module(module_name) { sources = [] include_dirs = [] } config("public") { include_dirs = [ ".", "include", "//inc", "//inc/config", "//inc/utils", "//inc/hw", "//inc/hw/reg", "//inc/io_lib", "//inc/plc_lib", "//inc/pib", "//inc/uart", "//inc/os_shim", "//inc/crypto", "//inc/compiler", "//inc/compiler/gcc", "//inc/ipc", "//inc/app", "//inc/pkt", "//inc/cli", "//inc/cli/plc", "//inc/dbglog", "//inc/dbglog/plc", "//inc/driver", "//inc/socket", "//inc/driver/flash", "//export/inc", "//export/inc/app", "//export/inc/config", "//export/inc/socket", "//export/inc/pib", "//export/inc/uart", "//export/inc/utils", "//export/inc/gpio", "//export/inc/io_lib", "//export/inc/gp_timer", "//export/inc/os_shim", "//export/inc/crypto", "//export/inc/bsp", "//export/inc/ipc", "//export/inc/sg_lib", "//export/inc/upgrade", "//export/inc/compiler", "//export/inc/compiler/gcc", "//export/inc/plc_lib", "//export/inc/pkt", "//export/inc/cli", "//export/inc/dbglog", "//cli/communicator", "//common/io_lib/inc", "//os/liteos_m/src/include", "//import/wq_vtb/ext_inc", "//plc/inc", "//driver/inc", "//os/freertos/src/include", "//os/freertos/src/portable/RISCV", ] if (target == "kunlun3") { include_dirs += [ "//inc/hw/reg/riscv3", "//inc/hw/reg/riscv3/2", "//inc/hw/reg/riscv3/2/plc/mac/parse_reg", "//inc/hw/reg/riscv3/2/plc/phy/parse_reg", "//inc/hw/reg/riscv3/2/soc/macro", "//inc/hw/reg/riscv3/2/soc/struct", "//startup/riscv3/inc", "//driver/src/hw3/inc", ] } defines = [ "typeof=__typeof__", "asm=__asm", ] ldflags = [ "-Wl,-T" + rebase_path("${kl_ld_script}"), "-Wl,-u_printf_float", ] if (target == "kunlun3") { if (sec_cpu_enable == "1") { defines += ["IOT_SEC_CPU_SUPPORT=1"] } else { defines += ["IOT_SEC_CPU_SUPPORT=0"] } } if (mpu_enable == "1") { defines += ["MPU_ENABLE"] } if (disable_print == "1") { defines += ["DISABLE_PRINT"] } if (rf_enable == "1") { defines += ["HPLC_RF_SUPPORT=1"] } if (dual_enable == "1") { defines += ["HPLC_RF_DEV_SUPPORT=1"] } else { defines += ["HPLC_RF_DEV_SUPPORT=0"] } if (PROTO_TYPE == "p1901") { defines += ["SUPPORT_IEEE_1901=1"] } if(defined(new_type_cco)) { if (new_type_cco == "1") { defines += ["INCLUDE_VIRTUAL_CHANNEL=1"] } } if (defined(smart_cco_sta)) { if (smart_cco_sta != "") { defines += ["IOT_SMART_CONFIG=${smart_cco_sta}"] } else { defines += ["IOT_SMART_CONFIG=0"] smart_cco_sta = "0" } } else { defines += ["IOT_SMART_CONFIG=0"] smart_cco_sta = "0" } if (psram_enable == "1") { defines += ["RUN_IN_PSRAM=1","IOT_PSRAM_ENABLE=1"] if (defined(psram_size)) { defines += ["IOT_PSRAM_SIZE=${psram_size}"] } else { if (cco == "1"){ defines += ["IOT_PSRAM_SIZE=4"] } else { defines += ["IOT_PSRAM_SIZE=2"] } } } else { defines += [ "RUN_IN_PSRAM=0", "IOT_PSRAM_ENABLE=0", "IOT_PSRAM_SIZE=0" ] } if (product_line == "PLC") { if (ftm_build == "1") { defines += [ "PLC_SUPPORT_CCO_ROLE=0", "IOT_FTM_SUPPORT=1", "IOT_MP_SUPPORT=0" ] } else { if (cco == "1") { defines += [ "PLC_SUPPORT_CCO_ROLE=1", "IOT_FTM_SUPPORT=1", "IOT_MP_SUPPORT=1" ] } else { defines += [ "PLC_SUPPORT_CCO_ROLE=0", "IOT_FTM_SUPPORT=1", "IOT_MP_SUPPORT=1" ] } } } if (cpu1_build == "1"){ defines += ["RUN_ON_CPU_1=1"] } if (hw_platform_ver != "") { defines += ["HW_PLATFORM_VER=${hw_platform_ver}"] } else { if (target == "kunlun3") { defines += ["HW_PLATFORM_VER=2"] } else { defines += ["HW_PLATFORM_VER=15"] } } if (build_amp_type == "1") { defines += ["BUILD_AMP_TYPE=1"] } else { if (build_amp_type == "2") { defines += ["BUILD_AMP_TYPE=2"] } else { defines += ["BUILD_AMP_TYPE=0"] } } if (fastboot_mode == "1") { defines += ["BUILD_FASTBOOT_MODE=1"] } if (layout_index != "") { defines += ["FLASH_LAYOUT_INDEX=${layout_index}"] } if (smart_cco_sta != "0") { defines += ["ENABLE_WDT_DEFAULT=1", "IOT_FLASH_BUILD=1"] } else { if (flash_build == "1") { defines += ["ENABLE_WDT_DEFAULT=1", "IOT_FLASH_BUILD=1"] } else { defines += ["SHARE_IRQ_ENABLE"] } } if (product_line == "PLC") { defines += ["IOT_PRODUCT_LINE=0"] } else { assert(false,"product_line value error.") } if (gcc == "riscv") { defines += ["RISCV"] } if (PLATFORM == "") { defines += ["HW_PLATFORM=1"] } else if (PLATFORM == "FPGA") { defines += ["HW_PLATFORM=1"] } else if (PLATFORM == "CHIP") { defines += ["HW_PLATFORM=2"] } if (!defined(HW_CHIP_ID)) { HW_CHIP_ID = "HZ" } if (HW_CHIP_ID == "HZ") { defines += ["HW_CHIP_ID=1"] } else if (HW_CHIP_ID == "WQ") { defines += ["HW_CHIP_ID=2"] } else { defines += ["HW_CHIP_ID=3"] } if (product_line == "PLC") { if (APP == "") { defines += ["IOT_APP_SELECTION=0"] } else { defines += ["IOT_APP_SELECTION=${APP}"] } } if (FLASH_SIZE == "") { defines += ["IOT_FLASH_SIZE=1"] } else { defines += ["IOT_FLASH_SIZE=${FLASH_SIZE}"] } if (!defined(PLC_SUPPORT_3_PHASE)) { if (cco == "1") { defines += ["PLC_SUPPORT_3_PHASE=1"] } } else { defines += ["PLC_SUPPORT_3_PHASE=${PLC_SUPPORT_3_PHASE}"] } if (target == "kunlun2") { defines += ["TARGET_VERSION=2"] } else if (target == "kunlun3") { defines += ["TARGET_VERSION=3"] } else { defines += ["TARGET_VERSION=1"] } libs = [ "c", "m", "nosys", ] }