Skip to content

Commit

Permalink
Merge pull request #97 from dzid26/debugging
Browse files Browse the repository at this point in the history
Debugging workflow
  • Loading branch information
emmebrusa committed Jul 3, 2024
2 parents 0e553a5 + 70e6fb7 commit d1e0bdc
Show file tree
Hide file tree
Showing 40 changed files with 9,491 additions and 232 deletions.
12 changes: 6 additions & 6 deletions .github/workflows/build.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ jobs:
steps:
- name: install SDCC
run: | #install silent and then unpack missing installation libraries
Invoke-WebRequest https://netix.dl.sourceforge.net/project/sdcc/sdcc-win64/$env:SDCC_VERSION/sdcc-$env:SDCC_VERSION-rc3-x64-setup.exe -OutFile sdcc_setup.exe
Invoke-WebRequest -UserAgent "Wget" -Uri https://sourceforge.net/projects/sdcc/files/sdcc-win64/$env:SDCC_VERSION/sdcc-$env:SDCC_VERSION-rc3-x64-setup.exe/download -OutFile sdcc_setup.exe
ls
Start-Process -wait -FilePath "sdcc_setup.exe" -ArgumentList "/S", "/D=C:\Program Files\SDCC"
echo "Adding sdcc to PATH"
Expand All @@ -37,7 +37,7 @@ jobs:
- uses: actions/upload-artifact@v4
with:
name: firmware_from_windows
path: bin/main.ihx
path: bin/main.hex


Build_Linux:
Expand All @@ -46,9 +46,9 @@ jobs:
- name: install SDCC
run: |
cd ~
wget https://altushost-swe.dl.sourceforge.net/project/sdcc/sdcc-linux-amd64/$SDCC_VERSION/sdcc-$SDCC_VERSION-amd64-unknown-linux2.5.tar.bz2
wget https://sourceforge.net/projects/sdcc/files/sdcc-linux-amd64/4.4.0/sdcc-4.4.0-amd64-unknown-linux2.5.tar.bz2/download -O sdcc-amd64.tar.bz2
ls
sudo tar xf sdcc-$SDCC_VERSION-amd64-unknown-linux2.5.tar.bz2
sudo tar xf sdcc-amd64.tar.bz2
cd sdcc-$SDCC_VERSION/
sudo cp -r * /usr/local
sdcc --version
Expand All @@ -62,7 +62,7 @@ jobs:
- uses: actions/upload-artifact@v4
with:
name: firmware_from_linux
path: bin/main.ihx
path: bin/main.hex


Compare_builds:
Expand All @@ -83,5 +83,5 @@ jobs:
run: |
ls
echo "Comparing build files"
git diff firmware_from_windows/main.ihx firmware_from_linux/main.ihx --word-diff=color --ignore-space-at-eol --exit-code
git diff firmware_from_windows/main.hex firmware_from_linux/main.hex --word-diff=color --ignore-space-at-eol --exit-code
echo "Done comparing build files. Files are the same."
9 changes: 7 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,10 @@ Debug
.vscode
tools/Java_Configurator_Source/
!tools/Java_Configurator_Source/src
src/main.ihx
src/Result.log
*.hex
*.bin
*.elf
src/Result.log
bin/
experimental settings/
releases/
5 changes: 2 additions & 3 deletions .vscode/c_cpp_properties.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,8 @@
{
"name": "stm8",
"includePath": [
"./src/controller",
"./src/common",
"./src/common/STM8S_StdPeriph_Lib/inc"
"./src/",
"./src/STM8S_StdPeriph_Lib/inc"
],
"defines": [
"STM8S105",
Expand Down
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"
]
}
71 changes: 71 additions & 0 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
{
// 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": "STM8 Build & Flash",
"postDebugTask": "OpenOCD reset target",
"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",
// "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 d1e0bdc

Please sign in to comment.