mirror of
https://github.com/RfidResearchGroup/proxmark3.git
synced 2024-12-29 11:52:59 +08:00
Flasher support for versionning
Only bootrom with version > 1.0.0 will allow 512K writes
This commit is contained in:
parent
c056e56492
commit
68aa9d631d
3 changed files with 28 additions and 3 deletions
|
@ -143,7 +143,7 @@ void UsbPacketReceived(uint8_t *packet, int len) {
|
|||
|
||||
case CMD_BL_VERSION: {
|
||||
dont_ack = 1;
|
||||
arg0 = VERSION_1_0_0;
|
||||
arg0 = BL_VERSION_1_0_0;
|
||||
reply_old(CMD_BL_VERSION, arg0, 0, 0, 0, 0);
|
||||
}
|
||||
|
||||
|
|
|
@ -356,8 +356,30 @@ int flash_start_flashing(int enable_bl_writes, char *serial_port_name, uint32_t
|
|||
*chipinfo = resp.oldarg[0];
|
||||
}
|
||||
|
||||
int version = BL_VERSION_INVALID;
|
||||
if (state & DEVICE_INFO_FLAG_UNDERSTANDS_VERSION) {
|
||||
SendCommandBL(CMD_BL_VERSION, 0, 0, 0, NULL, 0);
|
||||
PacketResponseNG resp;
|
||||
WaitForResponse(CMD_BL_VERSION, &resp);
|
||||
version = resp.oldarg[0];
|
||||
if ((version < BL_VERSION_FIRST || version > BL_VERSION_LAST)) {
|
||||
version = BL_VERSION_INVALID;
|
||||
}
|
||||
} else {
|
||||
PrintAndLogEx(ERR, _RED_("Note: Your bootloader does not understand the new CMD_BL_VERSION command"));
|
||||
PrintAndLogEx(ERR, _RED_("It is recommended that you update your bootloader") "\n");
|
||||
}
|
||||
|
||||
bool allow_512k_writes = false;
|
||||
if (version == BL_VERSION_INVALID) {
|
||||
PrintAndLogEx(ERR, _RED_("Note: Your bootloader reported an invalid version number"));
|
||||
PrintAndLogEx(ERR, _RED_("It is recommended that you update your bootloader") "\n");
|
||||
} else if (version >= BL_VERSION_1_0_0) {
|
||||
allow_512k_writes = true;
|
||||
}
|
||||
|
||||
uint32_t flash_end = FLASH_START + AT91C_IFLASH_PAGE_SIZE * AT91C_IFLASH_NB_OF_PAGES / 2;
|
||||
if (((*chipinfo & 0xF00) >> 8) > 9) {
|
||||
if ((((*chipinfo & 0xF00) >> 8) > 9) && allow_512k_writes) {
|
||||
flash_end = FLASH_START + AT91C_IFLASH_PAGE_SIZE * AT91C_IFLASH_NB_OF_PAGES;
|
||||
}
|
||||
|
||||
|
|
|
@ -541,7 +541,10 @@ typedef struct {
|
|||
#define DEVICE_INFO_FLAG_UNDERSTANDS_VERSION (1<<6)
|
||||
|
||||
// Different versions here. Each version should increse the number
|
||||
#define VERSION_1_0_0 1
|
||||
#define BL_VERSION_INVALID 0
|
||||
#define BL_VERSION_1_0_0 1
|
||||
#define BL_VERSION_FIRST BL_VERSION_1_0_0
|
||||
#define BL_VERSION_LAST BL_VERSION_1_0_0
|
||||
|
||||
/* CMD_START_FLASH may have three arguments: start of area to flash,
|
||||
end of area to flash, optional magic.
|
||||
|
|
Loading…
Reference in a new issue