Преглед на файлове

fix: Replace the deprecated esp32 board argument with ESP-DevkitC boards

In Zephyr 3.5.0 the esp32 board has been deprecated and split into
esp32_devkitc and esp32_devkitm boards.
This means that the example can no longer build due to mismatch in board
.overlay file name.

This commit switches to the new boards and changes the README and
the CI accordingly.
Djordje Nedic преди 2 години
родител
ревизия
6f5f761586

+ 8 - 8
.gitlab-ci.yml

@@ -16,9 +16,9 @@ variables:
   ARM_TOOLCHAIN_URL: https://developer.arm.com/-/media/Files/downloads/gnu-rm/9-2020q2/gcc-arm-none-eabi-9-2020-q2-update-x86_64-linux.tar.bz2?revision=05382cca-1721-44e1-ae19-1e7c3dc96118&la=en&hash=D7C9D18FCA2DD9F894FD9F3C3DC9228498FA281A
   QEMU_PATH: /opt/qemu/bin/qemu-system-xtensa
   ZEPHYR_REPO: https://github.com/zephyrproject-rtos/zephyr.git
-  ZEPHYR_REPO_REV: v3.2.0
-  ZEPHYR_TOOLCHAIN: https://github.com/zephyrproject-rtos/sdk-ng/releases/download/v0.15.2/toolchain_linux-x86_64_xtensa-espressif_esp32_zephyr-elf.tar.gz
-  ZEPHYR_SDK: https://github.com/zephyrproject-rtos/sdk-ng/releases/download/v0.15.2/zephyr-sdk-0.15.2_linux-aarch64_minimal.tar.gz
+  ZEPHYR_REPO_REV: v3.5.0
+  ZEPHYR_TOOLCHAIN: https://github.com/zephyrproject-rtos/sdk-ng/releases/download/v0.16.3/toolchain_linux-x86_64_xtensa-espressif_esp32_zephyr-elf.tar.xz
+  ZEPHYR_SDK: https://github.com/zephyrproject-rtos/sdk-ng/releases/download/v0.16.3/zephyr-sdk-0.16.3_linux-aarch64_minimal.tar.xz
 
 .build_idf_template:
   stage: build
@@ -95,10 +95,10 @@ build_zephyr:
     - git clone --single-branch --depth=1 -b ${ZEPHYR_REPO_REV} ${ZEPHYR_REPO}
     - mkdir $CI_PROJECT_DIR/zephyrproject-rtos/zephyr-sdk
     - cd $CI_PROJECT_DIR/zephyrproject-rtos/zephyr-sdk
-    - wget --no-verbose -O zephyr_sdk.tar.gz ${ZEPHYR_SDK}
-    - tar xvf zephyr_sdk.tar.gz --strip-components=1
-    - wget --no-verbose -O esp32_toolchain.tar.gz ${ZEPHYR_TOOLCHAIN}
-    - tar xvf esp32_toolchain.tar.gz
+    - wget --no-verbose -O zephyr_sdk.tar.xz ${ZEPHYR_SDK}
+    - tar xvf zephyr_sdk.tar.xz --strip-components=1
+    - wget --no-verbose -O esp32_toolchain.tar.xz ${ZEPHYR_TOOLCHAIN}
+    - tar xvf esp32_toolchain.tar.xz
     - export ZEPHYR_SDK_INSTALL_DIR=$(pwd)
     - export ZEPHYR_TOOLCHAIN_VARIANT="zephyr"
     - cd $CI_PROJECT_DIR/zephyrproject-rtos/zephyr
@@ -111,7 +111,7 @@ build_zephyr:
     - unset IDF_PATH
     - west zephyr-export
     - west update hal_espressif
-    - west build -p -b esp32 $CI_PROJECT_DIR/examples/zephyr_example -DZEPHYR_EXTRA_MODULES=$CI_PROJECT_DIR
+    - west build -p -b esp32_devkitc_wroom $CI_PROJECT_DIR/examples/zephyr_example -DZEPHYR_EXTRA_MODULES=$CI_PROJECT_DIR
 
 run_tests:
   stage: test

+ 13 - 13
examples/zephyr_example/README.md

@@ -2,8 +2,8 @@
 
 ## Overview
 
-This sample code demonstrates how to flash ESP32/ESP32-S2/ESP8266 from another (host) MCU using
-esp_serial_flash component API. In this case, ESP32 is also used as host MCU.
+This sample code demonstrates how to flash an Espressif SoC from another (host) MCU using
+esp_serial_flash component API. In this case, the ESP32 is used as host MCU.
 Binaries to be flashed from host MCU to another Espressif SoC can be found in `binaries` folder
 and are converted into C-array during build process.
 
@@ -23,31 +23,31 @@ phase, and can be changed before calling `esp_loader_connect`, if necessary.
 
 ## Hardware Required
 
-* Two development boards with ESP32 SoC (e.g., ESP32-DevKitC, ESP-WROVER-KIT, etc.).
+* Any supported Espressif SoC board for the target
+* An ESP32-DevKitC board for the host
 * One or two USB cables for power supply and programming.
 
 ## Hardware connection
 
-Table below shows connection between two ESP32 devices.
+Table below shows connection between the two devices:
 
-| ESP32 (host) | ESP32 (slave) |
-|:------------:|:-------------:|
-|    IO4       |      IO0      |
-|    IO2       |     RESET     |
-|    IO9       |      TX0      |
-|    IO10      |      RX0      |
-
-Note: interconnection is the same for all three targets (slaves).
+| ESP32 (host) | Espressif SoC (target) |
+|:------------:|:----------------------:|
+|    IO4       |           IO0          |
+|    IO2       |          RESET         |
+|    IO9       |           TX0          |
+|    IO10      |           RX0          |
 
 ## Build and flash
 
 To run the example, type the following command:
 
 ```c
-west build -p -b esp32
+west build -p -b <supported board>
 west flash
 west espressif monitor
 ```
+>**Note:** You can find the supported boards in the boards folder.
 
 (To exit the serial monitor, type ``ctrl-c``.)
 

+ 0 - 0
examples/zephyr_example/boards/esp32.overlay → examples/zephyr_example/boards/esp32_devkitc_wroom.overlay


+ 34 - 0
examples/zephyr_example/boards/esp32_devkitc_wrover.overlay

@@ -0,0 +1,34 @@
+/*
+ * Copyright (c) 2022 Espressif Systems (Shanghai) Co., Ltd.
+ *
+ * SPDX-License-Identifier: Apache-2.0
+ */
+
+#include <zephyr/dt-bindings/pinctrl/esp-pinctrl-common.h>
+#include <dt-bindings/pinctrl/esp32-pinctrl.h>
+#include <zephyr/dt-bindings/pinctrl/esp32-gpio-sigmap.h>
+
+/ {
+	aliases {
+		en = &en_button;
+		boot = &boot_button;
+		uart1 = &uart1;
+	};
+
+	gpio_keys {
+		compatible = "gpio-keys";
+		en_button: en_button {
+			gpios = <&gpio0 2 (GPIO_PULL_UP | GPIO_ACTIVE_HIGH)>;
+		};
+		boot_button: boot_button {
+			gpios = <&gpio0 4 (GPIO_PULL_UP | GPIO_ACTIVE_HIGH)>;
+		};
+	};
+};
+
+&uart1 {
+	status = "okay";
+	current-speed = <115200>;
+	pinctrl-0 = <&uart1_default>;
+	pinctrl-names = "default";
+};

+ 3 - 1
examples/zephyr_example/sample.yaml

@@ -3,5 +3,7 @@ sample:
   name: zephyr_flasher
 tests:
   sample.esp_flasher.zephyr_example:
-    platform_allow: esp32
+    platform_allow:
+      - esp32_devkitc_wroom
+      - esp32_devkitc_wrover
     tags: esp32