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

Monitor mode debug on Gen3 device #1730

Open
wants to merge 1 commit into
base: develop
Choose a base branch
from

Conversation

YutingYou
Copy link
Contributor

@YutingYou YutingYou commented Mar 16, 2019

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

  • User is totes amazing for contributing!
  • Contributor has signed CLA (Info here)
  • 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)

@wraithan
Copy link

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!

@YutingYou
Copy link
Contributor Author

@wraithan Congratulation! 👏 🎉

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants