diff --git a/Makefile b/Makefile index a2909d1c..2560a381 100644 --- a/Makefile +++ b/Makefile @@ -198,15 +198,18 @@ test-app/image.elf: wolfboot.elf $(Q)$(MAKE) -C test-app WOLFBOOT_ROOT="$(WOLFBOOT_ROOT)" image.elf $(Q)$(SIZE) test-app/image.elf -internal_flash.dd: $(BINASSEMBLE) wolfboot.bin $(BOOT_IMG) $(PRIVATE_KEY) test-app/image_v1_signed.bin - @echo "\t[MERGE] internal_flash.dd" - $(Q)dd if=/dev/zero bs=1 count=$$(($(WOLFBOOT_SECTOR_SIZE))) > /tmp/swap - $(Q)$(BINASSEMBLE) $@ \ +assemble_internal_flash.dd: FORCE + $(Q)$(BINASSEMBLE) internal_flash.dd \ 0 wolfboot.bin \ $$(($(WOLFBOOT_PARTITION_BOOT_ADDRESS) - $(ARCH_FLASH_OFFSET))) test-app/image_v1_signed.bin \ $$(($(WOLFBOOT_PARTITION_UPDATE_ADDRESS)-$(ARCH_FLASH_OFFSET))) /tmp/swap \ $$(($(WOLFBOOT_PARTITION_SWAP_ADDRESS)-$(ARCH_FLASH_OFFSET))) /tmp/swap +internal_flash.dd: $(BINASSEMBLE) wolfboot.bin $(BOOT_IMG) $(PRIVATE_KEY) test-app/image_v1_signed.bin + @echo "\t[MERGE] internal_flash.dd" + $(Q)dd if=/dev/zero bs=1 count=$$(($(WOLFBOOT_SECTOR_SIZE))) > /tmp/swap + make assemble_internal_flash.dd + factory.bin: $(BINASSEMBLE) wolfboot.bin $(BOOT_IMG) $(PRIVATE_KEY) test-app/image_v1_signed.bin @echo "\t[MERGE] $@" $(Q)$(BINASSEMBLE) $@ \ diff --git a/test-app/app_sim.c b/test-app/app_sim.c index e200db55..2b058c6f 100644 --- a/test-app/app_sim.c +++ b/test-app/app_sim.c @@ -70,7 +70,31 @@ int do_cmd(const char *cmd) if (strcmp(cmd, "reset") == 0) { exit(0); } + if (strncmp(cmd, "get_tlv",7) == 0) { + uint8_t* imageHdr = (uint8_t*)WOLFBOOT_PARTITION_BOOT_ADDRESS; + uint8_t* ptr = NULL; + uint16_t tlv = 0x34; /* default */ + int size; + int i; + const char* tlvStr = strstr(cmd, "get_tlv="); + if (tlvStr) { + tlvStr += strlen("get_tlv="); + tlv = (uint16_t)atoi(tlvStr); + } + printf("Get TLV %04x\r\n", tlv); + + size = wolfBoot_find_header(imageHdr + IMAGE_HEADER_OFFSET, tlv, &ptr); + if (size >= 0 && ptr != NULL) { + /* From here, the value 0xAABBCCDD is at ptr */ + printf("TLV 0x%x:\n", tlv); + for (i=0; i