|
|
|
@ -80,69 +80,69 @@
@@ -80,69 +80,69 @@
|
|
|
|
|
// RESET finalise flash programming, reset chip and starts application
|
|
|
|
|
//
|
|
|
|
|
|
|
|
|
|
#define BL_PROTOCOL_VERSION 5 // The revision of the bootloader protocol
|
|
|
|
|
#define BL_PROTOCOL_VERSION 5 // The revision of the bootloader protocol
|
|
|
|
|
//* Next revision needs to update
|
|
|
|
|
|
|
|
|
|
// protocol bytes
|
|
|
|
|
#define PROTO_INSYNC 0x12 // 'in sync' byte sent before status
|
|
|
|
|
#define PROTO_EOC 0x20 // end of command
|
|
|
|
|
#define PROTO_INSYNC 0x12 // 'in sync' byte sent before status
|
|
|
|
|
#define PROTO_EOC 0x20 // end of command
|
|
|
|
|
|
|
|
|
|
// Reply bytes
|
|
|
|
|
#define PROTO_OK 0x10 // INSYNC/OK - 'ok' response
|
|
|
|
|
#define PROTO_FAILED 0x11 // INSYNC/FAILED - 'fail' response
|
|
|
|
|
#define PROTO_INVALID 0x13 // INSYNC/INVALID - 'invalid' response for bad commands
|
|
|
|
|
#define PROTO_BAD_SILICON_REV 0x14 // On the F4 series there is an issue with < Rev 3 silicon
|
|
|
|
|
#define PROTO_RESERVED_0X15 0x15 // Reserved
|
|
|
|
|
#define PROTO_OK 0x10 // INSYNC/OK - 'ok' response
|
|
|
|
|
#define PROTO_FAILED 0x11 // INSYNC/FAILED - 'fail' response
|
|
|
|
|
#define PROTO_INVALID 0x13 // INSYNC/INVALID - 'invalid' response for bad commands
|
|
|
|
|
#define PROTO_BAD_SILICON_REV 0x14 // On the F4 series there is an issue with < Rev 3 silicon
|
|
|
|
|
#define PROTO_RESERVED_0X15 0x15 // Reserved
|
|
|
|
|
|
|
|
|
|
// see https://pixhawk.org/help/errata
|
|
|
|
|
// Command bytes
|
|
|
|
|
#define PROTO_GET_SYNC 0x21 // NOP for re-establishing sync
|
|
|
|
|
#define PROTO_GET_DEVICE 0x22 // get device ID bytes
|
|
|
|
|
#define PROTO_CHIP_ERASE 0x23 // erase program area and reset program address
|
|
|
|
|
#define PROTO_PROG_MULTI 0x27 // write bytes at program address and increment
|
|
|
|
|
#define PROTO_GET_CRC 0x29 // compute & return a CRC
|
|
|
|
|
#define PROTO_GET_OTP 0x2a // read a byte from OTP at the given address
|
|
|
|
|
#define PROTO_GET_SN 0x2b // read a word from UDID area ( Serial) at the given address
|
|
|
|
|
#define PROTO_GET_CHIP 0x2c // read chip version (MCU IDCODE)
|
|
|
|
|
#define PROTO_SET_DELAY 0x2d // set minimum boot delay
|
|
|
|
|
#define PROTO_GET_CHIP_DES 0x2e // read chip version In ASCII
|
|
|
|
|
#define PROTO_BOOT 0x30 // boot the application
|
|
|
|
|
#define PROTO_DEBUG 0x31 // emit debug information - format not defined
|
|
|
|
|
#define PROTO_SET_BAUD 0x33 // set baud rate on uart
|
|
|
|
|
|
|
|
|
|
#define PROTO_RESERVED_0X36 0x36 // Reserved
|
|
|
|
|
#define PROTO_RESERVED_0X37 0x37 // Reserved
|
|
|
|
|
#define PROTO_RESERVED_0X38 0x38 // Reserved
|
|
|
|
|
#define PROTO_RESERVED_0X39 0x39 // Reserved
|
|
|
|
|
|
|
|
|
|
#define PROTO_PROG_MULTI_MAX 64 // maximum PROG_MULTI size
|
|
|
|
|
#define PROTO_READ_MULTI_MAX 255 // size of the size field
|
|
|
|
|
#define PROTO_GET_SYNC 0x21 // NOP for re-establishing sync
|
|
|
|
|
#define PROTO_GET_DEVICE 0x22 // get device ID bytes
|
|
|
|
|
#define PROTO_CHIP_ERASE 0x23 // erase program area and reset program address
|
|
|
|
|
#define PROTO_PROG_MULTI 0x27 // write bytes at program address and increment
|
|
|
|
|
#define PROTO_GET_CRC 0x29 // compute & return a CRC
|
|
|
|
|
#define PROTO_GET_OTP 0x2a // read a byte from OTP at the given address
|
|
|
|
|
#define PROTO_GET_SN 0x2b // read a word from UDID area ( Serial) at the given address
|
|
|
|
|
#define PROTO_GET_CHIP 0x2c // read chip version (MCU IDCODE)
|
|
|
|
|
#define PROTO_SET_DELAY 0x2d // set minimum boot delay
|
|
|
|
|
#define PROTO_GET_CHIP_DES 0x2e // read chip version In ASCII
|
|
|
|
|
#define PROTO_BOOT 0x30 // boot the application
|
|
|
|
|
#define PROTO_DEBUG 0x31 // emit debug information - format not defined
|
|
|
|
|
#define PROTO_SET_BAUD 0x33 // set baud rate on uart
|
|
|
|
|
|
|
|
|
|
#define PROTO_RESERVED_0X36 0x36 // Reserved
|
|
|
|
|
#define PROTO_RESERVED_0X37 0x37 // Reserved
|
|
|
|
|
#define PROTO_RESERVED_0X38 0x38 // Reserved
|
|
|
|
|
#define PROTO_RESERVED_0X39 0x39 // Reserved
|
|
|
|
|
|
|
|
|
|
#define PROTO_PROG_MULTI_MAX 64 // maximum PROG_MULTI size
|
|
|
|
|
#define PROTO_READ_MULTI_MAX 255 // size of the size field
|
|
|
|
|
|
|
|
|
|
/* argument values for PROTO_GET_DEVICE */ |
|
|
|
|
#define PROTO_DEVICE_BL_REV 1 // bootloader revision
|
|
|
|
|
#define PROTO_DEVICE_BOARD_ID 2 // board ID
|
|
|
|
|
#define PROTO_DEVICE_BOARD_REV 3 // board revision
|
|
|
|
|
#define PROTO_DEVICE_FW_SIZE 4 // size of flashable area
|
|
|
|
|
#define PROTO_DEVICE_VEC_AREA 5 // contents of reserved vectors 7-10
|
|
|
|
|
#define PROTO_DEVICE_BL_REV 1 // bootloader revision
|
|
|
|
|
#define PROTO_DEVICE_BOARD_ID 2 // board ID
|
|
|
|
|
#define PROTO_DEVICE_BOARD_REV 3 // board revision
|
|
|
|
|
#define PROTO_DEVICE_FW_SIZE 4 // size of flashable area
|
|
|
|
|
#define PROTO_DEVICE_VEC_AREA 5 // contents of reserved vectors 7-10
|
|
|
|
|
|
|
|
|
|
#define STATE_PROTO_OK 0x10 // INSYNC/OK - 'ok' response
|
|
|
|
|
#define STATE_PROTO_FAILED 0x11 // INSYNC/FAILED - 'fail' response
|
|
|
|
|
#define STATE_PROTO_INVALID 0x13 // INSYNC/INVALID - 'invalid' response for bad commands
|
|
|
|
|
#define STATE_PROTO_BAD_SILICON_REV 0x14 // On the F4 series there is an issue with < Rev 3 silicon
|
|
|
|
|
#define STATE_PROTO_RESERVED_0X15 0x15 // Reserved
|
|
|
|
|
#define STATE_PROTO_OK 0x10 // INSYNC/OK - 'ok' response
|
|
|
|
|
#define STATE_PROTO_FAILED 0x11 // INSYNC/FAILED - 'fail' response
|
|
|
|
|
#define STATE_PROTO_INVALID 0x13 // INSYNC/INVALID - 'invalid' response for bad commands
|
|
|
|
|
#define STATE_PROTO_BAD_SILICON_REV 0x14 // On the F4 series there is an issue with < Rev 3 silicon
|
|
|
|
|
#define STATE_PROTO_RESERVED_0X15 0x15 // Reserved
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// State
|
|
|
|
|
#define STATE_PROTO_GET_SYNC 0x1 // Have Seen NOP for re-establishing sync
|
|
|
|
|
#define STATE_PROTO_GET_DEVICE 0x2 // Have Seen get device ID bytes
|
|
|
|
|
#define STATE_PROTO_CHIP_ERASE 0x4 // Have Seen erase program area and reset program address
|
|
|
|
|
#define STATE_PROTO_PROG_MULTI 0x8 // Have Seen write bytes at program address and increment
|
|
|
|
|
#define STATE_PROTO_GET_CRC 0x10 // Have Seen compute & return a CRC
|
|
|
|
|
#define STATE_PROTO_GET_OTP 0x20 // Have Seen read a byte from OTP at the given address
|
|
|
|
|
#define STATE_PROTO_GET_SN 0x40 // Have Seen read a word from UDID area ( Serial) at the given address
|
|
|
|
|
#define STATE_PROTO_GET_CHIP 0x80 // Have Seen read chip version (MCU IDCODE)
|
|
|
|
|
#define STATE_PROTO_GET_CHIP_DES 0x100 // Have Seen read chip version In ASCII
|
|
|
|
|
#define STATE_PROTO_BOOT 0x200 // Have Seen boot the application
|
|
|
|
|
#define STATE_PROTO_GET_SYNC 0x1 // Have Seen NOP for re-establishing sync
|
|
|
|
|
#define STATE_PROTO_GET_DEVICE 0x2 // Have Seen get device ID bytes
|
|
|
|
|
#define STATE_PROTO_CHIP_ERASE 0x4 // Have Seen erase program area and reset program address
|
|
|
|
|
#define STATE_PROTO_PROG_MULTI 0x8 // Have Seen write bytes at program address and increment
|
|
|
|
|
#define STATE_PROTO_GET_CRC 0x10 // Have Seen compute & return a CRC
|
|
|
|
|
#define STATE_PROTO_GET_OTP 0x20 // Have Seen read a byte from OTP at the given address
|
|
|
|
|
#define STATE_PROTO_GET_SN 0x40 // Have Seen read a word from UDID area ( Serial) at the given address
|
|
|
|
|
#define STATE_PROTO_GET_CHIP 0x80 // Have Seen read chip version (MCU IDCODE)
|
|
|
|
|
#define STATE_PROTO_GET_CHIP_DES 0x100 // Have Seen read chip version In ASCII
|
|
|
|
|
#define STATE_PROTO_BOOT 0x200 // Have Seen boot the application
|
|
|
|
|
|
|
|
|
|
#if defined(TARGET_HW_PX4_PIO_V1) |
|
|
|
|
#define STATE_ALLOWS_ERASE (STATE_PROTO_GET_SYNC) |
|
|
|
|