diff --git a/Firmware/Chameleon-Mini/Application/DESFire/DESFireInstructions.c b/Firmware/Chameleon-Mini/Application/DESFire/DESFireInstructions.c index ecec8abb..8383fdbf 100644 --- a/Firmware/Chameleon-Mini/Application/DESFire/DESFireInstructions.c +++ b/Firmware/Chameleon-Mini/Application/DESFire/DESFireInstructions.c @@ -119,7 +119,7 @@ static uint16_t ISO7816CmdAppendRecord(uint8_t *Buffer, uint16_t ByteCount); * handlers to the end of the array, or insert them haphazardly in * the middle !!! */ -const DESFIRE_FIRMWARE_ALIGNAT DESFireCommand DESFireCommandSet[] DESFIRE_DFFRAM_SECTION = { +static const DESFireCommand DESFireCommandSet[] = { { .insCode = CMD_AUTHENTICATE, .insFunc = &EV0CmdAuthenticateLegacy1 @@ -325,8 +325,7 @@ uint16_t CallInstructionHandler(uint8_t *Buffer, uint16_t ByteCount) { DESFireCommand dfCmd; while (curInsUpper >= curInsLower) { curInsIndex = curInsLower + (curInsUpper + 1 - curInsLower) / 2; - MemoryReadBlock(&dfCmd, DESFireCommandSet[curInsIndex], sizeof(DESFireCommand)); - nextDESFireFRAMBaseAddr += sizeof(DESFireCommand); + dfCmd = DESFireCommandSet[curInsIndex]; if (dfCmd.insCode == insCode) { if (dfCmd.insFunc == NULL) { return CmdNotImplemented(Buffer, ByteCount); diff --git a/Firmware/Chameleon-Mini/Application/DESFire/DESFireInstructions.h b/Firmware/Chameleon-Mini/Application/DESFire/DESFireInstructions.h index 8149fe3c..a31bf770 100644 --- a/Firmware/Chameleon-Mini/Application/DESFire/DESFireInstructions.h +++ b/Firmware/Chameleon-Mini/Application/DESFire/DESFireInstructions.h @@ -117,8 +117,6 @@ typedef struct { InsCodeHandlerFunc insFunc; } DESFireCommand DESFIRE_FIRMWARE_ALIGNAT; -extern const DESFIRE_FIRMWARE_ALIGNAT DESFireCommand DESFireCommandSet[]; - /* Helper and batch process functions */ uint16_t CallInstructionHandler(uint8_t *Buffer, uint16_t ByteCount); diff --git a/Firmware/Chameleon-Mini/Log.h b/Firmware/Chameleon-Mini/Log.h index 19c60e82..c833d4d4 100644 --- a/Firmware/Chameleon-Mini/Log.h +++ b/Firmware/Chameleon-Mini/Log.h @@ -8,18 +8,9 @@ #else #define LOG_SIZE 2048 #endif -#ifdef DESFIRE_FRAM_LOG_START -/* This is separated so we can store the large DESFire (native) and ISO7816 command subset - * oragnized in a sorted lookup table by command (byte) ID in the FLASH -> FRAM memory space. - */ -#define FRAM_LOG_ADDR_ADDR DESFIRE_FRAM_LOG_START // start of the second half of FRAM -#define FRAM_LOG_START_ADDR (DESFIRE_FRAM_LOG_START + 0x002) // directly after the address -#define FRAM_LOG_SIZE (DESFIRE_FRAM_LOG_SIZE) // the whole second half (minus the 2 Bytes of Address) -#else #define FRAM_LOG_ADDR_ADDR 0x4000 // start of the second half of FRAM #define FRAM_LOG_START_ADDR 0x4002 // directly after the address #define FRAM_LOG_SIZE 0x3FFE // the whole second half (minus the 2 Bytes of Address) -#endif extern uint8_t LogMem[LOG_SIZE]; extern uint8_t *LogMemPtr; diff --git a/Firmware/Chameleon-Mini/Makefile b/Firmware/Chameleon-Mini/Makefile index c993d4e6..cd8a5bcf 100644 --- a/Firmware/Chameleon-Mini/Makefile +++ b/Firmware/Chameleon-Mini/Makefile @@ -143,19 +143,12 @@ DESFIRE_DFFRAM_SECTION_START=0x6048 DESFIRE_DFFRAM_DATA_ADDR=0x16048 DESFIRE_DFFRAM_MAX_SIZE=0x0FFF DESFIRE_DFFRAM_SECTION_NAME=\".dffram\" -DESFIRE_CONFIG_SETTINGS_BASE=$(SETTINGS) -DCONFIG_MF_DESFIRE_SUPPORT -DMEMORY_LIMITED_TESTING -DDESFIRE_CRYPTO1_SAVE_SPACE -UDEFAULT_CONFIGURATION \ - -DDESFIRE_FRAM_LOG_START=$(DESFIRE_FRAM_LOG_START) -DDESFIRE_FRAM_LOG_SIZE=$(DESFIRE_FRAM_LOG_SIZE) \ - -DDESFIRE_DFFRAM_MAX_SIZE=$(DESFIRE_DFFRAM_MAX_SIZE) \ - -DDESFIRE_DFFRAM_SECTION_START=$(DESFIRE_DFFRAM_SECTION_START) \ - -DDESFIRE_DFFRAM_DATA_ADDR=$(DESFIRE_DFFRAM_DATA_ADDR) \ - -DDESFIRE_DFFRAM_SECTION_NAME=$(DESFIRE_DFFRAM_SECTION_NAME) +DESFIRE_CONFIG_SETTINGS_BASE=$(SETTINGS) -DCONFIG_MF_DESFIRE_SUPPORT -DMEMORY_LIMITED_TESTING -DDESFIRE_CRYPTO1_SAVE_SPACE -UDEFAULT_CONFIGURATION DESFIRE_DFFRAM_OBJCOPY= --set-section-flags=.dffram="alloc,load,readonly" #Memory definitions and objcopy flags to include sections in binaries FLASH_DATA_ADDR = 0x10000 #Start of data section in flash FLASH_DATA_SIZE = 0x10000 #Size of data section in flash -#FLASH_DATA_ADDR = 0x12046 -#FLASH_DATA_SIZE = 0xF001 FLASH_DATA_OBJCOPY = --set-section-flags=.flashdata="alloc,load" SPM_HELPER_ADDR = 0x21FE0 #Start of SPM helper section. Should be last 32Byte in bootloader section SPM_HELPER_OBJCOPY = --set-section-flags=.spmhelper="alloc,load" @@ -314,15 +307,10 @@ git-add-dev: ## Defining custom targets for the DESFire build (normal/user mode) and ## developer mode for use with the Android CMLD application that enables ## the printing of LIVE logs to the phone's console by default: -desfire-objcopy: $(TARGET).elf - @echo $(MSG_OBJCPY_CMD) RE-Extracting HEX file data from \"$<\" - $(CROSS)-objcopy -O ihex -R .eeprom -R .fuse -R .lock -R .signature $(FLASH_DATA_OBJCOPY) $(DESFIRE_DFFRAM_OBJCOPY) $< $(TARGET).hex - @echo $(MSG_OBJCPY_CMD) RE-Extracting BIN file data from \"$<\" - $(CROSS)-objcopy -O binary -R .eeprom -R .fuse -R .lock -R .signature $(FLASH_DATA_OBJCOPY) $< $(TARGET).bin +desfire-build: local-clean $(TARGET).elf $(TARGET).hex $(TARGET).eep $(TARGET).bin check_size @cp $(TARGET).hex $(TARGET)-DESFire.hex @cp $(TARGET).eep $(TARGET)-DESFire.eep @cp $(TARGET).bin $(TARGET)-DESFire.bin -desfire-build: local-clean $(TARGET).elf $(TARGET).hex $(TARGET).eep $(TARGET).bin desfire-objcopy check_size @echo -e "\n" @avr-size -A -x $(TARGET).elf @avr-size -B -x $(TARGET).elf diff --git a/Firmware/Chameleon-Mini/MemoryAsm.S b/Firmware/Chameleon-Mini/MemoryAsm.S index da1a3ebf..1821302e 100644 --- a/Firmware/Chameleon-Mini/MemoryAsm.S +++ b/Firmware/Chameleon-Mini/MemoryAsm.S @@ -223,9 +223,3 @@ FlashCommonSPM: .section .flashdata .align 1 .skip MEMORY_SIZE, MEMORY_INIT_VALUE - -#ifdef DESFIRE_FRAM_LOG_SIZE -.section .dffram -.align 1 -.skip DESFIRE_FRAM_LOG_SIZE, MEMORY_INIT_VALUE -#endif