diff --git a/Sming/Arch/Host/Components/vflash/component.mk b/Sming/Arch/Host/Components/vflash/component.mk index 98410de609..12eea0f2c4 100644 --- a/Sming/Arch/Host/Components/vflash/component.mk +++ b/Sming/Arch/Host/Components/vflash/component.mk @@ -24,6 +24,12 @@ define WriteFlash $(if $1,$(Q) $(VFLASH) write-chunks $1) endef +# Verify one or more chunks against flash content +# $1 -> List of `Offset=File` chunks +define VerifyFlash + @echo VerifyFlash not implemented for Host +endef + # Read flash memory into file # $1 -> `Offset,Size` chunk # $2 -> Output filename diff --git a/Sming/Components/esptool/component.mk b/Sming/Components/esptool/component.mk index 3c936f186f..bb5464e2da 100644 --- a/Sming/Components/esptool/component.mk +++ b/Sming/Components/esptool/component.mk @@ -52,6 +52,15 @@ define WriteFlash ) endef +# Verify flash against file contents +# $1 -> List of `Offset=File` chunks +define VerifyFlash + $(if $1,\ + $(info VerifyFlash $1) \ + $(call ESPTOOL_EXECUTE,verify_flash $(flashimageoptions) $(subst =, ,$1)) \ + ) +endef + # Read flash memory into file # $1 -> `Offset,Size` chunk # $2 -> Output filename diff --git a/Sming/component.mk b/Sming/component.mk index f97cb98ceb..c8caaef428 100644 --- a/Sming/component.mk +++ b/Sming/component.mk @@ -151,3 +151,8 @@ ifeq ($(ENABLE_GDB), 1) else ifneq ($(SMING_ARCH),Host) $(TERMINAL) endif + +.PHONY: verifyflash +verifyflash: ##Read all flash sections and verify against source + $(Q) $(call CheckPartitionChunks,$(FLASH_PARTITION_CHUNKS)) + $(call VerifyFlash,$(FLASH_BOOT_CHUNKS) $(FLASH_MAP_CHUNK) $(FLASH_PARTITION_CHUNKS)) diff --git a/docs/source/troubleshooting/random-restart.rst b/docs/source/troubleshooting/random-restart.rst index 10b5ec2a70..39698bc8d8 100644 --- a/docs/source/troubleshooting/random-restart.rst +++ b/docs/source/troubleshooting/random-restart.rst @@ -26,3 +26,7 @@ To achieve this do the following: 3) Re-program your device:: make flash + +4) Verify flash data has been written successfully + + make verifyflash diff --git a/samples/Basic_Storage/basic_storage.hw b/samples/Basic_Storage/basic_storage.hw index 4d28b7fa28..14e3419269 100644 --- a/samples/Basic_Storage/basic_storage.hw +++ b/samples/Basic_Storage/basic_storage.hw @@ -11,7 +11,7 @@ * https://sming.readthedocs.io/en/latest/_inc/Sming/Components/esptool/index.html#envvar-SPI_MODE. */ // "mode": "qio", - "speed": 80 + // "speed": 80 } }, "partitions": {