Refactor cmake/presets for easier serial usb device selection

This commit is contained in:
Allen Hill
2026-06-11 19:33:06 -07:00
parent c2440d5118
commit 051d8dbe99
2 changed files with 60 additions and 13 deletions
-1
View File
@@ -3,7 +3,6 @@ include(CMakeDependentOption)
set(WITH_MCU OFF) # Disable target name modification setting from toolchain set(WITH_MCU OFF) # Disable target name modification setting from toolchain
set(AVR_MCU "attiny3216") set(AVR_MCU "attiny3216")
set(AVR_UPLOADTOOL_PORT /dev/ttyUSB0)
set(AVR_PROGRAMMER serialupdi) set(AVR_PROGRAMMER serialupdi)
set(AVR_UPLOADTOOL_BAUDRATE 230400) set(AVR_UPLOADTOOL_BAUDRATE 230400)
+60 -12
View File
@@ -2,9 +2,25 @@
"version": 2, "version": 2,
"configurePresets": [ "configurePresets": [
{ {
"name": "default", "name": "usb0",
"displayName": "Debug", "hidden": true,
"description": "Configure with Debug build settings", "description": "Program over /dev/ttyUSB0",
"cacheVariables": {
"AVR_UPLOADTOOL_PORT": "/dev/ttyUSB0"
}
},
{
"name": "usb1",
"hidden": true,
"description": "Program over /dev/ttyUSB1",
"cacheVariables": {
"AVR_UPLOADTOOL_PORT": "/dev/ttyUSB1"
}
},
{
"name": "debug-base",
"hidden": true,
"description": "Debug build settings",
"generator": "Unix Makefiles", "generator": "Unix Makefiles",
"binaryDir": "${sourceDir}/build", "binaryDir": "${sourceDir}/build",
"cacheVariables": { "cacheVariables": {
@@ -14,18 +30,50 @@
} }
}, },
{ {
"name": "relwithdebinfo", "name": "relwithdebinfo-base",
"displayName": "RelWithDebInfo", "hidden": true,
"description": "Configure with RelWithDebInfo build settings", "description": "RelWithDebInfo build settings",
"generator": "Unix Makefiles", "inherits": "debug-base",
"binaryDir": "${sourceDir}/build",
"inherits": "default",
"cacheVariables": { "cacheVariables": {
"CMAKE_BUILD_TYPE": "RelWithDebInfo", "CMAKE_BUILD_TYPE": "RelWithDebInfo",
"FREQSEL": "20MHz",
"TCB_CLKSEL": "TCB_CLKSEL_CLKDIV1_gc",
"USART_RXMODE": "USART_RXMODE_CLK2X_gc" "USART_RXMODE": "USART_RXMODE_CLK2X_gc"
} }
},
{
"name": "default",
"displayName": "Debug (ttyUSB0)",
"description": "Debug build, program over /dev/ttyUSB0",
"inherits": [
"debug-base",
"usb0"
]
},
{
"name": "default-usb1",
"displayName": "Debug (ttyUSB1)",
"description": "Debug build, program over /dev/ttyUSB1",
"inherits": [
"debug-base",
"usb1"
]
},
{
"name": "relwithdebinfo",
"displayName": "RelWithDebInfo (ttyUSB1)",
"description": "RelWithDebInfo build, program over /dev/ttyUSB1",
"inherits": [
"relwithdebinfo-base",
"usb1"
]
},
{
"name": "relwithdebinfo-usb0",
"displayName": "RelWithDebInfo (ttyUSB0)",
"description": "RelWithDebInfo build, program over /dev/ttyUSB0",
"inherits": [
"relwithdebinfo-base",
"usb0"
]
} }
] ]
} }