Package tockloader.bootloader_serial Documentation

Interface with a board over serial that is using the Tock Bootloader.

Class BootloaderSerial

Implementation of BoardInterface for the Tock Bootloader over serial.

__init__


def __init__(self, args)

Initialize self. See help(type(self)) for accurate signature.

bootloader_is_present


def bootloader_is_present(self)

For this communication protocol we can safely say the bootloader is present.

determine_current_board


def determine_current_board(self)

Figure out which board we are connected to. Most likely done by reading the attributes. Doesn't return anything.

enter_bootloader_mode


def enter_bootloader_mode(self)

Reset the chip and assert the bootloader select pin to enter bootloader mode. Handle retries if necessary.

erase_page


def erase_page(self, address)

Erase a specific page of internal flash.

exit_bootloader_mode


def exit_bootloader_mode(self)

Reset the chip to exit bootloader mode.

flash_binary


def flash_binary(self, address, binary, pad=True)

Write pages until a binary has been flashed. binary must have a length that is a multiple of page size.

get_all_attributes


def get_all_attributes(self)

Get all attributes on a board. Returns an array of attribute dicts.

get_apps_start_address


def get_apps_start_address(self)

Return the address in flash where applications start on this platform. This might be set on the board itself, in the command line arguments to Tockloader, or just be the default.

get_attribute


def get_attribute(self, index)

Get a single attribute. Returns a dict with two keys: key and value.

get_board_arch


def get_board_arch(self)

Return the architecture of the board we are connected to.

get_board_name


def get_board_name(self)

Return the name of the board we are connected to.

get_bootloader_version


def get_bootloader_version(self)

Return the version string of the bootloader. Should return a value like 0.5.0, or None if it is unknown.

get_page_size


def get_page_size(self)

Return the size of the page in bytes for the connected board.

open_link_to_board


def open_link_to_board(self)

Open the serial port to the chip/bootloader.

Also sets up a local port for determining when two Tockloader instances are running simultaneously.

print_known_boards


def print_known_boards(self)

Display the boards that have settings configured in tockloader.

read_range


def read_range(self, address, length)

Read a specific range of flash.

run_terminal


def run_terminal(self)

Run miniterm for receiving data from the board.

set_attribute


def set_attribute(self, index, raw)

Set a single attribute.

_change_baud_rate


def _change_baud_rate(self, baud_rate)

If the bootloader on the board supports it and if it succeeds, try to increase the baud rate to make everything faster.

_check_crc


def _check_crc(self, address, binary)

Compares the CRC of the local binary to the one calculated by the bootloader.

_decode_attribute


def _decode_attribute(self, raw)

_get_crc_internal_flash


def _get_crc_internal_flash(self, address, length)

Get the bootloader to compute a CRC.

_get_serial_port_hash


def _get_serial_port_hash(self)

Get an identifier that will be consistent for this serial port on this machine that is also guaranteed to not have any special characters (like slashes) that would interfere with using as a file name.

_issue_command


def _issue_command(self, command, message, sync, response_len, response_code, show_errors=True)

Setup a command to send to the bootloader and handle the response.

_ping_bootloader_and_wait_for_response


def _ping_bootloader_and_wait_for_response(self)

Throws an exception if the device does not respond with a PONG.

_server_thread


def _server_thread(self)

_toggle_bootloader_entry


def _toggle_bootloader_entry(self)

Reset the chip and assert the bootloader select pin to enter bootloader mode.