icopyx bootloader safeguard

This commit is contained in:
Philippe Teuwen 2021-08-21 23:52:15 +02:00
parent e79fb92074
commit 0384359aa4
4 changed files with 23 additions and 1 deletions

View file

@ -132,7 +132,7 @@ bootrom/%: FORCE cleanifplatformchanged
armsrc/%: FORCE cleanifplatformchanged fpga_compress/%
$(info [*] MAKE $@)
$(Q)$(MAKE) --no-print-directory -C armsrc $(patsubst armsrc/%,%,$@) DESTDIR=$(MYDESTDIR)
client/%: FORCE
client/%: FORCE cleanifplatformchanged
$(info [*] MAKE $@)
$(Q)$(MAKE) --no-print-directory -C client $(patsubst client/%,%,$@) DESTDIR=$(MYDESTDIR)
recovery/all: bootrom/all armsrc/all
@ -222,6 +222,7 @@ ifeq ($(PLATFORM_CHANGED),true)
$(Q)$(MAKE) --no-print-directory -C bootrom clean
$(Q)$(MAKE) --no-print-directory -C armsrc clean
$(Q)$(MAKE) --no-print-directory -C recovery clean
$(Q)$(MAKE) --no-print-directory -C client clean
$(Q)$(MAKE) --no-print-directory -C tools/fpga_compress clean
$(Q)echo CACHED_PLATFORM=$(PLATFORM) > .Makefile.options.cache
$(Q)echo CACHED_PLATFORM_EXTRAS=$(PLATFORM_EXTRAS) >> .Makefile.options.cache

View file

@ -112,6 +112,9 @@ static void UsbPacketReceived(uint8_t *packet) {
break;
case CMD_FINISH_WRITE: {
#if defined ICOPYX
if (c->arg[1] == 0xff && c->arg[2] == 0x1fd) {
#endif
for (int j = 0; j < 2; j++) {
uint32_t flash_address = arg0 + (0x100 * j);
AT91PS_EFC efc_bank = AT91C_BASE_EFC0;
@ -147,6 +150,9 @@ static void UsbPacketReceived(uint8_t *packet) {
reply_old(CMD_NACK, sr, 0, 0, 0, 0);
}
}
#if defined ICOPYX
}
#endif
}
break;

View file

@ -5,6 +5,17 @@
#-----------------------------------------------------------------------------
include ../Makefile.defs
ifeq ($(PLTNAME),)
-include ../Makefile.platform
-include ../.Makefile.options.cache
ifneq ($(PLATFORM), $(CACHED_PLATFORM))
$(error platform definitions have been changed, please "make clean" at the root of the project)
endif
endif
ifeq ($(PLATFORM),PM3ICOPYX)
INCLUDES += -DICOPYX
endif
INSTALLBIN = proxmark3
INSTALLSHARE = cmdscripts lualibs luascripts pyscripts resources dictionaries

View file

@ -522,7 +522,11 @@ static int write_block(uint32_t address, uint8_t *data, uint32_t length) {
memset(block_buf, 0xFF, BLOCK_SIZE);
memcpy(block_buf, data, length);
PacketResponseNG resp;
#if defined ICOPYX
SendCommandBL(CMD_FINISH_WRITE, address, 0xff, 0x1fd, block_buf, length);
#else
SendCommandBL(CMD_FINISH_WRITE, address, 0, 0, block_buf, length);
#endif
int ret = wait_for_ack(&resp);
if (ret && resp.oldarg[0]) {
uint32_t lock_bits = resp.oldarg[0] >> 16;