doc: provide compile and flash instructions

This commit is contained in:
King Kévin 2022-07-24 15:50:30 +02:00
parent 59826f0d5b
commit d120cb1c24
1 changed files with 56 additions and 0 deletions

View File

@ -1,6 +1,62 @@
This is a [USB DFU](https://www.usb.org/document-library/device-firmware-upgrade-11-new-version-31-aug-2004) (DFU mode) implementation for [ESP32-S2](https://www.espressif.com/en/products/socs/esp32-s2) based on [tinyUSB](https://docs.tinyusb.org/en/latest/index.html).
It allows flashing the firmware using [dfu-util](http://dfu-util.sourceforge.net/).
install
=======
compile
-------
To compile the firmware, you need the [ESP-IDF](https://docs.espressif.com/projects/esp-idf/en/latest/esp32s2/get-started/index.html#installation).
Here I compile it for the [WEMOS S2 mini](https://www.wemos.cc/en/latest/s2/s2_mini.html) board (other board definitions are available in `hw/bsp/esp32s2/boards/`).
~~~
cd examples/device/dfu_freertos/
make BOARD=wemos_s2_mini all
~~~
This is equivalent to:
~~~
idf.py -B_build/wemos_s2_mini -DFAMILY=esp32s2 -DBOARD=wemos_s2_mini -DIDF_TARGET=esp32s2 build
~~~
flash
-----
To flash the compiled fimware:
~~~
idf.py -B_build/wemos_s2_mini -DFAMILY=esp32s2 -DBOARD=wemos_s2_mini -DIDF_TARGET=esp32s2 -p /dev/ttyACM0 flash
~~~
or to use esptool directly over the ROM USB DFU bootloader, without ESP-IDF:
~~~
esptool.py -p /dev/ttyACM0 --before no_reset --after no_reset --chip esp32s2 write_flash --flash_mode dio --flash_size detect --flash_freq 80m 0x1000 _build/wemos_s2_mini/bootloader/bootloader.bin 0x8000 _build/wemos_s2_mini/partition_table/partition-table.bin 0xd000 _build/wemos_s2_mini/ota_data_initial.bin 0x10000 _build/wemos_s2_mini/dfu_freertos.bin
~~~
This will flash the DFU firmware to the `factory` partition.
The DFU firmware will in turn flash the downladed image onto the [OTA0](https://docs.espressif.com/projects/esp-idf/en/latest/esp32s2/api-reference/system/ota.html) partition.
For that a custom [partition table](https://docs.espressif.com/projects/esp-idf/en/latest/esp32s2/api-guides/partition-tables.html) is used.
config
------
To further configure the build:
~~~
idf.py -B_build/wemos_s2_mini -DFAMILY=esp32s2 -DBOARD=wemos_s2_mini -DIDF_TARGET=esp32s2 menuconfig
~~~
runtime
-------
This firmware is just for the DFU mode.
The main application needs to implement the runtime mode seperately.
To switch from runtime to DFU mode during detach, set the boot partition in `otadata` to `factory`, and restart the ESP.
design choice
=============