Monitor mode debug on Gen3 device
Problem
Implement monitor mode debug to support debugging in a BLE connection.
Note
This PR is under development.
TODO:
- Should we optimize makefile to support compile assembly file
- Only tested on MacOS
Steps to Test
- Disable
BLE_CHANNEL_SECURITY_ENABLED - Build firmware
make clean all PLATFORM=xenon TEST=app/blank DEBUG_BUILD=y MODULAR=n - Flash the blank application to a Xenon
- Start debugging on VSCode
- Send GDB command of monitor mode debug via DEBUG CONSOLE
mon reset 0
mon exec SetMonModeDebug=1
mon exec SetMonModeVTableAddr=0x30000

- Press
Continue (F5)to run - Use Lightblue to connect to the Xenon
- Press
Pause (F6)to stop - Observe whether the connection is terminated
Example App
References
[CH29931]
Monitor Mode Debugging in Segger embedded studios
Monitor Mode Debugging with J-Link and GDB/Eclipse
Completeness
- [x] User is totes amazing for contributing!
- [x] Contributor has signed CLA (Info here)
- [x] Problem and Solution clearly stated
- [ ] Run unit/integration/application tests on device
- [ ] Added documentation
- [ ] Added to CHANGELOG.md after merging (add links to docs and issues)
Howdy Eugene, I was using this branch to test monitor mode debugging with workbench (notes here, there is a lot of them: https://docs.google.com/document/d/1kSZyuEk0pg1XvWKSsfGLEFEg73Cn6hJJVymiysBSWvE/edit# )
I wanted to provide the launch.json task settings I use for debugging user applications with monitor mode in workbench:
{
"type": "cortex-debug",
"request": "attach",
"name": "J-Link (argon, boron / bsom, xenon)",
"servertype": "jlink",
"interface": "swd",
"device": "nRF52840_xxAA",
"cwd": "${workspaceRoot}",
"executable": "${command:particle.getDebuggerExecutable}",
"preLaunchTask": "Particle: Flash application for debug (local)",
"armToolchainPath": "${command:particle.getDebuggerCompilerDir}",
"svdFile": "${command:particle.getDebuggerSVDFile}",
"searchDir": [
"${command:particle.getDebuggerSearchDir}"
],
"postAttachCommands": [
"monitor reset halt",
"monitor reset 0",
"monitor exec SetMonModeDebug=1",
"monitor exec SetMonModeVTableAddr=0x30000"
],
}
I was successful in debugging using this branch and your notes, thank you for them!
@wraithan Congratulation! 👏 🎉