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

Add support for bootloader targets debugging #637

Merged
merged 1 commit into from
Dec 8, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
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
Loading