gostlink

package module
v0.0.0-...-4a92bb6 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 14, 2020 License: GPL-3.0 Imports: 10 Imported by: 1

README

About

Go library that provides support for interacting with ST-Link (> V2) to read out ram or SWO messages. It also includes a simple SeggerRTT interface which provides support for real time transfer.

The usb interface is based on the OpenOCD project https://sourceforge.net/p/openocd/code

The rtt implemenation ist based on phryniszak reversed engineered strtt library https://github.com/phryniszak/strtt

Usage

For usage see in stRttLogger/

Installation under Windows

Gostlink uses the gousb package. For installation see:

https://github.com/google/gousb

Documentation

Index

Constants

View Source
const (
	StLinkModeUnknown   StLinkMode = 0
	StLinkModeDfu                  = 1
	StLinkModeMass                 = 2
	StLinkModeDebugJtag            = 3
	StLinkModeDebugSwd             = 4
	StLinkModeDebugSwim            = 5
)
View Source
const (
	Memory8BitBlock  MemoryBlockSize = 1
	Memory16BitBlock                 = 2
	Memory32BitBlock                 = 4
)
View Source
const (
	SeggerRttModeNoBlockSkip     seggerRttMode = 0
	SeggerRttModeNoBlockTrim                   = 1
	SeggerRttModeBlockIfFifoFull               = 2
)
View Source
const (
	TraceConfigTypeDisabled TraceConfigType = 0 // tracing is disabled
	TraceConfigTypeExternal                 = 1 // trace output is captured externally
	TraceConfigTypeInternal                 = 2 // trace output is handled by OpenOCD adapter driver
)
View Source
const (
	TpuiPinProtocolSync           TpuiPinProtocolType = 0 // synchronous trace output
	TpuiPinProtocolAsynManchester                     = 1 // asynchronous output with Manchester coding
	TpuiPinProtocolAsyncUart                          = 2 // asynchronous output with NRZ coding
)
View Source
const AllSupportedPIds = 0xFFFF
View Source
const AllSupportedVIds = 0xFFFF
View Source
const (
	DefaultRamStart = 0x20000000
)

Variables

This section is empty.

Functions

func CloseUSB

func CloseUSB()

func InitUsb

func InitUsb() error

func SetLogger

func SetLogger(loggerInstance *logrus.Logger)

Types

type Buffer

type Buffer struct {
	bytes.Buffer
}

func NewBuffer

func NewBuffer(initSize int) *Buffer

func (*Buffer) ReadUint16BE

func (buf *Buffer) ReadUint16BE() uint16

func (*Buffer) ReadUint16LE

func (buf *Buffer) ReadUint16LE() uint16

func (*Buffer) ReadUint32BE

func (buf *Buffer) ReadUint32BE() uint32

func (*Buffer) ReadUint32LE

func (buf *Buffer) ReadUint32LE() uint32

func (*Buffer) WriteUint16LE

func (buf *Buffer) WriteUint16LE(value uint16)

func (*Buffer) WriteUint32LE

func (buf *Buffer) WriteUint32LE(value uint32)

type Endian

type Endian uint8

type MemoryBlockSize

type MemoryBlockSize int // block size for read and write operations

type RttDataCb

type RttDataCb func(int, []byte) error
type StLink struct {
	// contains filtered or unexported fields
}

*

func NewStLink(config *StLinkInterfaceConfig) (*StLink, error)

func (*StLink) Close

func (h *StLink) Close()

func (*StLink) ConfigTrace

func (h *StLink) ConfigTrace(enabled bool, tpiuProtocol TpuiPinProtocolType, portSize uint32,
	traceFreq *uint32, traceClkInFreq uint32, preScaler *uint16) error

func (*StLink) GetIdCode

func (h *StLink) GetIdCode() (uint32, error)

func (*StLink) GetTargetVoltage

func (h *StLink) GetTargetVoltage() (float32, error)

func (*StLink) InitializeRtt

func (h *StLink) InitializeRtt(rttSearchRanges [][2]uint64) error

func (*StLink) PollTrace

func (h *StLink) PollTrace(buffer []byte, size *uint32) error

func (*StLink) ReadMem

func (h *StLink) ReadMem(addr uint32, bitLength MemoryBlockSize, count uint32, buffer *bytes.Buffer) error

func (*StLink) ReadRttChannels

func (h *StLink) ReadRttChannels(callback RttDataCb) error

func (*StLink) Reset

func (h *StLink) Reset()

func (*StLink) SetSpeed

func (h *StLink) SetSpeed(khz uint32, query bool) (uint32, error)

func (*StLink) UpdateRttChannels

func (h *StLink) UpdateRttChannels(readChannelNames bool) error

func (*StLink) WriteMem

func (h *StLink) WriteMem(address uint32, bitLength MemoryBlockSize, count uint32, buffer []byte) error

type StLinkInterfaceConfig

type StLinkInterfaceConfig struct {
	// contains filtered or unexported fields
}

func NewStLinkConfig

func NewStLinkConfig(vid gousb.ID, pid gousb.ID, mode StLinkMode,
	serial string, initialSpeed uint32, connectUnderReset bool) *StLinkInterfaceConfig

type StLinkMode

type StLinkMode uint8 // stlink debug modes

type StmCpuInfo

type StmCpuInfo struct {
	RamStart uint64
	RamSize  uint64
}

func GetCpuInformation

func GetCpuInformation(cpuId string) *StmCpuInfo

type TpuiPinProtocolType

type TpuiPinProtocolType int

type TraceConfigType

type TraceConfigType int

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL