efm8¶
Flash via AN945: EFM8 Factory Bootloader HID.
usage: efm8 [-h] [-p PRODUCT] [-s SERIAL] firmware
-
firmware
¶
Intel Hex format file to flash
-
-h
,
--help
¶
show this help message and exit
-
-p
<product>
,
--product
<product>
¶ USB Product ID of device to program
-
-s
<serial>
,
--serial
<serial>
¶ Serial number of device to program
The protocol is documented in AN945.
Flash via AN945: EFM8 Factory Bootloader HID.
-
exception
efm8.
BadChecksum
¶ Checksum mismatch.
-
exception
efm8.
BadResponse
¶ Command not confirmed.
-
exception
efm8.
Unsupported
¶ Input file not understood.
-
efm8.
crc
(data)¶ CITT-16, XModem.
-
efm8.
create_frame
(cmd, data)¶ Bootloader frames start with ‘$’, 1 byte length, 1 byte command, x bytes data.
-
efm8.
flash
(manufacturer, product, serial, frames)¶ Send bootloader frames over HID, and check confirmations.
-
efm8.
read_flash
(manufacturer, product, serial, length)¶ Exploit CRC to read back firmware.
-
efm8.
read_intel_hex
(filename)¶ Read simple Intel format Hex files into byte array.
-
efm8.
to_frames
(data, checksum=True, run=True)¶ Convert firmware byte array into sequence of bootloader frames.
-
efm8.
toaddr
(addr)¶ Split a 16bit address into two bytes (dosn’t check it is a 16bit address ;-).
-
efm8.
tostr
(buf)¶ Ensure we have str across python versions.
-
efm8.
twos_complement
(input_value, num_bits=8)¶ Calculate unsigned int which binary matches the two’s complement of the input.
-
efm8.
write_hex
(buf, filename)¶ Write an Intel Format Hex file.