Skip to content

Commit

Permalink
Add verifyflash build target (#2368)
Browse files Browse the repository at this point in the history
* Don't default to 80Mhz flash speed in Basic_Storage sample

May cause problems which are hard to diagnose

* Add `verifyflash` build target
  • Loading branch information
mikee47 authored and slaff committed Sep 27, 2021
1 parent 557c0c2 commit 77dc9a4
Show file tree
Hide file tree
Showing 5 changed files with 25 additions and 1 deletion.
6 changes: 6 additions & 0 deletions Sming/Arch/Host/Components/vflash/component.mk
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
9 changes: 9 additions & 0 deletions Sming/Components/esptool/component.mk
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
5 changes: 5 additions & 0 deletions Sming/component.mk
Original file line number Diff line number Diff line change
Expand Up @@ -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))
4 changes: 4 additions & 0 deletions docs/source/troubleshooting/random-restart.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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
2 changes: 1 addition & 1 deletion samples/Basic_Storage/basic_storage.hw
Original file line number Diff line number Diff line change
Expand Up @@ -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": {
Expand Down

0 comments on commit 77dc9a4

Please sign in to comment.