feat(cproject): 移除CAN DMA相关代码并优化编译配置

- 移除了CAN模块中的DMA相关代码,包括can_dma_init函数、
  DMA中断处理函数以及相关的全局变量和头文件包含

- 更新了项目构建配置,将优化级别从balanced改为size以减小
  固件体积

- 添加了-fno-exceptions和-fno-rtti编译选项以进一步优化代码

- 升级了GD32C10x_DFP包版本至1.5.0

- 调整了OTA跳转逻辑,增加了更安全的中断和外设关闭处理

- 修复了Flash写入时的重复包处理逻辑,增加错误标志清理机制

- 将AES加密算法中的gf_mul函数标记为noinline属性
This commit is contained in:
cbb
2026-07-26 23:08:02 +08:00
parent c357a8af6f
commit 05069e3057
58 changed files with 1332 additions and 4191 deletions
@@ -84,6 +84,8 @@ target_compile_options(${CONTEXT} PUBLIC
"SHELL:-D__packed=packed"
"SHELL:-fshort-enums"
"SHELL:-fshort-wchar"
"SHELL:-fno-exceptions"
"SHELL:-fno-rtti"
"SHELL:-D__MICROLIB"
"SHELL:-Wno-register"
"SHELL:-gdwarf-5"
@@ -99,6 +101,8 @@ target_compile_options(${CONTEXT} PUBLIC
"SHELL:${CXX_BYTE_ORDER}"
"SHELL:-fshort-enums"
"SHELL:-fshort-wchar"
"SHELL:-fno-exceptions"
"SHELL:-fno-rtti"
"SHELL:-D__MICROLIB"
"SHELL:-Wno-register"
"SHELL:-gdwarf-5"
@@ -111,9 +115,9 @@ target_compile_options(${CONTEXT} PUBLIC
# Compile Options Abstractions
add_library(${CONTEXT}_ABSTRACTIONS INTERFACE)
cbuild_set_options_flags(CXX "balanced" "off" "" "" CXX_OPTIONS_FLAGS_${CONTEXT})
cbuild_set_options_flags(CC "balanced" "off" "" "" CC_OPTIONS_FLAGS_${CONTEXT})
cbuild_set_options_flags(ASM "balanced" "off" "" "" ASM_OPTIONS_FLAGS_${CONTEXT})
cbuild_set_options_flags(CXX "size" "off" "" "" CXX_OPTIONS_FLAGS_${CONTEXT})
cbuild_set_options_flags(CC "size" "off" "" "" CC_OPTIONS_FLAGS_${CONTEXT})
cbuild_set_options_flags(ASM "size" "off" "" "" ASM_OPTIONS_FLAGS_${CONTEXT})
target_compile_options(${CONTEXT}_ABSTRACTIONS INTERFACE
$<$<COMPILE_LANGUAGE:CXX>:
"SHELL:${CXX_OPTIONS_FLAGS_${CONTEXT}}"
@@ -139,10 +143,8 @@ target_link_libraries(${CONTEXT} PUBLIC
GigaDevice_Device_GD32C10x_StdPeripherals_CAN_1_3_0
GigaDevice_Device_GD32C10x_StdPeripherals_CRC_1_3_0
GigaDevice_Device_GD32C10x_StdPeripherals_DBG_1_3_0
GigaDevice_Device_GD32C10x_StdPeripherals_DMA_1_3_0
GigaDevice_Device_GD32C10x_StdPeripherals_EXTI_1_3_0
GigaDevice_Device_GD32C10x_StdPeripherals_FMC_1_3_0
GigaDevice_Device_GD32C10x_StdPeripherals_FWDGT_1_3_0
GigaDevice_Device_GD32C10x_StdPeripherals_GPIO_1_3_0
GigaDevice_Device_GD32C10x_StdPeripherals_MISC_1_3_0
GigaDevice_Device_GD32C10x_StdPeripherals_PMU_1_3_0
@@ -85,24 +85,6 @@ target_link_libraries(GigaDevice_Device_GD32C10x_StdPeripherals_DBG_1_3_0 PUBLIC
${CONTEXT}_ABSTRACTIONS
)
# component GigaDevice::Device:GD32C10x_StdPeripherals:DMA@1.3.0
add_library(GigaDevice_Device_GD32C10x_StdPeripherals_DMA_1_3_0 OBJECT
"${SOLUTION_ROOT}/Robot_V2/RTE/Device/GD32C103CB/gd32c10x_dma.c"
)
target_include_directories(GigaDevice_Device_GD32C10x_StdPeripherals_DMA_1_3_0 PUBLIC
$<TARGET_PROPERTY:${CONTEXT},INTERFACE_INCLUDE_DIRECTORIES>
"${CMSIS_PACK_ROOT}/GigaDevice/GD32C10x_DFP/1.5.0/Device/Firmware/Peripherals/inc"
)
target_compile_definitions(GigaDevice_Device_GD32C10x_StdPeripherals_DMA_1_3_0 PUBLIC
$<TARGET_PROPERTY:${CONTEXT},INTERFACE_COMPILE_DEFINITIONS>
)
target_compile_options(GigaDevice_Device_GD32C10x_StdPeripherals_DMA_1_3_0 PUBLIC
$<TARGET_PROPERTY:${CONTEXT},INTERFACE_COMPILE_OPTIONS>
)
target_link_libraries(GigaDevice_Device_GD32C10x_StdPeripherals_DMA_1_3_0 PUBLIC
${CONTEXT}_ABSTRACTIONS
)
# component GigaDevice::Device:GD32C10x_StdPeripherals:EXTI@1.3.0
add_library(GigaDevice_Device_GD32C10x_StdPeripherals_EXTI_1_3_0 OBJECT
"${SOLUTION_ROOT}/Robot_V2/RTE/Device/GD32C103CB/gd32c10x_exti.c"
@@ -139,24 +121,6 @@ target_link_libraries(GigaDevice_Device_GD32C10x_StdPeripherals_FMC_1_3_0 PUBLIC
${CONTEXT}_ABSTRACTIONS
)
# component GigaDevice::Device:GD32C10x_StdPeripherals:FWDGT@1.3.0
add_library(GigaDevice_Device_GD32C10x_StdPeripherals_FWDGT_1_3_0 OBJECT
"${SOLUTION_ROOT}/Robot_V2/RTE/Device/GD32C103CB/gd32c10x_fwdgt.c"
)
target_include_directories(GigaDevice_Device_GD32C10x_StdPeripherals_FWDGT_1_3_0 PUBLIC
$<TARGET_PROPERTY:${CONTEXT},INTERFACE_INCLUDE_DIRECTORIES>
"${CMSIS_PACK_ROOT}/GigaDevice/GD32C10x_DFP/1.5.0/Device/Firmware/Peripherals/inc"
)
target_compile_definitions(GigaDevice_Device_GD32C10x_StdPeripherals_FWDGT_1_3_0 PUBLIC
$<TARGET_PROPERTY:${CONTEXT},INTERFACE_COMPILE_DEFINITIONS>
)
target_compile_options(GigaDevice_Device_GD32C10x_StdPeripherals_FWDGT_1_3_0 PUBLIC
$<TARGET_PROPERTY:${CONTEXT},INTERFACE_COMPILE_OPTIONS>
)
target_link_libraries(GigaDevice_Device_GD32C10x_StdPeripherals_FWDGT_1_3_0 PUBLIC
${CONTEXT}_ABSTRACTIONS
)
# component GigaDevice::Device:GD32C10x_StdPeripherals:GPIO@1.3.0
add_library(GigaDevice_Device_GD32C10x_StdPeripherals_GPIO_1_3_0 OBJECT
"${SOLUTION_ROOT}/Robot_V2/RTE/Device/GD32C103CB/gd32c10x_gpio.c"
@@ -1,7 +1,7 @@
cmake_minimum_required(VERSION ${CMAKE_VERSION}) # this file comes with cmake
set(command "C:/Users/cbb/.vcpkg/artifacts/2139c4c6/tools.kitware.cmake/3.31.5/bin/cmake.exe;-G;Ninja;-S;G:/Robot_v2/BOOT/tmp/Robot_V2.Release+GD32C103CB;-B;G:/Robot_v2/BOOT/tmp/1;-DSOLUTION_ROOT=G:/Robot_v2/BOOT;-DCMSIS_PACK_ROOT=C:/Users/cbb/AppData/Local/arm/packs;-DCMSIS_COMPILER_ROOT=C:/Users/cbb/.vscode/extensions/arm.cmsis-csolution-1.66.0-win32-x64/tools/cmsis-toolbox/etc")
set(command "C:/Users/cbb/.vcpkg/artifacts/2139c4c6/tools.kitware.cmake/3.31.12/bin/cmake.exe;-G;Ninja;-S;G:/Robot_v2/BOOT/tmp/Robot_V2.Release+GD32C103CB;-B;G:/Robot_v2/BOOT/tmp/1;-DSOLUTION_ROOT=G:/Robot_v2/BOOT;-DCMSIS_PACK_ROOT=C:/Users/cbb/AppData/Local/arm/packs;-DCMSIS_COMPILER_ROOT=C:/Users/cbb/.vcpkg/artifacts/2139c4c6/tools.open.cmsis.pack.cmsis.toolbox/2.13.0/etc")
set(log_merged "")
set(log_output_on_failure "ON")
set(stdout_log "G:/Robot_v2/BOOT/tmp/Robot_V2.Release+GD32C103CB/src/Robot_V2.Release+GD32C103CB-stamp/Robot_V2.Release+GD32C103CB-configure-out.log")
@@ -1,17 +1,17 @@
-- The CXX compiler identification is ARMClang 6.24.0
-- The C compiler identification is ARMClang 6.24.0
-- The ASM compiler identification is ARMClang
-- Found assembler: c:/Users/cbb/.vcpkg/artifacts/2139c4c6/compilers.arm.armclang/6.24.0/bin/armclang.exe
-- Found assembler: C:/Users/cbb/.vcpkg/artifacts/2139c4c6/compilers.arm.armclang/6.24.0/bin/armclang.exe
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Check for working CXX compiler: c:/Users/cbb/.vcpkg/artifacts/2139c4c6/compilers.arm.armclang/6.24.0/bin/armclang.exe - skipped
-- Check for working CXX compiler: C:/Users/cbb/.vcpkg/artifacts/2139c4c6/compilers.arm.armclang/6.24.0/bin/armclang.exe - skipped
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working C compiler: c:/Users/cbb/.vcpkg/artifacts/2139c4c6/compilers.arm.armclang/6.24.0/bin/armclang.exe - skipped
-- Check for working C compiler: C:/Users/cbb/.vcpkg/artifacts/2139c4c6/compilers.arm.armclang/6.24.0/bin/armclang.exe - skipped
-- Detecting C compile features
-- Detecting C compile features - done
-- Configuring done (6.2s)
-- Configuring done (10.3s)
-- Generating done (0.1s)
-- Build files have been written to: G:/Robot_v2/BOOT/tmp/1
@@ -1,56 +0,0 @@
cmake_minimum_required(VERSION ${CMAKE_VERSION}) # this file comes with cmake
set(command "C:/Users/cbb/.vcpkg/artifacts/2139c4c6/tools.kitware.cmake/3.31.5/bin/cmake.exe;--build;G:/Robot_v2/BOOT/tmp/1;--target;database")
set(log_merged "")
set(log_output_on_failure "ON")
set(stdout_log "G:/Robot_v2/BOOT/tmp/Robot_V2.Release+GD32C103CB/src/Robot_V2.Release+GD32C103CB-stamp/Robot_V2.Release+GD32C103CB-database-out.log")
set(stderr_log "G:/Robot_v2/BOOT/tmp/Robot_V2.Release+GD32C103CB/src/Robot_V2.Release+GD32C103CB-stamp/Robot_V2.Release+GD32C103CB-database-err.log")
execute_process(
COMMAND ${command}
RESULT_VARIABLE result
OUTPUT_FILE "${stdout_log}"
ERROR_FILE "${stderr_log}"
)
macro(read_up_to_max_size log_file output_var)
file(SIZE ${log_file} determined_size)
set(max_size 10240)
if (determined_size GREATER max_size)
math(EXPR seek_position "${determined_size} - ${max_size}")
file(READ ${log_file} ${output_var} OFFSET ${seek_position})
set(${output_var} "...skipping to end...\n${${output_var}}")
else()
file(READ ${log_file} ${output_var})
endif()
endmacro()
if(result)
set(msg "Command failed: ${result}\n")
foreach(arg IN LISTS command)
set(msg "${msg} '${arg}'")
endforeach()
if (${log_merged})
set(msg "${msg}\nSee also\n ${stderr_log}")
else()
set(msg "${msg}\nSee also\n G:/Robot_v2/BOOT/tmp/Robot_V2.Release+GD32C103CB/src/Robot_V2.Release+GD32C103CB-stamp/Robot_V2.Release+GD32C103CB-database-*.log")
endif()
if (${log_output_on_failure})
message(SEND_ERROR "${msg}")
if (${log_merged})
read_up_to_max_size("${stderr_log}" error_log_contents)
message(STATUS "Log output is:\n${error_log_contents}")
else()
read_up_to_max_size("${stdout_log}" out_log_contents)
read_up_to_max_size("${stderr_log}" err_log_contents)
message(STATUS "stdout output is:\n${out_log_contents}")
message(STATUS "stderr output is:\n${err_log_contents}")
endif()
message(FATAL_ERROR "Stopping after outputting logs.")
else()
message(FATAL_ERROR "${msg}")
endif()
else()
if(NOT "Ninja" MATCHES "Ninja")
set(msg "Robot_V2.Release+GD32C103CB database command succeeded. See also G:/Robot_v2/BOOT/tmp/Robot_V2.Release+GD32C103CB/src/Robot_V2.Release+GD32C103CB-stamp/Robot_V2.Release+GD32C103CB-database-*.log")
message(STATUS "${msg}")
endif()
endif()
@@ -1 +0,0 @@
[1/1] C:\WINDOWS\system32\cmd.exe /C "cd /D G:\Robot_v2\BOOT\tmp\1 && C:\Users\cbb\.vcpkg\artifacts\2139c4c6\tools.kitware.cmake\3.31.5\bin\cmake.exe -E make_directory G:/Robot_v2/BOOT/out/Robot_V2/GD32C103CB/Release && C:\Users\cbb\.vcpkg\artifacts\2139c4c6\tools.kitware.cmake\3.31.5\bin\cmake.exe -E copy_if_different G:/Robot_v2/BOOT/tmp/1/compile_commands.json G:/Robot_v2/BOOT/out/Robot_V2/GD32C103CB/Release"
@@ -1 +1 @@
cmd='C:/Users/cbb/.vcpkg/artifacts/2139c4c6/tools.kitware.cmake/3.31.5/bin/cmake.exe;-G;Ninja;-S;<SOURCE_DIR>;-B;<BINARY_DIR>;-DSOLUTION_ROOT=G:/Robot_v2/BOOT;-DCMSIS_PACK_ROOT=C:/Users/cbb/AppData/Local/arm/packs;-DCMSIS_COMPILER_ROOT=C:/Users/cbb/.vscode/extensions/arm.cmsis-csolution-1.66.0-win32-x64/tools/cmsis-toolbox/etc'
cmd='C:/Users/cbb/.vcpkg/artifacts/2139c4c6/tools.kitware.cmake/3.31.12/bin/cmake.exe;-G;Ninja;-S;<SOURCE_DIR>;-B;<BINARY_DIR>;-DSOLUTION_ROOT=G:/Robot_v2/BOOT;-DCMSIS_PACK_ROOT=C:/Users/cbb/AppData/Local/arm/packs;-DCMSIS_COMPILER_ROOT=C:/Users/cbb/.vcpkg/artifacts/2139c4c6/tools.open.cmsis.pack.cmsis.toolbox/2.13.0/etc'
@@ -1,6 +1,6 @@
# toolchain.cmake
set(REGISTERED_TOOLCHAIN_ROOT "c:/Users/cbb/.vcpkg/artifacts/2139c4c6/compilers.arm.armclang/6.24.0/bin/")
set(REGISTERED_TOOLCHAIN_ROOT "C:/Users/cbb/.vcpkg/artifacts/2139c4c6/compilers.arm.armclang/6.24.0/bin")
set(REGISTERED_TOOLCHAIN_VERSION "6.24.0")
include("${CMSIS_COMPILER_ROOT}/AC6.6.16.2.cmake")