Skip to content

Commit 0e7e152

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 0e7e152

19 files changed

+163
-310
lines changed

.github/workflows/build_esp32.yml

Lines changed: 89 additions & 130 deletions
Original file line numberDiff line numberDiff line change
@@ -4,164 +4,123 @@ 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'
19+
uses: actions/checkout@v4
20+
21+
# - uses: actions/setup-python@v2
22+
# with:
23+
# python-version: '3.9'
24+
# - name: Setup cmake
25+
# uses: jwlawson/actions-setup-cmake@v1.13
26+
# with:
27+
# cmake-version: '3.18.4'
28+
- name: Get Date
29+
id: get-date
5130
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
58-
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'
63-
run: |
64-
65-
source ./esp-idf/export.sh
31+
echo "date=$(/bin/date -u "+%Y%m%d")" >> $GITHUB_OUTPUT
32+
shell: bash
33+
# - uses: actions/cache@v3
34+
# id: cache
35+
# with:
36+
# path: |
37+
# dependencies/**
38+
# esp-idf/**
39+
# key: ${{ steps.get-date.outputs.date }}
6640

41+
- name: Prepare to Build Tensorflow Micropython Firmware for ESP32
42+
# if: steps.cache.outputs.cache-hit != 'true'
43+
run: |
44+
mv * ..
45+
cd ..
6746
pip3 install Pillow
6847
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: |
79-
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
48+
source ./scripts/build.sh && prepare_dependencies
49+
source ./dependencies/micropython/tools/ci.sh && ci_esp32_idf50_setup
50+
echo "BUILDING MICROLITE"
51+
source ./scripts/build.sh && build_esp32 "MICROLITE"
52+
TARGET=$(pwd)/dependencies/micropython/ports/esp32
53+
echo "TARGET=$TARGET"
54+
./scripts/assemble-unified-image-esp.sh $TARGET "MICROLITE"
55+
ls $TARGET/build-MICROLITE
56+
shell: bash
9757

9858
- name: Archive ESP32-MICROLITE firmware
99-
uses: actions/upload-artifact@v2
59+
uses: actions/upload-artifact@v3
10060
with:
10161
name: microlite-esp32-firmware
102-
path: |
103-
boards/esp32/MICROLITE/build/firmware.bin
62+
path: dependencies/micropython/ports/esp32/build-MICROLITE/firmware.bin
10463

105-
- name: Build with psram support and 16MB Flash firmware
106-
run: |
107-
source ./esp-idf/export.sh
64+
# - name: Build with psram support and 16MB Flash firmware
65+
# run: |
66+
# source ./esp-idf/export.sh
10867

109-
echo "cd ./boards/esp32/MICROLITE_SPIRAM_16M"
110-
cd ./boards/esp32/MICROLITE_SPIRAM_16M
68+
# echo "cd ./boards/esp32/MICROLITE_SPIRAM_16M"
69+
# cd ./boards/esp32/MICROLITE_SPIRAM_16M
11170

112-
echo "Building MICROLITE_SPIRAM_16M"
113-
rm -rf build
114-
idf.py clean build
71+
# echo "Building MICROLITE_SPIRAM_16M"
72+
# rm -rf build
73+
# idf.py clean build
11574

116-
../../../micropython-modules/microlite/assemble-unified-image-esp.sh \
117-
../../../micropython/ports/esp32
75+
# ../../../micropython-modules/microlite/assemble-unified-image-esp.sh \
76+
# ../../../micropython/ports/esp32
11877

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
78+
# - name: Archive ESP32-MICROLITE-SPIRAM-16M firmware
79+
# uses: actions/upload-artifact@v2
80+
# with:
81+
# name: microlite-spiram-16m-esp32-firmware
82+
# path: |
83+
# boards/esp32/MICROLITE_SPIRAM_16M/build/firmware.bin
12584

126-
- name: Build with psram support
127-
run: |
128-
source ./esp-idf/export.sh
85+
# - name: Build with psram support
86+
# run: |
87+
# source ./esp-idf/export.sh
12988

130-
echo "cd ./boards/esp32/MICROLITE_SPIRAM"
131-
cd ./boards/esp32/MICROLITE_SPIRAM
89+
# echo "cd ./boards/esp32/MICROLITE_SPIRAM"
90+
# cd ./boards/esp32/MICROLITE_SPIRAM
13291

133-
echo "Building MICROLITE_SPIRAM"
134-
rm -rf build
135-
idf.py clean build
92+
# echo "Building MICROLITE_SPIRAM"
93+
# rm -rf build
94+
# idf.py clean build
13695

137-
../../../micropython-modules/microlite/assemble-unified-image-esp.sh \
138-
../../../micropython/ports/esp32
96+
# ../../../micropython-modules/microlite/assemble-unified-image-esp.sh \
97+
# ../../../micropython/ports/esp32
13998

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
99+
# - name: Archive ESP32-MICROLITE-SPIRAM firmware
100+
# uses: actions/upload-artifact@v2
101+
# with:
102+
# name: microlite-spiram-esp32-firmware
103+
# path: |
104+
# boards/esp32/MICROLITE_SPIRAM/build/firmware.bin
146105

147-
- name: Build MICROLITE_SPIRAM_CAM
148-
run: |
106+
# - name: Build MICROLITE_SPIRAM_CAM
107+
# run: |
149108

150-
source ./esp-idf/export.sh
109+
# source ./esp-idf/export.sh
151110

152-
echo "cd ./boards/esp32/MICROLITE_SPIRAM_CAM"
153-
cd ./boards/esp32/MICROLITE_SPIRAM_CAM
111+
# echo "cd ./boards/esp32/MICROLITE_SPIRAM_CAM"
112+
# cd ./boards/esp32/MICROLITE_SPIRAM_CAM
154113

155-
echo "Building MICROLITE_SPIRAM_CAM"
156-
rm -rf builds
157-
idf.py clean build
114+
# echo "Building MICROLITE_SPIRAM_CAM"
115+
# rm -rf builds
116+
# idf.py clean build
158117

159-
../../../micropython-modules/microlite/assemble-unified-image-esp.sh \
160-
../../../micropython/ports/esp32
118+
# ../../../micropython-modules/microlite/assemble-unified-image-esp.sh \
119+
# ../../../micropython/ports/esp32
161120

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
121+
# - name: Archive ESP32-MICROLITE_SPIRAM_CAM firmware
122+
# uses: actions/upload-artifact@v2
123+
# with:
124+
# name: microlite-spiram-cam-esp32-firmware
125+
# path: |
126+
# 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)
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
CONFIG_ESP32C3_REV_MIN_3=y
2+
CONFIG_ESP32C3_BROWNOUT_DET=y
3+
CONFIG_ESP32C3_BROWNOUT_DET_LVL_SEL_7=
4+
CONFIG_ESP32C3_BROWNOUT_DET_LVL_SEL_4=y
5+
CONFIG_ESP32C3_BROWNOUT_DET_LVL=4
6+
CONFIG_ESP_CONSOLE_UART_DEFAULT=
7+
CONFIG_ESP_CONSOLE_USB_SERIAL_JTAG=y

0 commit comments

Comments
 (0)