From 9c3ae5dd24c12831fc67de21593722668956ca98 Mon Sep 17 00:00:00 2001 From: wu58430 Date: Wed, 10 Jan 2024 20:05:46 +0800 Subject: [PATCH] =?UTF-8?q?=E5=90=8C=E6=97=B6=E7=BC=96=E8=AF=91=E5=A4=9A?= =?UTF-8?q?=E4=B8=AA=E7=89=88=E6=9C=AC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .idea/workspace.xml | 224 +++++++++++++++++++--------------------- Makefile | 56 ++++++++-- compile-with-docker.bat | 2 +- version.c | 16 +-- win_make.bat | 2 +- 5 files changed, 170 insertions(+), 130 deletions(-) diff --git a/.idea/workspace.xml b/.idea/workspace.xml index 9aeaf42..5229e1d 100644 --- a/.idea/workspace.xml +++ b/.idea/workspace.xml @@ -20,25 +20,11 @@ - - - + - - - - - - - - - - - - - - + + - { - "keyToString": { - "ASKED_ADD_EXTERNAL_FILES": "true", - "RunOnceActivity.OpenProjectViewOnStart": "true", - "RunOnceActivity.ShowReadmeOnStart": "true", - "RunOnceActivity.cidr.known.project.marker": "true", - "SHARE_PROJECT_CONFIGURATION_FILES": "true", - "WebServerToolWindowFactoryState": "false", - "cf.first.check.clang-format": "false", - "cidr.known.project.marker": "true", - "last_opened_file_path": "C:/Users/RUPC/Desktop/UV-K6/uv-k5-firmware-chinese", - "node.js.detected.package.eslint": "true", - "node.js.detected.package.tslint": "true", - "node.js.selected.package.eslint": "(autodetect)", - "node.js.selected.package.tslint": "(autodetect)", - "nodejs_package_manager_path": "npm", - "settings.editor.selected.configurable": "language.cpp.clang-tidy", - "structure.view.defaults.are.configured": "true", - "vue.rearranger.settings.migration": "true" + +}]]> @@ -117,18 +103,19 @@ - - - - - + + + + + + + @@ -141,14 +128,14 @@ - - + + - - + + @@ -199,7 +186,8 @@ - + + @@ -210,11 +198,11 @@ + + - - @@ -288,62 +276,12 @@ - - - 1701739409050 - - - 1701739895017 - - - 1701740303236 - - - 1701740447231 - - - 1701740770876 - - - 1701755444295 - - - 1701769945196 - - - 1701775483012 - 1701778784894 @@ -632,7 +570,63 @@ - @@ -659,13 +653,6 @@ - - - - - - - @@ -684,7 +671,14 @@ - diff --git a/Makefile b/Makefile index 856d21b..579958a 100644 --- a/Makefile +++ b/Makefile @@ -47,16 +47,43 @@ ENABLE_MDC1200 ?= 1 ENABLE_MDC1200_SHOW_OP_ARG ?= 1 ENABLE_MDC1200_SIDE_BEEP ?= 0 ENABLE_MDC1200_CONTACT ?= 1 -ENABLE_CHINESE_FULL = 4 ENABLE_UART_RW_BK_REGS ?= 0 ENABLE_AUDIO_BAR_DEFAULT ?=1 ENABLE_EEPROM_4M ?=1 +ENABLE_CHINESE_FULL = 4 + # ---- DEBUGGING ---- ENABLE_AM_FIX_SHOW_DATA ?= 0 ENABLE_AGC_SHOW_DATA ?= 0 ENABLE_TIMER ?= 0 ############################################################# +PACKED_FILE_SUFFIX = LOSEHU115 +ifeq ($(ENABLE_CHINESE_FULL),1) + $(info font1) + PACKED_FILE_SUFFIX = font1 +endif + +ifeq ($(ENABLE_CHINESE_FULL),2) + $(info font2) + PACKED_FILE_SUFFIX = font2 +endif + +ifeq ($(ENABLE_CHINESE_FULL),3) + $(info font3) + PACKED_FILE_SUFFIX = font3 +endif + +ifeq ($(ENABLE_CHINESE_FULL),4) + $(info K) + PACKED_FILE_SUFFIX := $(PACKED_FILE_SUFFIX)K +endif + +ifeq ($(ENABLE_CHINESE_FULL),0) + $(info Normal) +endif + + OPENOCD = openocd-win/bin/openocd.exe TARGET = firmware @@ -258,6 +285,9 @@ endif CFLAGS += -Wextra #CFLAGS += -Wpedantic +# 设置PACKED_FILE_SUFFIX,根据ENABLE_CHINESE_FULL的值设置不同的后缀 +CFLAGS += -DENABLE_CHINESE_FULL=$(ENABLE_CHINESE_FULL) +CFLAGS += -DPACKED_FILE_SUFFIX=\"$(PACKED_FILE_SUFFIX)\" CFLAGS += -DPRINTF_INCLUDE_CONFIG_H CFLAGS += -DAUTHOR_STRING=\"$(AUTHOR_STRING)\" -DVERSION_STRING=\"$(VERSION_STRING)\" @@ -273,7 +303,6 @@ endif ifeq ($(ENABLE_MDC1200_CONTACT),1) CFLAGS += -DENABLE_MDC1200_CONTACT endif -CFLAGS += -DENABLE_CHINESE_FULL=$(ENABLE_CHINESE_FULL) ifeq ($(ENABLE_AUDIO_BAR_DEFAULT),1) CFLAGS += -DENABLE_AUDIO_BAR_DEFAULT endif @@ -438,7 +467,6 @@ ifdef MY_PYTHON HAS_CRCMOD := $(shell $(MY_PYTHON) -c "import crcmod" 2>&1) endif - build:clean $(TARGET) $(OBJCOPY) -O binary $(TARGET) $(TARGET).bin ifndef MY_PYTHON @@ -451,11 +479,25 @@ else ifneq (,$(HAS_CRCMOD)) $(info !!!!!!!! run: pip install crcmod) $(info ) else - -$(MY_PYTHON) fw-pack.py $(TARGET).bin $(AUTHOR_STRING) $(TARGET).packed.bin + -$(MY_PYTHON) fw-pack.py $(TARGET).bin $(AUTHOR_STRING) $(PACKED_FILE_SUFFIX).bin endif $(SIZE) $(TARGET) -all: clean build flash - make clean + +full: + $(MAKE) build ENABLE_CHINESE_FULL=0 + $(MAKE) build ENABLE_CHINESE_FULL=1 + $(MAKE) build ENABLE_CHINESE_FULL=2 + $(MAKE) build ENABLE_CHINESE_FULL=3 + $(MAKE) build ENABLE_CHINESE_FULL=4 +both: + $(MAKE) build ENABLE_CHINESE_FULL=0 + $(MAKE) build ENABLE_CHINESE_FULL=4 + + +all: + $(MAKE) build + $(MAKE) flash + debug: $(OPENOCD) -c "bindto 0.0.0.0" -f interface/stlink.cfg -f dp32g030.cfg @@ -480,5 +522,5 @@ bsp/dp32g030/%.h: hardware/dp32g030/%.def -include $(DEPS) clean: - $(RM) $(call FixPath, $(TARGET).bin $(TARGET).packed.bin $(TARGET) $(OBJS) $(DEPS)) + $(RM) $(call FixPath, $(TARGET).bin $(PACKED_FILE_SUFFIX).bin $(TARGET) $(OBJS) $(DEPS)) diff --git a/compile-with-docker.bat b/compile-with-docker.bat index 3ad0749..f66ee6e 100644 --- a/compile-with-docker.bat +++ b/compile-with-docker.bat @@ -1,5 +1,5 @@ @echo off call clean.bat docker build -t uvk5 . -docker run -v %CD%\compiled-firmware:/app/compiled-firmware uvk5 /bin/bash -c "cd /app && make clean && make && cp firmware* compiled-firmware/" +docker run -v %CD%\compiled-firmware:/app/compiled-firmware uvk5 /bin/bash -c "cd /app && make clean && make && cp *.bin compiled-firmware/" pause diff --git a/version.c b/version.c index c7aa518..5fc0e5d 100644 --- a/version.c +++ b/version.c @@ -4,7 +4,7 @@ #ifdef GIT_HASH #define VER GIT_HASH #else - #define VER "114" + #define VER "11" #endif @@ -13,9 +13,13 @@ const char Version[] = "OEFW-"VER; const char UART_Version[] = "UV-K5 Firmware, Open Edition, OEFW-"VER"\r\n"; #else -#if ENABLE_CHINESE_FULL !=4 -const char Version[] = "LOSEHU"VER; -#else -const char Version[] = "LOSEHU"VER"K"; -#endif +//#if ENABLE_CHINESE_FULL !=4 +//const char Version[] = "LOSEHU"VER; +//#else +//const char Version[] = "LOSEHU"VER"K"; +//#endif + +const char Version[] = PACKED_FILE_SUFFIX; + + #endif diff --git a/win_make.bat b/win_make.bat index 8f3ec5b..426a9be 100644 --- a/win_make.bat +++ b/win_make.bat @@ -29,7 +29,7 @@ :: Do the compile :: make clean -make +make full :: pyinstaller --onefile ./MDC_WRITE/main.py :: If you have python installed, you can create a 'packed' .bin from the compiled firmware.bin file.