Last active
September 14, 2024 11:05
-
-
Save sago35/fd1b23d4ac9ac689ae84dee0be8c13b1 to your computer and use it in GitHub Desktop.
TinyGo + VSCode + Cortex-Debug for Wio Terminal (ATSAMD51P19A)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"version": "0.2.0", | |
"configurations": [ | |
{ | |
"type": "cortex-debug", | |
"servertype": "openocd", | |
"request": "launch", | |
"name": "tinygo-debug", | |
"runToEntryPoint": "main.main", | |
"executable": "${workspaceRoot}/out.elf", | |
"configFiles": [ | |
"interface/cmsis-dap.cfg", | |
"target/atsame5x.cfg" | |
], | |
"preLaunchTask": "tinygo build task", | |
"cwd": "${workspaceRoot}", | |
"gdbpath": "C:/Program Files (x86)/GNU Arm Embedded Toolchain/10 2020-q4-major/bin/arm-none-eabi-gdb.exe", | |
"svdFile": "${workspaceRoot}/lib/cmsis-svd/data/Atmel/ATSAMD51P19A.svd" | |
} | |
] | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"version": "2.0.0", | |
"tasks": [ | |
{ | |
"label": "tinygo build task", | |
"type": "shell", | |
"command": "tinygo build -o out.elf -target wioterminal -size short -opt 1 ./src/examples/blinky1", | |
"problemMatcher": [], | |
"group": { | |
"kind": "build", | |
"isDefault": true | |
} | |
} | |
] | |
} |
.vscode/tasks.json
に tinygo build task
というのを作っておいて、それを .vscode/launch.json
内の preLaunchTask
に指定しておく。
この状態だと、 F5
を押すなどしてデバッグ開始すると、その直前に tasks.json
の tinygo build task
が動き tinygo build
が実行される。
今の所 tinygo build
の引数などは環境に合わせて設定が必要となり面倒ではあるが、それなりにうまく動きそう。
あと、 launch.json
に svdFile
を足しておいた。
Cortex-Debug の CORTEX PERIPHERALS から各レジスタ値を見たりできる。
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
openocd + XIAO (cmsis-dap v2) + wioterminal (atsame5x) に対して VSCode + Cortex-Debug でデバッグを行う設定例。
.vscode/launch.json に上記を書いて置く。
out.elf は例えば以下のように作って書き込んでおく。