diff --git a/BUILD.gn b/BUILD.gn index 29367b9..133c05c 100644 --- a/BUILD.gn +++ b/BUILD.gn @@ -5,12 +5,11 @@ import("//build/buildcfg.gni") - +exe_bin="ht" module_name = get_path_info(rebase_path("."), "name") -executable("kunlun.out"){ - deps=[":$module_name"] +executable(exe_bin){ link_path=rebase_path("${kl_ld_script}") link_file=get_path_info(link_path,"file") link_dir=get_path_info(link_path,"dir") @@ -18,7 +17,15 @@ executable("kunlun.out"){ "-Wl,-T" + link_file, "-Wl,-u_printf_float", "-L" + link_dir, + "-Wl,--gc-sections",# 移除未使用的段 可以解决一些函数未定义问题 + "-Wall", + "-Wextra", + "-nostartfiles", + "-Wl,-Map,${exe_bin}.map", ] + output_name = exe_bin + output_extension = "elf" + deps=[":$module_name"] } diff --git a/app/smart_grid/BUILD.gn b/app/smart_grid/BUILD.gn index c163a90..3072040 100644 --- a/app/smart_grid/BUILD.gn +++ b/app/smart_grid/BUILD.gn @@ -15,111 +15,107 @@ module_name = "kl_sdk" kernel_module(module_name) { sources = [ - "cco/iot_sg_cco_min_clct_v28.c", - "cco/iot_sg_ext_cco.c", - "cco/iot_sg_cco_net_info.c", - "cco/iot_sg_cco_buf.c", - # "cco/iot_sg_cco_sw_branch_detect.c", - "cco/iot_sg_cco_active_qr.c", - "cco/iot_cco_buf.c", "cco/iot_sg_cco_pw_tsfm.c", - "cco/iot_sg_cco_pm_score.c", - "cco/iot_sg_cco.c", - "cco/iot_gw_app_cco.c", - "cco/iot_sg_cco_x4.c", - "cco/iot_sg_cco_clock_manage.c", - "cco/iot_sg_cco_lp_meter.c", - "cco/iot_sg_cco_cmd.c", - "cco/iot_sg_cco_upgrade.c", - "cco/iot_sg_cco_acm.c", - # "cco/iot_sg_cco_bd_common.c", - "cco/iot_sg_cco_addr_map.c", - "cco/iot_sg_cco_cli.c", - "cco/iot_sg_cco_predict_mr.c", - "cco/iot_sg_cco_qr_cnt.c", - "cco/iot_sg_cco_branch_detect.c", - # "cco/iot_sg_cco_optics.c", - "cco/iot_sg_cco_nli_cfg.c", + "cco/iot_sg_cco_min_clct_v28.c", "cco/iot_sg_cco_flash.c", - "cco/iot_sg_cco_edge_computing.c", + "cco/iot_gw_app_cco.c", + "cco/iot_sg_cco_net_info.c", + "cco/iot_sg_cco.c", + "cco/iot_sg_cco_clock_manage.c", + "cco/iot_cco_buf.c", + "cco/iot_sg_cco_cli.c", + "cco/iot_sg_cco_x4.c", + "cco/iot_sg_cco_buf.c", "cco/iot_nw_app_cco.c", + "cco/iot_sg_cco_active_qr.c", + "cco/iot_sg_cco_lp_meter.c", + "cco/iot_sg_cco_pm_score.c", "cco/iot_sg_cco_bd_id_map.c", + "cco/iot_sg_cco_upgrade.c", + "cco/iot_sg_ext_cco.c", + "cco/iot_sg_cco_predict_mr.c", "cco/iot_conn_less_app_cco.c", - # "cco/iot_sg_cco_min_clct_nw.c", - "common/iot_sg_ext.c", + "cco/iot_sg_cco_addr_map.c", + "cco/iot_sg_cco_branch_detect.c", + "cco/iot_sg_cco_cmd.c", + "cco/iot_sg_cco_acm.c", + "cco/iot_sg_cco_edge_computing.c", + "cco/iot_sg_cco_qr_cnt.c", + "cco/iot_sg_cco_nli_cfg.c", "common/iot_sg.c", + "common/iot_sg_ext.c", + "common/swc_lib/iot_swc_api_cco.c", "common/swc_lib/iot_swc_lib.c", "common/swc_lib/iot_swc_api.c", - "common/swc_lib/iot_swc_api_cco.c", "common/flash/iot_sg_flash.c", - "driver/sta/iot_sg_sta_drv_hx_pm.c", - "driver/sta/iot_sg_sta_drv_pm.c", - "driver/sta/iot_sg_sta_drv_hx_dlms_pm.c", + "driver/cco/iot_sg_cco_drv.c", + "driver/cco/iot_nw_drv_cctt.c", + "driver/cco/iot_gw_drv_cli.c", + "driver/cco/iot_gw_drv_cctt.c", + "driver/cco/iot_gw_drv_fj.c", "driver/sta/iot_sg_sta_drv_wapper_pm.c", "driver/sta/iot_sg_sta_drv_iec_pm.c", + "driver/sta/iot_sg_sta_drv_hx_pm.c", "driver/sta/iot_sg_sta_drv_collector_i.c", + "driver/sta/iot_sg_sta_drv.c", + "driver/sta/iot_sg_sta_drv_ct2_proto_irext.c", + "driver/sta/iot_sg_sta_drv_pm.c", "driver/sta/iot_sg_sta_drv_ct2_proto_irext_spg.c", "driver/sta/iot_sg_sta_drv_nw_collector_i.c", - "driver/sta/iot_sg_sta_drv_qsxj.c", "driver/sta/iot_sg_sta_drv_test.c", + "driver/sta/iot_sg_sta_drv_qsxj.c", "driver/sta/iot_sg_sta_drv_collector_ii.c", - "driver/sta/iot_sg_sta_drv_ct2_proto_irext.c", + "driver/sta/iot_sg_sta_drv_hx_dlms_pm.c", "driver/sta/iot_sg_sta_drv_1662_pm.c", - "driver/cco/iot_sg_cco_drv.c", - "driver/cco/iot_gw_drv_fj.c", - "driver/cco/iot_gw_drv_cli.c", - "driver/cco/iot_nw_drv_cctt.c", - "driver/cco/iot_gw_drv_cctt.c", - "protocol/proto_69845.c", - "protocol/proto_wapper.c", - "protocol/proto_645_fj.c", - "protocol/proto_iec_yj.c", - "protocol/proto_645_topo.c", - "protocol/proto_mwc.c", - "protocol/proto_3762.c", - "protocol/proto_69845_vendor.c", - "protocol/proto_645_vendor.c", - "protocol/proto_hx_dlms.c", - "protocol/proto_645.c", - "protocol/proto_1662.c", - "protocol/proto_qsxj.c", - "protocol/proto_spg.c", - "protocol/proto_dlms.c", - "protocol/proto_acm.c", - "protocol/proto_3761.c", - "protocol/proto_188.c", "protocol/tools/proto_crc16.c", - "sta/iot_sg_sta_ext_ec.c", - # "sta/iot_sg_sta_ext_sm_done_evt.c", - "sta/iot_sg_sta.c", - # "sta/iot_sg_sta_drv.c", + "protocol/proto_hx_dlms.c", + "protocol/proto_spg.c", + "protocol/proto_qsxj.c", + "protocol/proto_645_fj.c", + "protocol/proto_69845_vendor.c", + "protocol/proto_dlms.c", + "protocol/proto_1662.c", + "protocol/proto_wapper.c", + "protocol/proto_iec_yj.c", + "protocol/proto_acm.c", + "protocol/proto_69845.c", + "protocol/proto_188.c", + "protocol/proto_645_vendor.c", + "protocol/proto_mwc.c", + "protocol/proto_3761.c", + "protocol/proto_645.c", + "protocol/proto_3762.c", + "protocol/proto_645_topo.c", + "sta/iot_sg_ext_sta.c", "sta/iot_sg_sta_ext_js.c", + "sta/iot_sg_sta_ext_nli.c", + "sta/iot_sg_sta_ext_mf.c", + "sta/iot_sg_sta_flash.c", "sta/iot_sg_sta_gw_v28.c", - "sta/iot_sg_sta_ext.c", + "sta/iot_sg_sta_ext_tm.c", + "sta/iot_sg_sta_ext_lr.c", + "sta/iot_sg_sta_gw.c", + "sta/iot_sg_sta_ext_fj.c", + "sta/iot_sg_sta.c", + "sta/iot_sg_sta_ext_gw.c", + "sta/iot_sg_sta_ext_nw.c", + "sta/iot_sg_sta_ext_ai.c", + "sta/iot_sg_sta_ext_score.c", "sta/iot_sg_sta_tsfm.c", + "sta/iot_sg_sta_ext_ec.c", + "sta/iot_sg_sta_upgrade.c", + "sta/iot_sg_sta_ext.c", + "sta/iot_sg_sta_topo.c", + "sta/iot_sg_sta_ext_comm.c", "sta/iot_sg_sta_zc.c", "sta/iot_sg_sta_ext_x4.c", "sta/iot_sg_sta_nw.c", - "sta/iot_sg_sta_ext_upgrade.c", - "sta/iot_sg_sta_flash.c", - "sta/iot_sg_ext_sta.c", - "sta/iot_sg_sta_ext_nli.c", - "sta/iot_sg_sta_topo.c", - "sta/iot_sg_sta_ext_nw.c", - "sta/iot_sg_sta_ext_mf.c", - "sta/iot_sg_sta_ext_fj.c", - "sta/iot_sg_sta_upgrade.c", - "sta/iot_sg_sta_gw.c", - # "sta/iot_sg_sta_ext_pm_score.c", - # "sta/iot_sg_sta_ext_sta_score.c", - "sta/iot_sg_sta_ext_ai.c", - "sta/iot_sg_sta_ext_gw.c", - "sta/iot_sg_sta_ext_lr.c", - "sta/iot_sg_sta_ext_comm.c", - "sta/iot_sg_sta_conn_less.c", - "sta/iot_sg_sta_ext_tm.c", "sta/iot_sg_sta_cfg_flash.c", - ] + "sta/iot_sg_sta_ext_upgrade.c", + "sta/iot_sg_sta_conn_less.c", + + +] include_dirs = [ "//app/smart_grid/inc", "//app/smart_grid/inc/internal", diff --git a/build/BUILD.gn b/build/BUILD.gn index d072256..51642e2 100644 --- a/build/BUILD.gn +++ b/build/BUILD.gn @@ -12,9 +12,7 @@ config("compiler_defaults") { cflags = [ "-mabi=ilp32f", "-march=rv32imafc", - "-Os", "-falign-functions=2", - "-msave-restore", "-fno-optimize-strlen", "-freorder-blocks-algorithm=simple", "-fno-schedule-insns", @@ -27,12 +25,17 @@ config("compiler_defaults") { "-fdata-sections", "-fno-exceptions", "-fno-short-enums", - "-D__LITEOS__M", "-nostartfiles", "-mstrict-align", "-Wno-error=unused-function", "-Wno-error=unused-but-set-variable", "-ffast-math", + "-ffunction-sections", + "-fdata-sections", + "-fno-common", + "-fno-builtin-printf", + "-Os", + "-msave-restore", ] cflags_cc = cflags ldflags = cflags diff --git a/build/build_flash_kl3.sh b/build/build_flash_kl3.sh index c2c6ee3..5ecbc0a 100755 --- a/build/build_flash_kl3.sh +++ b/build/build_flash_kl3.sh @@ -687,6 +687,168 @@ build_prepare export HW_CHIP_ID="${DEF_CHIP_ID}" +select_ld_script() { + local LD_SCRIPT="" + if [ "${target}" == "kunlun3" ]; then + if [ "${flash_build}" == "1" ]; then + # define plc only lds + if [ "${build_amp_type}" == "0" ]; then + if [ "${cco}" == "1" ]; then + if [ "${psram_enable}" == "1" ]; then + LD_SCRIPT=link_psram_8m_cco_plc_only.lds + else + if [ "${flash_size}" == "2" ]; then + LD_SCRIPT=link_flash_2m_cco_plc_only.lds + else + LD_SCRIPT=link_flash_4m_cco_plc_only.lds + fi + fi + else + if [ "${psram_enable}" == "1" ]; then + LD_SCRIPT=link_psram_8m_sta_plc_only.lds + else + if [ "${flash_size}" == "2" ]; then + LD_SCRIPT=link_flash_2m_sta_plc_only.lds + else + LD_SCRIPT=link_flash_4m_sta_plc_only.lds + fi + fi + fi + else + # define customer-core lds of AMP + if [ "${psram_enable}" == "1" ]; then + if [ "${cco}" == "1" ]; then + if [ "${psram_enable}" == "1" ]; then + # for fastboot-mode specialized + if [ "${fastboot_mode}" == "1" ]; then + LD_SCRIPT=link_psram_8m_cus_cco_fb.lds + # for normal mode + else + LD_SCRIPT=link_psram_8m_cus_cco.lds + fi + else + LD_SCRIPT=link_flash_2m_cus_cco.lds + fi + else + if [ "${psram_enable}" == "1" ]; then + # for fastboot-mode specialized + if [ "${fastboot_mode}" == "1" ]; then + LD_SCRIPT=link_psram_8m_cus_sta_fb.lds + # for normal mode + else + LD_SCRIPT=link_psram_8m_cus_sta.lds + fi + else + LD_SCRIPT=link_flash_2m_cus_sta.lds + fi + fi + else + # define plc-core lds of AMP + if [ "${cco}" == "1" ]; then + if [ "${psram_enable}" == "1" ]; then + LD_SCRIPT=link_psram_8m_cco.lds + else + LD_SCRIPT=link_flash_2m_cco.lds + fi + else + if [ "${psram_enable}" == "1" ]; then + LD_SCRIPT=link_psram_8m_sta.lds + else + LD_SCRIPT=link_flash_2m_sta.lds + fi + fi + fi + fi + else + LD_SCRIPT=link.lds + fi + fi + echo ${LD_SCRIPT} +} + +build_use_ninja() { + local BUILD_FOLDER=$(pwd) + if [[ "${DEF_IMAGE_TYPE}" == *"cco"* ]]; then + # cco is 3201 + local file_path="config.gni" + local chip="htzd3201" + local mode="cco" + elif [ "${DEF_IMAGE_TYPE}" == "ckb" ]; then + # ckb is 3201 + local file_path="config.gni" + local chip="htzd3201" + local mode="sta" + elif [[ "${DEF_IMAGE_TYPE}" == *"sta"* ]]; then + local file_path="config.gni" + local chip="htzd3211" + local mode="sta" + elif [ "${DEF_IMAGE_TYPE}" == "ftm" ]; then + # ftm is 3211 + local file_path="config.gni" + local chip="htzd3211" + local mode="ftm" + else + echo "wrong value with DEF_IMAGE_TYPE:${DEF_IMAGE_TYPE}" + exit 1 + fi + local ld_script=$(select_ld_script) + if [ "${target}" == "kunlun3" ]; then + local lds_path=$(realpath "${BUILD_FOLDER}/../startup/ldscripts/riscv3/${ld_script}") + else + echo "wrong value with target:${target}" + exit 1 + fi + if [ "${build_amp_type}" == "1" ]; then + local tmp_lds="../tools/gen_img/tmp_cus.lds" + else + local tmp_lds="../tools/gen_img/tmp_plc.lds" + fi + + echo "fastboot_mode=\"${fastboot_mode}\"" > ${file_path} + echo "flash_size=\"${flash_size}\"" >> ${file_path} + echo "psram_enable=\"${psram_enable}\"" >> ${file_path} + echo "psram_size=\"${psram_size}\"" >> ${file_path} + echo "layout_index=\"${layout_index}\"" >> ${file_path} + echo "HW_CHIP_ID=\"${HW_CHIP_ID}\"" >> ${file_path} + echo "PROTO_TYPE=\"${PROTO_TYPE}\"" >> ${file_path} + echo "rf_enable=\"${rf_enable}\"" >> ${file_path} + echo "dual_enable=\"${dual_enable}\"" >> ${file_path} + echo "build_amp_type=\"${build_amp_type}\"" >> ${file_path} + echo "sec_cpu_enable=\"${sec_cpu_enable}\"" >> ${file_path} + echo "cco=\"${cco}\"" >> ${file_path} + echo "os_type=\"${os_type}\"" >> ${file_path} + echo "new_type_cco=\"${new_type_cco}\"" >> ${file_path} + echo "soft_float_enable=\"${soft_float_enable}\"" >> ${file_path} + echo "smart_cco_sta=\"${smart_cco_sta}\"" >> ${file_path} + echo "ckb=\"${ckb}\"" >> ${file_path} + echo "gdb_debug_enable=\"${gdb_debug_enable}\"" >> ${file_path} + + echo "disable_print=\"${disable_print}\"" >> ${file_path} + echo "hw_platform_ver=\"${hw_platform_ver}\"" >> ${file_path} + echo "gcc=\"${gcc}\"" >> ${file_path} + echo "target=\"${target}\"" >> ${file_path} + echo "ftm_build=\"${ftm_build}\"" >> ${file_path} + echo "opt_build=\"${opt_build}\"" >> ${file_path} + echo "flash_build=\"${flash_build}\"" >> ${file_path} + echo "cpu1_build=\"${cpu1_build}\"" >> ${file_path} + echo "mpu_enable=\"${mpu_enable}\"" >> ${file_path} + echo "release_build=\"${release_build}\"" >> ${file_path} + echo "product_line=\"${product_line}\"" >> ${file_path} + echo "PLATFORM=\"$1\"" >> ${file_path} + echo "APP=\"$2\"" >> ${file_path} + echo "FLASH_SIZE=\"$3\"" >> ${file_path} + echo "kl_ld_script=\"${lds_path}\"" >> ${file_path} + + echo "cp ${lds_path} to ${tmp_lds}" + cp ${lds_path} ${tmp_lds} + cd ../ + gn gen out/build + ninja -C out/build + + cd ${BUILD_FOLDER} +} + + build_obj_func() { IMG_TYPE=$(echo $1 | tr '[A-Z]' '[a-z]') APP_SELECTION=$2 @@ -787,10 +949,11 @@ build_obj_func() { else export cco=1 . ${SRC_ENV_FILE} - if [ "${DEF_CLEANUP}" == "true" ]; then - ./make.py -j APP=${APP_SELECTION} -C .. clobber - fi - ./make.py -j PLATFORM=${DEF_PLATFORM_TYPE} cco=1 APP=${APP_SELECTION} FLASH_SIZE=${FLASH_SIZE_nM} -C .. + # if [ "${DEF_CLEANUP}" == "true" ]; then + # ./make.py -j APP=${APP_SELECTION} -C .. clobber + # fi + # ./make.py -j PLATFORM=${DEF_PLATFORM_TYPE} cco=1 APP=${APP_SELECTION} FLASH_SIZE=${FLASH_SIZE_nM} -C .. + build_use_ninja ${DEF_PLATFORM_TYPE} ${APP_SELECTION} ${FLASH_SIZE_nM} if [ "${APP_SELECTION}" == "${DEF_CUS_APP}" ]; then #kl3 customer demo, cus_core. cp ../ap/.output/cus/lib/ht_cco.bin ../tools/gen_img/ht_cus.bin @@ -844,10 +1007,11 @@ build_obj_func() { else export cco=0 . ${SRC_ENV_FILE} - if [ "${DEF_CLEANUP}" == "true" ]; then - ./make.py -j APP=${APP_SELECTION} -C .. clobber - fi - ./make.py -j PLATFORM=${DEF_PLATFORM_TYPE} cco=0 APP=${APP_SELECTION} FLASH_SIZE=${FLASH_SIZE_nM} -C .. + # if [ "${DEF_CLEANUP}" == "true" ]; then + # ./make.py -j APP=${APP_SELECTION} -C .. clobber + # fi + # ./make.py -j PLATFORM=${DEF_PLATFORM_TYPE} cco=0 APP=${APP_SELECTION} FLASH_SIZE=${FLASH_SIZE_nM} -C .. + build_use_ninja ${DEF_PLATFORM_TYPE} ${APP_SELECTION} ${FLASH_SIZE_nM} fi if [ "${APP_SELECTION}" == "${DEF_CUS_APP}" ]; then @@ -886,11 +1050,11 @@ build_obj_func() { export cco=0 . ${SRC_ENV_FILE} - if [ "${DEF_CLEANUP}" == "true" ]; then - ./make.py -j APP=${APP_SELECTION} -C .. clobber - fi - - ./make.py -j PLATFORM=${DEF_PLATFORM_TYPE} cco=0 APP=${APP_SELECTION} FLASH_SIZE=${FLASH_SIZE_nM} -C .. + # if [ "${DEF_CLEANUP}" == "true" ]; then + # ./make.py -j APP=${APP_SELECTION} -C .. clobber + # fi + # ./make.py -j PLATFORM=${DEF_PLATFORM_TYPE} cco=0 APP=${APP_SELECTION} FLASH_SIZE=${FLASH_SIZE_nM} -C .. + build_use_ninja ${DEF_PLATFORM_TYPE} ${APP_SELECTION} ${FLASH_SIZE_nM} cp ../ap/.output/plc/lib/ht_ftm.bin ../tools/gen_img/ht.bin cp ../ap/.output/plc/lib/ht_ftm.out ../tools/gen_img/ht.out @@ -902,11 +1066,11 @@ build_obj_func() { export ckb=1 . ${SRC_ENV_FILE} - if [ "${DEF_CLEANUP}" == "true" ]; then - ./make.py -j APP=${APP_SELECTION} -C .. clobber - fi - - ./make.py -j PLATFORM=${DEF_PLATFORM_TYPE} cco=0 APP=${APP_SELECTION} FLASH_SIZE=${FLASH_SIZE_nM} -C .. + # if [ "${DEF_CLEANUP}" == "true" ]; then + # ./make.py -j APP=${APP_SELECTION} -C .. clobber + # fi + # ./make.py -j PLATFORM=${DEF_PLATFORM_TYPE} cco=0 APP=${APP_SELECTION} FLASH_SIZE=${FLASH_SIZE_nM} -C .. + build_use_ninja ${DEF_PLATFORM_TYPE} ${APP_SELECTION} ${FLASH_SIZE_nM} cp ../ap/.output/plc/lib/ht_sta.bin ../tools/gen_img/ht.bin cp ../ap/.output/plc/lib/ht_sta.out ../tools/gen_img/ht.out diff --git a/build/build_time_cost_test.py b/build/build_time_cost_test.py index 054c815..8d124ec 100755 --- a/build/build_time_cost_test.py +++ b/build/build_time_cost_test.py @@ -13,9 +13,12 @@ if __name__ == "__main__": cmd=f"{' '.join(sys.argv[1:])} > build_log.log" if not ('not_clean' in sys.argv[1:]): os.system("python3 ../clear_output.py > /dev/null") - os.remove("../make_flags.txt") - os.remove("../python_script_log.log") - os.system("python3 ../praper_vscode.py clear >> ../python_script_log.log") + try: + os.remove("../make_flags.txt") + os.remove("../python_script_log.log") + except Exception as e: + print(e) + # os.system("python3 ../praper_vscode.py clear >> ../python_script_log.log") path="../tools/gen_img/customer" if os.path.exists(path): shutil.rmtree(path) diff --git a/build/config.gni b/build/config.gni index 5ba16f7..a73f450 100644 --- a/build/config.gni +++ b/build/config.gni @@ -10,7 +10,7 @@ dual_enable="1" build_amp_type="0" sec_cpu_enable="1" cco="1" -os_type="freertos" +os_type="" new_type_cco="" soft_float_enable="" smart_cco_sta="" @@ -30,4 +30,4 @@ product_line="PLC" PLATFORM="CHIP" APP="0" FLASH_SIZE="4" -kl_ld_script="//startup/ldscripts/riscv3/link_psram_8m_cco_plc_only.lds" +kl_ld_script="/home/andy/source/clone/kunlun/startup/ldscripts/riscv3/link_psram_8m_cco_plc_only.lds" diff --git a/driver/BUILD.gn b/driver/BUILD.gn index c526f22..945b097 100644 --- a/driver/BUILD.gn +++ b/driver/BUILD.gn @@ -15,137 +15,156 @@ module_name = "kl_sdk" kernel_module(module_name) { sources = [ - # "src/hal/iot_bus.c", + "src/hal/diag.c", + "src/hal/mailbox.c", + "src/hal/iot_spi.c", + "src/hal/iot_mic_array.c", + "src/hal/math_matrix.c", + "src/hal/iot_crypto_async.c", + "src/hal/nand_flash.c", "src/hal/afft.c", "src/hal/vfs_uart.c", - "src/hal/iot_dma_sw.c", - "src/hal/iot_busmon.c", - "src/hal/nand_flash.c", - "src/hal/dbg_msg_stash.c", - "src/hal/mtd_part.c", - "src/hal/iot_uart_h.c", - "src/hal/system.c", - "src/hal/iot_gpio.c", - "src/hal/iot_eth.c", - "src/hal/iot_crypto_async.c", - "src/hal/led.c", - "src/hal/iot_spi.c", - "src/hal/iot_plc_pm_cus.c", - "src/hal/iot_plc_led_cus.c", - "src/hal/energe_meter.c", - "src/hal/math_matrix.c", - "src/hal/board_info.c", - "src/hal/rtc.c", - "src/hal/osif_dma_uart.c", - "src/hal/i2c.c", - "src/hal/iot_crypto_share.c", - "src/hal/iot_spinlock.c", - "src/hal/i2s.c", - "src/hal/mtd.c", - "src/hal/iot_dma_hw.c", "src/hal/usb_dev.c", - "src/hal/nor_flash.c", - "src/hal/iot_plc_led.c", - "src/hal/iot_pwm.c", - "src/hal/iot_crypto_mbedtls_lib.c", - "src/hal/iot_efuse.c", - "src/hal/irq.c", - "src/hal/mailbox.c", - "src/hal/iot_crypto.c", - "src/hal/iot_plc_pm.c", - "src/hal/iot_gp_timer.c", - "src/hal/diag.c", - "src/hal/upgrade.c", - "src/hal/iot_plc_hw_tsfm.c", - "src/hal/sram.c", - "src/hal/sd_card.c", - "src/hal/clock.c", - "src/hal/flash.c", - "src/hal/dbg_msg_pop.c", - "src/hal/iot_crypto_internal.c", - "src/hal/iot_i2c_slave.c", - "src/hal/spi_flash.c", - "src/hal/iot_wdg.c", - "src/hal/iot_crypto_lock.c", - "src/hal/debug_uart.c", - "src/hal/dma_i2s.c", - "src/hal/osif_uart.c", - "src/hal/adc.c", - "src/hal/power_mgmt.c", - "src/hal/iot_mic_array.c", "src/hal/iot_flash_layout.c", + "src/hal/spi_flash.c", + "src/hal/sd_card.c", + "src/hal/mtd.c", "src/hal/iot_plc_hw_topo.c", - "extern/bluetooth/src/iot_bt_ext_upgrade_img.c", - "extern/bluetooth/src/iot_bt_ext_upgrade.c", - "extern/bluetooth/src/iot_bt_ext_upgrade_img_mgr.c", - "extern/bluetooth/src/iot_bt_ext_dev_mgmt.c", - "extern/bluetooth/src/iot_bt_ext.c", - "extern/em/src/iot_em_ext.c", - "extern/em/src/iot_em_ext_calibration.c", + "src/hal/iot_plc_led_cus.c", + "src/hal/iot_plc_pm.c", + "src/hal/system.c", + "src/hal/irq.c", + "src/hal/iot_eth.c", + "src/hal/osif_uart.c", + "src/hal/board_info.c", + "src/hal/iot_plc_led.c", + "src/hal/i2s.c", + "src/hal/iot_crypto_share.c", + "src/hal/clock.c", + "src/hal/iot_crypto_mbedtls_lib.c", + "src/hal/iot_i2c_slave.c", + "src/hal/mtd_part.c", + "src/hal/osif_dma_uart.c", + "src/hal/iot_crypto.c", + "src/hal/flash.c", + "src/hal/iot_crypto_lock.c", + "src/hal/iot_plc_hw_tsfm.c", + "src/hal/iot_wdg.c", + "src/hal/nor_flash.c", + "src/hal/iot_uart_h.c", + "src/hal/iot_efuse.c", + "src/hal/iot_gpio.c", + "src/hal/iot_busmon.c", + "src/hal/iot_spinlock.c", + "src/hal/iot_gp_timer.c", + "src/hal/led.c", + "src/hal/iot_pwm.c", + "src/hal/dma_i2s.c", + "src/hal/dbg_msg_stash.c", + "src/hal/power_mgmt.c", + "src/hal/rtc.c", + "src/hal/iot_dma_hw.c", + "src/hal/iot_crypto_internal.c", + "src/hal/debug_uart.c", + "src/hal/dbg_msg_pop.c", + "src/hal/energe_meter.c", + "src/hal/upgrade.c", + "src/hal/adc.c", + "src/hal/i2c.c", + "src/hal/iot_dma_sw.c", + "src/hal/sram.c", + "src/hal/iot_plc_pm_cus.c", "extern/em/src/iot_em_ext_chip_att.c", + "extern/em/src/iot_em_ext_calibration.c", + "extern/em/src/iot_em_ext.c", + "extern/htm/src/iot_htm_ext.c", + "extern/rtc/src/bl8025t_driver.c", + "extern/rtc/src/iot_rtc_ext.c", + "extern/rtc/src/simu_rtc_driver.c", + "extern/rtc/src/rx8010_driver.c", + "extern/rtc/src/m41t0_driver.c", + "extern/wk2xxx_uart/src/wk2xxx_uart.c", + "extern/gsm/src/iot_gsm_ext.c", + "extern/gsm/src/c20_gsm_driver.c", + "extern/ext-io/src/iot_gpio_ex_tca9534a.c", + "extern/ext-io/src/iot_gpio_ex_mcp23017.c", + "extern/ext-io/src/iot_gpio_ex_tpt29555.c", + "extern/ext-io/src/iot_gpio_ex_aw9523b.c", + "extern/ext-io/src/iot_gpio_ex.c", + "extern/bluetooth/src/iot_bt_ext.c", + "extern/bluetooth/src/iot_bt_ext_upgrade_img_mgr.c", + "extern/bluetooth/src/iot_bt_ext_upgrade.c", + "extern/bluetooth/src/iot_bt_ext_upgrade_img.c", + "extern/bluetooth/src/iot_bt_ext_dev_mgmt.c", + "extern/virtualchannel/vc_upgrade/vc_upgrade_driver.c", + "extern/virtualchannel/vc_upgrade/dev_table.c", + "extern/virtualchannel/vc_upgrade/vc_upgrade.c", + "extern/virtualchannel/src/vc_task.c", + "extern/virtualchannel/src/vp_uart.c", + "extern/virtualchannel/src/vc_proto.c", ] if (target == "kunlun3") { sources += [ - "src/hw3/dma_sw.c", - "src/hw3/intc.c", - "src/hw3/cpu.c", - "src/hw3/i2c_hw.c", - "src/hw3/pmu.c", - "src/hw3/gpio_mtx.c", - "src/hw3/smc.c", - "src/hw3/system_hw.c", - "src/hw3/pmp.c", - "src/hw3/em_hw.c", - "src/hw3/efuse.c", - "src/hw3/ndfc.c", - "src/hw3/ahb_busmon.c", - "src/hw3/board_info_hw.c", - "src/hw3/pwm.c", - "src/hw3/topo_adc_adp.c", - "src/hw3/ledc.c", - "src/hw3/gp_timer.c", - "src/hw3/pmp_hw.c", - "src/hw3/ana.c", "src/hw3/i2c_slv_hw.c", - "src/hw3/afft_hw.c", - "src/hw3/gpio_hw.c", - "src/hw3/mtx_hw.c", - "src/hw3/dwc_eth.c", - "src/hw3/dma_hw.c", - "src/hw3/rtc_hw.c", - "src/hw3/rom_patch_hw.c", - "src/hw3/simd.c", - "src/hw3/sadc_pwm.c", - "src/hw3/sha512_hw.c", - "src/hw3/sec_glb.c", - "src/hw3/dw_apb_ssi.c", - "src/hw3/mailbox_hw.c", - "src/hw3/snapshot.c", - "src/hw3/sadc.c", - "src/hw3/uart_e.c", - "src/hw3/apb.c", - "src/hw3/clk.c", - "src/hw3/ahb.c", - "src/hw3/ada.c", - "src/hw3/ddrc.c", - "src/hw3/mmon.c", - "src/hw3/wdg.c", - "src/hw3/mon_hw.c", "src/hw3/i2s_hw.c", - "src/hw3/dma.c", - "src/hw3/sfc.c", - "src/hw3/power_mgmt_hw.c", + "src/hw3/dma_hw.c", + "src/hw3/clk.c", + "src/hw3/afft_hw.c", + "src/hw3/sha512_hw.c", + "src/hw3/smc.c", + "src/hw3/em_hw.c", + "src/hw3/apb.c", + "src/hw3/ndfc.c", + "src/hw3/topo_adc_adp.c", + "src/hw3/gp_timer.c", + "src/hw3/efuse.c", + "src/hw3/mtx_hw.c", "src/hw3/dma_uart_hw.c", - "src/hw3/pll_cal.c", - "src/hw3/sha256_hw.c", - "src/hw3/sec_sys.c", - "src/hw3/dev_spinlock.c", + "src/hw3/board_info_hw.c", + "src/hw3/mon_hw.c", + "src/hw3/intc.c", + "src/hw3/system_hw.c", + "src/hw3/ledc.c", "src/hw3/dbg_msg_ring_hw.c", + "src/hw3/ahb.c", + "src/hw3/sfc.c", + "src/hw3/dev_spinlock.c", + "src/hw3/wdg.c", + "src/hw3/rom_patch_hw.c", + "src/hw3/uart_e.c", + "src/hw3/pmp.c", + "src/hw3/dwc_eth.c", + "src/hw3/ddrc.c", + "src/hw3/gpio_hw.c", + "src/hw3/cpu.c", + "src/hw3/pwm.c", + "src/hw3/sadc_pwm.c", + "src/hw3/ahb_busmon.c", + "src/hw3/ana.c", + "src/hw3/dma.c", + "src/hw3/dw_apb_ssi.c", + "src/hw3/sha256_hw.c", + "src/hw3/pmu.c", + "src/hw3/dma_sw.c", + "src/hw3/simd.c", + "src/hw3/sec_sys.c", + "src/hw3/pmp_hw.c", + "src/hw3/mailbox_hw.c", + "src/hw3/ada.c", + "src/hw3/power_mgmt_hw.c", + "src/hw3/sadc.c", + "src/hw3/rtc_hw.c", + "src/hw3/pll_cal.c", + "src/hw3/sec_glb.c", + "src/hw3/gpio_mtx.c", + "src/hw3/i2c_hw.c", + "src/hw3/mmon.c", + "src/hw3/snapshot.c", + "src/hw3/mbedtls/hardware_entropy_patch_alt.c", + "src/hw3/mbedtls/sha512_patch_alt.c", + "src/hw3/mbedtls/sha256_patch_alt.c", "src/hw3/mbedtls/aes_patch_alt.c", "src/hw3/mbedtls/bignum_patch_alt.c", - "src/hw3/mbedtls/hardware_entropy_patch_alt.c", - "src/hw3/mbedtls/sha256_patch_alt.c", - "src/hw3/mbedtls/sha512_patch_alt.c", ] } include_dirs = [ @@ -156,5 +175,11 @@ kernel_module(module_name) { "//driver/inc/mbedtls", "//driver/extern/bluetooth/inc", "//driver/extern/em/inc", + "//driver/extern/rtc/inc", + "//driver/extern/ext-io/inc", + "//driver/extern/gsm/inc", + "//driver/extern/wk2xxx_uart/inc", + "//driver/extern/htm/inc", + "//driver/extern/virtualchannel/inc", ] } diff --git a/ftm/BUILD.gn b/ftm/BUILD.gn index fdafa4f..dd3a206 100644 --- a/ftm/BUILD.gn +++ b/ftm/BUILD.gn @@ -29,6 +29,8 @@ kernel_module(module_name) { "cus/iot_ftm_cus_cmd.c", "../bb_cpu/bb/bb_rf_tone_tbl.c", "../bb_cpu/bb/bb_rf_hw_tbl.c", + "../bb_cpu/bb/bb_rf_cfg.c", + "../bb_cpu/bb/bb_init.c", "../bb_cpu/common/rf_spi_api.c", "../bb_cpu/common/bb_cpu_utils.c", "../bb_cpu/common/bb_cpu_timer.c", diff --git a/plc/BUILD.gn b/plc/BUILD.gn index 87d17d3..9ba06bf 100644 --- a/plc/BUILD.gn +++ b/plc/BUILD.gn @@ -171,6 +171,11 @@ kernel_module(module_name) { "htbus/src/htbus.c", "htbus/src/htbus_test.c", "htbus/src/sta/htbus_sta.c", + "halphy/hw3/plc/math_log10.c", + "halphy/test/phy_tools.c", + "halphy/hw_common/phy_hw_cmn.c", + "halmac/hw3/rx/mac_rx_buf_ring.c", + "halmac/hw_desc/mac_desc_api.c" ] if (target == "kunlun3") { sources += [ diff --git a/sbl/BUILD.gn b/sbl/BUILD.gn new file mode 100644 index 0000000..333ee88 --- /dev/null +++ b/sbl/BUILD.gn @@ -0,0 +1,27 @@ +module_name = "kl_sdk" + +kernel_module(module_name) { + sources = [ + "src/common.c", + "src/boot.c", + "src/version.c", + "src/sbl_printf.c", + "src/hw3/sbl_boot.c", + "src/riscv/entry_def.S", + "src/riscv/sbl.S", + ] + include_dirs = [ + "//sbl/inc", + "//sbl/inc/hw3", + "//sbl/lzma", + "//inc/pib", + "//driver/inc", + "//inc", + "//inc/io_lib", + "//inc/os_shim", + "//inc/compiler/gcc", + "//inc/utils", + "//driver/src/hw3/inc", + "//inc/driver", + ] +} \ No newline at end of file diff --git a/startup/BUILD.gn b/startup/BUILD.gn index a6c528e..2959569 100644 --- a/startup/BUILD.gn +++ b/startup/BUILD.gn @@ -22,6 +22,7 @@ kernel_module(module_name) { sources += [ "riscv3/src/start.S", "riscv3/src/entry_def.S", + "riscv3/src/entry.S", "riscv3/src/startup_init.c", "riscv3/src/exception.c", "riscv3/src/platform.c",