Skip to content

Commit

Permalink
Merge pull request #637 from ohmtech-rdi/bootloader-targets-debug
Browse files Browse the repository at this point in the history
Add support for bootloader targets debugging
  • Loading branch information
ohmtech-rdi authored Dec 8, 2023
2 parents 79a695f + f7687b2 commit 687e1c4
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 12 deletions.
10 changes: 10 additions & 0 deletions build-system/erbb/generators/vscode/launch.py
Original file line number Diff line number Diff line change
Expand Up @@ -86,11 +86,21 @@ def generate_module (self, path, module):
os_launch_debug_config += ' "program": "%s"\n' % rack_path
os_launch_debug_config += ' }'

openocd_launch_commands = ' "init",\n'

if module.section.name == 'flash':
openocd_launch_commands += ' "reset init"\n'
elif module.section.name == 'sram' or module.section.name == 'qspi':
openocd_launch_commands += ' "reset init",\n'
openocd_launch_commands += ' "gdb_breakpoint_override hard"\n'
else:
assert False

template = template.replace ('%executable_release%', file_elf_release.replace ('\\', '/'))
template = template.replace ('%executable_debug%', file_elf_debug.replace ('\\', '/'))
template = template.replace ('%svd_file%', file_svd.replace ('\\', '/'))
template = template.replace ('% os_launch_debug_config%', os_launch_debug_config)
template = template.replace ('% openocd_launch_commands%', openocd_launch_commands)

with open (path_dst, 'w', encoding='utf-8') as file:
file.write (template)
12 changes: 4 additions & 8 deletions build-system/erbb/generators/vscode/launch_template.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,10 @@
"executable": "%executable_release%",
"interface": "swd",
"openOCDLaunchCommands": [
"init",
"reset init"
% openocd_launch_commands%
],
"preLaunchTask": "Build Firmware - Release",
"preLaunchTask": "Build and Flash Firmware - Release",
"preRestartCommands": [
"load",
"enable breakpoint",
"monitor reset"
],
Expand Down Expand Up @@ -48,12 +46,10 @@
"executable": "%executable_debug%",
"interface": "swd",
"openOCDLaunchCommands": [
"init",
"reset init"
% openocd_launch_commands%
],
"preLaunchTask": "Build Firmware - Debug",
"preLaunchTask": "Build and Flash Firmware - Debug",
"preRestartCommands": [
"load",
"enable breakpoint",
"monitor reset"
],
Expand Down
8 changes: 4 additions & 4 deletions build-system/erbb/generators/vscode/tasks_template.json
Original file line number Diff line number Diff line change
Expand Up @@ -36,9 +36,9 @@
]
},
{
"label": "Build Firmware - Debug",
"label": "Build and Flash Firmware - Debug",
"type": "shell",
"command": "erbb build firmware --configuration debug --semihosting",
"command": "erbb build firmware --configuration debug --semihosting && erbb install firmware --configuration debug",
"group": {
"kind": "build",
"isDefault": true,
Expand All @@ -51,9 +51,9 @@
]
},
{
"label": "Build Firmware - Release",
"label": "Build and Flash Firmware - Release",
"type": "shell",
"command": "erbb build firmware --configuration release --semihosting",
"command": "erbb build firmware --configuration release --semihosting && erbb install firmware --configuration release",
"group": "build",
"options": {
"cwd": "${workspaceFolder}"
Expand Down

0 comments on commit 687e1c4

Please sign in to comment.