Skip to content

Commit 7e6e0ac

Browse files
author
Michael O'Cleirigh
committed
[esp32] Update MICROLITE_C3 board configuration
Also update ci for building esp32 MICROLITE using the new build scripts.
1 parent f57bad1 commit 7e6e0ac

18 files changed

+152
-301
lines changed

.github/workflows/build_esp32.yml

Lines changed: 93 additions & 126 deletions
Original file line numberDiff line numberDiff line change
@@ -4,164 +4,131 @@ name: ESP32
44
on:
55
push:
66
pull_request:
7-
paths-ignore:
8-
- "examples/**"
9-
- "README.md"
10-
- "ci/*unix*.sh"
11-
- ".github/workflows/build_unix.yml"
7+
paths:
8+
- ".github/workflows/build_esp32.yml"
9+
- "micropython-modules/microlite/**"
10+
- "micropython-modules/micropython-camera-driver/**"
11+
1212

1313
jobs:
1414
tensorflow_micropython_esp32_build:
1515
runs-on: ubuntu-latest
1616

1717
steps:
1818
- name: Checkout repository
19-
uses: actions/checkout@v2
20-
- name: Prepare to Build Tensorflow Micropython Firmware for ESP32
21-
run: |
22-
git submodule init
23-
git submodule update --recursive
24-
cd micropython
25-
git submodule update --init lib/axtls
26-
git submodule update --init lib/berkeley-db-1.xx
27-
cd ports/esp32
28-
make BOARD= submodules
29-
cd ../../..
30-
cd tflm_esp_kernels
31-
git submodule update --init components/esp32-camera
32-
git submodule update --init components/esp-nn
33-
- name: Get Cache Keys
34-
# later get this like this: git ls-remote --heads https://github.com/espressif/esp-idf
35-
# this commit is hard-coded in micropython/tools/ci.sh
36-
run: |
37-
IDF_COMMIT=142bb32c50fa9875b8b69fa539a2d59559460d72
38-
echo "esp-idf-commit=$IDF_COMMIT" >> $GITHUB_ENV
39-
TFLM_COMMIT=$(git submodule status tensorflow | awk '{print ($1)}')
40-
echo "tflm-commit=$TFLM_COMMIT" >> $GITHUB_ENV
41-
# - name: Cache esp-idf
42-
# id: cache-esp-idf
43-
# uses: actions/cache@v2
44-
# env:
45-
# cache-name: cache-esp-idf
46-
# with:
47-
# path: ./esp-idf
48-
# key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ env.esp-idf-commit }}
49-
- name: Setup IDF
50-
# if: steps.cache-esp-idf.outputs.cache-hit != 'true'
51-
run: |
52-
source ./micropython/tools/ci.sh && ci_esp32_idf50_setup
53-
- name: Cache tflm
54-
id: cache-tflm
55-
uses: actions/cache@v2
56-
env:
57-
cache-name: cache-tflm
19+
uses: actions/checkout@v4
20+
- uses: actions/setup-python@v2
21+
with:
22+
python-version: '3.9'
23+
- name: Setup cmake
24+
uses: jwlawson/[email protected]
5825
with:
59-
path: ./micropython-modules/microlite/tflm
60-
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ env.tflm-commit }}
61-
- name: Setup Build for Tensorflow
62-
# if: steps.cache-tflm.outputs.cache-hit != 'true'
26+
cmake-version: '3.18.4'
27+
- name: Get Date
28+
id: get-date
6329
run: |
30+
echo "date=$(/bin/date -u "+%Y%m%d")" >> $GITHUB_OUTPUT
31+
shell: bash
32+
# - uses: actions/cache@v3
33+
# id: cache
34+
# with:
35+
# path: |
36+
# dependencies/**
37+
# esp-idf/**
38+
# key: ${{ steps.get-date.outputs.date }}
6439

65-
source ./esp-idf/export.sh
66-
40+
- name: Prepare to Build Tensorflow Micropython Firmware for ESP32
41+
# if: steps.cache.outputs.cache-hit != 'true'
42+
run: |
43+
python --version
44+
cmake --version
6745
pip3 install Pillow
6846
pip3 install Wave
69-
70-
echo "Regenerating microlite/tfm directory"
71-
rm -rf ./micropython-modules/microlite/tflm
72-
73-
cd ./tensorflow
74-
75-
../micropython-modules/microlite/prepare-tflm-esp.sh
76-
77-
- name: Build micropython cross compiler
78-
run: |
47+
source ./scripts/build.sh && prepare_dependencies
48+
source ./dependencies/micropython/tools/ci.sh && ci_esp32_idf50_setup
7949
source ./esp-idf/export.sh
80-
cd ./micropython
81-
echo "make -C mpy-cross V=1 clean all"
82-
make -C mpy-cross V=1 clean all
83-
84-
- name: Build standard non-psram 4MB Flash firmware
85-
run: |
86-
source ./esp-idf/export.sh
87-
88-
echo "cd ./boards/esp32/MICROLITE"
89-
cd ./boards/esp32/MICROLITE
90-
91-
echo "Building MICROLITE"
92-
rm -rf builds
93-
idf.py clean build
94-
95-
../../../micropython-modules/microlite/assemble-unified-image-esp.sh \
96-
../../../micropython/ports/esp32
50+
echo "BUILDING MICROLITE"
51+
source ./scripts/build.sh && build_esp32 "MICROLITE"
52+
./scripts/assemble-unified-image-esp.sh ./dependencies/micropython "MICROLITE"
53+
shell: bash
54+
55+
# - name: Build standard non-psram 4MB Flash firmware
56+
# run: |
57+
# pip3 install Pillow
58+
# pip3 install Wave
59+
# rm -rf ./dependencies/micropython/ports/esp32/build-MICROLITE
60+
# source ./esp-idf/export.sh
61+
# source ./scripts/build.sh && build_esp32 "MICROLITE"
62+
# ./scripts/assemble-unified-image-esp.sh ./dependencies/micropython/ports/esp32 "MICROLITE"
63+
# shell: bash
9764

9865
- name: Archive ESP32-MICROLITE firmware
9966
uses: actions/upload-artifact@v2
10067
with:
10168
name: microlite-esp32-firmware
10269
path: |
103-
boards/esp32/MICROLITE/build/firmware.bin
70+
dependencies/micropython/build-MICROLITE/firmware.bin
10471
105-
- name: Build with psram support and 16MB Flash firmware
106-
run: |
107-
source ./esp-idf/export.sh
72+
# - name: Build with psram support and 16MB Flash firmware
73+
# run: |
74+
# source ./esp-idf/export.sh
10875

109-
echo "cd ./boards/esp32/MICROLITE_SPIRAM_16M"
110-
cd ./boards/esp32/MICROLITE_SPIRAM_16M
76+
# echo "cd ./boards/esp32/MICROLITE_SPIRAM_16M"
77+
# cd ./boards/esp32/MICROLITE_SPIRAM_16M
11178

112-
echo "Building MICROLITE_SPIRAM_16M"
113-
rm -rf build
114-
idf.py clean build
79+
# echo "Building MICROLITE_SPIRAM_16M"
80+
# rm -rf build
81+
# idf.py clean build
11582

116-
../../../micropython-modules/microlite/assemble-unified-image-esp.sh \
117-
../../../micropython/ports/esp32
83+
# ../../../micropython-modules/microlite/assemble-unified-image-esp.sh \
84+
# ../../../micropython/ports/esp32
11885

119-
- name: Archive ESP32-MICROLITE-SPIRAM-16M firmware
120-
uses: actions/upload-artifact@v2
121-
with:
122-
name: microlite-spiram-16m-esp32-firmware
123-
path: |
124-
boards/esp32/MICROLITE_SPIRAM_16M/build/firmware.bin
86+
# - name: Archive ESP32-MICROLITE-SPIRAM-16M firmware
87+
# uses: actions/upload-artifact@v2
88+
# with:
89+
# name: microlite-spiram-16m-esp32-firmware
90+
# path: |
91+
# boards/esp32/MICROLITE_SPIRAM_16M/build/firmware.bin
12592

126-
- name: Build with psram support
127-
run: |
128-
source ./esp-idf/export.sh
93+
# - name: Build with psram support
94+
# run: |
95+
# source ./esp-idf/export.sh
12996

130-
echo "cd ./boards/esp32/MICROLITE_SPIRAM"
131-
cd ./boards/esp32/MICROLITE_SPIRAM
97+
# echo "cd ./boards/esp32/MICROLITE_SPIRAM"
98+
# cd ./boards/esp32/MICROLITE_SPIRAM
13299

133-
echo "Building MICROLITE_SPIRAM"
134-
rm -rf build
135-
idf.py clean build
100+
# echo "Building MICROLITE_SPIRAM"
101+
# rm -rf build
102+
# idf.py clean build
136103

137-
../../../micropython-modules/microlite/assemble-unified-image-esp.sh \
138-
../../../micropython/ports/esp32
104+
# ../../../micropython-modules/microlite/assemble-unified-image-esp.sh \
105+
# ../../../micropython/ports/esp32
139106

140-
- name: Archive ESP32-MICROLITE-SPIRAM firmware
141-
uses: actions/upload-artifact@v2
142-
with:
143-
name: microlite-spiram-esp32-firmware
144-
path: |
145-
boards/esp32/MICROLITE_SPIRAM/build/firmware.bin
107+
# - name: Archive ESP32-MICROLITE-SPIRAM firmware
108+
# uses: actions/upload-artifact@v2
109+
# with:
110+
# name: microlite-spiram-esp32-firmware
111+
# path: |
112+
# boards/esp32/MICROLITE_SPIRAM/build/firmware.bin
146113

147-
- name: Build MICROLITE_SPIRAM_CAM
148-
run: |
114+
# - name: Build MICROLITE_SPIRAM_CAM
115+
# run: |
149116

150-
source ./esp-idf/export.sh
117+
# source ./esp-idf/export.sh
151118

152-
echo "cd ./boards/esp32/MICROLITE_SPIRAM_CAM"
153-
cd ./boards/esp32/MICROLITE_SPIRAM_CAM
119+
# echo "cd ./boards/esp32/MICROLITE_SPIRAM_CAM"
120+
# cd ./boards/esp32/MICROLITE_SPIRAM_CAM
154121

155-
echo "Building MICROLITE_SPIRAM_CAM"
156-
rm -rf builds
157-
idf.py clean build
122+
# echo "Building MICROLITE_SPIRAM_CAM"
123+
# rm -rf builds
124+
# idf.py clean build
158125

159-
../../../micropython-modules/microlite/assemble-unified-image-esp.sh \
160-
../../../micropython/ports/esp32
126+
# ../../../micropython-modules/microlite/assemble-unified-image-esp.sh \
127+
# ../../../micropython/ports/esp32
161128

162-
- name: Archive ESP32-MICROLITE_SPIRAM_CAM firmware
163-
uses: actions/upload-artifact@v2
164-
with:
165-
name: microlite-spiram-cam-esp32-firmware
166-
path: |
167-
boards/esp32/MICROLITE_SPIRAM_CAM/build/firmware.bin
129+
# - name: Archive ESP32-MICROLITE_SPIRAM_CAM firmware
130+
# uses: actions/upload-artifact@v2
131+
# with:
132+
# name: microlite-spiram-cam-esp32-firmware
133+
# path: |
134+
# boards/esp32/MICROLITE_SPIRAM_CAM/build/firmware.bin

boards/esp32/MICROLITE/mpconfigboard.cmake

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
set(SDKCONFIG_DEFAULTS
22
boards/sdkconfig.base
33
boards/sdkconfig.ble
4-
../../../../boards/esp32/ESP32_GENERIC/sdkconfig.partition
4+
../../../../boards/esp32/MICROLITE/sdkconfig.partition
55
)
66

77
if(MICROPY_BOARD_VARIANT STREQUAL "D2WD")
@@ -53,6 +53,4 @@ set(USER_C_MODULES
5353
${CMAKE_CURRENT_LIST_DIR}/../../../micropython-modules/micropython.cmake
5454
)
5555

56-
# set (COMPONENTS esp-tflite-micro)
57-
# list(APPEND IDF_COMPONENTS esp-tflite-micro)
5856
list(APPEND EXTRA_COMPONENT_DIRS ${CMAKE_CURRENT_LIST_DIR}/../../../dependencies/tflite-micro-esp-examples/components/esp-tflite-micro)

boards/esp32/MICROLITE/sdkconfig.partition

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,4 +4,4 @@
44
#CONFIG_ESPTOOLPY_FLASHSIZE_2MB=y
55
CONFIG_PARTITION_TABLE_CUSTOM=y
66
# move back up from micropython/ports/esp32 to the main project source code
7-
CONFIG_PARTITION_TABLE_CUSTOM_FILENAME="../../../../boards/esp32/ESP32_GENERIC/custom-partitions.csv"
7+
CONFIG_PARTITION_TABLE_CUSTOM_FILENAME="../../../../boards/esp32/MICROLITE/custom-partitions.csv"

boards/esp32/MICROLITE_C3/CMakeLists.txt

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

boards/esp32/MICROLITE_C3_USB/board.json renamed to boards/esp32/MICROLITE_C3/board.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,14 +5,14 @@
55
"docs": "",
66
"features": [
77
"BLE",
8+
"External Flash",
89
"WiFi"
910
],
10-
"id": "esp32c3-usb",
1111
"images": [
1212
"esp32c3_devkitmini.jpg"
1313
],
1414
"mcu": "esp32c3",
15-
"product": "ESP32-C3 with USB",
15+
"product": "ESP32-C3",
1616
"thumbnail": "",
1717
"url": "https://www.espressif.com/en/products/modules",
1818
"vendor": "Espressif"

boards/esp32/MICROLITE_C3/board.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
The following files are firmware images that should work on most
2+
ESP32-C3-based boards with 4MiB of flash, including WROOM and MINI modules,
3+
that use the revision 3 silicon (or newer).
4+
5+
USB serial/JTAG support is enabled on pin 18 and 19. Note that this
6+
is not a full USB stack, the C3 just provides a CDC/ACM class serial
7+
and JTAG interface.

boards/esp32/MICROLITE_C3/main/CMakeLists.txt

Lines changed: 0 additions & 13 deletions
This file was deleted.
Lines changed: 7 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,14 @@
1-
set (IDF_TARGET esp32c3)
1+
set(IDF_TARGET esp32c3)
22

33
set(SDKCONFIG_DEFAULTS
4-
${MICROPY_PORT_DIR}/boards/sdkconfig.base
5-
${MICROPY_PORT_DIR}/boards/sdkconfig.ble
6-
${MICROPY_BOARD_DIR}/sdkconfig.partition
7-
4+
boards/sdkconfig.base
5+
boards/sdkconfig.ble
6+
boards/ESP32_GENERIC_C3/sdkconfig.c3usb
7+
../../../../boards/esp32/MICROLITE_C3/sdkconfig.partition
88
)
99

10-
message (STATUS "mpconfigboard.cmake: PROJECT_DIR=${PROJECT_DIR}")
11-
1210
set(USER_C_MODULES
13-
${PROJECT_DIR}/micropython-modules/micropython.cmake
11+
${CMAKE_CURRENT_LIST_DIR}/../../../micropython-modules/micropython.cmake
1412
)
1513

16-
if(NOT MICROPY_FROZEN_MANIFEST)
17-
set(MICROPY_FROZEN_MANIFEST ${MICROPY_PORT_DIR}/boards/manifest.py)
18-
endif()
14+
list(APPEND EXTRA_COMPONENT_DIRS ${CMAKE_CURRENT_LIST_DIR}/../../../dependencies/tflite-micro-esp-examples/components/esp-tflite-micro)
Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,11 @@
11
// This configuration is for a generic ESP32C3 board with 4MiB (or more) of flash.
22

3-
#define MICROPY_HW_BOARD_NAME "ESP32C3 module (microlite)"
4-
#define MICROPY_HW_MCU_NAME "ESP32C3"
3+
#define MICROPY_HW_BOARD_NAME "Microlite ESP32C3 module"
4+
#define MICROPY_HW_MCU_NAME "Microlite ESP32C3"
55

66
#define MICROPY_HW_ENABLE_SDCARD (0)
77
#define MICROPY_PY_MACHINE_DAC (0)
8-
// TODO: early esp-idf's didn't support i2s. check if this still applies
98
#define MICROPY_PY_MACHINE_I2S (0)
9+
10+
// Enable UART REPL for modules that have an external USB-UART and don't use native USB.
11+
#define MICROPY_HW_ENABLE_UART_REPL (1)

0 commit comments

Comments
 (0)