增加自动化编译打包脚本

This commit is contained in:
2026-09-08 11:10:20 +08:00
parent 15758d848b
commit 4118e943d6
6 changed files with 275 additions and 205 deletions
+39 -205
View File
@@ -1,8 +1,14 @@
# make 编译并下载
# make 编译并下载,成功后自动打包到 release/
# make pack 仅打包(需已编译生成 jl_isd.fw)
# make VERBOSE=1 显示编译详细过程
# make clean 清除编译临时文件
#
# USB 烧录(两套镜像都会生成,只烧其中一套):
# .\build.bat 或 .\build.bat nokey -> 烧不带 Key
# .\build.bat key -> 烧带 Key
# make BURN_KEY=1 与 build.bat key 相同
#
# 注意: Linux 下编译方式:
# 1. 从 http://pkgman.jieliapp.com/doc/all 处找到下载链接
# 2. 下载后,解压到 /opt/jieli 目录下,保证
@@ -31,6 +37,11 @@ export PATH:=$(TOOL_DIR);$(PATH)
FIXBAT := tools\utils\fixbat.exe # 用于处理 utf8->gbk 编码问题
POST_SCRIPT := cpu/br28/tools/download.bat
RUN_POST_SCRIPT := cpu\br28\tools\download.bat
PACK_SCRIPT := powershell -NoProfile -ExecutionPolicy Bypass -File tools\pack_firmware.ps1
# USB: 1/key/yes = flash keyed image; default = nokey
ifneq ($(filter 1 key yes,$(BURN_KEY)),)
export JL_BURN_KEY := 1
endif
else
# Linux 下工具链位置
TOOL_DIR := /opt/jieli/pi32v2/bin
@@ -53,6 +64,7 @@ export PATH:=$(TOOL_DIR):$(PATH)
FIXBAT := touch # Linux下不需要处理 bat 编码问题
POST_SCRIPT := cpu/br28/tools/download.sh
RUN_POST_SCRIPT := bash $(POST_SCRIPT)
PACK_SCRIPT :=
endif
CC := $(TOOL_DIR)/$(CC)
@@ -265,17 +277,9 @@ c_SRC_FILES := \
apps/common/audio/audio_utils.c \
apps/common/audio/decode/audio_key_tone.c \
apps/common/audio/decode/decode.c \
apps/common/audio/demo/audio_demo.c \
apps/common/audio/online_debug/aud_data_export.c \
apps/common/audio/online_debug/aud_mic_dut.c \
apps/common/audio/online_debug/aud_spatial_effect_dut.c \
apps/common/audio/online_debug/audio_online_debug.c \
apps/common/audio/sine_make.c \
apps/common/audio/uartPcmSender.c \
apps/common/audio/wm8978/iic.c \
apps/common/audio/wm8978/wm8978.c \
apps/common/bt_common/bt_test_api.c \
apps/common/cJSON/cJSON.c \
apps/common/config/app_config.c \
apps/common/config/bt_profile_config.c \
apps/common/config/ci_transport_uart.c \
@@ -285,35 +289,6 @@ c_SRC_FILES := \
apps/common/dev_manager/dev_manager.c \
apps/common/dev_manager/dev_reg.c \
apps/common/dev_manager/dev_update.c \
apps/common/device/gSensor/SC7A20.c \
apps/common/device/gSensor/STK8321.c \
apps/common/device/gSensor/da230.c \
apps/common/device/gSensor/gSensor_manage.c \
apps/common/device/gSensor/mpu6050.c \
apps/common/device/gx8002_npu/gx8002_enc/gx8002_enc.c \
apps/common/device/gx8002_npu/gx8002_npu.c \
apps/common/device/gx8002_npu/gx8002_npu_event_deal.c \
apps/common/device/gx8002_npu/gx8002_upgrade/app_upgrade/gx_uart_upgrade_app.c \
apps/common/device/gx8002_npu/gx8002_upgrade/app_upgrade/gx_uart_upgrade_tws.c \
apps/common/device/gx8002_npu/gx8002_upgrade/gx_uart_upgrade.c \
apps/common/device/gx8002_npu/gx8002_upgrade/gx_uart_upgrade_porting.c \
apps/common/device/gx8002_npu/gx8002_upgrade/sdfile_upgrade/gx_uart_upgrade_sdfile.c \
apps/common/device/gx8002_npu/gx8002_upgrade/spp_upgrade/gx_fifo.c \
apps/common/device/gx8002_npu/gx8002_upgrade/spp_upgrade/gx_uart_upgrade_spp.c \
apps/common/device/imu_sensor/icm_42670p/icm_42670p.c \
apps/common/device/imu_sensor/icm_42670p/inv_imu_apex.c \
apps/common/device/imu_sensor/icm_42670p/inv_imu_driver.c \
apps/common/device/imu_sensor/icm_42670p/inv_imu_transport.c \
apps/common/device/imu_sensor/imuSensor_manage.c \
apps/common/device/imu_sensor/lsm6dsl/lsm6dsl.c \
apps/common/device/imu_sensor/mpu6887/mpu6887p.c \
apps/common/device/imu_sensor/mpu9250/mpu9250.c \
apps/common/device/imu_sensor/qmi8658/qmi8658c.c \
apps/common/device/imu_sensor/sh3001/sh3001.c \
apps/common/device/in_ear_detect/in_ear_detect.c \
apps/common/device/in_ear_detect/in_ear_manage.c \
apps/common/device/ir_sensor/ir_manage.c \
apps/common/device/ir_sensor/jsa1221.c \
apps/common/device/key/adkey.c \
apps/common/device/key/adkey_rtcvdd.c \
apps/common/device/key/ctmu_touch_key.c \
@@ -323,7 +298,6 @@ c_SRC_FILES := \
apps/common/device/key/touch_key.c \
apps/common/device/key/uart_key.c \
apps/common/device/norflash/norflash_sfc.c \
apps/common/device/ntc/ntc_det.c \
apps/common/device/usb/device/cdc.c \
apps/common/device/usb/device/descriptor.c \
apps/common/device/usb/device/hid.c \
@@ -345,43 +319,11 @@ c_SRC_FILES := \
apps/common/device/usb/host/usb_storage.c \
apps/common/device/usb/usb_config.c \
apps/common/device/usb/usb_host_config.c \
apps/common/ezxml/ezxml.c \
apps/common/ezxml/ezxml_example.c \
apps/common/fat_nor/cfg_private.c \
apps/common/fat_nor/virfat_flash.c \
apps/common/file_operate/file_bs_deal.c \
apps/common/file_operate/file_manager.c \
apps/common/icsd/adt/icsd_adt.c \
apps/common/icsd/adt/icsd_adt_app.c \
apps/common/icsd/anc/icsd_anc_app.c \
apps/common/icsd/anc/icsd_anc_board.c \
apps/common/icsd/anc/icsd_anc_data.c \
apps/common/jl_kws/jl_kws_algo.c \
apps/common/jl_kws/jl_kws_audio.c \
apps/common/jl_kws/jl_kws_event.c \
apps/common/jl_kws/jl_kws_main.c \
apps/common/music/breakpoint.c \
apps/common/music/music_decrypt.c \
apps/common/music/music_id3.c \
apps/common/music/music_player.c \
apps/common/temp_trim/dtemp_pll_trim.c \
apps/common/test/fs_test.c \
apps/common/test/os_test.c \
apps/common/third_party_profile/Tecent_LL/tecent_ll_demo/ll_demo.c \
apps/common/third_party_profile/Tecent_LL/tecent_ll_demo/ll_task.c \
apps/common/third_party_profile/Tecent_LL/tecent_protocol/ble_qiot_import.c \
apps/common/third_party_profile/Tecent_LL/tecent_protocol/ble_qiot_llsync_data.c \
apps/common/third_party_profile/Tecent_LL/tecent_protocol/ble_qiot_llsync_device.c \
apps/common/third_party_profile/Tecent_LL/tecent_protocol/ble_qiot_llsync_event.c \
apps/common/third_party_profile/Tecent_LL/tecent_protocol/ble_qiot_llsync_ota.c \
apps/common/third_party_profile/Tecent_LL/tecent_protocol/ble_qiot_service.c \
apps/common/third_party_profile/Tecent_LL/tecent_protocol/ble_qiot_template.c \
apps/common/third_party_profile/Tecent_LL/tecent_protocol/ble_qiot_utils_base64.c \
apps/common/third_party_profile/Tecent_LL/tecent_protocol/ble_qiot_utils_crc.c \
apps/common/third_party_profile/Tecent_LL/tecent_protocol/ble_qiot_utils_hmac.c \
apps/common/third_party_profile/Tecent_LL/tecent_protocol/ble_qiot_utils_log.c \
apps/common/third_party_profile/Tecent_LL/tecent_protocol/ble_qiot_utils_md5.c \
apps/common/third_party_profile/Tecent_LL/tecent_protocol/ble_qiot_utils_sha1.c \
apps/common/third_party_profile/common/3th_profile_api.c \
apps/common/third_party_profile/common/custom_cfg.c \
apps/common/third_party_profile/common/mic_rec.c \
@@ -398,7 +340,6 @@ c_SRC_FILES := \
apps/common/third_party_profile/jieli/JL_rcsp/adv_app_setting/adv_anc_voice_key.c \
apps/common/third_party_profile/jieli/JL_rcsp/adv_app_setting/adv_bt_name_setting.c \
apps/common/third_party_profile/jieli/JL_rcsp/adv_app_setting/adv_eq_setting.c \
apps/common/third_party_profile/jieli/JL_rcsp/adv_app_setting/adv_hearing_aid_setting.c \
apps/common/third_party_profile/jieli/JL_rcsp/adv_app_setting/adv_high_low_vol_setting.c \
apps/common/third_party_profile/jieli/JL_rcsp/adv_app_setting/adv_key_setting.c \
apps/common/third_party_profile/jieli/JL_rcsp/adv_app_setting/adv_led_setting.c \
@@ -415,85 +356,26 @@ c_SRC_FILES := \
apps/common/third_party_profile/jieli/JL_rcsp/rcsp_updata/rcsp_adv_user_update.c \
apps/common/third_party_profile/jieli/JL_rcsp/rcsp_updata/rcsp_ch_loader_download.c \
apps/common/third_party_profile/jieli/JL_rcsp/rcsp_updata/rcsp_user_update.c \
apps/common/third_party_profile/jieli/le_hogp.c \
apps/common/third_party_profile/jieli/online_db/online_db_deal.c \
apps/common/third_party_profile/jieli/online_db/spp_online_db.c \
apps/common/third_party_profile/jieli/trans_data_demo/le_trans_data.c \
apps/common/third_party_profile/jieli/trans_data_demo/spp_trans_data.c \
apps/common/third_party_profile/jieli/wireless_mic/le_wireless_mic_client.c \
apps/common/third_party_profile/jieli/wireless_mic/le_wireless_mic_server.c \
apps/common/third_party_profile/tuya_protocol/app/demo/tuya_ble_app_demo.c \
apps/common/third_party_profile/tuya_protocol/app/demo/tuya_ota.c \
apps/common/third_party_profile/tuya_protocol/app/product_test/tuya_ble_app_production_test.c \
apps/common/third_party_profile/tuya_protocol/app/uart_common/tuya_ble_app_uart_common_handler.c \
apps/common/third_party_profile/tuya_protocol/extern_components/mbedtls/aes.c \
apps/common/third_party_profile/tuya_protocol/extern_components/mbedtls/ccm.c \
apps/common/third_party_profile/tuya_protocol/extern_components/mbedtls/hmac.c \
apps/common/third_party_profile/tuya_protocol/extern_components/mbedtls/md5.c \
apps/common/third_party_profile/tuya_protocol/extern_components/mbedtls/sha1.c \
apps/common/third_party_profile/tuya_protocol/extern_components/mbedtls/sha256.c \
apps/common/third_party_profile/tuya_protocol/port/tuya_ble_port.c \
apps/common/third_party_profile/tuya_protocol/port/tuya_ble_port_JL.c \
apps/common/third_party_profile/tuya_protocol/port/tuya_ble_port_peripheral.c \
apps/common/third_party_profile/tuya_protocol/sdk/src/tuya_ble_api.c \
apps/common/third_party_profile/tuya_protocol/sdk/src/tuya_ble_bulk_data.c \
apps/common/third_party_profile/tuya_protocol/sdk/src/tuya_ble_data_handler.c \
apps/common/third_party_profile/tuya_protocol/sdk/src/tuya_ble_event.c \
apps/common/third_party_profile/tuya_protocol/sdk/src/tuya_ble_event_handler.c \
apps/common/third_party_profile/tuya_protocol/sdk/src/tuya_ble_event_handler_weak.c \
apps/common/third_party_profile/tuya_protocol/sdk/src/tuya_ble_feature_weather.c \
apps/common/third_party_profile/tuya_protocol/sdk/src/tuya_ble_gatt_send_queue.c \
apps/common/third_party_profile/tuya_protocol/sdk/src/tuya_ble_heap.c \
apps/common/third_party_profile/tuya_protocol/sdk/src/tuya_ble_main.c \
apps/common/third_party_profile/tuya_protocol/sdk/src/tuya_ble_mem.c \
apps/common/third_party_profile/tuya_protocol/sdk/src/tuya_ble_mutli_tsf_protocol.c \
apps/common/third_party_profile/tuya_protocol/sdk/src/tuya_ble_queue.c \
apps/common/third_party_profile/tuya_protocol/sdk/src/tuya_ble_storage.c \
apps/common/third_party_profile/tuya_protocol/sdk/src/tuya_ble_unix_time.c \
apps/common/third_party_profile/tuya_protocol/sdk/src/tuya_ble_utils.c \
apps/common/ui/lcd_simple/lcd_simple_api.c \
apps/common/ui/lcd_simple/ui.c \
apps/common/ui/lcd_simple/ui_mainmenu.c \
apps/common/update/testbox_update.c \
apps/common/update/update.c \
apps/common/update/update_tws.c \
apps/common/update/update_tws_new.c \
apps/earphone/aec/br28/audio_aec.c \
apps/earphone/aec/br28/audio_aec_demo.c \
apps/earphone/aec/br28/audio_aec_dms.c \
apps/earphone/aec/br28/audio_aec_online.c \
apps/earphone/aec/br28/audio_cvp_3mic.c \
apps/earphone/aec/br28/audio_cvp_ais_3mic.c \
apps/earphone/app_ancbox.c \
apps/earphone/app_anctool.c \
apps/earphone/app_main.c \
apps/earphone/app_protocol_deal.c \
apps/earphone/app_task_switch.c \
apps/earphone/app_testbox.c \
apps/earphone/audio_enc_mpt_cvp_ctr.c \
apps/earphone/audio_enc_mpt_self.c \
apps/earphone/ble_adv.c \
apps/earphone/board/br28/board_jl7016g_hybrid.c \
apps/earphone/board/br28/board_jl7018f_demo.c \
apps/earphone/board/br28/board_jl701n_anc.c \
apps/earphone/board/br28/board_jl701n_btemitter.c \
apps/earphone/board/br28/board_jl701n_demo.c \
apps/earphone/bt_auto_test.c \
apps/earphone/bt_background.c \
apps/earphone/bt_ble.c \
apps/earphone/bt_ble_hid.c \
apps/earphone/bt_emitter.c \
apps/earphone/bt_tws.c \
apps/earphone/default_event_handler.c \
apps/earphone/dual_update_demo.c \
apps/earphone/earphone.c \
apps/earphone/eartch_event_deal.c \
apps/earphone/font/fontinit.c \
apps/earphone/idle.c \
apps/earphone/key_event_deal.c \
apps/earphone/kws_voice_event_deal.c \
apps/earphone/linein/linein.c \
apps/earphone/ll_sync_demo/ll_sync_demo.c \
apps/earphone/log_config/app_config.c \
apps/earphone/log_config/lib_btctrler_config.c \
apps/earphone/log_config/lib_btstack_config.c \
@@ -501,53 +383,33 @@ c_SRC_FILES := \
apps/earphone/log_config/lib_media_config.c \
apps/earphone/log_config/lib_system_config.c \
apps/earphone/log_config/lib_update_config.c \
apps/earphone/music/sd_music.c \
apps/earphone/pbg_demo.c \
apps/earphone/pc/pc.c \
apps/earphone/power_manage/app_charge.c \
apps/earphone/power_manage/app_chargestore.c \
apps/earphone/power_manage/app_power_manage.c \
apps/earphone/power_manage/app_umidigi_chargestore.c \
apps/earphone/rcsp/jl_phone_app.c \
apps/earphone/rcsp/rcsp_adv.c \
apps/earphone/tone_table.c \
apps/earphone/trans_data_demo/trans_data_demo.c \
apps/earphone/tuya/tuya_app.c \
apps/earphone/tuya/tuya_demo.c \
apps/earphone/ui/lcd_simple/my_demo.c \
apps/earphone/ui_manage.c \
apps/earphone/user_cfg.c \
apps/earphone/version.c \
apps/earphone/vol_sync.c \
apps/earphone/wireless_mic/app_main_wireless_mic.c \
apps/earphone/wireless_mic/audio/adapter_adc.c \
apps/earphone/wireless_mic/audio/adapter_media.c \
apps/earphone/wireless_mic/audio/wireless/adapter_wireless_dec.c \
apps/earphone/wireless_mic/audio/wireless/adapter_wireless_enc.c \
apps/earphone/wireless_mic/bt/bt_edr_fun.c \
apps/earphone/wireless_mic/bt/bt_status_event.c \
apps/earphone/wireless_mic/idev/adapter_idev.c \
apps/earphone/wireless_mic/idev/idev_bt/adapter_idev_bt.c \
apps/earphone/wireless_mic/idev/idev_bt/idev_ble/adapter_idev_ble.c \
apps/earphone/wireless_mic/idev/idev_mic/adapter_idev_mic.c \
apps/earphone/wireless_mic/odev/adapter_odev.c \
apps/earphone/wireless_mic/odev/odev_bt/adapter_odev_bt.c \
apps/earphone/wireless_mic/odev/odev_bt/odev_ble/adapter_odev_ble.c \
apps/earphone/wireless_mic/odev/odev_bt/odev_ble/odev_ble_wireless.c \
apps/earphone/wireless_mic/odev/odev_bt/odev_edr/adapter_odev_edr.c \
apps/earphone/wireless_mic/odev/odev_dac/adapter_odev_dac.c \
apps/earphone/wireless_mic/process/adapter_process.c \
apps/usr_jb_proto/Protocol/jb_product.c \
apps/usr_jb_proto/Protocol/jb_protocol.c \
apps/usr_jb_proto/Utils/jb_common.c \
apps/usr_jb_proto/Utils/jb_ringbuffer.c \
apps/usr_jb_proto/usr_jb_main.c \
apps/usr_periph/usr_rtc.c \
apps/usr_le_code/ble_proto.c \
apps/usr_le_code/bleproto.c \
apps/usr_le_code/bleproto_packer.c \
apps/usr_le_code/thirdpart/mjson/mjson.c \
apps/usr_le_code/usr_le_adv.c \
apps/usr_le_code/usr_le_recieve.c \
cpu/br28/adc_api.c \
cpu/br28/aec_tool.c \
cpu/br28/app_audio.c \
cpu/br28/audio_anc.c \
cpu/br28/audio_anc_fade_ctr.c \
cpu/br28/audio_anc_mult_scene.c \
cpu/br28/audio_capture.c \
cpu/br28/audio_codec_clock.c \
cpu/br28/audio_common/audio_mic_codec.c \
cpu/br28/audio_cvp_dut.c \
cpu/br28/audio_cvp_sync.c \
cpu/br28/audio_dec.c \
cpu/br28/audio_dec/audio_dec_file.c \
cpu/br28/audio_dec/audio_dec_iis.c \
@@ -555,17 +417,8 @@ c_SRC_FILES := \
cpu/br28/audio_dec/audio_dec_pcm.c \
cpu/br28/audio_dec/audio_usb_mic.c \
cpu/br28/audio_dec_eff.c \
cpu/br28/audio_demo/audio_adc_demo.c \
cpu/br28/audio_demo/audio_dac_demo.c \
cpu/br28/audio_demo/audio_fft_demo.c \
cpu/br28/audio_demo/audio_matrix_demo.c \
cpu/br28/audio_demo/audio_wind_detect_demo.c \
cpu/br28/audio_effect_develop.c \
cpu/br28/audio_enc.c \
cpu/br28/audio_general.c \
cpu/br28/audio_hearing/audio_hearing_aid.c \
cpu/br28/audio_hearing/audio_hearing_aid_lp.c \
cpu/br28/audio_hearing/audio_sidetone.c \
cpu/br28/audio_link.c \
cpu/br28/audio_sync.c \
cpu/br28/charge.c \
@@ -573,7 +426,6 @@ c_SRC_FILES := \
cpu/br28/clock_manager.c \
cpu/br28/eq_config.c \
cpu/br28/hw_fft.c \
cpu/br28/icsd_anc_user.c \
cpu/br28/iic_hw.c \
cpu/br28/iic_soft.c \
cpu/br28/irflt.c \
@@ -594,43 +446,13 @@ c_SRC_FILES := \
cpu/br28/pwm_led.c \
cpu/br28/rdec.c \
cpu/br28/setup.c \
cpu/br28/smart_voice/aispeech_asr.c \
cpu/br28/smart_voice/jl_kws_platform.c \
cpu/br28/smart_voice/kws_event.c \
cpu/br28/smart_voice/nn_vad.c \
cpu/br28/smart_voice/smart_voice_config.c \
cpu/br28/smart_voice/smart_voice_core.c \
cpu/br28/smart_voice/user_asr.c \
cpu/br28/smart_voice/vad_clock_trim.c \
cpu/br28/smart_voice/vad_mic.c \
cpu/br28/smart_voice/voice_mic_data.c \
cpu/br28/sound_device.c \
cpu/br28/spatial_effect/spatial_effect.c \
cpu/br28/spatial_effect/spatial_effect_imu.c \
cpu/br28/spatial_effect/spatial_effect_test.c \
cpu/br28/spatial_effect/spatial_effect_tws.c \
cpu/br28/spatial_effect/spatial_imu_trim.c \
cpu/br28/spi.c \
cpu/br28/tone_player.c \
cpu/br28/tws_audio.c \
cpu/br28/uart_dev.c \
cpu/br28/umidigi_chargestore.c \
apps/usr_jb_proto/Protocol/jb_product.c \
apps/usr_jb_proto/Protocol/jb_protocol.c \
apps/usr_jb_proto/Utils/jb_common.c \
apps/usr_jb_proto/Utils/jb_ringbuffer.c \
apps/usr_jb_proto/usr_jb_main.c \
apps/usr_periph/usr_rtc.c \
apps/usr_le_code/ble_proto.c \
apps/usr_le_code/bleproto.c \
apps/usr_le_code/bleproto_packer.c \
apps/usr_le_code/thirdpart/mjson/mjson.c \
apps/usr_le_code/usr_le_adv.c \
apps/usr_le_code/usr_le_recieve.c \
cpu/br28/uart_test.c
# 需要编译的 .S 文件
S_SRC_FILES := \
apps/earphone/sdk_version.z.S \
@@ -789,7 +611,7 @@ LINK_AT ?= 1
# 表示下面的不是一个文件的名字,无论是否存在 all, clean, pre_build 这样的文件
# 还是要执行命令
# see: https://www.gnu.org/software/make/manual/html_node/Phony-Targets.html
.PHONY: all clean pre_build
.PHONY: all clean pre_build pack
# 不要使用 make 预设置的规则
# see: https://www.gnu.org/software/make/manual/html_node/Suffix-Rules.html
@@ -798,6 +620,18 @@ LINK_AT ?= 1
all: pre_build $(OUT_ELF)
$(info +POST-BUILD)
$(QUITE) $(RUN_POST_SCRIPT) sdk
ifneq ($(PACK_SCRIPT),)
$(info +PACK-FIRMWARE)
$(QUITE) $(PACK_SCRIPT)
endif
pack:
$(info +PACK-FIRMWARE)
ifneq ($(PACK_SCRIPT),)
$(QUITE) $(PACK_SCRIPT)
else
$(error pack script is Windows-only)
endif
pre_build: