mirror of
https://github.com/espressif/esp-idf.git
synced 2024-10-05 20:47:46 -04:00
Merge branch 'feature/erase_flash' into 'master'
Build system: Add `make erase_flash` target See merge request !328
This commit is contained in:
commit
a760eb3980
@ -64,6 +64,12 @@ In both cases the factory app is flashed at offset 0x10000. If you `make partiti
|
|||||||
|
|
||||||
For more details about partition tables and how to create custom variations, view the `docs/partition-tables.rst` file.
|
For more details about partition tables and how to create custom variations, view the `docs/partition-tables.rst` file.
|
||||||
|
|
||||||
|
# Erasing Flash
|
||||||
|
|
||||||
|
The `make flash` target does not erase the entire flash contents. However it is sometimes useful to set the device back to a totally erased state, particularly when making partition table changes or OTA app updates. To erase the entire flash, run `make erase_flash`.
|
||||||
|
|
||||||
|
This can be combined with other targets, ie `make erase_flash flash` will erase everything and then re-flash the new app, bootloader and partition table.
|
||||||
|
|
||||||
# Resources
|
# Resources
|
||||||
|
|
||||||
* The [docs directory of the esp-idf repository](docs) contains source of [esp-idf](http://esp-idf.readthedocs.io/) documentation.
|
* The [docs directory of the esp-idf repository](docs) contains source of [esp-idf](http://esp-idf.readthedocs.io/) documentation.
|
||||||
|
@ -43,7 +43,7 @@ bootloader: $(BOOTLOADER_BIN)
|
|||||||
|
|
||||||
ESPTOOL_ALL_FLASH_ARGS += $(BOOTLOADER_OFFSET) $(BOOTLOADER_BIN)
|
ESPTOOL_ALL_FLASH_ARGS += $(BOOTLOADER_OFFSET) $(BOOTLOADER_BIN)
|
||||||
|
|
||||||
bootloader-flash: $(BOOTLOADER_BIN)
|
bootloader-flash: $(BOOTLOADER_BIN) | erase_flash
|
||||||
$(ESPTOOLPY_WRITE_FLASH) 0x1000 $^
|
$(ESPTOOLPY_WRITE_FLASH) 0x1000 $^
|
||||||
|
|
||||||
else ifdef CONFIG_SECURE_BOOTLOADER_ONE_TIME_FLASH
|
else ifdef CONFIG_SECURE_BOOTLOADER_ONE_TIME_FLASH
|
||||||
|
@ -43,17 +43,22 @@ APP_BIN_UNSIGNED ?= $(APP_BIN)
|
|||||||
$(APP_BIN_UNSIGNED): $(APP_ELF) $(ESPTOOLPY_SRC)
|
$(APP_BIN_UNSIGNED): $(APP_ELF) $(ESPTOOLPY_SRC)
|
||||||
$(ESPTOOLPY) elf2image $(ESPTOOL_FLASH_OPTIONS) $(ESPTOOL_ELF2IMAGE_OPTIONS) -o $@ $<
|
$(ESPTOOLPY) elf2image $(ESPTOOL_FLASH_OPTIONS) $(ESPTOOL_ELF2IMAGE_OPTIONS) -o $@ $<
|
||||||
|
|
||||||
flash: all_binaries $(ESPTOOLPY_SRC)
|
flash: all_binaries $(ESPTOOLPY_SRC) | erase_flash
|
||||||
@echo "Flashing binaries to serial port $(ESPPORT) (app at offset $(CONFIG_APP_OFFSET))..."
|
@echo "Flashing binaries to serial port $(ESPPORT) (app at offset $(CONFIG_APP_OFFSET))..."
|
||||||
ifdef CONFIG_SECURE_BOOT_ENABLED
|
ifdef CONFIG_SECURE_BOOT_ENABLED
|
||||||
@echo "(Secure boot enabled, so bootloader not flashed automatically. See 'make bootloader' output)"
|
@echo "(Secure boot enabled, so bootloader not flashed automatically. See 'make bootloader' output)"
|
||||||
endif
|
endif
|
||||||
$(ESPTOOLPY_WRITE_FLASH) $(ESPTOOL_ALL_FLASH_ARGS)
|
$(ESPTOOLPY_WRITE_FLASH) $(ESPTOOL_ALL_FLASH_ARGS)
|
||||||
|
|
||||||
app-flash: $(APP_BIN) $(ESPTOOLPY_SRC)
|
app-flash: $(APP_BIN) $(ESPTOOLPY_SRC) | erase_flash
|
||||||
@echo "Flashing app to serial port $(ESPPORT), offset $(CONFIG_APP_OFFSET)..."
|
@echo "Flashing app to serial port $(ESPPORT), offset $(CONFIG_APP_OFFSET)..."
|
||||||
$(ESPTOOLPY_WRITE_FLASH) $(CONFIG_APP_OFFSET) $(APP_BIN)
|
$(ESPTOOLPY_WRITE_FLASH) $(CONFIG_APP_OFFSET) $(APP_BIN)
|
||||||
|
|
||||||
# Submodules normally added in component.mk, but can be added
|
# Submodules normally added in component.mk, but can be added
|
||||||
# at the project level as long as qualified path
|
# at the project level as long as qualified path
|
||||||
COMPONENT_SUBMODULES += $(COMPONENT_PATH)/esptool
|
COMPONENT_SUBMODULES += $(COMPONENT_PATH)/esptool
|
||||||
|
|
||||||
|
.PHONY: erase_flash
|
||||||
|
erase_flash:
|
||||||
|
@echo "Erasing entire flash..."
|
||||||
|
$(ESPTOOLPY_SERIAL) erase_flash
|
||||||
|
@ -125,5 +125,6 @@ Flashing the partition table
|
|||||||
|
|
||||||
A manual flashing command is also printed as part of ``make partition_table``.
|
A manual flashing command is also printed as part of ``make partition_table``.
|
||||||
|
|
||||||
|
Note that updating the partition table doesn't erase data that may have been stored according to the old partition table. You can use ``make erase_flash`` (or ``esptool.py erase_flash``) to erase the entire flash contents.
|
||||||
|
|
||||||
.. _secure boot: security/secure-boot.rst
|
.. _secure boot: security/secure-boot.rst
|
||||||
|
@ -26,9 +26,10 @@ help:
|
|||||||
@echo "make defconfig - Set defaults for all new configuration options"
|
@echo "make defconfig - Set defaults for all new configuration options"
|
||||||
@echo ""
|
@echo ""
|
||||||
@echo "make all - Build app, bootloader, partition table"
|
@echo "make all - Build app, bootloader, partition table"
|
||||||
@echo "make flash - Flash all components to a fresh chip"
|
@echo "make flash - Flash app, bootloader, partition table to a chip"
|
||||||
@echo "make clean - Remove all build output"
|
@echo "make clean - Remove all build output"
|
||||||
@echo "make size - Display the memory footprint of the app"
|
@echo "make size - Display the memory footprint of the app"
|
||||||
|
@echo "make erase_flash - Erase entire flash contents"
|
||||||
@echo ""
|
@echo ""
|
||||||
@echo "make app - Build just the app"
|
@echo "make app - Build just the app"
|
||||||
@echo "make app-flash - Flash just the app"
|
@echo "make app-flash - Flash just the app"
|
||||||
|
Loading…
x
Reference in New Issue
Block a user