build: Replace 'make download' with 'make flash'

This commit is contained in:
Alan C. Assis 2021-10-14 10:57:21 -03:00 committed by Gustavo Henrique Nihei
parent a7d8d9dd98
commit e0389ce1fb
11 changed files with 40 additions and 34 deletions

View File

@ -58,14 +58,14 @@ The `esptool.py` command to flash all the binaries is::
However, this is also included in the build process and we can build and flash with:: However, this is also included in the build process and we can build and flash with::
make download ESPTOOL_PORT=<port> ESPTOOL_BINDIR=../esp-bins make flash ESPTOOL_PORT=<port> ESPTOOL_BINDIR=../esp-bins
Where ``<port>`` is typically ``/dev/ttyUSB0`` or similar and ``../esp-bins`` is Where ``<port>`` is typically ``/dev/ttyUSB0`` or similar and ``../esp-bins`` is
the path to the folder containing the bootloader and the partition table the path to the folder containing the bootloader and the partition table
for the ESP32-C3 as explained above. for the ESP32-C3 as explained above.
Note that this step is required only one time. Once the bootloader and partition Note that this step is required only one time. Once the bootloader and partition
table are flashed, we don't need to flash them again. So subsequent builds table are flashed, we don't need to flash them again. So subsequent builds
would just require: ``make download ESPTOOL_PORT=/dev/ttyUSBXX`` would just require: ``make flash ESPTOOL_PORT=/dev/ttyUSBXX``
Debugging with OpenOCD Debugging with OpenOCD
====================== ======================

View File

@ -60,7 +60,7 @@ It's a two step process where the first converts the ELF file into a ESP32-compa
and the second flashes it to the board. These steps are included into the build system and you can and the second flashes it to the board. These steps are included into the build system and you can
flash your NuttX firmware simply by running:: flash your NuttX firmware simply by running::
$ make download ESPTOOL_PORT=<port> $ make flash ESPTOOL_PORT=<port>
where ``<port>`` is typically ``/dev/ttyUSB0`` or similar. You can change the baudrate by passing ``ESPTOOL_BAUD``. where ``<port>`` is typically ``/dev/ttyUSB0`` or similar. You can change the baudrate by passing ``ESPTOOL_BAUD``.
@ -73,7 +73,7 @@ Once you downloaded both binaries, you can flash them by adding an ``ESPTOOL_BIN
.. code-block:: console .. code-block:: console
$ make download ESPTOOL_PORT=<port> ESPTOOL_BINDIR=<dir> $ make flash ESPTOOL_PORT=<port> ESPTOOL_BINDIR=<dir>
.. note:: It is recommended that if this is the first time you are using the board with NuttX that you perform a complete .. note:: It is recommended that if this is the first time you are using the board with NuttX that you perform a complete
SPI FLASH erase. SPI FLASH erase.

View File

@ -1546,12 +1546,12 @@ build directory.
build. (2) The logic in tools/mkexport.sh only supports GCC and, for example, build. (2) The logic in tools/mkexport.sh only supports GCC and, for example,
explicitly assumes that the archiver is 'ar' explicitly assumes that the archiver is 'ar'
* `download` * `flash` (or `download` : DEPRECATED)
This is a helper target that will rebuild NuttX and download it to the target This is a helper target that will rebuild NuttX and flash it to the target
system in one step. The operation of this target depends completely upon system in one step. The operation of this target depends completely upon
implementation of the DOWNLOAD command in the user Make.defs file. It will implementation of the FLASH command in the user Make.defs file. It will
generate an error an error if the DOWNLOAD command is not defined. generate an error if the FLASH command is not defined.
The following targets are used internally by the make logic but can be invoked The following targets are used internally by the make logic but can be invoked
from the command under certain conditions if necessary. from the command under certain conditions if necessary.

View File

@ -71,7 +71,7 @@ endif
ifeq ($(CONFIG_DFU_BINARY),y) ifeq ($(CONFIG_DFU_BINARY),y)
define DOWNLOAD define FLASH
$(Q) echo "DFUSUFFIX: $(1).dfu" $(Q) echo "DFUSUFFIX: $(1).dfu"
$(Q) $(OBJCOPY) $(OBJCOPYARGS) -O binary $(1) $(1).dfu $(Q) $(OBJCOPY) $(OBJCOPYARGS) -O binary $(1) $(1).dfu
$(Q) $(DFUSUFFIX) -v $(subst 0x,,$(CONFIG_DFU_VID)) -p $(subst 0x,,$(CONFIG_DFU_PID)) -a $(1).dfu $(Q) $(DFUSUFFIX) -v $(subst 0x,,$(CONFIG_DFU_VID)) -p $(subst 0x,,$(CONFIG_DFU_PID)) -a $(1).dfu
@ -80,7 +80,7 @@ endef
else else
define DOWNLOAD define FLASH
$(Q) $(ECHO) "Photon firmware upload through JTAG is not supported" $(Q) $(ECHO) "Photon firmware upload through JTAG is not supported"
endef endef

View File

@ -71,7 +71,7 @@ ifeq ($(CONFIG_DEBUG_SYMBOLS),y)
endif endif
ifneq ($(CONFIG_CYGWIN_WINTOOL),y) ifneq ($(CONFIG_CYGWIN_WINTOOL),y)
define DOWNLOAD define FLASH
$(Q) st-flash write nuttx.bin 0x8000000 $(Q) st-flash write nuttx.bin 0x8000000
endef endef
endif endif

View File

@ -62,7 +62,7 @@ ifeq ($(CONFIG_DEBUG_SYMBOLS),y)
LDFLAGS += -g LDFLAGS += -g
endif endif
define DOWNLOAD define FLASH
$(Q) echo "Download firmware $(1).bin" $(Q) echo "Download firmware $(1).bin"
$(Q) st-flash write $(1).bin 0x08000000 $(Q) st-flash write $(1).bin 0x08000000
endef endef

View File

@ -449,15 +449,18 @@ ifeq ($(CONFIG_UBOOT_UIMAGE),y)
endif endif
$(call POSTBUILD, $(TOPDIR)) $(call POSTBUILD, $(TOPDIR))
# download # flash (or download : DEPRECATED)
# #
# This is a helper target that will rebuild NuttX and download it to the target # This is a helper target that will rebuild NuttX and flash it to the target
# system in one step. The operation of this target depends completely upon # system in one step. The operation of this target depends completely upon
# implementation of the DOWNLOAD command in the user Make.defs file. It will # implementation of the FLASH command in the user Make.defs file. It will
# generate an error if the DOWNLOAD command is not defined. # generate an error if the FLASH command is not defined.
flash: $(BIN)
$(call FLASH, $<)
download: $(BIN) download: $(BIN)
$(call DOWNLOAD, $<) $(call FLASH, $<)
# bootloader # bootloader
# #

View File

@ -408,15 +408,18 @@ ifeq ($(CONFIG_RAW_BINARY),y)
endif endif
$(call POSTBUILD, $(TOPDIR)) $(call POSTBUILD, $(TOPDIR))
# download # flash (or download : DEPRECATED)
# #
# This is a helper target that will rebuild NuttX and download it to the target # This is a helper target that will rebuild NuttX and flash it to the target
# system in one step. The operation of this target depends completely upon # system in one step. The operation of this target depends completely upon
# implementation of the DOWNLOAD command in the user Make.defs file. It will # implementation of the FLASH command in the user Make.defs file. It will
# generate an error an error if the DOWNLOAD command is not defined. # generate an error if the FLASH command is not defined.
flash: $(BIN)
$(call FLASH, $<)
download: $(BIN) download: $(BIN)
$(call DOWNLOAD, $<) $(call FLASH, $<)
# bootloader # bootloader
# #

View File

@ -188,12 +188,12 @@ endif
ESPTOOL_BAUD ?= 921600 ESPTOOL_BAUD ?= 921600
# DOWNLOAD -- Download binary image via esptool.py # FLASH -- Download a binary image via esptool.py
define DOWNLOAD define FLASH
$(Q) if [ -z $(ESPTOOL_PORT) ]; then \ $(Q) if [ -z $(ESPTOOL_PORT) ]; then \
echo "DOWNLOAD error: Missing serial port device argument."; \ echo "FLASH error: Missing serial port device argument."; \
echo "USAGE: make download ESPTOOL_PORT=<port> [ ESPTOOL_BAUD=<baud> ] [ ESPTOOL_BINDIR=<dir> ]"; \ echo "USAGE: make flash ESPTOOL_PORT=<port> [ ESPTOOL_BAUD=<baud> ] [ ESPTOOL_BINDIR=<dir> ]"; \
exit 1; \ exit 1; \
fi fi
esptool.py -c esp32 -p $(ESPTOOL_PORT) -b $(ESPTOOL_BAUD) write_flash $(ESPTOOL_WRITEFLASH_OPTS) $(ESPTOOL_BINS) esptool.py -c esp32 -p $(ESPTOOL_PORT) -b $(ESPTOOL_BAUD) write_flash $(ESPTOOL_WRITEFLASH_OPTS) $(ESPTOOL_BINS)

View File

@ -181,12 +181,12 @@ endif
ESPTOOL_BAUD ?= 921600 ESPTOOL_BAUD ?= 921600
# DOWNLOAD -- Download binary image via esptool.py # FLASH -- Download a binary image via esptool.py
define DOWNLOAD define FLASH
$(Q) if [ -z $(ESPTOOL_PORT) ]; then \ $(Q) if [ -z $(ESPTOOL_PORT) ]; then \
echo "DOWNLOAD error: Missing serial port device argument."; \ echo "FLASH error: Missing serial port device argument."; \
echo "USAGE: make download ESPTOOL_PORT=<port> [ ESPTOOL_BAUD=<baud> ]"; \ echo "USAGE: make flash ESPTOOL_PORT=<port> [ ESPTOOL_BAUD=<baud> ]"; \
exit 1; \ exit 1; \
fi fi
esptool.py -c esp32c3 -p $(ESPTOOL_PORT) -b $(ESPTOOL_BAUD) write_flash $(ESPTOOL_WRITEFLASH_OPTS) $(ESPTOOL_BINS) esptool.py -c esp32c3 -p $(ESPTOOL_PORT) -b $(ESPTOOL_BAUD) write_flash $(ESPTOOL_WRITEFLASH_OPTS) $(ESPTOOL_BINS)

View File

@ -181,12 +181,12 @@ endif
ESPTOOL_BAUD ?= 921600 ESPTOOL_BAUD ?= 921600
# DOWNLOAD -- Download binary image via esptool.py # FLASH -- Download a binary image via esptool.py
define DOWNLOAD define FLASH
$(Q) if [ -z $(ESPTOOL_PORT) ]; then \ $(Q) if [ -z $(ESPTOOL_PORT) ]; then \
echo "DOWNLOAD error: Missing serial port device argument."; \ echo "FLASH error: Missing serial port device argument."; \
echo "USAGE: make download ESPTOOL_PORT=<port> [ ESPTOOL_BAUD=<baud> ] [ ESPTOOL_BINDIR=<dir> ]"; \ echo "USAGE: make flash ESPTOOL_PORT=<port> [ ESPTOOL_BAUD=<baud> ] [ ESPTOOL_BINDIR=<dir> ]"; \
exit 1; \ exit 1; \
fi fi
esptool.py -c esp32s2 -p $(ESPTOOL_PORT) -b $(ESPTOOL_BAUD) write_flash $(ESPTOOL_WRITEFLASH_OPTS) $(ESPTOOL_BINS) esptool.py -c esp32s2 -p $(ESPTOOL_PORT) -b $(ESPTOOL_BAUD) write_flash $(ESPTOOL_WRITEFLASH_OPTS) $(ESPTOOL_BINS)