Add a version command to the bootloader (not activated yet)

This commit is contained in:
slurdge 2019-07-19 18:08:59 +02:00 committed by Philippe Teuwen
parent 7ad7275ee9
commit c056e56492
2 changed files with 14 additions and 0 deletions

View file

@ -126,6 +126,7 @@ void UsbPacketReceived(uint8_t *packet, int len) {
DEVICE_INFO_FLAG_CURRENT_MODE_BOOTROM |
DEVICE_INFO_FLAG_UNDERSTANDS_START_FLASH |
DEVICE_INFO_FLAG_UNDERSTANDS_CHIP_INFO;
//to add later: DEVICE_INFO_FLAG_UNDERSTANDS_VERSION
if (common_area.flags.osimage_present)
arg0 |= DEVICE_INFO_FLAG_OSIMAGE_PRESENT;
@ -140,6 +141,12 @@ void UsbPacketReceived(uint8_t *packet, int len) {
}
break;
case CMD_BL_VERSION: {
dont_ack = 1;
arg0 = VERSION_1_0_0;
reply_old(CMD_BL_VERSION, arg0, 0, 0, 0, 0);
}
case CMD_SETUP_WRITE: {
/* The temporary write buffer of the embedded flash controller is mapped to the
* whole memory region, only the last 8 bits are decoded.

View file

@ -208,6 +208,7 @@ typedef struct {
#define CMD_HARDWARE_RESET 0x0004
#define CMD_START_FLASH 0x0005
#define CMD_CHIP_INFO 0x0006
#define CMD_BL_VERSION 0x0007
#define CMD_NACK 0x00fe
#define CMD_ACK 0x00ff
@ -536,6 +537,12 @@ typedef struct {
/* Set if this device understands the chip info command */
#define DEVICE_INFO_FLAG_UNDERSTANDS_CHIP_INFO (1<<5)
/* Set if this device understands the version command */
#define DEVICE_INFO_FLAG_UNDERSTANDS_VERSION (1<<6)
// Different versions here. Each version should increse the number
#define VERSION_1_0_0 1
/* CMD_START_FLASH may have three arguments: start of area to flash,
end of area to flash, optional magic.
The bootrom will not allow to overwrite itself unless this magic