Skip to content

Conversation

kienvo
Copy link
Member

@kienvo kienvo commented Mar 5, 2025

This PR set up config for OpenOCD and GDB to work with the firmware that resolves #79. However, it still needs to be documented to explain both the hardware and software setup. I'll keep it as a draft until the document is complete.

Summary by Sourcery

This PR enables debugging with OpenOCD and GDB. It introduces a debug configuration file and updates the Makefile to include debug and program targets for OpenOCD. It also updates the pin definitions for the LED driver.

New Features:

  • Adds a debug configuration file for OpenOCD.

Build:

  • Updates the Makefile to include debug and program targets for OpenOCD.
  • Adds a default PREFIX variable for the toolchain.
  • Adds a default OPENOCD variable for the OpenOCD path.

Tests:

  • Adds a .gdbinit file for GDB.

Copy link
Contributor

sourcery-ai bot commented Mar 5, 2025

Reviewer's Guide by Sourcery

This pull request introduces debugging capabilities using OpenOCD and GDB. It includes configuration files for OpenOCD, updates to the Makefile to integrate debugging commands, and modifications to the LED pin assignments in leddrv.c.

Sequence diagram for debugging with OpenOCD

sequenceDiagram
  participant Developer
  participant Makefile
  participant OpenOCD
  participant GDB
  Developer->>Makefile: Executes 'make debug'
  Makefile->>OpenOCD: Runs OpenOCD with debug.cfg
  OpenOCD->>OpenOCD: Initializes target
  OpenOCD->>OpenOCD: Halts target
  OpenOCD->>OpenOCD: Resets target
  Developer->>GDB: Connects to OpenOCD server
  GDB->>Target: Debugging session starts
Loading

File-Level Changes

Change Details Files
Introduces debugging configuration files for OpenOCD and GDB.
  • Added debug.cfg for OpenOCD.
  • Added .gdbinit for GDB.
debug.cfg
.gdbinit
Updates the Makefile to enable debugging and integrate OpenOCD.
  • Introduced DEBUG variable to control debug builds.
  • Added OPENOCD variable to specify the OpenOCD path.
  • Added debug target to run OpenOCD with the debug configuration.
  • Modified the program target to use the OPENOCD variable.
  • Set a default value for the PREFIX variable.
Makefile
Updates LED pin assignments.
  • Changed pin assignments for LEDs J and K.
src/leddrv.c

Assessment against linked issues

Issue Objective Addressed Explanation
#79 Enable debugging of the firmware using OpenOCD.
#79 Provide necessary configurations and instructions for setting up OpenOCD for debugging.

Possibly linked issues

  • Document Debugging method #79: The PR addresses the issue by setting up OpenOCD for debugging, resolving the need for manual setup described in the issue.

Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!
  • Generate a plan of action for an issue: Comment @sourcery-ai plan on
    an issue to generate a plan of action for it.

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

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

Successfully merging this pull request may close these issues.

Document Debugging method
1 participant