Skip to content

Commit

Permalink
Move to CMakepresets
Browse files Browse the repository at this point in the history
  • Loading branch information
MaJerle committed May 17, 2022
1 parent 80d91c4 commit b50391b
Show file tree
Hide file tree
Showing 36 changed files with 265 additions and 180 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
"version": 4,
"configurations": [
{
/* ms-vscode.cmake-tools plugin shall to be installed, which provides include paths and defines through CMake file */
"name": "STM32",
"includePath": [],
"defines": [],
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,14 @@
"name": "Debug Microcontroller - ST-Link",
"cwd": "${workspaceFolder}",
"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
"servertype": "stlink",
"device": "STM32F429ZI", //MCU used
"device": "", //MCU used, ex. "STM32H735IG"
"interface": "swd",
"serialNumber": "", //Set ST-Link ID if you use multiple at the same time
"runToMain": true,
"svdFile": "", //SVD file to see registers
"svdFile": "path/to/file.svd", //Path to SVD file to see registers
"v1": false,
"showDevDebugOutput": true,

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"type": "cppbuild",
"label": "Build project",
"command": "cmake",
"args": ["--build", "\"build\"", "-j", "8"],
"args": ["--build", "${command:cmake.buildDirectory}", "-j", "8"],
"options": {
"cwd": "${workspaceFolder}"
},
Expand All @@ -19,7 +19,7 @@
"type": "shell",
"label": "Re-build project",
"command": "cmake",
"args": ["--build", "\"build\"", "--clean-first", "-v", "-j", "8"],
"args": ["--build", "${command:cmake.buildDirectory}", "--clean-first", "-v", "-j", "8"],
"options": {
"cwd": "${workspaceFolder}"
},
Expand All @@ -29,24 +29,7 @@
"type": "shell",
"label": "Clean project",
"command": "cmake",
"args": ["--build", "\"build\"", "--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"
],
"args": ["--build", "${command:cmake.buildDirectory}", "--target", "clean"],
"options": {
"cwd": "${workspaceFolder}"
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -224,6 +224,7 @@ target_link_options(${EXECUTABLE} PRIVATE
-T${MCU_LINKER_SCRIPT}${linker_script_SRC}
${CPU_PARAMETERS}
-Wl,-Map=${CMAKE_PROJECT_NAME}.map
-u _printf_float # STDIO float formatting support (remove if not used)
--specs=nosys.specs
-Wl,--start-group
-lc
Expand All @@ -244,9 +245,9 @@ add_custom_command(TARGET ${EXECUTABLE} POST_BUILD
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
COMMAND ${CMAKE_OBJCOPY} -O binary $<TARGET_FILE:${EXECUTABLE}> ${EXECUTABLE}.bin
)

message("Exiting ${CMAKE_CURRENT_LIST_DIR}/CMakeLists.txt")
message("Exiting ${CMAKE_CURRENT_LIST_DIR}/CMakeLists.txt")
Original file line number Diff line number Diff line change
@@ -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"
}
}
]
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
"version": 4,
"configurations": [
{
/* ms-vscode.cmake-tools plugin shall to be installed, which provides include paths and defines through CMake file */
"name": "STM32",
"includePath": [],
"defines": [],
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,14 @@
"name": "Debug Microcontroller - ST-Link",
"cwd": "${workspaceFolder}",
"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
"servertype": "stlink",
"device": "STM32F401RE", //MCU used
"device": "", //MCU used, ex. "STM32H735IG"
"interface": "swd",
"serialNumber": "", //Set ST-Link ID if you use multiple at the same time
"runToMain": true,
"svdFile": "", //SVD file to see registers
"svdFile": "path/to/file.svd", //Path to SVD file to see registers
"v1": false,
"showDevDebugOutput": true,

Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"type": "cppbuild",
"label": "Build project",
"command": "cmake",
"args": ["--build", "\"build\"", "-j", "8"],
"args": ["--build", "${command:cmake.buildDirectory}", "-j", "8"],
"options": {
"cwd": "${workspaceFolder}"
},
Expand All @@ -19,7 +19,7 @@
"type": "shell",
"label": "Re-build project",
"command": "cmake",
"args": ["--build", "\"build\"", "--clean-first", "-v", "-j", "8"],
"args": ["--build", "${command:cmake.buildDirectory}", "--clean-first", "-v", "-j", "8"],
"options": {
"cwd": "${workspaceFolder}"
},
Expand All @@ -29,24 +29,7 @@
"type": "shell",
"label": "Clean project",
"command": "cmake",
"args": ["--build", "\"build\"", "--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"
],
"args": ["--build", "${command:cmake.buildDirectory}", "--target", "clean"],
"options": {
"cwd": "${workspaceFolder}"
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -203,6 +203,7 @@ target_link_options(${EXECUTABLE} PRIVATE
-T${MCU_LINKER_SCRIPT}${linker_script_SRC}
${CPU_PARAMETERS}
-Wl,-Map=${CMAKE_PROJECT_NAME}.map
-u _printf_float # STDIO float formatting support (remove if not used)
--specs=nosys.specs
-Wl,--start-group
-lc
Expand All @@ -223,9 +224,9 @@ add_custom_command(TARGET ${EXECUTABLE} POST_BUILD
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
COMMAND ${CMAKE_OBJCOPY} -O binary $<TARGET_FILE:${EXECUTABLE}> ${EXECUTABLE}.bin
)

message("Exiting ${CMAKE_CURRENT_LIST_DIR}/CMakeLists.txt")
message("Exiting ${CMAKE_CURRENT_LIST_DIR}/CMakeLists.txt")
Original file line number Diff line number Diff line change
@@ -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"
}
}
]
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
"version": 4,
"configurations": [
{
/* ms-vscode.cmake-tools plugin shall to be installed, which provides include paths and defines through CMake file */
"name": "STM32",
"includePath": [],
"defines": [],
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,14 @@
"name": "Debug Microcontroller - ST-Link",
"cwd": "${workspaceFolder}",
"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
"servertype": "stlink",
"device": "STM32F429ZI", //MCU used
"device": "", //MCU used, ex. "STM32H735IG"
"interface": "swd",
"serialNumber": "", //Set ST-Link ID if you use multiple at the same time
"runToMain": true,
"svdFile": "", //SVD file to see registers
"svdFile": "path/to/file.svd", //Path to SVD file to see registers
"v1": false,
"showDevDebugOutput": true,

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"type": "cppbuild",
"label": "Build project",
"command": "cmake",
"args": ["--build", "\"build\"", "-j", "8"],
"args": ["--build", "${command:cmake.buildDirectory}", "-j", "8"],
"options": {
"cwd": "${workspaceFolder}"
},
Expand All @@ -19,7 +19,7 @@
"type": "shell",
"label": "Re-build project",
"command": "cmake",
"args": ["--build", "\"build\"", "--clean-first", "-v", "-j", "8"],
"args": ["--build", "${command:cmake.buildDirectory}", "--clean-first", "-v", "-j", "8"],
"options": {
"cwd": "${workspaceFolder}"
},
Expand All @@ -29,24 +29,7 @@
"type": "shell",
"label": "Clean project",
"command": "cmake",
"args": ["--build", "\"build\"", "--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"
],
"args": ["--build", "${command:cmake.buildDirectory}", "--target", "clean"],
"options": {
"cwd": "${workspaceFolder}"
},
Expand Down

0 comments on commit b50391b

Please sign in to comment.