-
Notifications
You must be signed in to change notification settings - Fork 39
Just flash ELF without debugging #45
Comments
If you have a debug probe connected, you can use OpenOCD to just flash the ELF. There is a "flash" task included in the VS Code configuration that we ship. You could use that (it's a bit clunky in the VS Code UI) or the equivalent one-liner: openocd -f interface/cmsis-dap.cfg -f target/rp2040.cfg -c "adapter speed 5000; program {path/to/elf} verify reset exit" |
Awesome, the one-liner works great. I could also add a dependency to the flash task so that it builds first: {
"version": "2.0.0",
"tasks": [
{
"label": "Flash",
"type": "shell",
"command": "openocd",
"args": [
"-f",
"interface/cmsis-dap.cfg",
"-f",
"target/rp2040.cfg",
"-c",
"adapter speed 5000; program {${command:cmake.launchTargetPath}} verify reset exit"
],
"problemMatcher": [],
"dependsOn": ["Build"]
},
{
"label": "Build",
"type": "cmake",
"command": "build",
"problemMatcher": "$gcc",
"group": {
"kind": "build",
"isDefault": true
}
}
]
} Now I may swap this around so that Ctrl+Shift+B does build then flashes or I need to find a way to set a shortcut to the flash task. Thanks a lot! |
Great, glad that helped! I think you might want to look into launch configurations -- we added that Flash task (and did not add the build task as a dependency) for the C++ debugger task that we have in the configuration (the last one in the file), because that task builds the code but does not flash it by default. You might be able to create a configuration which just does the build and flash, without lauching a debugger. |
To bind the Flash task that depends on the Build task to Ctrl+Shift+B I used that as my {
"version": "2.0.0",
"tasks": [
{
"label": "Flash",
"type": "shell",
"command": "openocd",
"args": [
"-f",
"interface/cmsis-dap.cfg",
"-f",
"target/rp2040.cfg",
"-c",
"adapter speed 5000; program {${command:cmake.launchTargetPath}} verify reset exit"
],
"problemMatcher": [],
"dependsOn": ["Build"],
"group": {
"kind": "build",
"isDefault": true
}
},
{
"label": "Build",
"type": "cmake",
"command": "build",
"problemMatcher": "$gcc",
}
]
} Just moved the following block from the Build task to the Flash task: "group": {
"kind": "build",
"isDefault": true
} |
I'm trying to streamline my workflow by not having to mount the boot drive and copy the
uf2
.I have not find a way to do that reliably from Visual Studio Code but it could be I just missed it.
Trying to do it from the command line seems to work but then I would need a one liner cause as it is I'm still faster mounting the drive and copying the file.
See also:
raspberrypi/debugprobe#141
https://forums.raspberrypi.com/viewtopic.php?t=302344
The text was updated successfully, but these errors were encountered: