diff --git a/.vscode/launch.json b/.vscode/launch.json index 4f5a24a8..464755f4 100644 --- a/.vscode/launch.json +++ b/.vscode/launch.json @@ -6,7 +6,7 @@ "configurations": [ { "name": "Cortex-Debug - stm32h7", - "preLaunchTask": "Flash stm32h7", + "preLaunchTask": "flash stm32h7", "cwd": "${workspaceFolder}", "executable": "${workspaceFolder}/target/thumbv7em-none-eabihf/debug/rmk-stm32h7", "request": "launch", @@ -18,11 +18,14 @@ "${workspaceFolder}/boards/stm32h7/openocd.cfg" ], "svdFile": "${workspaceFolder}/boards/stm32h7/STM32H7B0x.svd", + "postRestartCommands": [ + "monitor rtt start", + ], "rttConfig": { "enabled": true, "address": "auto", "clearSearch": false, - "polling_interval": 20, + "polling_interval": 10, "rtt_start_retry": 2000, "decoders": [ { @@ -33,6 +36,22 @@ ] }, }, + { + "name": "Cortex-Debug - rp2040", + "type": "cortex-debug", + "request": "launch", + "gdbPath" : "gdb-multiarch", + // "preLaunchTask": "flash rp2040", + "cwd": "${workspaceFolder}/boards/rp2040", + "device": "RP2040", + "servertype": "openocd", + "showDevDebugOutput": "parsed", + "executable": "${workspaceFolder}/target/thumbv6m-none-eabi/debug/rmk-rp2040", + "runToEntryPoint": "main", + "configFiles": [ + "openocd.cfg" + ] + }, { "name": "Probe-rs - rp2040", "preLaunchTask": "Build Debug", diff --git a/.vscode/tasks.json b/.vscode/tasks.json index 18ffe8d0..6d30f988 100644 --- a/.vscode/tasks.json +++ b/.vscode/tasks.json @@ -4,18 +4,13 @@ "version": "2.0.0", "tasks": [ { - "label": "objcopy rmk-stm32h7 --bin --release", + "label": "build stm32h7 --debug", "type": "process", "command": "cargo", "args": [ - "objcopy", - "--release", + "size", "-j", - "32", - "--", - "-O", - "binary", - "${workspaceFolder}/target/thumbv7em-none-eabihf/release/rmk-stm32h7.bin" + "32" ], "options": { "cwd": "${workspaceFolder}/boards/stm32h7" @@ -28,18 +23,13 @@ }, }, { - "label": "objcopy rmk-rp2040 --bin --release", + "label": "build rp2040 --debug", "type": "process", "command": "cargo", "args": [ - "objcopy", - "--release", + "size", "-j", - "32", - "--", - "-O", - "binary", - "${workspaceFolder}/target/thumbv6m-none-eabi/release/rmk-rp2040.bin" + "32" ], "options": { "cwd": "${workspaceFolder}/boards/rp2040" @@ -51,57 +41,80 @@ "kind": "build", }, }, - { - "label": "Build Debug", + { + "label": "build stm32h7 --release", "type": "process", "command": "cargo", "args": [ "size", + "--release", "-j", "32" ], "options": { - "cwd": "${workspaceFolder}/boards/${input:targetChip}" + "cwd": "${workspaceFolder}/boards/stm32h7" }, "problemMatcher": [ "$rustc" ], "group": { "kind": "build", - "isDefault": true }, }, { - "label": "Build Release", + "label": "build rp2040 --release", "type": "process", "command": "cargo", "args": [ "size", + "--release", "-j", - "32", - "--release" + "32" ], "options": { - "cwd": "${workspaceFolder}/boards/${input:targetChip}" + "cwd": "${workspaceFolder}/boards/rp2040" }, "problemMatcher": [ "$rustc" ], "group": { "kind": "build", - "isDefault": true }, }, { - "label": "Flash stm32h7", + "label": "flash stm32h7", "group": "build", "type": "shell", "command": "openocd -f \"${workspaceFolder}/boards/stm32h7/openocd.cfg\" -c \"program target/thumbv7em-none-eabihf/debug/rmk-stm32h7 preverify verify reset exit\"", "dependsOn": [ - "Build Debug" + "build stm32h7 --debug" ], "dependsOrder": "sequence" }, + { + "label": "flash rp2040", + "group": "build", + "type": "shell", + "command": "openocd -f \"${workspaceFolder}/boards/rp2040/openocd.cfg\" -c \"program target/thumbv6m-none-eabi/debug/rmk-rp2040 preverify verify reset exit\"", + "dependsOn": [ + "build rp2040 --debug" + ], + "dependsOrder": "sequence" + }, + { + "label": "objcopy", + "type": "shell", + "command": "cargo objcopy --release -- -O binary \"${workspaceFolder}/target/release/rmk-${input:targetChip}.bin\" && cargo size -j 32 --release", + "options": { + "cwd": "${workspaceFolder}/boards/${input:targetChip}" + }, + "problemMatcher": [ + "$rustc" + ], + "group": { + "kind": "build", + }, + }, ], "inputs": [ { diff --git a/boards/rp2040/openocd.cfg b/boards/rp2040/openocd.cfg new file mode 100644 index 00000000..4e9ef727 --- /dev/null +++ b/boards/rp2040/openocd.cfg @@ -0,0 +1,6 @@ +source [find interface/cmsis-dap.cfg] +transport select swd + +source [find target/rp2040.cfg] + +adapter speed 10000 \ No newline at end of file