stlink

package module
v0.0.0-...-948f31a Latest Latest
Warning

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

Go to latest
Published: Sep 13, 2018 License: MIT Imports: 5 Imported by: 1 module, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

README

Build Status Go Report Card GoDoc

ST-Link V2 tool built using Golang

WARNING: Go-STlink is under development, it is definitly not stable yet.

You need the Golang toolchain 1.8 or above. Get it from here. No binary releases yet!

$ go get github.com/rikvdh/go-stlink

TBD

More information for this readme is not ready yet.

Documentation

Overview

go generate GENERATED BY THE COMMAND ABOVE; DO NOT EDIT Generated at 2017-06-26 07:05:44.804214161 +0200 CEST using data from http://www.st.com/content/st_com/en/products/microcontrollers/stm32-32-bit-arm-cortex-mcus.product-grid.html/SC1169.json

Index

Constants

View Source
const (
	StlinkClockSpeed4000 StlinkClockSpeed = 0
	StlinkClockSpeed1800                  = 1
	StlinkClockSpeed1200                  = 2
	StlinkClockSpeed950                   = 3
	StlinkClockSpeed480                   = 7
	StlinkClockSpeed240                   = 15
	StlinkClockSpeed125                   = 31
	StlinkClockSpeed100                   = 40
	StlinkClockSpeed50                    = 79
	StlinkClockSpeed25                    = 158
	StlinkClockSpeed15                    = 265
	StlinkClockSpeed5                     = 798
)
View Source
const (
	AIRCRReg uint32 = 0xe000ed0c
	DHCSRReg uint32 = 0xe000edf0
	DEMCRReg uint32 = 0xe000edfc

	AIRCRKey            uint32 = 0x05fa0000
	AIRCRSysResetReqBit uint32 = 0x00000004
	AIRCRSysResetReq    uint32 = AIRCRKey | AIRCRSysResetReqBit

	DHCSRKey           uint32 = 0xa05f0000
	DHCSRDebugEnBit    uint32 = 0x00000001
	DHCSRHaltBit       uint32 = 0x00000002
	DHCSRStepBit       uint32 = 0x00000004
	DHCSRStatusHaltBit uint32 = 0x00020000
	DHCSRDebugDis      uint32 = DHCSRKey
	DHCSRDebugEn       uint32 = DHCSRKey | DHCSRDebugEnBit
	DHCSRHalt          uint32 = DHCSRKey | DHCSRDebugEnBit | DHCSRHaltBit
	DHCSRStep          uint32 = DHCSRKey | DHCSRDebugEnBit | DHCSRStepBit

	DEMCRRunAfterReset  uint32 = 0x00000000
	DEMCRHaltAfterReset uint32 = 0x00000001
)
View Source
const (
	StlinkV2PID  gousb.ID = 0x3748
	StlinkV21PID gousb.ID = 0x374b
)

Variables

This section is empty.

Functions

This section is empty.

Types

type ChipFamily

type ChipFamily uint16
const (
	ChipFamilySTM32F0             ChipFamily = 0x440
	ChipFamilySTM32F0Can          ChipFamily = 0x448
	ChipFamilySTM32F0Small        ChipFamily = 0x444
	ChipFamilySTM32F04            ChipFamily = 0x445
	ChipFamilySTM32F09X           ChipFamily = 0x442
	ChipFamilySTM32F1Connectivity ChipFamily = 0x418
	ChipFamilySTM32F1High         ChipFamily = 0x414
	ChipFamilySTM32F1Low          ChipFamily = 0x412
	ChipFamilySTM32F1Medium       ChipFamily = 0x410
	ChipFamilySTM32F1VLHigh       ChipFamily = 0x428
	ChipFamilySTM32F1VLMedium     ChipFamily = 0x420
	ChipFamilySTM32F1XL           ChipFamily = 0x430
	ChipFamilySTM32F2             ChipFamily = 0x411
	ChipFamilySTM32F3             ChipFamily = 0x422
	ChipFamilySTM32F3Small        ChipFamily = 0x439
	ChipFamilySTM32F303High       ChipFamily = 0x446
	ChipFamilySTM32F334           ChipFamily = 0x438
	ChipFamilySTM32F37x           ChipFamily = 0x432
	ChipFamilySTM32F4             ChipFamily = 0x413
	ChipFamilySTM32F4DE           ChipFamily = 0x433
	ChipFamilySTM32F4DSI          ChipFamily = 0x434
	ChipFamilySTM32F4HD           ChipFamily = 0x419
	ChipFamilySTM32F4LP           ChipFamily = 0x423
	ChipFamilySTM32F410           ChipFamily = 0x458
	ChipFamilySTM32F411RE         ChipFamily = 0x431
	ChipFamilySTM32F412           ChipFamily = 0x441
	ChipFamilySTM32F413           ChipFamily = 0x463
	ChipFamilySTM32F446           ChipFamily = 0x421
	ChipFamilySTM32F7             ChipFamily = 0x449
	ChipFamilySTM32F7Advanced     ChipFamily = 0x451
	ChipFamilySTM32F7Foundation   ChipFamily = 0x452
	ChipFamilySTM32L0             ChipFamily = 0x417
	ChipFamilySTM32L0Cat2         ChipFamily = 0x425
	ChipFamilySTM32L0Cat5         ChipFamily = 0x447
	ChipFamilySTM32L011           ChipFamily = 0x457
	ChipFamilySTM32L1Cat2         ChipFamily = 0x429
	ChipFamilySTM32L1High         ChipFamily = 0x436
	ChipFamilySTM32L1MediumLow    ChipFamily = 0x416
	ChipFamilySTM32L1MediumHigh   ChipFamily = 0x427
	ChipFamilySTM32L152RE         ChipFamily = 0x437
	ChipFamilySTM32L4             ChipFamily = 0x415
	ChipFamilySTM32L434X          ChipFamily = 0x435
	ChipFamilySTM32L4X6           ChipFamily = 0x461
)

func (ChipFamily) Group

func (cf ChipFamily) Group() ChipFamilyGroup

GroupName gets the chip family group name (e.g "stm32f0", "stm32l0" ...)

type ChipFamilyGroup

type ChipFamilyGroup string
const (
	ChipFamilyGroupSTM32L0 ChipFamilyGroup = "stm32l0"
	ChipFamilyGroupSTM32L1 ChipFamilyGroup = "stm32l1"
	ChipFamilyGroupSTM32L4 ChipFamilyGroup = "stm32l4"
	ChipFamilyGroupSTM32F0 ChipFamilyGroup = "stm32f0"
	ChipFamilyGroupSTM32F1 ChipFamilyGroup = "stm32f1"
	ChipFamilyGroupSTM32F2 ChipFamilyGroup = "stm32f2"
	ChipFamilyGroupSTM32F3 ChipFamilyGroup = "stm32f3"
	ChipFamilyGroupSTM32F4 ChipFamilyGroup = "stm32f4"
	ChipFamilyGroupSTM32F7 ChipFamilyGroup = "stm32f7"
)

type CortexMPartNumber

type CortexMPartNumber uint16
const (
	CortexMPartNumberUnknown CortexMPartNumber = 0x000
	CortexMPartNumberM0      CortexMPartNumber = 0xc20
	CortexMPartNumberM0Plus  CortexMPartNumber = 0xc60
	CortexMPartNumberM1      CortexMPartNumber = 0xc21
	CortexMPartNumberM3      CortexMPartNumber = 0xc23
	CortexMPartNumberM4      CortexMPartNumber = 0xc24
	CortexMPartNumberM7      CortexMPartNumber = 0xc27
)

func (CortexMPartNumber) String

func (c CortexMPartNumber) String() string

type Device

type Device struct {
	SerialNumber string
	PID          gousb.ID
	// contains filtered or unexported fields
}

Device represents a ST-link device

func (*Device) ChipID

func (d *Device) ChipID() (uint32, error)

func (*Device) ClockSpeed

func (d *Device) ClockSpeed() (StlinkClockSpeed, error)

func (*Device) Close

func (d *Device) Close() error

Close closes the device when needed

func (*Device) CoreID

func (d *Device) CoreID() (uint32, error)

func (*Device) CoreResetHalt

func (d *Device) CoreResetHalt() error

func (*Device) CortexMPartNumber

func (d *Device) CortexMPartNumber() (CortexMPartNumber, error)

func (*Device) CpuID

func (d *Device) CpuID() (uint32, error)

func (*Device) DevID

func (d *Device) DevID() (ChipFamily, error)

func (*Device) EnterSWDMode

func (d *Device) EnterSWDMode() error

func (*Device) ExitDFUMode

func (d *Device) ExitDFUMode() error

func (*Device) FlashSize

func (d *Device) FlashSize() (uint16, error)

func (*Device) ForceDebug

func (d *Device) ForceDebug() error

func (*Device) Halt

func (d *Device) Halt() error

func (*Device) HardReset

func (d *Device) HardReset() error

func (*Device) Mode

func (d *Device) Mode() (StlinkMode, error)

Mode reads the mode for an ST-link, see StlinkMode

func (*Device) Name

func (d *Device) Name() (string, error)

func (*Device) Read16

func (d *Device) Read16(addr uint32) (uint16, error)

func (*Device) Read32

func (d *Device) Read32(addr uint32) (uint32, error)

func (*Device) Reset

func (d *Device) Reset() error

func (*Device) Run

func (d *Device) Run() error

func (*Device) SetMode

func (d *Device) SetMode(mode StlinkMode) error

func (*Device) Status

func (d *Device) Status() (StlinkStatus, error)

func (*Device) Step

func (d *Device) Step() error

func (*Device) String

func (d *Device) String() string

func (*Device) TargetVoltage

func (d *Device) TargetVoltage() (float32, error)

func (*Device) Version

func (d *Device) Version() (string, error)

func (*Device) Write32

func (d *Device) Write32(addr, w uint32) error

type FlashLoader

type FlashLoader interface {
	Init(voltage float32) error
}
type Stlink struct {
	// contains filtered or unexported fields
}

Stlink context structure

func New

func New() (*Stlink, error)

New creates a new Stlink context

func (*Stlink) Close

func (s *Stlink) Close() error

Close closes the Slink context

func (*Stlink) OpenDevice

func (s *Stlink) OpenDevice(serial string) (*Device, error)

OpenDevice opens a device by serial number. Giving serial as an empty string, OpenDevice takes the first ST-link it can find

func (*Stlink) Probe

func (s *Stlink) Probe() ([]Device, error)

Probe searches for a list of devices and returns them. returned devices don't need to be closed but can't be used either. Use OpenDevice to open a device by SerialNumber

type StlinkClockSpeed

type StlinkClockSpeed uint16

type StlinkMode

type StlinkMode uint8
const (
	StlinkModeUnknown StlinkMode = 0xff
	StlinkModeDfu     StlinkMode = 0x00
	StlinkModeMass    StlinkMode = 0x01
	StlinkModeDebug   StlinkMode = 0x02
)

func (StlinkMode) String

func (s StlinkMode) String() string

type StlinkStatus

type StlinkStatus uint8
const (
	StlinkStatusUnknown     StlinkStatus = 0xff
	StlinkStatusCoreRunning StlinkStatus = 0x80
	StlinkStatusCoreHalted  StlinkStatus = 0x81
)

func (StlinkStatus) String

func (s StlinkStatus) String() string

type Target

type Target struct {
	Type       string
	Core       CortexMPartNumber
	Frequency  uint
	FlashSize  uint
	EepromSize uint
	SramSize   uint
}

Directories

Path Synopsis
cmd
getpartlist command
stlink command

Jump to

Keyboard shortcuts

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