mirror of
https://github.com/MaJerle/lwmem.git
synced 2025-02-07 14:14:10 +08:00
Move to CMakEPresets
This commit is contained in:
parent
0139b087c7
commit
f5738aa725
@ -2,6 +2,7 @@
|
|||||||
"version": 4,
|
"version": 4,
|
||||||
"configurations": [
|
"configurations": [
|
||||||
{
|
{
|
||||||
|
/* ms-vscode.cmake-tools plugin shall to be installed, which provides include paths and defines through CMake file */
|
||||||
"name": "STM32",
|
"name": "STM32",
|
||||||
"includePath": [],
|
"includePath": [],
|
||||||
"defines": [],
|
"defines": [],
|
||||||
|
@ -1,10 +0,0 @@
|
|||||||
[
|
|
||||||
{
|
|
||||||
"name": "GCC arm-none-eabi - custom toolchain setup",
|
|
||||||
"compilers": {
|
|
||||||
"C": "arm-none-eabi-gcc",
|
|
||||||
"CXX": "arm-none-eabi-g++"
|
|
||||||
},
|
|
||||||
"toolchainFile": "gcc-arm-none-eabi.cmake"
|
|
||||||
}
|
|
||||||
]
|
|
@ -8,14 +8,14 @@
|
|||||||
"name": "Debug Microcontroller - ST-Link",
|
"name": "Debug Microcontroller - ST-Link",
|
||||||
"cwd": "${workspaceFolder}",
|
"cwd": "${workspaceFolder}",
|
||||||
"type": "cortex-debug",
|
"type": "cortex-debug",
|
||||||
"executable": "${command:cmake.launchTargetPath}", //or fixed file path: build/project-name.elf
|
"executable": "${command:cmake.launchTargetPath}", //or fixed file path: build/stm32h735g-dk-led.elf
|
||||||
"request": "launch", //Use "attach" to connect to target w/o elf download
|
"request": "launch", //Use "attach" to connect to target w/o elf download
|
||||||
"servertype": "stlink",
|
"servertype": "stlink",
|
||||||
"device": "STM32L496AG", //MCU used
|
"device": "", //MCU used, ex. "STM32H735IG"
|
||||||
"interface": "swd",
|
"interface": "swd",
|
||||||
"serialNumber": "", //Set ST-Link ID if you use multiple at the same time
|
"serialNumber": "", //Set ST-Link ID if you use multiple at the same time
|
||||||
"runToMain": true,
|
"runToMain": true,
|
||||||
"svdFile": "", //SVD file to see registers
|
"svdFile": "path/to/file.svd", //Path to SVD file to see registers
|
||||||
"v1": false,
|
"v1": false,
|
||||||
"showDevDebugOutput": true,
|
"showDevDebugOutput": true,
|
||||||
|
|
||||||
|
@ -5,7 +5,7 @@
|
|||||||
"type": "cppbuild",
|
"type": "cppbuild",
|
||||||
"label": "Build project",
|
"label": "Build project",
|
||||||
"command": "cmake",
|
"command": "cmake",
|
||||||
"args": ["--build", "\"build\"", "-j", "8"],
|
"args": ["--build", "${command:cmake.buildDirectory}", "-j", "8"],
|
||||||
"options": {
|
"options": {
|
||||||
"cwd": "${workspaceFolder}"
|
"cwd": "${workspaceFolder}"
|
||||||
},
|
},
|
||||||
@ -19,7 +19,7 @@
|
|||||||
"type": "shell",
|
"type": "shell",
|
||||||
"label": "Re-build project",
|
"label": "Re-build project",
|
||||||
"command": "cmake",
|
"command": "cmake",
|
||||||
"args": ["--build", "\"build\"", "--clean-first", "-v", "-j", "8"],
|
"args": ["--build", "${command:cmake.buildDirectory}", "--clean-first", "-v", "-j", "8"],
|
||||||
"options": {
|
"options": {
|
||||||
"cwd": "${workspaceFolder}"
|
"cwd": "${workspaceFolder}"
|
||||||
},
|
},
|
||||||
@ -29,24 +29,7 @@
|
|||||||
"type": "shell",
|
"type": "shell",
|
||||||
"label": "Clean project",
|
"label": "Clean project",
|
||||||
"command": "cmake",
|
"command": "cmake",
|
||||||
"args": ["--build", "\"build\"", "--target", "clean"],
|
"args": ["--build", "${command:cmake.buildDirectory}", "--target", "clean"],
|
||||||
"options": {
|
|
||||||
"cwd": "${workspaceFolder}"
|
|
||||||
},
|
|
||||||
"problemMatcher": []
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"type": "shell",
|
|
||||||
"label": "Run CMake configuration",
|
|
||||||
"command": "cmake",
|
|
||||||
"args": [
|
|
||||||
"--no-warn-unused-cli",
|
|
||||||
"-DCMAKE_EXPORT_COMPILE_COMMANDS:BOOL=TRUE",
|
|
||||||
"-DCMAKE_BUILD_TYPE:STRING=Debug",
|
|
||||||
"-DCMAKE_TOOLCHAIN_FILE:FILEPATH=gcc-arm-none-eabi.cmake",
|
|
||||||
"-Bbuild",
|
|
||||||
"-G", "Ninja"
|
|
||||||
],
|
|
||||||
"options": {
|
"options": {
|
||||||
"cwd": "${workspaceFolder}"
|
"cwd": "${workspaceFolder}"
|
||||||
},
|
},
|
||||||
|
@ -198,6 +198,7 @@ target_link_options(${EXECUTABLE} PRIVATE
|
|||||||
-T${MCU_LINKER_SCRIPT}${linker_script_SRC}
|
-T${MCU_LINKER_SCRIPT}${linker_script_SRC}
|
||||||
${CPU_PARAMETERS}
|
${CPU_PARAMETERS}
|
||||||
-Wl,-Map=${CMAKE_PROJECT_NAME}.map
|
-Wl,-Map=${CMAKE_PROJECT_NAME}.map
|
||||||
|
-u _printf_float # STDIO float formatting support (remove if not used)
|
||||||
--specs=nosys.specs
|
--specs=nosys.specs
|
||||||
-Wl,--start-group
|
-Wl,--start-group
|
||||||
-lc
|
-lc
|
||||||
@ -218,7 +219,7 @@ add_custom_command(TARGET ${EXECUTABLE} POST_BUILD
|
|||||||
COMMAND ${CMAKE_OBJCOPY} -O ihex $<TARGET_FILE:${EXECUTABLE}> ${EXECUTABLE}.hex
|
COMMAND ${CMAKE_OBJCOPY} -O ihex $<TARGET_FILE:${EXECUTABLE}> ${EXECUTABLE}.hex
|
||||||
)
|
)
|
||||||
|
|
||||||
# Conver to bin file -> add conditional check?
|
# Convert to bin file -> add conditional check?
|
||||||
add_custom_command(TARGET ${EXECUTABLE} POST_BUILD
|
add_custom_command(TARGET ${EXECUTABLE} POST_BUILD
|
||||||
COMMAND ${CMAKE_OBJCOPY} -O binary $<TARGET_FILE:${EXECUTABLE}> ${EXECUTABLE}.bin
|
COMMAND ${CMAKE_OBJCOPY} -O binary $<TARGET_FILE:${EXECUTABLE}> ${EXECUTABLE}.bin
|
||||||
)
|
)
|
||||||
|
@ -0,0 +1,43 @@
|
|||||||
|
{
|
||||||
|
"version": 3,
|
||||||
|
"configurePresets": [
|
||||||
|
{
|
||||||
|
"name": "default",
|
||||||
|
"hidden": true,
|
||||||
|
"generator": "Ninja",
|
||||||
|
"binaryDir": "${sourceDir}/build/${presetName}",
|
||||||
|
"toolchainFile": "${sourceDir}/cmake/gcc-arm-none-eabi.cmake",
|
||||||
|
"cacheVariables": {
|
||||||
|
"CMAKE_EXPORT_COMPILE_COMMANDS": "ON"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "Debug",
|
||||||
|
"inherits": "default",
|
||||||
|
"cacheVariables": {
|
||||||
|
"CMAKE_BUILD_TYPE": "Debug"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "RelWithDebInfo",
|
||||||
|
"inherits": "default",
|
||||||
|
"cacheVariables": {
|
||||||
|
"CMAKE_BUILD_TYPE": "RelWithDebInfo"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "Release",
|
||||||
|
"inherits": "default",
|
||||||
|
"cacheVariables": {
|
||||||
|
"CMAKE_BUILD_TYPE": "Release"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "MinSizeRel",
|
||||||
|
"inherits": "default",
|
||||||
|
"cacheVariables": {
|
||||||
|
"CMAKE_BUILD_TYPE": "MinSizeRel"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
@ -2,6 +2,7 @@
|
|||||||
"version": 4,
|
"version": 4,
|
||||||
"configurations": [
|
"configurations": [
|
||||||
{
|
{
|
||||||
|
/* ms-vscode.cmake-tools plugin shall to be installed, which provides include paths and defines through CMake file */
|
||||||
"name": "STM32",
|
"name": "STM32",
|
||||||
"includePath": [],
|
"includePath": [],
|
||||||
"defines": [],
|
"defines": [],
|
||||||
|
@ -1,10 +0,0 @@
|
|||||||
[
|
|
||||||
{
|
|
||||||
"name": "GCC arm-none-eabi - custom toolchain setup",
|
|
||||||
"compilers": {
|
|
||||||
"C": "arm-none-eabi-gcc",
|
|
||||||
"CXX": "arm-none-eabi-g++"
|
|
||||||
},
|
|
||||||
"toolchainFile": "gcc-arm-none-eabi.cmake"
|
|
||||||
}
|
|
||||||
]
|
|
@ -8,14 +8,14 @@
|
|||||||
"name": "Debug Microcontroller - ST-Link",
|
"name": "Debug Microcontroller - ST-Link",
|
||||||
"cwd": "${workspaceFolder}",
|
"cwd": "${workspaceFolder}",
|
||||||
"type": "cortex-debug",
|
"type": "cortex-debug",
|
||||||
"executable": "${command:cmake.launchTargetPath}", //or fixed file path: build/project-name.elf
|
"executable": "${command:cmake.launchTargetPath}", //or fixed file path: build/stm32h735g-dk-led.elf
|
||||||
"request": "launch", //Use "attach" to connect to target w/o elf download
|
"request": "launch", //Use "attach" to connect to target w/o elf download
|
||||||
"servertype": "stlink",
|
"servertype": "stlink",
|
||||||
"device": "STM32L496AG", //MCU used
|
"device": "", //MCU used, ex. "STM32H735IG"
|
||||||
"interface": "swd",
|
"interface": "swd",
|
||||||
"serialNumber": "", //Set ST-Link ID if you use multiple at the same time
|
"serialNumber": "", //Set ST-Link ID if you use multiple at the same time
|
||||||
"runToMain": true,
|
"runToMain": true,
|
||||||
"svdFile": "", //SVD file to see registers
|
"svdFile": "path/to/file.svd", //Path to SVD file to see registers
|
||||||
"v1": false,
|
"v1": false,
|
||||||
"showDevDebugOutput": true,
|
"showDevDebugOutput": true,
|
||||||
|
|
||||||
|
@ -5,7 +5,7 @@
|
|||||||
"type": "cppbuild",
|
"type": "cppbuild",
|
||||||
"label": "Build project",
|
"label": "Build project",
|
||||||
"command": "cmake",
|
"command": "cmake",
|
||||||
"args": ["--build", "\"build\"", "-j", "8"],
|
"args": ["--build", "${command:cmake.buildDirectory}", "-j", "8"],
|
||||||
"options": {
|
"options": {
|
||||||
"cwd": "${workspaceFolder}"
|
"cwd": "${workspaceFolder}"
|
||||||
},
|
},
|
||||||
@ -19,7 +19,7 @@
|
|||||||
"type": "shell",
|
"type": "shell",
|
||||||
"label": "Re-build project",
|
"label": "Re-build project",
|
||||||
"command": "cmake",
|
"command": "cmake",
|
||||||
"args": ["--build", "\"build\"", "--clean-first", "-v", "-j", "8"],
|
"args": ["--build", "${command:cmake.buildDirectory}", "--clean-first", "-v", "-j", "8"],
|
||||||
"options": {
|
"options": {
|
||||||
"cwd": "${workspaceFolder}"
|
"cwd": "${workspaceFolder}"
|
||||||
},
|
},
|
||||||
@ -29,24 +29,7 @@
|
|||||||
"type": "shell",
|
"type": "shell",
|
||||||
"label": "Clean project",
|
"label": "Clean project",
|
||||||
"command": "cmake",
|
"command": "cmake",
|
||||||
"args": ["--build", "\"build\"", "--target", "clean"],
|
"args": ["--build", "${command:cmake.buildDirectory}", "--target", "clean"],
|
||||||
"options": {
|
|
||||||
"cwd": "${workspaceFolder}"
|
|
||||||
},
|
|
||||||
"problemMatcher": []
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"type": "shell",
|
|
||||||
"label": "Run CMake configuration",
|
|
||||||
"command": "cmake",
|
|
||||||
"args": [
|
|
||||||
"--no-warn-unused-cli",
|
|
||||||
"-DCMAKE_EXPORT_COMPILE_COMMANDS:BOOL=TRUE",
|
|
||||||
"-DCMAKE_BUILD_TYPE:STRING=Debug",
|
|
||||||
"-DCMAKE_TOOLCHAIN_FILE:FILEPATH=gcc-arm-none-eabi.cmake",
|
|
||||||
"-Bbuild",
|
|
||||||
"-G", "Ninja"
|
|
||||||
],
|
|
||||||
"options": {
|
"options": {
|
||||||
"cwd": "${workspaceFolder}"
|
"cwd": "${workspaceFolder}"
|
||||||
},
|
},
|
||||||
|
@ -182,6 +182,7 @@ target_link_options(${EXECUTABLE} PRIVATE
|
|||||||
-T${MCU_LINKER_SCRIPT}${linker_script_SRC}
|
-T${MCU_LINKER_SCRIPT}${linker_script_SRC}
|
||||||
${CPU_PARAMETERS}
|
${CPU_PARAMETERS}
|
||||||
-Wl,-Map=${CMAKE_PROJECT_NAME}.map
|
-Wl,-Map=${CMAKE_PROJECT_NAME}.map
|
||||||
|
-u _printf_float # STDIO float formatting support (remove if not used)
|
||||||
--specs=nosys.specs
|
--specs=nosys.specs
|
||||||
-Wl,--start-group
|
-Wl,--start-group
|
||||||
-lc
|
-lc
|
||||||
@ -202,7 +203,7 @@ add_custom_command(TARGET ${EXECUTABLE} POST_BUILD
|
|||||||
COMMAND ${CMAKE_OBJCOPY} -O ihex $<TARGET_FILE:${EXECUTABLE}> ${EXECUTABLE}.hex
|
COMMAND ${CMAKE_OBJCOPY} -O ihex $<TARGET_FILE:${EXECUTABLE}> ${EXECUTABLE}.hex
|
||||||
)
|
)
|
||||||
|
|
||||||
# Conver to bin file -> add conditional check?
|
# Convert to bin file -> add conditional check?
|
||||||
add_custom_command(TARGET ${EXECUTABLE} POST_BUILD
|
add_custom_command(TARGET ${EXECUTABLE} POST_BUILD
|
||||||
COMMAND ${CMAKE_OBJCOPY} -O binary $<TARGET_FILE:${EXECUTABLE}> ${EXECUTABLE}.bin
|
COMMAND ${CMAKE_OBJCOPY} -O binary $<TARGET_FILE:${EXECUTABLE}> ${EXECUTABLE}.bin
|
||||||
)
|
)
|
||||||
|
43
examples/stm32/lwmem_stm32l496_discovery/CMakePresets.json
Normal file
43
examples/stm32/lwmem_stm32l496_discovery/CMakePresets.json
Normal file
@ -0,0 +1,43 @@
|
|||||||
|
{
|
||||||
|
"version": 3,
|
||||||
|
"configurePresets": [
|
||||||
|
{
|
||||||
|
"name": "default",
|
||||||
|
"hidden": true,
|
||||||
|
"generator": "Ninja",
|
||||||
|
"binaryDir": "${sourceDir}/build/${presetName}",
|
||||||
|
"toolchainFile": "${sourceDir}/cmake/gcc-arm-none-eabi.cmake",
|
||||||
|
"cacheVariables": {
|
||||||
|
"CMAKE_EXPORT_COMPILE_COMMANDS": "ON"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "Debug",
|
||||||
|
"inherits": "default",
|
||||||
|
"cacheVariables": {
|
||||||
|
"CMAKE_BUILD_TYPE": "Debug"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "RelWithDebInfo",
|
||||||
|
"inherits": "default",
|
||||||
|
"cacheVariables": {
|
||||||
|
"CMAKE_BUILD_TYPE": "RelWithDebInfo"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "Release",
|
||||||
|
"inherits": "default",
|
||||||
|
"cacheVariables": {
|
||||||
|
"CMAKE_BUILD_TYPE": "Release"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "MinSizeRel",
|
||||||
|
"inherits": "default",
|
||||||
|
"cacheVariables": {
|
||||||
|
"CMAKE_BUILD_TYPE": "MinSizeRel"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
Loading…
x
Reference in New Issue
Block a user