device-os icon indicating copy to clipboard operation
device-os copied to clipboard

Monitor mode debug on Gen3 device

Open YutingYou opened this issue 7 years ago • 2 comments

Problem

Implement monitor mode debug to support debugging in a BLE connection.

Note

This PR is under development.

TODO:

  1. Should we optimize makefile to support compile assembly file
  2. Only tested on MacOS

Steps to Test

  1. Disable BLE_CHANNEL_SECURITY_ENABLED
  2. Build firmware make clean all PLATFORM=xenon TEST=app/blank DEBUG_BUILD=y MODULAR=n
  3. Flash the blank application to a Xenon
  4. Start debugging on VSCode
  5. Send GDB command of monitor mode debug via DEBUG CONSOLE
mon reset 0
mon exec SetMonModeDebug=1
mon exec SetMonModeVTableAddr=0x30000

image

  1. Press Continue (F5) to run
  2. Use Lightblue to connect to the Xenon
  3. Press Pause (F6) to stop
  4. 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)

YutingYou avatar Mar 16 '19 16:03 YutingYou

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 avatar Dec 11 '19 23:12 wraithan

@wraithan Congratulation! 👏 🎉

YutingYou avatar Dec 12 '19 07:12 YutingYou