Documentation ¶
Index ¶
- Constants
- func ReadFile(path string) (int, []byte, error)
- type Booter
- type Bootloader
- type Command
- type Flasher
- type GpioBooter
- type GpioSerialProgrammer
- type Programmer
- type Rdp
- type RdpStatus
- type Sector
- type SerialFlasher
- func (p *SerialFlasher) Erase() error
- func (p *SerialFlasher) EraseGlobal() error
- func (p *SerialFlasher) ExtendedEraseGlobal() error
- func (p *SerialFlasher) Get() (Bootloader, error)
- func (p *SerialFlasher) GetVersionAndReadProtectionStatus() (RdpStatus, error)
- func (p *SerialFlasher) Init() error
- func (p *SerialFlasher) Read(b []byte) (int, error)
- func (p *SerialFlasher) ReadoutProtect() error
- func (p *SerialFlasher) ReadoutUnprotect() error
- func (p *SerialFlasher) Write(b []byte) (int, error)
- func (p *SerialFlasher) WriteProtect(sectors []byte) error
- func (p *SerialFlasher) WriteUnprotect() error
- type SerialFlasherOpts
Constants ¶
View Source
const ( ACK byte = 0x79 NACK byte = 0x1F INIT = 0x7F GET Command = 0x00 GET_VERSION_AND_RPS Command = 0x01 READ_MEMORY Command = 0x11 WRITE_MEMORY Command = 0x31 ERASE Command = 0x43 EXTENDED_ERASE Command = 0x44 WRITE_PROTECT Command = 0x63 WRITE_UNPROTECT Command = 0x73 READOUT_PROTECT Command = 0x82 READOUT_UNPROTECT Command = 0x92 )
View Source
const APPLICATION_ADDRESS = 0x8000000
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Bootloader ¶
type Flasher ¶
type Flasher interface { io.ReadWriter Init() error Erase() error }
Flasher initializes chip and reads, and writes to memory. It can erase memory too. Sector erase is not yet implemented.
type GpioBooter ¶
func (*GpioBooter) Boot ¶
func (dp *GpioBooter) Boot() error
func (*GpioBooter) Reset ¶
func (dp *GpioBooter) Reset() error
type GpioSerialProgrammer ¶
type GpioSerialProgrammer struct { *GpioBooter *SerialFlasher }
type Programmer ¶
func (*Programmer) Program ¶
func (p *Programmer) Program(b []byte) error
func (*Programmer) ProgramVerify ¶
func (p *Programmer) ProgramVerify(b []byte) error
type SerialFlasher ¶
type SerialFlasher struct {
// contains filtered or unexported fields
}
func NewSerialFlasher ¶
func NewSerialFlasher(o SerialFlasherOpts) (*SerialFlasher, error)
NewSerialFlasher open selected port and flushes it.
func (*SerialFlasher) Erase ¶
func (p *SerialFlasher) Erase() error
func (*SerialFlasher) EraseGlobal ¶
func (p *SerialFlasher) EraseGlobal() error
func (*SerialFlasher) ExtendedEraseGlobal ¶
func (p *SerialFlasher) ExtendedEraseGlobal() error
func (*SerialFlasher) Get ¶
func (p *SerialFlasher) Get() (Bootloader, error)
func (*SerialFlasher) GetVersionAndReadProtectionStatus ¶
func (p *SerialFlasher) GetVersionAndReadProtectionStatus() (RdpStatus, error)
func (*SerialFlasher) Init ¶
func (p *SerialFlasher) Init() error
func (*SerialFlasher) ReadoutProtect ¶
func (p *SerialFlasher) ReadoutProtect() error
func (*SerialFlasher) ReadoutUnprotect ¶
func (p *SerialFlasher) ReadoutUnprotect() error
func (*SerialFlasher) WriteProtect ¶
func (p *SerialFlasher) WriteProtect(sectors []byte) error
func (*SerialFlasher) WriteUnprotect ¶
func (p *SerialFlasher) WriteUnprotect() error
type SerialFlasherOpts ¶
func DefaultOptions ¶
func DefaultOptions(port string) SerialFlasherOpts
DefaultOptions sets maximum baundrate for port (115200 bps). Use WithX to modify settings.
func (SerialFlasherOpts) WithApplicationAdress ¶
func (o SerialFlasherOpts) WithApplicationAdress(addr uint32) SerialFlasherOpts
WithApplicationAdress returns new options with given application address.
func (SerialFlasherOpts) WithBaund ¶
func (o SerialFlasherOpts) WithBaund(baund int) SerialFlasherOpts
WithBaund returns new options with given baundrate.
func (SerialFlasherOpts) WithReadChunk ¶
func (o SerialFlasherOpts) WithReadChunk(chunk uint8) SerialFlasherOpts
WithReadChunk returns new options with selected read chunk size. Up to 256 bytes can be read in one command. When encountering issues with EEPROM reads, decrease chunk size.
Click to show internal directories.
Click to hide internal directories.