# OUTPUT type # 1 - .out # 2 - .a # 3 - .so OUTPUT_TYPE = 2 OUTPUT_NAME = ht ifeq ($(target), kunlun3) ifneq ($(build_amp_type), 1) SUB_DIRS += sbl endif else SUB_DIRS += sbl endif ifeq ($(rom_enable), 1) SUB_DIRS += rom else SUB_DIRS += driver ifneq ($(target), kunlun3) SUB_DIRS += sp else ifeq ($(dtest_only), 1) export MBEDTLS_NONE_ROM_EN = 0 else export MBEDTLS_NONE_ROM_EN = 1 endif ifeq ($(MBEDTLS_NONE_ROM_EN), 1) SUB_DIRS += $(TOPDIR)/import/mbedtls $(TOPDIR)/rom/riscv3/romlib/crypto/iotelic endif ifeq ($(sec_cpu_enable), 1) SUB_DIRS += sec_cpu PRE_MARCO += IOT_SEC_CPU_SUPPORT=1 else PRE_MARCO += IOT_SEC_CPU_SUPPORT=0 endif ifeq ($(dual_enable), 1) ifneq ($(build_amp_type), 1) SUB_DIRS += bb_cpu endif endif endif ifeq ($(product_line), PLC) ifneq ($(build_amp_type), 1) SUB_DIRS += ftm plc endif SUB_DIRS += import/wq_vtb endif ifeq ($(product_line), BT) SUB_DIRS += bt/fw endif ifeq ($(product_line), NB) SUB_DIRS += nbstack endif SUB_DIRS += common os startup pib ifneq ($(APP), 8) SUB_DIRS += import/lwip endif ifeq ($(target), kunlun3) ifneq ($(build_amp_type), 1) SUB_DIRS += mfgtool cli endif else SUB_DIRS += mfgtool cli endif ifeq ($(fatfs_enable), 1) SUB_DIRS += import/fatfs endif SUB_DIRS += ap endif # .h files dir ADD_INCLUDE = $(TOPDIR)/inc $(TOPDIR)/app/smart_grid/inc $(TOPDIR)/app/smart_grid/inc/internal $(TOPDIR)/inc/dbglog $(TOPDIR)/inc/hw $(TOPDIR)/export/inc $(TOPDIR)/export/inc/app $(TOPDIR)/export/inc/compiler/gcc \ $(TOPDIR)/export/inc/dbglog $(TOPDIR)/export/inc/os_shim $(TOPDIR)/export/inc/io_lib $(TOPDIR)/export/inc/pkt \ $(TOPDIR)/export/inc/plc_lib $(TOPDIR)/export/inc/uart $(TOPDIR)/export/inc/utils $(TOPDIR)/inc/io_lib \ $(TOPDIR)/export/inc/pib $(TOPDIR)/export/inc/upgrade $(TOPDIR)/export/inc/socket $(TOPDIR)/export/inc/bsp $(TOPDIR)/export/inc/gpio \ $(TOPDIR)/export/inc/cli $(TOPDIR)/export/inc/ipc $(TOPDIR)/export/inc/swc_lib $(TOPDIR)/export/inc/crypto $(TOPDIR)/export/inc/sg_lib $(TOPDIR)/export/inc/cnn $(TOPDIR)/export/inc/dnn $(TOPDIR)/export/inc/gp_timer ifeq ($(target), kunlun2) ADD_INCLUDE += $(TOPDIR)/rom/riscv2/crypto/mbedtls-2.4.0/include $(TOPDIR)/rom/riscv2/crypto/iotelic/inc else ifeq ($(target), kunlun3) ADD_INCLUDE += $(TOPDIR)/rom/riscv3/romlib/crypto/iotelic/inc \ $(TOPDIR)/rom/riscv3/romlib/crypto/iotelic/inc/mbedtls ifeq ($(MBEDTLS_NONE_ROM_EN), 1) ADD_INCLUDE += $(TOPDIR)/import/mbedtls/include \ $(TOPDIR)/import/mbedtls/include/psa else ADD_INCLUDE += $(TOPDIR)/rom/riscv3/romlib/crypto/mbedtls-2.4.0/include endif else ADD_INCLUDE += $(TOPDIR)/rom/riscv/crypto/mbedtls-2.4.0/include $(TOPDIR)/rom/riscv/crypto/iotelic/inc endif # predefined macro ifeq ($(mpu_enable), 1) PRE_MARCO += MPU_ENABLE endif ifeq ($(disable_print), 1) PRE_MARCO += DISABLE_PRINT endif ifeq ($(rf_enable), 1) PRE_MARCO += HPLC_RF_SUPPORT=1 endif ifeq ($(dual_enable), 1) PRE_MARCO += HPLC_RF_DEV_SUPPORT=1 else PRE_MARCO += HPLC_RF_DEV_SUPPORT=0 endif ifeq ($(PROTO_TYPE), p1901) PRE_MARCO += SUPPORT_IEEE_1901=1 endif ifeq ($(new_type_cco), 1) PRE_MARCO += INCLUDE_VIRTUAL_CHANNEL=1 endif ifneq ($(smart_cco_sta), ) PRE_MARCO += IOT_SMART_CONFIG=$(smart_cco_sta) else PRE_MARCO += IOT_SMART_CONFIG=0 smart_cco_sta = 0 endif ifeq ($(psram_enable), 1) PRE_MARCO += RUN_IN_PSRAM=1 PRE_MARCO += IOT_PSRAM_ENABLE=1 ifdef psram_size PRE_MARCO += IOT_PSRAM_SIZE=$(psram_size) else ifeq ($(cco), 1) PRE_MARCO += IOT_PSRAM_SIZE=4 else PRE_MARCO += IOT_PSRAM_SIZE=2 endif endif else PRE_MARCO += RUN_IN_PSRAM=0 PRE_MARCO += IOT_PSRAM_ENABLE=0 PRE_MARCO += IOT_PSRAM_SIZE=0 endif ifeq ($(smp_enable), 1) PRE_MARCO += RISCV_SMP_ENABLE=1 endif ifeq ($(eda_simu), 1) PRE_MARCO += EDA_SIMU_SUPPORT=1 endif ifeq ($(product_line), PLC) ifeq ($(ftm_build), 1) PRE_MARCO += PLC_SUPPORT_CCO_ROLE=0 IOT_FTM_SUPPORT=1 IOT_MP_SUPPORT=0 OUTPUT_NAME = ht_ftm else ifeq ($(cco), 1) PRE_MARCO += PLC_SUPPORT_CCO_ROLE=1 IOT_FTM_SUPPORT=1 IOT_MP_SUPPORT=1 OUTPUT_NAME = ht_cco else PRE_MARCO += PLC_SUPPORT_CCO_ROLE=0 IOT_FTM_SUPPORT=1 IOT_MP_SUPPORT=1 OUTPUT_NAME = ht_sta endif endif else ifeq ($(product_line), AI) OUTPUT_NAME = ht_ai endif ifeq ($(product_line), BT) OUTPUT_NAME = ht_bt endif ifeq ($(product_line), NB) OUTPUT_NAME = ht_nb endif endif ifeq ($(cpu1_build), 1) PRE_MARCO += RUN_ON_CPU_1=1 endif ifneq ($(hw_platform_ver),) PRE_MARCO += HW_PLATFORM_VER=$(hw_platform_ver) HW_HEADER_VER = $(hw_platform_ver) else ifeq ($(target), kunlun3) PRE_MARCO += HW_PLATFORM_VER=2 HW_HEADER_VER = 2 else PRE_MARCO += HW_PLATFORM_VER=15 HW_HEADER_VER = 15 endif endif ifneq ($(hw_board_id),) PRE_MARCO += HW_BOARD_ID=$(hw_board_id) else PRE_MARCO += HW_BOARD_ID=0 endif #define IOT_BUILD_AMP_NONE 0 #define IOT_BUILD_AMP_CUSTOM 1 #define IOT_BUILD_AMP_PLC 2 ifeq ($(build_amp_type), 1) PRE_MARCO += BUILD_AMP_TYPE=1 else ifeq ($(build_amp_type), 2) PRE_MARCO += BUILD_AMP_TYPE=2 else PRE_MARCO += BUILD_AMP_TYPE=0 endif endif ifeq ($(fastboot_mode), 1) PRE_MARCO += BUILD_FASTBOOT_MODE=1 endif ifneq ($(layout_index), ) PRE_MARCO += FLASH_LAYOUT_INDEX=$(layout_index) endif ifeq ($(pt_board_build), 2) PRE_MARCO += IOT_PT_BOARD_SELECT=$(pt_board_build) PRE_MARCO += PT_HARDWARE_VER=3 endif ifeq ($(opt_build), 1) ifeq ($(cco), 1) OPT_FLAG = -Os -fno-omit-frame-pointer else ifeq ($(flash_size), 4) OPT_FLAG = -Os -fno-omit-frame-pointer -msave-restore else ifeq ($(flash_size), 2) OPT_FLAG = -Os -msave-restore else ifeq ($(flash_size), 1) OPT_FLAG = -Os -msave-restore else OPT_FLAG = -Os endif endif else OPT_FLAG = -O0 endif ifneq ($(smart_cco_sta), 0) PRE_MARCO += ENABLE_WDT_DEFAULT=1 IOT_FLASH_BUILD=1 else ifeq ($(flash_build), 1) PRE_MARCO += ENABLE_WDT_DEFAULT=1 IOT_FLASH_BUILD=1 else PRE_MARCO += SHARE_IRQ_ENABLE endif endif ifeq ($(fpga_image_type), SOC) PRE_MARCO += FPGA_IMAGE_TYPE=0 else ifeq ($(fpga_image_type), AI) PRE_MARCO += FPGA_IMAGE_TYPE=1 else ifeq ($(fpga_image_type), BB) PRE_MARCO += FPGA_IMAGE_TYPE=2 else ifeq ($(fpga_image_type), A10) PRE_MARCO += FPGA_IMAGE_TYPE=3 else ifeq ($(fpga_image_type), AUDIO) PRE_MARCO += FPGA_IMAGE_TYPE=4 endif ifeq ($(product_line), PLC) PRE_MARCO += IOT_PRODUCT_LINE=0 else ifeq ($(product_line), AI) PRE_MARCO += IOT_PRODUCT_LINE=1 else ifeq ($(product_line), NB) PRE_MARCO += IOT_PRODUCT_LINE=2 else ifeq ($(product_line), BT) PRE_MARCO += IOT_PRODUCT_LINE=3 endif ifeq ($(gcc), arm) ADD_INCLUDE += $(TOPDIR)/inc/hw/reg/cm3/$(HW_HEADER_VER) else ifeq ($(target), kunlun2) ADD_INCLUDE += $(TOPDIR)/inc/hw/reg/riscv2/$(HW_HEADER_VER) else ifeq ($(target), kunlun3) ADD_INCLUDE += $(TOPDIR)/inc/hw/reg/riscv3/$(HW_HEADER_VER) \ $(TOPDIR)/inc/hw/reg/riscv3/$(HW_HEADER_VER)/soc/macro \ $(TOPDIR)/inc/hw/reg/riscv3/$(HW_HEADER_VER)/soc/struct \ $(TOPDIR)/inc/hw/reg/riscv3/$(HW_HEADER_VER)/plc/mac/parse_reg \ $(TOPDIR)/inc/hw/reg/riscv3/$(HW_HEADER_VER)/plc/phy/parse_reg \ $(TOPDIR)/inc/hw/reg/riscv3 else ADD_INCLUDE += $(TOPDIR)/inc/hw/reg/riscv/$(HW_HEADER_VER) endif endif endif # lib dir ADD_LIBDIR = startup pib ftm cli plc driver common os # lib need to ld together ADD_LIB = startup pib driver common os ifneq ($(build_amp_type), 1) ADD_LIB += ftm plc cli endif ifeq ($(APP), 5) SUB_DIRS += app/smart_grid ADD_LIBDIR += app/smart_grid ADD_LIB += smart_grid ADD_INCLUDE += $(TOPDIR)/export/inc/socket endif ifeq ($(APP), 6) SUB_DIRS += app/smart_grid ADD_LIBDIR += app/smart_grid ADD_LIB += smart_grid endif ifeq ($(APP), 7) ADD_INCLUDE += $(TOPDIR)/app/grapp $(TOPDIR)/app/grapp/lwmqtt/include $(TOPDIR)/app/grapp/httpd/inc $(TOPDIR)/app/grapp/ge_socket/inc $(TOPDIR)/import/lwip/lwip/src/include $(TOPDIR)/import/lwip/ports/include $(TOPDIR)/app/led_ctrl_app/controller SUB_DIRS += app/led_ctrl_app ADD_LIBDIR += app/led_ctrl_app ADD_LIB += grapp endif ifeq ($(APP), 8) ADD_INCLUDE += $(TOPDIR)/app/grapp $(TOPDIR)/app/grapp/lwmqtt/include $(TOPDIR)/app/grapp/httpd/inc $(TOPDIR)/app/grapp/ge_socket/inc $(TOPDIR)/import/lwip/lwip/src/include $(TOPDIR)/import/lwip/ports/include SUB_DIRS += app/iot_ge_lwip_app ADD_LIBDIR += app/iot_ge_lwip_app ADD_LIB += grapp endif ifeq ($(APP), 9) ADD_INCLUDE += $(TOPDIR)/app/grapp SUB_DIRS += app/grapp ADD_LIBDIR += app/grapp ADD_LIB += grapp endif ifeq ($(APP), 10) ADD_INCLUDE += $(TOPDIR)/app/grapp $(TOPDIR)/app/grapp/lwmqtt/include $(TOPDIR)/app/grapp/httpd/inc $(TOPDIR)/app/grapp/ge_socket/inc $(TOPDIR)/import/lwip/lwip/src/include $(TOPDIR)/import/lwip/ports/include SUB_DIRS += app/grapp app/grapp/lwmqtt/src app/grapp/httpd/src app/grapp/ge_socket/src ADD_LIBDIR += app/grapp ADD_LIB += grapp endif ifeq ($(APP), 22) ADD_INCLUDE += $(TOPDIR)/app/grapp $(TOPDIR)/app/grapp/lwmqtt/include $(TOPDIR)/app/grapp/httpd/inc $(TOPDIR)/app/grapp/ge_socket/inc $(TOPDIR)/import/lwip/lwip/src/include $(TOPDIR)/import/lwip/ports/include SUB_DIRS += app/iot_micro_cctt_app ADD_LIBDIR += app/iot_micro_cctt_app ADD_LIB += grapp endif ifeq ($(APP), 25) ADD_INCLUDE += $(TOPDIR)/import/lwip/lwip/src/include $(TOPDIR)/import/lwip/ports/include $(TOPDIR)/app/iot_cus_at_app/common $(TOPDIR)/app/iot_cus_at_app/driver SUB_DIRS += app/iot_micro_cctt_app ADD_LIBDIR += app/iot_micro_cctt_app ADD_LIB += endif # add import lib ADD_INCLUDE += $(TOPDIR)/import/sby/inc $(TOPDIR)/import/wq_vtb/ext_inc ADD_LIBDIR += import/wq_vtb ADD_LIB += wq_vtb ifeq ($(FLASH_SIZE), 2) SUB_DIRS += import ADD_LIBDIR += import ADD_LIB += sby endif ifeq ($(FLASH_SIZE), 4) SUB_DIRS += $(TOPDIR)/import ADD_LIBDIR += $(TOPDIR)/import ADD_LIB += sby endif # add fatfs ifeq ($(fatfs_enable), 1) ADD_LIBDIR += import/fatfs ADD_LIB += fatfs endif extra_work = echo cp $(OUTPUT_FULL_NAME) $(TOPDIR)/export/lib;\ cp $(OUTPUT_FULL_NAME) $(TOPDIR)/export/lib;\ $(STRIP) --strip-debug $(TOPDIR)/export/lib/*.a;\ echo "$(PRE_MARCO)" > $(TOPDIR)/export/lib/macro_config.ini;\ echo "$(GLOBAL_MACRO)" >> $(TOPDIR)/export/lib/macro_config.ini;\ ######################################################## #leave the lines below un-modified ######################################################## ifdef TOPDIR include $(TOPDIR)/build/makefile.cfg else include $(CURDIR)/build/makefile.cfg TOPDIR = $(CURDIR) export TOPDIR endif .PHONY:dtest dtest: @$(MAKE) -C $(TOPDIR)/dtest dtest_only=1 dtest_clean: ifneq ($(product_line), BT) @$(MAKE) -C $(TOPDIR)/plc/halphy clean endif @$(MAKE) -C $(TOPDIR)/dtest clean .PHONY:bootram bootram: @$(MAKE) -C $(TOPDIR)/mfgtool/bootram bootram_clean: @$(MAKE) -C $(TOPDIR)/mfgtool/bootram clean .PHONY:ram RAMDIR = $(TOPDIR)/mfgtool/ram ram: @$(MAKE) -C $(RAMDIR) ram_clean: @$(MAKE) -C $(RAMDIR) clean .PHONY:sbl sbl: @$(MAKE) -C $(TOPDIR)/sbl sbl_clean: @$(MAKE) -C $(TOPDIR)/sbl clean .PHONY:ah ah: @$(MAKE) -C $(TOPDIR)/mfgtool/ah ah_clean: @$(MAKE) -C $(TOPDIR)/mfgtool/ah clean .PHONY:lzma lzma: @$(MAKE) -C $(TOPDIR)/mfgtool/lzma lzma_clean: @$(MAKE) -C $(TOPDIR)/mfgtool/lzma clean .PHONY:oem_tool oem_tool: @$(MAKE) -C $(TOPDIR)/mfgtool/oem_tool oem_tool_clean: @$(MAKE) -C $(TOPDIR)/mfgtool/oem_tool clean # display the obj files and output name debug: @echo TOPDIR=$(TOPDIR) @echo OUTPUT_DIR=$(OUTPUT_DIR) @echo OUTPUT_MAP=$(OUTPUT_MAP) @echo OUTPUT_LIB=$(OUTPUT_FULL_NAME) @echo DEPS=$(DEPS) @echo OBJECTS=$(OBJECTS) @echo SRCS=$(SRCS) @echo OBJECTS folder=$(foreach dirname, $(SUB_DIRS), $(addprefix $(BIN_DIR)/, $(dirname))) @echo output_name=$(OUTPUT_FULL_NAME) @echo LINK_LIBS=$(LINK_LIBS) @echo MAKEDEP=$(MAKEDEP) @echo CC=$(CC)