Browse Source

完成子模块适配

master
Lizongdi 1 week ago
parent
commit
546b765e96
  1. 3
      .gitmodules
  2. 33
      .project
  3. 5
      CMakeLists.txt
  4. 86
      CMakePresets.json
  5. 48
      gcc-arm-none-eabi.cmake
  6. 1
      robot

3
.gitmodules

@ -0,0 +1,3 @@
[submodule "robot"]
path = robot
url = http://123.207.52.103:3000/LiZongdi/robot.git

33
.project

@ -0,0 +1,33 @@
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>32g431</name>
<comment></comment>
<projects>
</projects>
<buildSpec>
<buildCommand>
<name>com.st.stm32cube.ide.cmake.CmakeConfigureProjectBuilder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>org.eclipse.cdt.managedbuilder.core.genmakebuilder</name>
<triggers>clean,full,incremental,</triggers>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>org.eclipse.cdt.managedbuilder.core.ScannerConfigBuilder</name>
<triggers>full,incremental,</triggers>
<arguments>
</arguments>
</buildCommand>
</buildSpec>
<natures>
<nature>org.eclipse.cdt.core.cnature</nature>
<nature>org.eclipse.cdt.managedbuilder.core.managedBuildNature</nature>
<nature>org.eclipse.cdt.managedbuilder.core.ScannerConfigNature</nature>
<nature>com.st.stm32cube.ide.cmake.CmakeConfigProjectNature</nature>
<nature>com.st.stm32cube.ide.mcu.MCUEndUserDisabledTrustZoneProjectNature</nature>
</natures>
</projectDescription>

5
CMakeLists.txt

@ -61,8 +61,11 @@ target_compile_definitions(${CMAKE_PROJECT_NAME} PRIVATE
list(REMOVE_ITEM CMAKE_C_IMPLICIT_LINK_LIBRARIES ob)
# Add linked libraries
set(GENERATED_COMMON_DIR "${CMAKE_BINARY_DIR}/library/common")
include_directories("${GENERATED_COMMON_DIR}")
add_subdirectory(robot)
target_link_libraries(${CMAKE_PROJECT_NAME}
stm32cubemx
main
# Add user defined libraries
)

86
CMakePresets.json

@ -1,38 +1,52 @@
{
"version": 3,
"configurePresets": [
{
"name": "default",
"hidden": true,
"generator": "Ninja",
"binaryDir": "${sourceDir}/build/${presetName}",
"toolchainFile": "${sourceDir}/cmake/gcc-arm-none-eabi.cmake",
"cacheVariables": {
}
},
{
"name": "Debug",
"inherits": "default",
"cacheVariables": {
"CMAKE_BUILD_TYPE": "Debug"
}
},
{
"name": "Release",
"inherits": "default",
"cacheVariables": {
"CMAKE_BUILD_TYPE": "Release"
}
}
],
"buildPresets": [
{
"name": "Debug",
"configurePreset": "Debug"
},
{
"name": "Release",
"configurePreset": "Release"
}
]
"version": 4,
"configurePresets": [
{
"name": "default-release",
"hidden": true,
"displayName": "Default Release Build",
"description": "Default Release Build",
"binaryDir": "${sourceDir}/build",
"cacheVariables": {
"CMAKE_BUILD_TYPE": "Release",
"A_BUILD_MAIN": "ON",
"BUILD_COMMON": "ON",
"MY_BUILD_STATIC": "ON"
}
},
{
"name": "Spool-end",
"generator": "Ninja",
"toolchainFile": "${sourceDir}/gcc-arm-none-eabi.cmake",
"inherits": "default-release",
"cacheVariables": {
"CMAKE_BUILD_TYPE": "Debug",
"BUILD_LUA": "ON",
"A_BUILD_MAIN_AS_STATIC_LIB": "ON",
"BUILD_LUA_STANDALONE": "OFF",
"MY_BUILD_STATIC": "OFF",
"BUILD_RINGBUFFER": "ON",
"BUILD_PERIPHERAL": "ON",
"BUILD_LIST": "ON",
"BUILD_BSPMCU": "ON",
"MEM_POOL_TOTAL_SIZE": "46*1024",
"USE_UART": true,
"USE_CAN": true
}
},
{
"name": "robot",
"inherits": "Spool-end",
"cacheVariables": {
"BUILD_RBCORE": "ON",
"BUILD_OPTIONAL": "ON",
"IOC_100PIN": true,
"USE_LUA_ST": true,
"USE_LUA_ST_CAN": true,
"USE_TALNET": true,
"USE_LWIP": true,
"USE_FREERTOS": true
}
}
]
}

48
gcc-arm-none-eabi.cmake

@ -0,0 +1,48 @@
set(CMAKE_SYSTEM_NAME Generic)
set(CMAKE_SYSTEM_PROCESSOR arm)
set(CMAKE_C_COMPILER_ID GNU)
set(CMAKE_CXX_COMPILER_ID GNU)
# Some default GCC settings
# arm-none-eabi- must be part of path environment
set(TOOLCHAIN_PREFIX arm-none-eabi-)
set(CMAKE_C_COMPILER ${TOOLCHAIN_PREFIX}gcc)
set(CMAKE_ASM_COMPILER ${CMAKE_C_COMPILER})
set(CMAKE_CXX_COMPILER ${TOOLCHAIN_PREFIX}g++)
set(CMAKE_LINKER ${TOOLCHAIN_PREFIX}g++)
set(CMAKE_OBJCOPY ${TOOLCHAIN_PREFIX}objcopy)
set(CMAKE_SIZE ${TOOLCHAIN_PREFIX}size)
set(CMAKE_EXECUTABLE_SUFFIX_ASM ".elf")
set(CMAKE_EXECUTABLE_SUFFIX_C ".elf")
set(CMAKE_EXECUTABLE_SUFFIX_CXX ".elf")
set(CMAKE_TRY_COMPILE_TARGET_TYPE STATIC_LIBRARY)
# MCU specific flags
set(TARGET_FLAGS "-mcpu=cortex-m4 -mfpu=fpv4-sp-d16 -mfloat-abi=hard ")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${TARGET_FLAGS}")
set(CMAKE_ASM_FLAGS "${CMAKE_C_FLAGS} -x assembler-with-cpp -MMD -MP")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall -fdata-sections -ffunction-sections -fstack-usage")
# The cyclomatic-complexity parameter must be defined for the Cyclomatic complexity feature in STM32CubeIDE to work.
# However, most GCC toolchains do not support this option, which causes a compilation error; for this reason, the feature is disabled by default.
# set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fcyclomatic-complexity")
set(CMAKE_C_FLAGS_DEBUG "-O0 -g3")
set(CMAKE_C_FLAGS_RELEASE "-Os -g0")
set(CMAKE_CXX_FLAGS_DEBUG "-O0 -g3")
set(CMAKE_CXX_FLAGS_RELEASE "-Os -g0")
set(CMAKE_CXX_FLAGS "${CMAKE_C_FLAGS} -fno-rtti -fno-exceptions -fno-threadsafe-statics")
set(LINKER_SYMBOLS "-u _fputc -u fputc -u _fgetc -u fgetc")
set(CMAKE_EXE_LINKER_FLAGS "${TARGET_FLAGS}")
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -T \"${CMAKE_SOURCE_DIR}/STM32G431XX_FLASH.ld\"")
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} --specs=nano.specs")
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -Wl,-Map=${CMAKE_PROJECT_NAME}.map -Wl,--gc-sections")
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -Wl,--print-memory-usage")
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} ${LINKER_SYMBOLS}")
set(TOOLCHAIN_LINK_LIBRARIES "m")

1
robot

@ -0,0 +1 @@
Subproject commit 07754e024e60b4b8766b89f34581dc0738639533
Loading…
Cancel
Save