Serial Wire Debug (SWD) is a 2-pin (SWDIO/SWCLK) electrical alternative JTAG interface that has the JTAG protocol on top. It was developed by ARM® and is widely used for programming/debugging microcontrollers, PMICs, and other embedded devices. More information on SWD can be found in the ARM Debug Interface v5 Architecture Specification.
This library aims to implement the SWD protocol in pure Go. It was started to program the flash of STM32 MCUs.
The library is split into distinct parts that can be used independently.
The io
package provides the low-level SWD interface that can be implemented by different
transport implementations. The library provides bitbang implementations for generic Linux
sysfs GPIOs as well as Raspberry Pi GPIOs.
Hardware accelerated transports may implement the io.Accessor
interface directly.
The swd
package contains the SWD protocol implementation for accessing debug and access
port registers such as CSW, TAR or DRW.
The Core Debug layer is a higher-level interface that allows to access the debug registers
or memory of a Cortex-M MCU. It is implemented in the core-debug
package.
For more information on the Core Debug interface, refer to the Cortex-M3 Technical Reference Manual r1p1.
This layer provides convenience functions for interacting with STM32 MCUs such as reading,
writing and erasing flash memory. It is implemented in the stm32
package.
Please refer to the examples
directory for simple examples that read the IDCODE of a
STM32 MCU or program the flash memory.
Contributions are welcome as this project was started with a small scope but aims for more functionality and device support. Please open pull requests to extend it.
This library is licensed under the MIT license. See the LICENSE file for more information.