Skip to content

Commit dcf8e34

Browse files
authored
Merge pull request #420 from tropicsquare/ETR01SDK-511-Prepare-ESP32-examples-and-tests
ETR01SDK-511: Prepare esp32 examples and tests
2 parents 1e08157 + dcb5cf6 commit dcf8e34

File tree

47 files changed

+6968
-27
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

47 files changed

+6968
-27
lines changed
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
name: Build examples for ESP32 boards
2+
on:
3+
push:
4+
branches:
5+
- 'develop'
6+
- 'master'
7+
pull_request:
8+
branches:
9+
- 'master'
10+
- 'develop'
11+
12+
jobs:
13+
build_examples:
14+
name: Build examples for ESP32 boards
15+
runs-on: ubuntu-latest
16+
container: espressif/idf:v5.5.1
17+
steps:
18+
- name: Checkout repository
19+
uses: actions/checkout@v4.1.7
20+
21+
- name: Build ESP32-DevKit-V4 examples
22+
run: |
23+
. /opt/esp/idf/export.sh
24+
idf.py -C examples/esp32/ESP32-DevKit-V4/hello_world/ build
25+
idf.py -C examples/esp32/ESP32-DevKit-V4/identify_chip/ build
26+
idf.py -C examples/esp32/ESP32-DevKit-V4/fw_update/ build
27+
28+
- name: Build ESP32-S3-DevKitC-1 examples
29+
run: |
30+
. /opt/esp/idf/export.sh
31+
idf.py -C examples/esp32/ESP32-S3-DevKitC-1/hello_world/ build
32+
idf.py -C examples/esp32/ESP32-S3-DevKitC-1/identify_chip/ build
33+
idf.py -C examples/esp32/ESP32-S3-DevKitC-1/fw_update/ build
Lines changed: 74 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,74 @@
1+
# ESP32 Tutorial
2+
This tutorial will guide you through the building of the examples in the `examples/esp32/` directory. In this directory, there are multiple subdirectories for each supported ESP32 board. Instructions in this tutorial are common for all of the boards.
3+
4+
## Install Dependencies and Prepare the Repository
5+
See below for instructions based on your OS.
6+
7+
!!! example "Installation instructions"
8+
=== ":fontawesome-brands-linux: Linux"
9+
1. Setup ESP-IDF and its dependencies:
10+
- Complete the first 4 steps in the [official ESP-IDF setup guide](https://docs.espressif.com/projects/esp-idf/en/stable/esp32/get-started/linux-macos-setup.html).
11+
- We recommend getting the 5.5.1 version, but any 5.x.x version should work.
12+
2. Get the Libtropic repository:
13+
- Using git: `git clone https://github.com/tropicsquare/libtropic.git`
14+
- Or you can download the [latest release](https://github.com/tropicsquare/libtropic/releases/latest).
15+
16+
=== ":fontawesome-brands-apple: macOS"
17+
TBA
18+
19+
=== ":fontawesome-brands-windows: Windows"
20+
TBA
21+
22+
## Start with our Examples!
23+
Now, let's build and flash the available examples.
24+
25+
### Build and Run Hello World Example
26+
!!! example "Building and running the Hello World example"
27+
=== ":fontawesome-brands-linux: Linux"
28+
```bash
29+
cd examples/esp32/<your_board>/hello_world/
30+
idf.py build flash monitor
31+
```
32+
33+
=== ":fontawesome-brands-apple: macOS"
34+
TBA
35+
36+
=== ":fontawesome-brands-windows: Windows"
37+
TBA
38+
39+
After this, you should see a colored output in your terminal.
40+
41+
### Build and Run Chip Identification Example
42+
!!! example "Building and running the Identify Chip example"
43+
=== ":fontawesome-brands-linux: Linux"
44+
```bash
45+
cd examples/esp32/<your_board>/identify_chip/
46+
idf.py build flash monitor
47+
```
48+
49+
=== ":fontawesome-brands-apple: macOS"
50+
TBA
51+
52+
=== ":fontawesome-brands-windows: Windows"
53+
TBA
54+
55+
After this, you should see a colored output in your terminal.
56+
57+
### Build and Run a Firmware Update Example
58+
!!! example "Building and running the Firmware Update example"
59+
=== ":fontawesome-brands-linux: Linux"
60+
```bash
61+
cd examples/esp32/<your_board>/fw_update/
62+
idf.py build flash monitor
63+
```
64+
65+
=== ":fontawesome-brands-apple: macOS"
66+
TBA
67+
68+
=== ":fontawesome-brands-windows: Windows"
69+
TBA
70+
71+
After this, you should see a colored output in your terminal.
72+
73+
## FAQ
74+
If you encounter any issues, please check the [FAQ](../../../faq.md) before filing an issue or reaching out to our [support](https://support.desk.tropicsquare.com/).

docs/get_started/tutorials/index.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,4 +15,5 @@ Pick a tutorial based on your host platform and a development kit you want to us
1515

1616
- :fontawesome-brands-linux: Linux
1717
- [:fontawesome-solid-microchip: Raspberry Pi / Arduino devkit (raw SPI interface)](linux/arduino_rpi_shield.md)
18-
- [:fontawesome-brands-usb: USB devkit](linux/usb_devkit.md)
18+
- [:fontawesome-brands-usb: USB devkit](linux/usb_devkit.md)
19+
- [ESP32](esp32/index.md)
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
# ESP32
2+
To support the widest range of Espressif SoCs possible, we provide a HAL directly for the [Espressif IoT Development Framework](https://github.com/espressif/esp-idf) (ESP-IDF). The HAL is available in the `libtropic/hal/esp-idf/` directory.
3+
4+
!!! info "ESP-IDF Version"
5+
The ESP-IDF version tested with Libtropic is 5.5.1.
6+
7+
Currently tested ESP32 boards are:
8+
9+
- [ESP32-DevKitC-V4](https://docs.espressif.com/projects/esp-dev-kits/en/latest/esp32/esp32-devkitc/user_guide.html)
10+
- [ESP32-S3-DevKitC-1](https://docs.espressif.com/projects/esp-dev-kits/en/latest/esp32s3/esp32-s3-devkitc-1/index.html)
11+
12+
## Initialization
13+
If Libtropic's [LT_USE_INT_PIN](../../get_started/integrating_libtropic/how_to_configure/index.md#lt_use_int_pin) CMake option is used, the ESP-IDF HAL will use GPIO interrupts. This puts a requirement on your application — in your code, call the [`gpio_install_isr_service`](https://docs.espressif.com/projects/esp-idf/en/stable/esp32/api-reference/peripherals/gpio.html#_CPPv424gpio_install_isr_servicei) function with parameter `0` before calling `lt_init`. This function has to be called **exactly once** in your application. See the ESP32 examples in the `examples/esp32/` directory for inspiration.

docs/other/supported_host_platforms/esp_idf.md

Lines changed: 0 additions & 13 deletions
This file was deleted.

docs/other/supported_host_platforms/index.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,9 @@
22
These are the currently supported host platforms:
33

44
- [STM32](stm32.md)
5+
- [ESP32](esp32.md)
56
- [Linux](linux.md)
67
- [POSIX](posix.md)
7-
- [ESP-IDF](esp_idf.md)
88
- [Arduino](arduino.md)
99

1010
All HAL files can be found in the `libtropic/hal/` directory.
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
cmake_minimum_required(VERSION 3.16)
2+
3+
include($ENV{IDF_PATH}/tools/cmake/project.cmake)
4+
idf_build_set_property(MINIMAL_BUILD ON)
5+
project(fw_update)
6+
7+
# Add libtropic top-level project so its 'tropic' target is available to components.
8+
# Add it after including IDF's project.cmake so IDF toolchain variables are configured.
9+
set(PATH_LIBTROPIC ${CMAKE_CURRENT_LIST_DIR}/../../../../)
10+
add_subdirectory(${PATH_LIBTROPIC} ${CMAKE_CURRENT_BINARY_DIR}/libtropic_build)
11+
12+
# Add libtropic's MbedTLS CAL.
13+
add_subdirectory("${PATH_LIBTROPIC}cal/mbedtls_v4" ${CMAKE_CURRENT_BINARY_DIR}/mbedtls_v4_cal)
14+
target_sources(tropic PRIVATE ${LT_CAL_SRCS})
15+
target_include_directories(tropic PUBLIC ${LT_CAL_INC_DIRS})
16+
17+
# Add libtropic's ESP-IDF HAL.
18+
add_subdirectory("${PATH_LIBTROPIC}hal/esp-idf" ${CMAKE_CURRENT_BINARY_DIR}/esp_idf_hal)
19+
target_sources(tropic PRIVATE ${LT_HAL_SRCS})
20+
target_include_directories(tropic PUBLIC ${LT_HAL_INC_DIRS})
21+
22+
# Link IDF components to libtropic's HAL and CAL, because they depend on them.
23+
target_link_libraries(tropic PUBLIC
24+
idf::mbedtls
25+
idf::esp_driver_spi
26+
idf::esp_driver_gpio
27+
)
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
cmake_minimum_required(VERSION 3.16)
2+
3+
# Path from this file to the libtropic repo root.
4+
set(PATH_LIBTROPIC ${CMAKE_CURRENT_LIST_DIR}/../../../../../../)
5+
6+
# Register the libtropic component and list its dependencies.
7+
idf_component_register(REQUIRES mbedtls esp_driver_spi esp_driver_gpio)
8+
9+
# Link the component library to the 'tropic' target from libtropic.
10+
target_link_libraries(${COMPONENT_LIB} INTERFACE tropic)
11+
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
idf_component_register(SRCS "main.c"
2+
INCLUDE_DIRS "."
3+
REQUIRES mbedtls libtropic)

0 commit comments

Comments
 (0)