|
|
#define | CAN_HW_BASE CAN1 |
| |
|
#define | ACK 0U |
| | ACK defined as 0.
|
| |
|
#define | NACK 1U |
| | NACK defined as 1.
|
| |
|
#define | DGRAM_MAX_MSG_SIZE 8 |
| | Max message size of datagram.
|
| |
|
#define | BYTES_TO_WORD(bytes) (bytes / 4) |
| | Convert bytes to number of words for ARM32 system.
|
| |
| #define | ALLIGNMENT_SIZE 4 |
| |
|
#define | NUM_FLASH_PAGES 128U |
| | 256KB of memory / 2KB per page
|
| |
|
#define | BOOTLOADER_PAGE_BYTES ((size_t)0x800) |
| | 2KB per flash page as per datasheet
|
| |
|
#define | BOOTLOADER_PING_BYTES ((size_t)0x1000) |
| | 4KB max per ping
|
| |
|
#define | BOOTLOADER_FLASH_WORD_SIZE 4U |
| | ARM32 Word size is 4 bytes.
|
| |
| #define | BOOTLOADER_ADDR_TO_PAGE(addr) (((uintptr_t)(addr) - (uintptr_t)APP_ACTIVE_START_ADDRESS) / BOOTLOADER_PAGE_BYTES) |
| | Convert memory address to page number. More...
|
| |
| #define | BOOTLOADER_PAGE_TO_ADDR(page) ((uintptr_t)(page) * (uintptr_t)BOOTLOADER_PAGE_BYTES + (uintptr_t)APP_ACTIVE_START_ADDRESS) |
| | Convert page number to memory address. More...
|
| |
|
#define | FLASH_START_ADDRESS_LINKERSCRIPT ((uint32_t) & _flash_start) |
| | Flash start address as defined in the linkerscripts.
|
| |
|
#define | FLASH_SIZE_LINKERSCRIPT ((size_t) & _flash_size) |
| | Flash size as defined in the linkerscripts.
|
| |
|
#define | FLASH_PAGE_SIZE_LINKERSCRIPT ((size_t) & _flash_page_size) |
| | Flash page size as defined in the linkerscripts.
|
| |
|
#define | APP_ACTIVE_START_ADDRESS ((uint32_t) & _app_active_start) |
| | Application Active start address as defined in the linkerscripts.
|
| |
|
#define | APP_ACTIVE_SIZE ((size_t) & _app_active_size) |
| | Application Active size as defined in the linkerscripts.
|
| |
|
#define | APP_STAGING_START_ADDRESS ((uint32_t) & _app_staging_start) |
| | Application Staging start address as defined in the linkerscripts.
|
| |
|
#define | APP_STAGING_SIZE ((size_t) & _app_staging_size) |
| | Application Staging size as defined in the linkerscripts.
|
| |
|
#define | BOOTLOADER_START_ADDRESS ((uint32_t) & _bootloader_start) |
| | Bootloader start address as defined in the linkerscripts.
|
| |
|
#define | BOOTLOADER_SIZE ((size_t) & _bootloader_size) |
| | Bootloader size as defined in the linkerscripts.
|
| |
|
#define | BOOTSTRAP_START_ADDRESS ((uint32_t) & _bootstrap_start) |
| | Bootstrap start address as defined in the linkerscripts.
|
| |
|
#define | BOOTSTRAP_SIZE ((size_t) & _bootstrap_size) |
| | Bootstrap size as defined in the linkerscripts.
|
| |
|
#define | FS_STORAGE_START_ADDRESS ((uint32_t) & _fs_storage_start) |
| | File System Storage start address as defined in the linkerscripts.
|
| |
|
#define | FS_STORAGE_SIZE ((size_t) & _fs_storage_size) |
| | File System Storage size as defined in the linkerscripts.
|
| |
|
#define | SRAM_START_ADDRESS ((uint32_t) & _sram_start) |
| | SRAM start address as defined in the linkerscripts.
|
| |
|
#define | SRAM_SIZE ((size_t) & _sram_size) |
| | SRAM size as defined in the linkerscripts.
|
| |
|
| enum | BootloaderStates {
BOOTLOADER_UNINITIALIZED = 0
, BOOTLOADER_IDLE
, BOOTLOADER_START
, BOOTLOADER_WAIT_SEQUENCING
,
BOOTLOADER_DATA_RECEIVE
, BOOTLOADER_JUMP_APP
, BOOTLOADER_FAULT
, BOOTLOADER_PING
} |
| | Bootloader State Machine. More...
|
| |
| enum | BootloaderPingStates { BOOTLOADER_PING_NODES = 0
, BOOTLOADER_PING_BRANCH
, BOOTLOADER_PING_PROJECT
} |
| | Bootloader Ping States. More...
|
| |
| enum | Boot_CanBitrate {
BOOT_CAN_BITRATE_125KBPS
, BOOT_CAN_BITRATE_250KBPS
, BOOT_CAN_BITRATE_500KBPS
, BOOT_CAN_BITRATE_1000KBPS
,
NUM_BOOT_CAN_BITRATES
} |
| |
| enum | Boot_CanMode {
CAN_CONTINUOUS = 0
, CAN_ONE_SHOT_MODE
, NUM_CAN_MODES
, CAN_CONTINUOUS = 0
,
CAN_ONE_SHOT_MODE
, NUM_CAN_MODES
} |
| |
| enum | BootloaderCanID {
BOOTLOADER_CAN_SEQUENCING_ID = 30
, BOOTLOADER_CAN_FLASH_ID
, BOOTLOADER_CAN_JUMP_APPLICATION_ID
, BOOTLOADER_CAN_ACK_ID
,
BOOTLOADER_CAN_START_ID
, BOOTLOADER_CAN_JUMP_BOOTLOADER
, BOOTLOADER_CAN_PING_METADATA_ID
, BOOTLOADER_CAN_PING_DATA_ID
} |
| | Bootloader reserved CAN arbitration IDs. More...
|
| |
| enum | BootloaderError {
BOOTLOADER_ERROR_NONE = 0
, BOOTLOADER_OVERSIZE
, BOOTLOADER_DATA_NOT_ALIGNED
, BOOTLOADER_INVALID_ID
,
BOOTLOADER_INTERNAL_ERR
, BOOTLOADER_INVALID_ARGS
, BOOTLOADER_ERROR_UNINITIALIZED
, BOOTLOADER_FLASH_ERR
,
BOOTLOADER_FLASH_WRITE_NOT_ALIGNED
, BOOTLOADER_FLASH_WRITE_OUT_OF_BOUNDS
, BOOTLOADER_FLASH_READ_FAILED
, BOOTLOADER_BUFFER_OVERFLOW
,
BOOTLOADER_CAN_INIT_ERR
, BOOLOADER_CAN_TRANSMISSION_ERROR
, BOOTLOADER_CAN_RECEIVE_ERROR
, BOOTLOADER_CAN_TRANSMIT_ERROR
,
BOOTLOADER_INVALID_ADDRESS
, BOOTLOADER_CRC_MISMATCH_BEFORE_WRITE
, BOOTLOADER_CRC_MISMATCH_AFTER_WRITE
, BOOTLOADER_SEQUENCE_ERROR
,
BOOTLOADER_TIMEOUT
, BOOTLOADER_FLASH_MEMORY_VERIFY_FAILED
, BOOTLOADER_PING_TIMEOUT
} |
| | Bootloader error definitions. More...
|
| |
|
| BootloaderError | bootloader_init (void) |
| | Initialize the bootloader. More...
|
| |
| BootloaderError | bootloader_run (Boot_CanMessage *msg) |
| | Run the bootloader. More...
|
| |
| BootloaderError | bootloader_jump_app (void) |
| | Jump application. More...
|
| |
| BootloaderError | boot_can_init (const Boot_CanSettings *settings) |
| | Initialize the CAN interface for the bootloader. More...
|
| |
| BootloaderError | boot_can_transmit (uint32_t id, bool extended, const uint8_t *data, size_t len) |
| | Transmit a CAN message in the bootloader. More...
|
| |
| BootloaderError | boot_can_receive (Boot_CanMessage *const msg) |
| | Receive a CAN message in the bootloader. More...
|
| |
| BootloaderDatagram | deserialize_datagram (Boot_CanMessage *msg, uint16_t *target_nodes) |
| | Deserialize an incoming CAN message. More...
|
| |
| void | send_ack_datagram (bool ack, BootloaderError error) |
| | Send Bootloader ACK/NACK message over CAN. More...
|
| |
| BootloaderError | boot_crc32_init (void) |
| | Initialize the CRC hardware component. More...
|
| |
| uint32_t | boot_crc32_calculate (const uint32_t *buffer, size_t buffer_len) |
| | Calculate a CRC32 on a provided data buffer. More...
|
| |
| void | boot_align_to_32bit_words (uint8_t *buffer, size_t *buffer_len) |
| | Align a provided data buffer to the 4-byte boundary. More...
|
| |
| BootloaderError | boot_flash_write (uintptr_t address, uint8_t *buffer, size_t buffer_len) |
| | Write to flash memory. More...
|
| |
| BootloaderError | boot_flash_erase (uint8_t start_page, uint8_t num_pages) |
| | Erase some number of flash pages. More...
|
| |
| BootloaderError | boot_flash_read (uintptr_t address, uint8_t *buffer, size_t buffer_len) |
| | Read from flash memory. More...
|
| |
| BootloaderError | boot_verify_flash_memory (void) |
| | Verify that the flash memory is not erased. More...
|
| |
| void | protect_bootloader_memory (uint32_t bootloader_start_address, uint32_t bootloader_size) |
| | Protect the bootloader memory provided the bootloaders start address and size. More...
|
| |