Common bootloader definitions See Common for detailed documentation.

License#

Copyright 2018 Silicon Laboratories Inc. www.silabs.com

The licensor of this software is Silicon Laboratories Inc. Your use of this software is governed by the terms of Silicon Labs Master Software License Agreement (MSLA) available at www.silabs.com/about-us/legal/master-software-license-agreement. This software is distributed to you in Source Code format and is governed by the sections of the MSLA applicable to Source Code.

/***************************************************************************/
#ifndef __BOOTLOADER_COMMON_H__
#define __BOOTLOADER_COMMON_H__

#ifndef DOXYGEN_SHOULD_SKIP_THIS

//#define BL_DEBUG

#ifdef BL_DEBUG
#define BLDEBUG(x) (x)   // turn debug output on
#define BLDEBUG_PRINT(str) serPutStr(str)
#else
#define BLDEBUG(x)       // turn debug output off
#define BLDEBUG_PRINT(str)
#endif

#endif //DOXYGEN_SHOULD_SKIP_THIS

typedef uint8_t BL_Status;

#define BL_SUCCESS 0U

#define BL_CRC_MATCH 2U

#define BL_IMG_FLASHED 3U

#define BL_ERR 1U

#define BL_ERR_MASK 0x40U

#define BL_ERR_HEADER_EXP 0x41U

#define BL_ERR_HEADER_WRITE_CRC 0x42U

#define BL_ERR_CRC 0x43U

#define BL_ERR_UNKNOWN_TAG 0x44U

#define BL_ERR_SIG 0x45U

#define BL_ERR_ODD_LEN 0x46U

#define BL_ERR_BLOCK_INDEX 0x47U

#define BL_ERR_OVWR_BL 0x48U

#define BL_ERR_OVWR_SIMEE 0x49U

#define BL_ERR_ERASE_FAIL 0x4AU

#define BL_ERR_WRITE_FAIL 0x4BU

#define BL_ERR_CRC_LEN 0x4CU

#define BL_ERR_NO_QUERY 0X4DU

#define BL_ERR_BAD_LEN 0x4EU

#define BL_ERR_TAGBUF 0x4FU

#define BL_EBL_CONTINUE 0x50U

#define BL_ERR_UNEXPECTED_TAG 0x51U

#define BL_ERR_UNK_ENC 0x52U

#define BL_ERR_INV_KEY 0x53U

#define BL_ERR_ENC 0x54U

#define BL_IBR_ERR_CRC 0x55U

#define BL_IBR_ERR_VERS 0x56U

#define BL_IBR_ERR_ADDR 0x57U

#define BL_IBR_ERR_HDR 0x58U

#define TIMEOUT             0x16
#define FILEDONE            0x17
#define FILEABORT           0x18
#define BLOCKOK             0x19
#define QUERYFOUND          0x1A
#define START_TIMEOUT       0x1B
#define BLOCK_TIMEOUT       0x1C
#define BLOCKERR_MASK       0x20

#define BLOCKERR_SOH        0x21

#define BLOCKERR_CHK        0x22

#define BLOCKERR_CRCH       0x23

#define BLOCKERR_CRCL       0x24

#define BLOCKERR_SEQUENCE   0x25

#define BLOCKERR_PARTIAL    0x26

#define BLOCKERR_DUPLICATE 0x27

// two possible communication modes: serial mode, or radio/ota mode.
enum {
  COMM_SERIAL  = 0x01,  // in serial mode (uart or ezsp spi)
  COMM_RADIO   = 0x02,  // in radio mode
};

#endif //__BOOTLOADER_COMMON_H__

Bootloader Status Definitions#

These are numerical definitions for the possible bootloader status codes.

#define

Numerical definition for a bootloader status code: Success.

#define

Numerical definition for a bootloader status code: CRC match.

#define

Numerical definition for a bootloader status code: Image flashed.

#define

Numerical definition for a bootloader status code: serial error.

#define

Numerical definition for a bootloader status code: Error mask.

#define

Numerical definition for a bootloader status code: Failed in header state. Header expected.

#define

Numerical definition for a bootloader status code: Failed write/CRC of header.

#define

Numerical definition for a bootloader status code: Failed file CRC.

#define

Numerical definition for a bootloader status code: Unknown tag.

#define

Numerical definition for a bootloader status code: EBL header error.

#define

Numerical definition for a bootloader status code: Trying to flash odd length bytes.

#define

Numerical definition for a bootloader status code: Indexed past end of block buffer.

#define

Numerical definition for a bootloader status code: Attempt to overwrite bootloader flash.

#define

Numerical definition for a bootloader status code: Attempt to overwrite Simulated EEPROM flash.

#define

Numerical definition for a bootloader status code: Flash erase failed.

#define

Numerical definition for a bootloader status code: Flash write failed.

#define

Numerical definition for a bootloader status code: END tag CRC wrong length.

#define

Numerical definition for a bootloader status code: Received data before query request/response.

#define

Numerical definition for a bootloader status code: Invalid length detected.

#define

Numerical definition for a bootloader status code: Problem with tagBuf detected.

#define

Numerical definition for a bootloader status code: processEbl deferred, call again to continue.

#define

Numerical definition for a bootloader status code: A known tag was found in an unexpected location (eg. header tag found after data)

#define

Numerical definition for a bootloader status code: The specified encryption type is unknown to this bootloader.

#define

Numerical definition for a bootloader status code: No valid encryption key found on the device (ie. It's all 0xFF's). Bootloader will not function until this key is set.

#define

Numerical definition for a bootloader status code: Generic error indicating that there was a problem with the encrypted file when decrypting.

#define

Numerical definition for a bootloader status code: Failed IBR crc.

#define

Numerical definition for a bootloader status code: Incorrect IBR version.

#define

Numerical definition for a bootloader status code: Invalid ebl address in IBR.

#define

Numerical definition for a bootloader status code: Incorrect IBR header.

Bootloader State Flags#

These are numerical flags for the possible bootloader states. These values are used in the bootloader code for making the current state more verbose. The flags do not start at 0 so that they can be output via the serial port during debug and easily screened out of normal xmodem traffic which depends only on ACK (0x06) and NAK (0x15).

#define
TIMEOUT 0x16

Bootloader state flag.

#define

Bootloader state flag.

#define

Bootloader state flag.

#define
BLOCKOK 0x19

Bootloader state flag.

#define

Bootloader state flag.

#define

Bootloader state flag.

#define

Bootloader state flag.

#define

Bootloader state flag.

#define

Bootloader state flag: Start Of Header not received.

#define

Bootloader state flag: Sequence of bytes don't match.

#define

Bootloader state flag: CRC High byte failure.

#define

Bootloader state flag: CRC Low byte failure.

#define

Bootloader state flag: Block received out of sequence.

#define

Bootloader state flag: Partial block received.

#define

Bootloader state flag: Duplicate of previous block.

Enumerations#

enum
@0 {
PRIORITIZE_BEACONS_BASED_ON_PARENT_CLASSIFICATION = 0x0001
PRIORITIZE_BEACONS_BASED_ON_TC_CONNECTVITY = 0x0002
TC_CONNECTIVITY = 0x0010
LONG_UPTIME = 0x0020
BAD_PARENT_CONNECTIVITY = 0x0040
EMBER_OUTGOING_MESSAGES = 0x0001
EMBER_INCOMING_MESSAGES = 0x0002
EMBER_RADIO_IS_ON = 0x0004
EMBER_TRANSPORT_ACTIVE = 0x0008
EMBER_APS_LAYER_ACTIVE = 0x0010
EMBER_ASSOCIATING = 0x0020
EMBER_ZLL_TOUCH_LINKING = 0x0040
EMBER_NETWORK_TIMEOUT_REQUEST = 0x0200
EMBER_SEND_ORPHAN_NOTIFICATION = 0x0400
EMBER_MAC_DATA_POLL_SUPER_RETRY = 0x0800
INITIAL = 0x0000
SCAN_FOR_TOUCH_LINK = 0x0001
SCAN_FOR_DEVICE_INFORMATION = 0x0002
SCAN_FOR_IDENTIFY = 0x0004
SCAN_FOR_RESET = 0x0008
TARGET_NETWORK_FOUND = 0x0010
ABORTING_TOUCH_LINK = 0x0020
SCAN_COMPLETE = 0x0040
TOUCH_LINK_TARGET = 0x0080
FORMING_NETWORK = 0x0100
RESETTING_TO_FACTORY_NEW = 0x0200
ADC_REF_INT = 42U
TOKEN_COUNT
COMM_SERIAL = 0x01
COMM_RADIO = 0x02
}

Typedefs#

typedef uint8_t

Define the bootloader status type.

Bootloader Status Definitions Documentation#

BL_SUCCESS#

#define BL_SUCCESS
Value:
0U

Numerical definition for a bootloader status code: Success.


Definition at line 53 of file /Users/vihuszar/Git/EmbeddedSoftware/super/platform/base/hal/micro/cortexm3/common/bootloader-common.h

BL_CRC_MATCH#

#define BL_CRC_MATCH
Value:
2U

Numerical definition for a bootloader status code: CRC match.


Definition at line 57 of file /Users/vihuszar/Git/EmbeddedSoftware/super/platform/base/hal/micro/cortexm3/common/bootloader-common.h

BL_IMG_FLASHED#

#define BL_IMG_FLASHED
Value:
3U

Numerical definition for a bootloader status code: Image flashed.


Definition at line 61 of file /Users/vihuszar/Git/EmbeddedSoftware/super/platform/base/hal/micro/cortexm3/common/bootloader-common.h

BL_ERR#

#define BL_ERR
Value:
1U

Numerical definition for a bootloader status code: serial error.


Definition at line 65 of file /Users/vihuszar/Git/EmbeddedSoftware/super/platform/base/hal/micro/cortexm3/common/bootloader-common.h

BL_ERR_MASK#

#define BL_ERR_MASK
Value:
0x40U

Numerical definition for a bootloader status code: Error mask.


Definition at line 69 of file /Users/vihuszar/Git/EmbeddedSoftware/super/platform/base/hal/micro/cortexm3/common/bootloader-common.h

BL_ERR_HEADER_EXP#

#define BL_ERR_HEADER_EXP
Value:
0x41U

Numerical definition for a bootloader status code: Failed in header state. Header expected.


Definition at line 74 of file /Users/vihuszar/Git/EmbeddedSoftware/super/platform/base/hal/micro/cortexm3/common/bootloader-common.h

BL_ERR_HEADER_WRITE_CRC#

#define BL_ERR_HEADER_WRITE_CRC
Value:
0x42U

Numerical definition for a bootloader status code: Failed write/CRC of header.


Definition at line 79 of file /Users/vihuszar/Git/EmbeddedSoftware/super/platform/base/hal/micro/cortexm3/common/bootloader-common.h

BL_ERR_CRC#

#define BL_ERR_CRC
Value:
0x43U

Numerical definition for a bootloader status code: Failed file CRC.


Definition at line 83 of file /Users/vihuszar/Git/EmbeddedSoftware/super/platform/base/hal/micro/cortexm3/common/bootloader-common.h

BL_ERR_UNKNOWN_TAG#

#define BL_ERR_UNKNOWN_TAG
Value:
0x44U

Numerical definition for a bootloader status code: Unknown tag.


Definition at line 87 of file /Users/vihuszar/Git/EmbeddedSoftware/super/platform/base/hal/micro/cortexm3/common/bootloader-common.h

BL_ERR_SIG#

#define BL_ERR_SIG
Value:
0x45U

Numerical definition for a bootloader status code: EBL header error.


Definition at line 91 of file /Users/vihuszar/Git/EmbeddedSoftware/super/platform/base/hal/micro/cortexm3/common/bootloader-common.h

BL_ERR_ODD_LEN#

#define BL_ERR_ODD_LEN
Value:
0x46U

Numerical definition for a bootloader status code: Trying to flash odd length bytes.


Definition at line 96 of file /Users/vihuszar/Git/EmbeddedSoftware/super/platform/base/hal/micro/cortexm3/common/bootloader-common.h

BL_ERR_BLOCK_INDEX#

#define BL_ERR_BLOCK_INDEX
Value:
0x47U

Numerical definition for a bootloader status code: Indexed past end of block buffer.


Definition at line 101 of file /Users/vihuszar/Git/EmbeddedSoftware/super/platform/base/hal/micro/cortexm3/common/bootloader-common.h

BL_ERR_OVWR_BL#

#define BL_ERR_OVWR_BL
Value:
0x48U

Numerical definition for a bootloader status code: Attempt to overwrite bootloader flash.


Definition at line 106 of file /Users/vihuszar/Git/EmbeddedSoftware/super/platform/base/hal/micro/cortexm3/common/bootloader-common.h

BL_ERR_OVWR_SIMEE#

#define BL_ERR_OVWR_SIMEE
Value:
0x49U

Numerical definition for a bootloader status code: Attempt to overwrite Simulated EEPROM flash.


Definition at line 111 of file /Users/vihuszar/Git/EmbeddedSoftware/super/platform/base/hal/micro/cortexm3/common/bootloader-common.h

BL_ERR_ERASE_FAIL#

#define BL_ERR_ERASE_FAIL
Value:
0x4AU

Numerical definition for a bootloader status code: Flash erase failed.


Definition at line 116 of file /Users/vihuszar/Git/EmbeddedSoftware/super/platform/base/hal/micro/cortexm3/common/bootloader-common.h

BL_ERR_WRITE_FAIL#

#define BL_ERR_WRITE_FAIL
Value:
0x4BU

Numerical definition for a bootloader status code: Flash write failed.


Definition at line 121 of file /Users/vihuszar/Git/EmbeddedSoftware/super/platform/base/hal/micro/cortexm3/common/bootloader-common.h

BL_ERR_CRC_LEN#

#define BL_ERR_CRC_LEN
Value:
0x4CU

Numerical definition for a bootloader status code: END tag CRC wrong length.


Definition at line 126 of file /Users/vihuszar/Git/EmbeddedSoftware/super/platform/base/hal/micro/cortexm3/common/bootloader-common.h

BL_ERR_NO_QUERY#

#define BL_ERR_NO_QUERY
Value:
0X4DU

Numerical definition for a bootloader status code: Received data before query request/response.


Definition at line 131 of file /Users/vihuszar/Git/EmbeddedSoftware/super/platform/base/hal/micro/cortexm3/common/bootloader-common.h

BL_ERR_BAD_LEN#

#define BL_ERR_BAD_LEN
Value:
0x4EU

Numerical definition for a bootloader status code: Invalid length detected.


Definition at line 136 of file /Users/vihuszar/Git/EmbeddedSoftware/super/platform/base/hal/micro/cortexm3/common/bootloader-common.h

BL_ERR_TAGBUF#

#define BL_ERR_TAGBUF
Value:
0x4FU

Numerical definition for a bootloader status code: Problem with tagBuf detected.


Definition at line 141 of file /Users/vihuszar/Git/EmbeddedSoftware/super/platform/base/hal/micro/cortexm3/common/bootloader-common.h

BL_EBL_CONTINUE#

#define BL_EBL_CONTINUE
Value:
0x50U

Numerical definition for a bootloader status code: processEbl deferred, call again to continue.


Definition at line 146 of file /Users/vihuszar/Git/EmbeddedSoftware/super/platform/base/hal/micro/cortexm3/common/bootloader-common.h

BL_ERR_UNEXPECTED_TAG#

#define BL_ERR_UNEXPECTED_TAG
Value:
0x51U

Numerical definition for a bootloader status code: A known tag was found in an unexpected location (eg. header tag found after data)


Definition at line 151 of file /Users/vihuszar/Git/EmbeddedSoftware/super/platform/base/hal/micro/cortexm3/common/bootloader-common.h

BL_ERR_UNK_ENC#

#define BL_ERR_UNK_ENC
Value:
0x52U

Numerical definition for a bootloader status code: The specified encryption type is unknown to this bootloader.


Definition at line 156 of file /Users/vihuszar/Git/EmbeddedSoftware/super/platform/base/hal/micro/cortexm3/common/bootloader-common.h

BL_ERR_INV_KEY#

#define BL_ERR_INV_KEY
Value:
0x53U

Numerical definition for a bootloader status code: No valid encryption key found on the device (ie. It's all 0xFF's). Bootloader will not function until this key is set.


Definition at line 162 of file /Users/vihuszar/Git/EmbeddedSoftware/super/platform/base/hal/micro/cortexm3/common/bootloader-common.h

BL_ERR_ENC#

#define BL_ERR_ENC
Value:
0x54U

Numerical definition for a bootloader status code: Generic error indicating that there was a problem with the encrypted file when decrypting.


Definition at line 167 of file /Users/vihuszar/Git/EmbeddedSoftware/super/platform/base/hal/micro/cortexm3/common/bootloader-common.h

BL_IBR_ERR_CRC#

#define BL_IBR_ERR_CRC
Value:
0x55U

Numerical definition for a bootloader status code: Failed IBR crc.


Definition at line 171 of file /Users/vihuszar/Git/EmbeddedSoftware/super/platform/base/hal/micro/cortexm3/common/bootloader-common.h

BL_IBR_ERR_VERS#

#define BL_IBR_ERR_VERS
Value:
0x56U

Numerical definition for a bootloader status code: Incorrect IBR version.


Definition at line 176 of file /Users/vihuszar/Git/EmbeddedSoftware/super/platform/base/hal/micro/cortexm3/common/bootloader-common.h

BL_IBR_ERR_ADDR#

#define BL_IBR_ERR_ADDR
Value:
0x57U

Numerical definition for a bootloader status code: Invalid ebl address in IBR.


Definition at line 181 of file /Users/vihuszar/Git/EmbeddedSoftware/super/platform/base/hal/micro/cortexm3/common/bootloader-common.h

BL_IBR_ERR_HDR#

#define BL_IBR_ERR_HDR
Value:
0x58U

Numerical definition for a bootloader status code: Incorrect IBR header.


Definition at line 186 of file /Users/vihuszar/Git/EmbeddedSoftware/super/platform/base/hal/micro/cortexm3/common/bootloader-common.h

Bootloader State Flags Documentation#

TIMEOUT#

#define TIMEOUT
Value:
0x16

Bootloader state flag.


Definition at line 202 of file /Users/vihuszar/Git/EmbeddedSoftware/super/platform/base/hal/micro/cortexm3/common/bootloader-common.h

FILEDONE#

#define FILEDONE
Value:
0x17

Bootloader state flag.


Definition at line 203 of file /Users/vihuszar/Git/EmbeddedSoftware/super/platform/base/hal/micro/cortexm3/common/bootloader-common.h

FILEABORT#

#define FILEABORT
Value:
0x18

Bootloader state flag.


Definition at line 204 of file /Users/vihuszar/Git/EmbeddedSoftware/super/platform/base/hal/micro/cortexm3/common/bootloader-common.h

BLOCKOK#

#define BLOCKOK
Value:
0x19

Bootloader state flag.


Definition at line 205 of file /Users/vihuszar/Git/EmbeddedSoftware/super/platform/base/hal/micro/cortexm3/common/bootloader-common.h

QUERYFOUND#

#define QUERYFOUND
Value:
0x1A

Bootloader state flag.


Definition at line 206 of file /Users/vihuszar/Git/EmbeddedSoftware/super/platform/base/hal/micro/cortexm3/common/bootloader-common.h

START_TIMEOUT#

#define START_TIMEOUT
Value:
0x1B

Bootloader state flag.


Definition at line 207 of file /Users/vihuszar/Git/EmbeddedSoftware/super/platform/base/hal/micro/cortexm3/common/bootloader-common.h

BLOCK_TIMEOUT#

#define BLOCK_TIMEOUT
Value:
0x1C

Bootloader state flag.


Definition at line 208 of file /Users/vihuszar/Git/EmbeddedSoftware/super/platform/base/hal/micro/cortexm3/common/bootloader-common.h

BLOCKERR_MASK#

#define BLOCKERR_MASK
Value:
0x20

Bootloader state flag.


Definition at line 209 of file /Users/vihuszar/Git/EmbeddedSoftware/super/platform/base/hal/micro/cortexm3/common/bootloader-common.h

BLOCKERR_SOH#

#define BLOCKERR_SOH
Value:
0x21

Bootloader state flag: Start Of Header not received.


Definition at line 213 of file /Users/vihuszar/Git/EmbeddedSoftware/super/platform/base/hal/micro/cortexm3/common/bootloader-common.h

BLOCKERR_CHK#

#define BLOCKERR_CHK
Value:
0x22

Bootloader state flag: Sequence of bytes don't match.


Definition at line 217 of file /Users/vihuszar/Git/EmbeddedSoftware/super/platform/base/hal/micro/cortexm3/common/bootloader-common.h

BLOCKERR_CRCH#

#define BLOCKERR_CRCH
Value:
0x23

Bootloader state flag: CRC High byte failure.


Definition at line 221 of file /Users/vihuszar/Git/EmbeddedSoftware/super/platform/base/hal/micro/cortexm3/common/bootloader-common.h

BLOCKERR_CRCL#

#define BLOCKERR_CRCL
Value:
0x24

Bootloader state flag: CRC Low byte failure.


Definition at line 225 of file /Users/vihuszar/Git/EmbeddedSoftware/super/platform/base/hal/micro/cortexm3/common/bootloader-common.h

BLOCKERR_SEQUENCE#

#define BLOCKERR_SEQUENCE
Value:
0x25

Bootloader state flag: Block received out of sequence.


Definition at line 229 of file /Users/vihuszar/Git/EmbeddedSoftware/super/platform/base/hal/micro/cortexm3/common/bootloader-common.h

BLOCKERR_PARTIAL#

#define BLOCKERR_PARTIAL
Value:
0x26

Bootloader state flag: Partial block received.


Definition at line 233 of file /Users/vihuszar/Git/EmbeddedSoftware/super/platform/base/hal/micro/cortexm3/common/bootloader-common.h

BLOCKERR_DUPLICATE#

#define BLOCKERR_DUPLICATE
Value:
0x27

Bootloader state flag: Duplicate of previous block.


Definition at line 237 of file /Users/vihuszar/Git/EmbeddedSoftware/super/platform/base/hal/micro/cortexm3/common/bootloader-common.h

Enumeration Documentation#

@0#

@0
Enumerator
PRIORITIZE_BEACONS_BASED_ON_PARENT_CLASSIFICATION
PRIORITIZE_BEACONS_BASED_ON_TC_CONNECTVITY
TC_CONNECTIVITY
LONG_UPTIME
BAD_PARENT_CONNECTIVITY
EMBER_OUTGOING_MESSAGES

There are messages waiting for transmission.

EMBER_INCOMING_MESSAGES

One or more incoming messages being processed.

EMBER_RADIO_IS_ON

The radio is currently powered on. On sleepy devices, the radio is turned off when not in use. On non-sleepy devices (EMBER_COORDINATOR, EMBER_ROUTER, or EMBER_END_DEVICE), the radio is always on.

EMBER_TRANSPORT_ACTIVE

The transport layer has messages awaiting an ACK.

EMBER_APS_LAYER_ACTIVE

The ZigBee APS layer has messages awaiting an ACK.

EMBER_ASSOCIATING

The node is currently trying to associate with a ZigBee PRO network.

EMBER_ZLL_TOUCH_LINKING

The node is currently touch linking.

EMBER_NETWORK_TIMEOUT_REQUEST

Network Timeout Request Event.

EMBER_SEND_ORPHAN_NOTIFICATION

Sending Orphan Notification Event.

EMBER_MAC_DATA_POLL_SUPER_RETRY

MAC Data Poll Super Retry Event .

INITIAL
SCAN_FOR_TOUCH_LINK
SCAN_FOR_DEVICE_INFORMATION
SCAN_FOR_IDENTIFY
SCAN_FOR_RESET
TARGET_NETWORK_FOUND
ABORTING_TOUCH_LINK
SCAN_COMPLETE
TOUCH_LINK_TARGET
FORMING_NETWORK
RESETTING_TO_FACTORY_NEW
ADC_REF_INT

Internal reference.

TOKEN_COUNT
COMM_SERIAL
COMM_RADIO

Definition at line 242 of file /Users/vihuszar/Git/EmbeddedSoftware/super/platform/base/hal/micro/cortexm3/common/bootloader-common.h

Typedef Documentation#

BL_Status#

typedef uint8_t BL_Status

Define the bootloader status type.


Definition at line 44 of file /Users/vihuszar/Git/EmbeddedSoftware/super/platform/base/hal/micro/cortexm3/common/bootloader-common.h