Build system: Add `make erase_flash` target

pull/155/merge
Angus Gratton 2016-12-20 10:00:04 +11:00
rodzic 1ed584f896
commit 59e0f63d37
5 zmienionych plików z 17 dodań i 4 usunięć

Wyświetl plik

@ -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.
# 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
* The [docs directory of the esp-idf repository](docs) contains source of [esp-idf](http://esp-idf.readthedocs.io/) documentation.

Wyświetl plik

@ -43,7 +43,7 @@ bootloader: $(BOOTLOADER_BIN)
ESPTOOL_ALL_FLASH_ARGS += $(BOOTLOADER_OFFSET) $(BOOTLOADER_BIN)
bootloader-flash: $(BOOTLOADER_BIN)
bootloader-flash: $(BOOTLOADER_BIN) | erase_flash
$(ESPTOOLPY_WRITE_FLASH) 0x1000 $^
else ifdef CONFIG_SECURE_BOOTLOADER_ONE_TIME_FLASH

Wyświetl plik

@ -43,17 +43,22 @@ APP_BIN_UNSIGNED ?= $(APP_BIN)
$(APP_BIN_UNSIGNED): $(APP_ELF) $(ESPTOOLPY_SRC)
$(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))..."
ifdef CONFIG_SECURE_BOOT_ENABLED
@echo "(Secure boot enabled, so bootloader not flashed automatically. See 'make bootloader' output)"
endif
$(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)..."
$(ESPTOOLPY_WRITE_FLASH) $(CONFIG_APP_OFFSET) $(APP_BIN)
# Submodules normally added in component.mk, but can be added
# at the project level as long as qualified path
COMPONENT_SUBMODULES += $(COMPONENT_PATH)/esptool
.PHONY: erase_flash
erase_flash:
@echo "Erasing entire flash..."
$(ESPTOOLPY_SERIAL) erase_flash

Wyświetl plik

@ -125,5 +125,6 @@ Flashing the 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

Wyświetl plik

@ -26,9 +26,10 @@ help:
@echo "make defconfig - Set defaults for all new configuration options"
@echo ""
@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 size - Display the memory footprint of the app"
@echo "make erase_flash - Erase entire flash contents"
@echo ""
@echo "make app - Build just the app"
@echo "make app-flash - Flash just the app"