Skip to content

Commit

Permalink
VScode debug
Browse files Browse the repository at this point in the history
Flashing tips

Use hex extension instead of ihx
copy main.hex to the root for the convenience
  • Loading branch information
dzid26 committed Jun 23, 2024
1 parent 2e63e16 commit 8584103
Show file tree
Hide file tree
Showing 12 changed files with 9,346 additions and 191 deletions.
6 changes: 5 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,8 @@ Debug
tools/Java_Configurator_Source/
!tools/Java_Configurator_Source/src
src/main.hex
src/Result.log
src/main.hex
src/Result.log
bin/
experimental settings/
releases/
3 changes: 2 additions & 1 deletion .vscode/extensions.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

// List of extensions which should be recommended for users of this workspace.
"recommendations": [
"ms-vscode.cpptools"
"ms-vscode.cpptools",
"cl.stm8-debug"
]
}
74 changes: 74 additions & 0 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
{
// Use IntelliSense to learn about possible attributes.
// Hover to view descriptions of existing attributes.
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
"version": "0.2.0",
"configurations": [
{
"preLaunchTask": "SDCC build",
"name": "STM8-gdb",
"request": "launch",
"type": "cppdbg",
"MIMode": "gdb",
"linux": {
"miDebuggerPath": "stm8-gdb"
},
"windows": {
"miDebuggerPath": "stm8-gdb" // unpack from from tools/stm8-gdb.zip and put in workspace root or PATH
},
"program": "${workspaceRoot}/bin/main.elf",
"stopAtEntry": true,
"cwd": "${workspaceRoot}/src",
"svdPath": "src/STM8S_StdPeriph_Lib/STM8S105C6.svd", // requires Peripheral Viewer extension
"filterStderr": true,
"filterStdout": false,
"debugServerPath": "openocd.exe",
"debugServerArgs": "-f interface/stlink-dap.cfg -f target/stm8s105.cfg -c \"cd C:/Users/dzidm/Repos/TSDZ2-Smart-EBike-1\" -c init -c \"reset halt\" -c \"load_image bin/main.hex 0x8000\" -c reset",
// "miDebuggerServerAddress": "localhost:3333", // it probably connects to server too early with this
// "serverStarted": "downloaded\\s+\\d+\\s+bytes", // doesn't seem to be necessary
"setupCommands": [
//flashing with gdb doesn't work, becasue flashing with openocd barely works on its own
// {"text": "file bin/main.elf", "description": "provide the file",},
// {"text": "load", "description": "load target",},
// {"text": "set print pretty on"}, //doesn't seem to work
{"text": "-target-select extended-remote localhost:3333", "description": "connect to target", "ignoreFailures": true},
{"text": "mon reset halt", "description": "reset target", "ignoreFailures": true},

],
// "hardwareBreakpoints": {"require": true, "limit": 2}, // stm8 has 2 hardware breakpoints
"externalConsole": false,
"internalConsoleOptions": "openOnSessionStart",
"logging": {
"moduleLoad": true,
"engineLogging": true,
"programOutput": true,
"exceptions": true,
"trace": true,
},
},

{
"preLaunchTask": "SDCC build",
"name": "stm8-debug extension", // it is Windows only
"type": "stm8-debug",
"request": "launch",
"serverType": "stm8-sdcc",
"executable": "${workspaceFolder}\\bin\\main.elf",
"cpu": "STM8S105S6",
"port": "3333",
"svdFile": ".vscode\\stm8s105s6.svd.json", // based on stm8s105k4 from the demo - some registers might not be accurate
"openOcdConfigs": [ //stm8-debug extension comes with sdcc 10.0 Windows binaries
"interface/stlink.cfg",
"target/stm8s105.cfg"
],
"customCommands": [
// "cd src",
"set solib-search-path C:/Users/dzidm/Repos/TSDZ2-Smart-EBike-1/src/",
// "directory ./", //doesn't seem to work https://alex.dzyoba.com/blog/gdb-source-path/



]
}
]
}
Loading

0 comments on commit 8584103

Please sign in to comment.