adafruit / Adafruit_Adalink

Python wrapper for Segger's J-Link Commander & STMicro STLink V2 to flash various ARM MCUs
MIT License
125 stars 33 forks source link

Add HW debugger abstraction #6

Closed microbuilder closed 9 years ago

microbuilder commented 9 years ago

AdaLink is currently hard-wired to talk to the JLink, but adding an abstraction around the debugger will open this up to support cheaper debuggers like the STLink/V2, while still keeping a standard, cross-platform flash interface that we can easily integrate in the Arduino IDE or whatever else in the future.

The nRF51822 codebase was recently updated to support the STLink/V2 via OpenOCD, which (unlike the JLink) can be run on the Raspberry Pi, which may be useful for production. See https://github.com/adafruit/Adafruit_nRF51822_Core/wiki/OpenOCD---STLink-V2 for details.

It might make sense to add a generic 'HW Debugger' abstraction between the cores and the debugger itself, support common commands like 'wipe', 'program' and the ability to read/write registers at the specified address.

The following function may need to be removed from the core.py base class, but it isn't terribly critical anyway and might not even be 'that' useful in the real world since we usually know exactly which device we're talking to: https://github.com/adafruit/Adafruit_Adalink/blob/master/adalink/core.py#L32

tdicola commented 9 years ago

This is implemented now with support for the STLink. The idea is that each core supports a list of programmer types and can either implement its own custom programmers, or more likely use a few pre-made ones like a JLink programmers class or STLink programmer class (using OpenOCD).