بدون توضیح

Martin Válik 9a02021eba Merge branch 'feature/update-component-0.0.2' into 'master' 3 سال پیش
examples 2888863ef1 fix binaries embedding for IDF 3.3 4 سال پیش
include 1e4feca73d Add ESP32-H2 target support 3 سال پیش
port 7ae016a2ba port/esp32: use GPIO driver instead of the deprecated ROM function 4 سال پیش
private_include 8d9de16fdc Added support for ESP32_C2 3 سال پیش
src 1e4feca73d Add ESP32-H2 target support 3 سال پیش
submodules 382db5834a Added STM32 support 5 سال پیش
test 1e4feca73d Add ESP32-H2 target support 3 سال پیش
.gitignore d607c9d291 examples/esp32: remove generated binaries.c 4 سال پیش
.gitlab-ci.yml 83cd41c254 ci: enable extra warnings and -Werror 4 سال پیش
.gitmodules 382db5834a Added STM32 support 5 سال پیش
CMakeLists.txt c6f1920325 add driver dependency to IDF component 3 سال پیش
Kconfig 81d28ed085 Make MD5 check configurable via Kconfig 3 سال پیش
LICENSE fcae1df69a Added licence file 5 سال پیش
README.md 74aa0d18f3 Extended loader_serial_config_t and moved to separate header file 5 سال پیش
idf_component.yml 78295d2c7b update IDF component version 3 سال پیش

README.md

Serial flasher

Overview

Serial flasher component provides portable library for flashing Espressif SoCs (ESP32, ESP32-S2, ESP8266) from other host microcontroller. Espressif SoCs are normally programmed via serial interface (UART). Port layer for given host microcontroller has to be implemented, if not available. Details can be found in section below.

Supporting new host target

In order to support new target, following function has to be implemented by user:

  • loader_port_serial_read()
  • loader_port_serial_write()
  • loader_port_enter_bootloader()
  • loader_port_delay_ms()
  • loader_port_start_timer()
  • loader_port_remaining_time()

Following functions are part of serial_io.h header for convenience, however, user does not have to strictly follow function signatures, as there are not called directly from library.

  • loader_port_change_baudrate()
  • loader_port_reset_target()
  • loader_port_debug_print()

Prototypes of all function mentioned above can be found in serial_io.h. Please refer to ports in port directory. Currently, only ports for ESP32 port and STM32 port are available.

Configuration

Apart from writing port (if not available), user can enable flash integrity check functionality by setting MD5_ENABLED option. If enabled, serial flasher is capable of verify flash integrity after writing to memory.

Configuration can be passed to cmake via command line:

cmake -DMD5_ENABLED=1 .. && cmake --build .

Note: in case, no compile definitions are provided, ESP32 is set as target and MD5 check is enabled by default. As ROM bootloader of ESP8266 does not support MD5_CHECK, -DMD5_ENABLED=0 has to be passed to command line.

STM32 support

STM32 port make use of STM32 HAL libraries, that does not come with CMake support. In order to compile the project, stm32-cmake (cmake support package) has to be pulled as submodule.

git clone --recursive https://github.com/espressif/esp-serial-flasher.git

If you have cloned this repository without the --recursive flag, you can initialize the submodule using the following command:

git submodule update --init

In addition to configuration parameters mentioned above, following definitions has to be set:

  • TOOLCHAIN_PREFIX: path to arm toolchain (i.e /home/user/gcc-arm-none-eabi-9-2019-q4-major)
  • STM32Cube_DIR: path to STM32 Cube libraries (i.e /home/user/STM32Cube/Repository/STM32Cube_FW_F4_V1.25.0)
  • STM32_CHIP: name of STM32 for which project should be compiled (i.e STM32F407VG)
  • PORT: STM32

This can be achieved by passing definition to command line, such as:

cmake -DTOOLCHAIN_PREFIX="/path_to_toolchain" -DSTM32Cube_DIR="path_to_stm32Cube" -DSTM32_CHIP="STM32F407VG" -DPORT="STM32" .. && cmake --build .

Alternatively, set those variables in top level cmake directory:

set(TOOLCHAIN_PREFIX    path_to_toolchain)
set(STM32Cube_DIR       path_to_stm32_HAL)
set(STM32_CHIP          STM32F407VG)
set(PORT                STM32)

Licence

Code is distributed under Apache 2.0 license.

Known limitations

Size of new binary image has to be known before flashing.