refactor: 工程清理,打造基础模板

- 删除冗余文件:main_backup/main_minimal/main_full、GD32F4xx_AddOn_Temp/、GD32F4xx_Custom_Backup/、GD32F4xx_Official/
- 删除无关工具:read_pdf.py、openocd_test.txt、version.txt
- 重构 main.cpp:去除 STEP 机制,简化为线性启动流程
- 清理 CMakeLists.txt:移除 usart0.c 引用、死代码、冗余 REMOVE_ITEM
- 修正 config.h SystemCoreClock 为 168MHz
- 修复 gd32f4xx_it.cpp 中已删除的 main.h 引用
This commit is contained in:
2026-04-26 16:38:14 +08:00
parent fc10ef2e10
commit 851c3db56e
20 changed files with 211 additions and 2324 deletions
+1 -22
View File
@@ -64,7 +64,6 @@ include_directories(
libs/common
libs/CMSIS
libs/thirdparty
libs/thirdparty/GD32F4xx_Official/LCD_TOUCH_MCU_LiangShanPi/Hardware/usart0
)
if(GD32F4XX_LIB_FOUND)
@@ -81,7 +80,6 @@ endif()
# Application sources (both .c and .cpp)
file(GLOB_RECURSE APP_SOURCES
app/*.cpp
app/tasks/*.cpp
bsp/*.cpp
drv/adc/*.cpp
drv/i2c/*.cpp
@@ -100,13 +98,6 @@ file(GLOB_RECURSE APP_SOURCES
bsp/device/flash/*.cpp
)
# Remove backup/extra main files from app sources
list(REMOVE_ITEM APP_SOURCES
${CMAKE_SOURCE_DIR}/app/main_backup.c
${CMAKE_SOURCE_DIR}/app/main_minimal.c
${CMAKE_SOURCE_DIR}/app/main_full.cpp
)
# GD32 standard peripheral library sources
@@ -119,13 +110,8 @@ set(ASSEMBLY_SOURCES
${CMAKE_SOURCE_DIR}/libs/thirdparty/GD32F4xx/Startup/startup_gd32f450_470.S
)
# Additional serial port driver
set(USART0_SOURCE
${CMAKE_SOURCE_DIR}/libs/thirdparty/GD32F4xx_Official/LCD_TOUCH_MCU_LiangShanPi/Hardware/usart0/usart0.c
)
# Combine all sources
set(ALL_SOURCES ${APP_SOURCES} ${GD32_SOURCES} ${ASSEMBLY_SOURCES} ${USART0_SOURCE})
set(ALL_SOURCES ${APP_SOURCES} ${GD32_SOURCES} ${ASSEMBLY_SOURCES})
add_executable(${PROJECT_NAME} ${ALL_SOURCES})
@@ -148,13 +134,6 @@ add_custom_command(TARGET ${PROJECT_NAME} POST_BUILD
set(FLASH_TOOL "auto" CACHE STRING "Programming tool to use (openocd, jlink, pyocd, auto)")
set_property(CACHE FLASH_TOOL PROPERTY STRINGS "openocd" "jlink" "pyocd" "auto")
# Check if flash script exists
if(NOT EXISTS ${CMAKE_SOURCE_DIR}/tools/flash.py)
message(WARNING "Flash script not found: ${CMAKE_SOURCE_DIR}/tools/flash.py")
message(STATUS "Creating default flash script...")
# Optionally create the flash script here or just warn
endif()
# Custom target for flashing
add_custom_target(flash
DEPENDS ${PROJECT_NAME}