Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix GDB on minichlink. #444

Merged
merged 23 commits into from
Nov 25, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
23 commits
Select commit Hold shift + click to select a range
dc7db24
Fix GDB on minichlink.
cnlohr Nov 13, 2024
aff6280
Update minichlink.exe
cnlohr Nov 13, 2024
00c21a7
Add `make gdbclient` as a target.
cnlohr Nov 13, 2024
391c53f
Merge pull request #445 from cnlohr/master
cnlohr Nov 14, 2024
cd1d689
Add `make gdbclient` as a target and change single step behavior.
cnlohr Nov 13, 2024
501387a
Merge branch 'fix_gdb' of https://github.com/cnlohr/ch32v003fun into …
cnlohr Nov 14, 2024
c50b6bf
Further tweaks to vs code launch (need to backport to template). And,…
cnlohr Nov 15, 2024
c75c9ea
* Optimize pgm-esp32-s2-ch32xx.c
cnlohr Nov 15, 2024
59e5ec6
Properly define flash memory section.
cnlohr Nov 16, 2024
5ffe1fa
Cleanup and unify vscode projects.
cnlohr Nov 16, 2024
497b7fc
Super unbrick mode now unlocked. It just continuously tries to unbrick.
cnlohr Nov 16, 2024
d1b10fe
Working on trying to make the v307 unbrick work
cnlohr Nov 16, 2024
d91e473
Tested working unbrick for v30x (and by extension v20x)
cnlohr Nov 16, 2024
f364f46
Fix unaligned (start address) writes.
cnlohr Nov 16, 2024
9de5fcf
Add vCont support.
cnlohr Nov 17, 2024
a884b4f
remove threads as a feature
cnlohr Nov 17, 2024
9a6ea5b
Update with s/c parsing
cnlohr Nov 17, 2024
3010b31
Mirror c and s... let's try making s;c just single step normally.
cnlohr Nov 22, 2024
30721a0
Announce steps.
cnlohr Nov 22, 2024
0750ad8
Fix debug break behavior.
cnlohr Nov 23, 2024
1f97064
Fixup debug tasks.json double variable.:
cnlohr Nov 23, 2024
8280013
Fixed halt/resume on WCH-LinkE
monte-monte Nov 24, 2024
c48ee31
Merge pull request #452 from monte-monte/fix_gdb
cnlohr Nov 24, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions ch32v003fun/ch32v003fun.mk
Original file line number Diff line number Diff line change
Expand Up @@ -212,6 +212,9 @@ unbrick :
gdbserver :
-$(MINICHLINK)/minichlink -baG

gdbclient :
gdb-multiarch $(TARGET).elf -ex "target remote :2000"

clangd :
make clean
bear -- make build
Expand Down
19 changes: 17 additions & 2 deletions examples/debugprintfdemo/.vscode/c_cpp_properties.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,28 @@
],
"defines": [],
"compilerPath": "/usr/bin/clang",
"cppStandard": "c++14",
"cppStandard": "c++20",
"intelliSenseMode": "linux-clang-x64",
"compilerArgs": [
"-DCH32V003FUN_BASE"
],
"configurationProvider": "ms-vscode.makefile-tools"
},
{
"name": "Win32",
"includePath": [
"${workspaceFolder}/**",
"${workspaceFolder}/../../ch32v003fun"
],
"defines": [],
"compilerPath": "riscv64-unknown-elf-gcc-10.1.0.exe",
"cppStandard": "c++20",
"compilerArgs": [
"-DCH32V003FUN_BASE"
],
"configurationProvider": "ms-vscode.makefile-tools"
}
],
"version": 4
"version": 4,
"enableConfigurationSquiggles": true
}
41 changes: 25 additions & 16 deletions examples/debugprintfdemo/.vscode/launch.json
Original file line number Diff line number Diff line change
@@ -1,39 +1,48 @@
{
"configurations": [
{
"name": "GDB Debug Target",
"name": "Debug Target",
"type": "cppdbg",
"request": "launch",
"program": "debugprintfdemo.elf",
"program": "${workspaceFolder}/debugprintfdemo.elf",
"args": [],
"stopAtEntry": true,
"cwd": "${workspaceFolder}",
"environment": [],
"externalConsole": false,
"MIMode": "gdb",
"deploySteps": [
{
"type": "shell",
"continueOn": "GDBServer",
"command": "make --directory=${workspaceFolder} closechlink flash gdbserver"
},
],
"preLaunchTask": "run_flash_and_gdbserver",
"setupCommands": [
{
"description": "Enable pretty-printing for gdb",
"text": "-enable-pretty-printing",
"ignoreFailures": true
}
],
"svdPath": "${workspaceFolder}/../../misc/CH32V003xx.svd", // extension 'Peripheral Viewer' by mcu-debug (cortex-debug)
"miDebuggerPath": "gdb-multiarch",
"miDebuggerServerAddress": "127.0.0.1:2000"
"miDebuggerServerAddress": "127.0.0.1:2000",
},
{
"name": "Run Only (In Terminal)",
"name": "Flash and run in terminal",
"type": "node-terminal",
"request": "launch",
"internalConsoleOptions": "neverOpen",
"command": "make closechlink clean; make flash monitor",
},
{
"name": "Compile and Flash",
"type": "node",
"request": "launch",
"program": "",
"preLaunchTask": "run_flash_and_gdbserver",
}
]
}
"internalConsoleOptions": "neverOpen",
"preLaunchTask" : "kill_all_tasks",
"postDebugTask": "run_flash",
"presentation": {
"hidden": false,
"group": "terminaloutput",
"order": 1
},
"runtimeExecutable": "echo"
}
]
}
6 changes: 3 additions & 3 deletions examples/debugprintfdemo/.vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,13 @@
"makefile.launchConfigurations": [
{
"cwd": "",
"sbinaryPath": "debugprintfdemo.elf",
"sbinaryPath": "debugprintf.elf",
"binaryArgs": []
}
],
"editor.insertSpaces": false,
"editor.tabSize": 4,
"files.associations": {
"ch32v003fun.h": "c"
}
}
},
}
116 changes: 96 additions & 20 deletions examples/debugprintfdemo/.vscode/tasks.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,54 +3,130 @@
"tasks": [
{
"type": "shell",
"label": "flash",
"presentation": {
"echo": true,
"focus": false,
"group": "build",
"panel": "shared",
"close": true,
"showReuseMessage" : false
},
"command": "make closechlink flash",
"command": "make closechlink clean; make flash monitor",
"label": "run_flash_and_monitor",
"group": {
"kind": "build",
"isDefault": true
},
"runOptions": {
"instanceLimit": 1,
},
"isBackground": true,
"problemMatcher": { // https://code.visualstudio.com/docs/editor/tasks#_defining-a-problem-matcher
"owner": "cpp",
"fileLocation": [
"relative",
"${workspaceFolder}"
],
"pattern": {
"regexp": "^(.*):(\\d+):(\\d+):\\s+(warning|error):\\s+(.*)$",
"file": 1,
"line": 2,
"column": 3,
"severity": 4,
"message": 5
},
"background": {
"activeOnStart": false,
"beginsPattern": "^.*Image written.*",
"endsPattern": "^.*GDBServer*"
},
}
},
{
"type": "shell",
"label": "run_flash_and_gdbserver",
"command": "make closechlink flash gdbserver",

"command": "make clean closechlink; make flash gdbserver",
"presentation": {
"echo": true,
"focus": false,
"focus": true,
"group": "build",
"panel": "shared",
"reveal": "always",
"close": true,
"showReuseMessage" : false
"showReuseMessage": false
},

"isBackground": true,
"options": {
"cwd": "${workspaceFolder}",
},
"runOptions": {
"instanceLimit": 2,
},
"instanceLimit": 1,
},
"group": "build",
"problemMatcher": {
"pattern": [
{
"regexp": ".",
"file": 1,
"location": 2,
"message": 3
}
"problemMatcher": { // https://code.visualstudio.com/docs/editor/tasks#_defining-a-problem-matcher
"owner": "cpp",
"fileLocation": [
"relative",
"${workspaceFolder}"
],

"pattern": {
"regexp": "^(.*):(\\d+):(\\d+):\\s+(warning|error):\\s+(.*)$",
"file": 1,
"line": 2,
"column": 3,
"severity": 4,
"message": 5
},
"background": {
"activeOnStart": false,
"beginsPattern": "^.*Image written.*",
"endsPattern": "^.*GDBServer*"
}
},
}
},
{
"type": "shell",
"label": "run_flash",
"command": "make clean closechlink; make flash",
"presentation": {
"echo": true,
"focus": true,
"group": "build",
"panel": "shared",
"close": true,
"reveal": "always",
"showReuseMessage": true
},
"isBackground": false,
"options": {
"cwd": "${workspaceFolder}",
},
"runOptions": {
"instanceLimit": 1,
},
"group": "build",
"problemMatcher": { // https://code.visualstudio.com/docs/editor/tasks#_defining-a-problem-matcher
"owner": "cpp",
"fileLocation": [
"relative",
"${workspaceFolder}"
],
"pattern": {
"regexp": "^(.*):(\\d+):(\\d+):\\s+(warning|error):\\s+(.*)$",
"file": 1,
"line": 2,
"column": 3,
"severity": 4,
"message": 5
},
}
},
{
"type": "process",
"label" : "kill_all_tasks",
"command":[
"${command:workbench.action.tasks.terminate} terminateAll",
]
}
]
}
}
41 changes: 25 additions & 16 deletions examples/template/.vscode/c_cpp_properties.json
Original file line number Diff line number Diff line change
@@ -1,26 +1,35 @@
{
"configurations": [
{
"name": "RISCV32EC",
"name": "Linux",
"includePath": [
"${workspaceFolder}/**",
"${workspaceFolder}/../../ch32v003fun",
"${workspaceFolder}/../../extralibs",
"/usr/include/newlib" //why? the configurationProvider ought to find this
"${workspaceFolder}/../../ch32v003fun"
],
"defines": [
"CH32V003",
"__riscv",
"USE_SIGNALS",
"CH32V003FUN_BASE"
"defines": [],
"compilerPath": "/usr/bin/clang",
"cppStandard": "c++20",
"intelliSenseMode": "linux-clang-x64",
"compilerArgs": [
"-DCH32V003FUN_BASE"
],
"configurationProvider": "ms-vscode.makefile-tools"
},
{
"name": "Win32",
"includePath": [
"${workspaceFolder}/**",
"${workspaceFolder}/../../ch32v003fun"
],
"defines": [],
"compilerPath": "riscv64-unknown-elf-gcc-10.1.0.exe",
"cppStandard": "c++20",
"compilerArgs": [
"-DCH32V003FUN_BASE"
],
"compilerPath": "/usr/bin/riscv64-unknown-elf-gcc",
"cStandard": "gnu11",
"cppStandard": "gnu++17",
"intelliSenseMode": "gcc-x86", //works. Someday, intellisense might get riscv modes
"compilerArgs": [],
"configurationProvider": "ms-vscode.makefile-tools"
}
],
"version": 4
}
"version": 4,
"enableConfigurationSquiggles": true
}
43 changes: 22 additions & 21 deletions examples/template/.vscode/launch.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"configurations": [
{
"name": "cppdbg GDB Debug Target",
"name": "Debug Target",
"type": "cppdbg",
"request": "launch",
"program": "${workspaceFolder}/template.elf",
Expand All @@ -11,37 +11,38 @@
"environment": [],
"externalConsole": false,
"MIMode": "gdb",
"deploySteps": [ // 'make ...gdbserver' doesn't seem to work here. The Makefile calls 'minichlink -baG'... Needs -aG. Easier to add minichlink as a seperate step below
{
"type": "shell", //isn't there some way to call a task from tasks.json?
"command": "make --directory=${workspaceFolder} -j 1 closechlink flash",
},
{
"type": "shell",
"command": "${workspaceFolder}/../../minichlink/minichlink -aG",
"continueOn": "gdbserver running"
},
],
"preLaunchTask": "run_flash_and_gdbserver",
"setupCommands": [
{
"description": "Enable pretty-printing for gdb",
"text": "-enable-pretty-printing",
"ignoreFailures": true,
},
"ignoreFailures": true
}
],
"svdPath": "${workspaceFolder}/../../misc/CH32V003xx.svd", // extension 'Peripheral Viewer' by mcu-debug (cortex-debug)
"miDebuggerPath": "gdb-multiarch",
"miDebuggerServerAddress": "localhost:2000",
"logging": {
"engineLogging": false
},
"miDebuggerServerAddress": "127.0.0.1:2000",
},
{
"name": "Run Only (In Terminal)",
"name": "Flash and run in terminal",
"type": "node-terminal",
"request": "launch",
"internalConsoleOptions": "neverOpen",
"command": "make closechlink clean; make flash monitor",
},
{
"name": "Compile and Flash",
"type": "node",
"request": "launch",
"program": "",
"preLaunchTask": "run_flash_and_gdbserver",
"internalConsoleOptions": "neverOpen",
"preLaunchTask" : "kill_all_tasks",
"postDebugTask": "run_flash",
"presentation": {
"hidden": false,
"group": "terminaloutput",
"order": 1
},
"runtimeExecutable": "echo"
}
]
}
Loading
Loading