Skip to content

Commit

Permalink
[esp32] Update MICROLITE_C3 board configuration
Browse files Browse the repository at this point in the history
Also update ci for building esp32 MICROLITE using the new build scripts.
  • Loading branch information
Michael O'Cleirigh committed Sep 13, 2023
1 parent f57bad1 commit eb1f616
Show file tree
Hide file tree
Showing 18 changed files with 173 additions and 303 deletions.
234 changes: 105 additions & 129 deletions .github/workflows/build_esp32.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,164 +4,140 @@ name: ESP32
on:
push:
pull_request:
paths-ignore:
- "examples/**"
- "README.md"
- "ci/*unix*.sh"
- ".github/workflows/build_unix.yml"
paths:
- ".github/workflows/build_esp32.yml"
- "micropython-modules/microlite/**"
- "micropython-modules/micropython-camera-driver/**"


jobs:
tensorflow_micropython_esp32_build:
runs-on: ubuntu-latest

steps:
- name: Checkout repository
uses: actions/checkout@v2
- name: Prepare to Build Tensorflow Micropython Firmware for ESP32
run: |
git submodule init
git submodule update --recursive
cd micropython
git submodule update --init lib/axtls
git submodule update --init lib/berkeley-db-1.xx
cd ports/esp32
make BOARD= submodules
cd ../../..
cd tflm_esp_kernels
git submodule update --init components/esp32-camera
git submodule update --init components/esp-nn
- name: Get Cache Keys
# later get this like this: git ls-remote --heads https://github.com/espressif/esp-idf
# this commit is hard-coded in micropython/tools/ci.sh
run: |
IDF_COMMIT=142bb32c50fa9875b8b69fa539a2d59559460d72
echo "esp-idf-commit=$IDF_COMMIT" >> $GITHUB_ENV
TFLM_COMMIT=$(git submodule status tensorflow | awk '{print ($1)}')
echo "tflm-commit=$TFLM_COMMIT" >> $GITHUB_ENV
# - name: Cache esp-idf
# id: cache-esp-idf
# uses: actions/cache@v2
# env:
# cache-name: cache-esp-idf
# with:
# path: ./esp-idf
# key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ env.esp-idf-commit }}
- name: Setup IDF
# if: steps.cache-esp-idf.outputs.cache-hit != 'true'
run: |
source ./micropython/tools/ci.sh && ci_esp32_idf50_setup
- name: Cache tflm
id: cache-tflm
uses: actions/cache@v2
env:
cache-name: cache-tflm
with:
path: ./micropython-modules/microlite/tflm
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ env.tflm-commit }}
- name: Setup Build for Tensorflow
# if: steps.cache-tflm.outputs.cache-hit != 'true'
# - name: Checkout repository
# uses: actions/checkout@v4
# with:
# repository: 'm'
# path: ''
# - uses: actions/setup-python@v2
# with:
# python-version: '3.9'
# - name: Setup cmake
# uses: jwlawson/actions-setup-cmake@v1.13
# with:
# cmake-version: '3.18.4'
- name: Get Date
id: get-date
run: |
echo "date=$(/bin/date -u "+%Y%m%d")" >> $GITHUB_OUTPUT
shell: bash
# - uses: actions/cache@v3
# id: cache
# with:
# path: |
# dependencies/**
# esp-idf/**
# key: ${{ steps.get-date.outputs.date }}

source ./esp-idf/export.sh
- name: Prepare to Build Tensorflow Micropython Firmware for ESP32
# if: steps.cache.outputs.cache-hit != 'true'
run: |
pwd
echo "working directory"
ls
echo "parent directory"
ls ..
python --version
cmake --version
getconf ARG_MAX
which python
pip3 install Pillow
pip3 install Wave
echo "Regenerating microlite/tfm directory"
rm -rf ./micropython-modules/microlite/tflm
cd ./tensorflow
../micropython-modules/microlite/prepare-tflm-esp.sh
- name: Build micropython cross compiler
run: |
source ./esp-idf/export.sh
cd ./micropython
echo "make -C mpy-cross V=1 clean all"
make -C mpy-cross V=1 clean all
- name: Build standard non-psram 4MB Flash firmware
run: |
source ./esp-idf/export.sh
echo "cd ./boards/esp32/MICROLITE"
cd ./boards/esp32/MICROLITE
echo "Building MICROLITE"
rm -rf builds
idf.py clean build
../../../micropython-modules/microlite/assemble-unified-image-esp.sh \
../../../micropython/ports/esp32
source ./scripts/build.sh && prepare_dependencies
source ./dependencies/micropython/tools/ci.sh && ci_esp32_idf50_setup
echo "BUILDING MICROLITE"
source ./scripts/build.sh && build_esp32 "MICROLITE"
./scripts/assemble-unified-image-esp.sh ./dependencies/micropython "MICROLITE"
shell: bash

# - name: Build standard non-psram 4MB Flash firmware
# run: |
# pip3 install Pillow
# pip3 install Wave
# rm -rf ./dependencies/micropython/ports/esp32/build-MICROLITE
# source ./esp-idf/export.sh
# source ./scripts/build.sh && build_esp32 "MICROLITE"
# ./scripts/assemble-unified-image-esp.sh ./dependencies/micropython/ports/esp32 "MICROLITE"
# shell: bash

- name: Archive ESP32-MICROLITE firmware
uses: actions/upload-artifact@v2
with:
name: microlite-esp32-firmware
path: |
boards/esp32/MICROLITE/build/firmware.bin
dependencies/micropython/build-MICROLITE/firmware.bin
- name: Build with psram support and 16MB Flash firmware
run: |
source ./esp-idf/export.sh
# - name: Build with psram support and 16MB Flash firmware
# run: |
# source ./esp-idf/export.sh

echo "cd ./boards/esp32/MICROLITE_SPIRAM_16M"
cd ./boards/esp32/MICROLITE_SPIRAM_16M
# echo "cd ./boards/esp32/MICROLITE_SPIRAM_16M"
# cd ./boards/esp32/MICROLITE_SPIRAM_16M

echo "Building MICROLITE_SPIRAM_16M"
rm -rf build
idf.py clean build
# echo "Building MICROLITE_SPIRAM_16M"
# rm -rf build
# idf.py clean build

../../../micropython-modules/microlite/assemble-unified-image-esp.sh \
../../../micropython/ports/esp32
# ../../../micropython-modules/microlite/assemble-unified-image-esp.sh \
# ../../../micropython/ports/esp32

- name: Archive ESP32-MICROLITE-SPIRAM-16M firmware
uses: actions/upload-artifact@v2
with:
name: microlite-spiram-16m-esp32-firmware
path: |
boards/esp32/MICROLITE_SPIRAM_16M/build/firmware.bin
# - name: Archive ESP32-MICROLITE-SPIRAM-16M firmware
# uses: actions/upload-artifact@v2
# with:
# name: microlite-spiram-16m-esp32-firmware
# path: |
# boards/esp32/MICROLITE_SPIRAM_16M/build/firmware.bin

- name: Build with psram support
run: |
source ./esp-idf/export.sh
# - name: Build with psram support
# run: |
# source ./esp-idf/export.sh

echo "cd ./boards/esp32/MICROLITE_SPIRAM"
cd ./boards/esp32/MICROLITE_SPIRAM
# echo "cd ./boards/esp32/MICROLITE_SPIRAM"
# cd ./boards/esp32/MICROLITE_SPIRAM

echo "Building MICROLITE_SPIRAM"
rm -rf build
idf.py clean build
# echo "Building MICROLITE_SPIRAM"
# rm -rf build
# idf.py clean build

../../../micropython-modules/microlite/assemble-unified-image-esp.sh \
../../../micropython/ports/esp32
# ../../../micropython-modules/microlite/assemble-unified-image-esp.sh \
# ../../../micropython/ports/esp32

- name: Archive ESP32-MICROLITE-SPIRAM firmware
uses: actions/upload-artifact@v2
with:
name: microlite-spiram-esp32-firmware
path: |
boards/esp32/MICROLITE_SPIRAM/build/firmware.bin
# - name: Archive ESP32-MICROLITE-SPIRAM firmware
# uses: actions/upload-artifact@v2
# with:
# name: microlite-spiram-esp32-firmware
# path: |
# boards/esp32/MICROLITE_SPIRAM/build/firmware.bin

- name: Build MICROLITE_SPIRAM_CAM
run: |
# - name: Build MICROLITE_SPIRAM_CAM
# run: |

source ./esp-idf/export.sh
# source ./esp-idf/export.sh

echo "cd ./boards/esp32/MICROLITE_SPIRAM_CAM"
cd ./boards/esp32/MICROLITE_SPIRAM_CAM
# echo "cd ./boards/esp32/MICROLITE_SPIRAM_CAM"
# cd ./boards/esp32/MICROLITE_SPIRAM_CAM

echo "Building MICROLITE_SPIRAM_CAM"
rm -rf builds
idf.py clean build
# echo "Building MICROLITE_SPIRAM_CAM"
# rm -rf builds
# idf.py clean build

../../../micropython-modules/microlite/assemble-unified-image-esp.sh \
../../../micropython/ports/esp32
# ../../../micropython-modules/microlite/assemble-unified-image-esp.sh \
# ../../../micropython/ports/esp32

- name: Archive ESP32-MICROLITE_SPIRAM_CAM firmware
uses: actions/upload-artifact@v2
with:
name: microlite-spiram-cam-esp32-firmware
path: |
boards/esp32/MICROLITE_SPIRAM_CAM/build/firmware.bin
# - name: Archive ESP32-MICROLITE_SPIRAM_CAM firmware
# uses: actions/upload-artifact@v2
# with:
# name: microlite-spiram-cam-esp32-firmware
# path: |
# boards/esp32/MICROLITE_SPIRAM_CAM/build/firmware.bin
4 changes: 1 addition & 3 deletions boards/esp32/MICROLITE/mpconfigboard.cmake
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
set(SDKCONFIG_DEFAULTS
boards/sdkconfig.base
boards/sdkconfig.ble
../../../../boards/esp32/ESP32_GENERIC/sdkconfig.partition
../../../../boards/esp32/MICROLITE/sdkconfig.partition
)

if(MICROPY_BOARD_VARIANT STREQUAL "D2WD")
Expand Down Expand Up @@ -53,6 +53,4 @@ set(USER_C_MODULES
${CMAKE_CURRENT_LIST_DIR}/../../../micropython-modules/micropython.cmake
)

# set (COMPONENTS esp-tflite-micro)
# list(APPEND IDF_COMPONENTS esp-tflite-micro)
list(APPEND EXTRA_COMPONENT_DIRS ${CMAKE_CURRENT_LIST_DIR}/../../../dependencies/tflite-micro-esp-examples/components/esp-tflite-micro)
2 changes: 1 addition & 1 deletion boards/esp32/MICROLITE/sdkconfig.partition
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,4 @@
#CONFIG_ESPTOOLPY_FLASHSIZE_2MB=y
CONFIG_PARTITION_TABLE_CUSTOM=y
# move back up from micropython/ports/esp32 to the main project source code
CONFIG_PARTITION_TABLE_CUSTOM_FILENAME="../../../../boards/esp32/ESP32_GENERIC/custom-partitions.csv"
CONFIG_PARTITION_TABLE_CUSTOM_FILENAME="../../../../boards/esp32/MICROLITE/custom-partitions.csv"
32 changes: 0 additions & 32 deletions boards/esp32/MICROLITE_C3/CMakeLists.txt

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,14 @@
"docs": "",
"features": [
"BLE",
"External Flash",
"WiFi"
],
"id": "esp32c3-usb",
"images": [
"esp32c3_devkitmini.jpg"
],
"mcu": "esp32c3",
"product": "ESP32-C3 with USB",
"product": "ESP32-C3",
"thumbnail": "",
"url": "https://www.espressif.com/en/products/modules",
"vendor": "Espressif"
Expand Down
7 changes: 7 additions & 0 deletions boards/esp32/MICROLITE_C3/board.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
The following files are firmware images that should work on most
ESP32-C3-based boards with 4MiB of flash, including WROOM and MINI modules,
that use the revision 3 silicon (or newer).

USB serial/JTAG support is enabled on pin 18 and 19. Note that this
is not a full USB stack, the C3 just provides a CDC/ACM class serial
and JTAG interface.
13 changes: 0 additions & 13 deletions boards/esp32/MICROLITE_C3/main/CMakeLists.txt

This file was deleted.

18 changes: 7 additions & 11 deletions boards/esp32/MICROLITE_C3/mpconfigboard.cmake
Original file line number Diff line number Diff line change
@@ -1,18 +1,14 @@
set (IDF_TARGET esp32c3)
set(IDF_TARGET esp32c3)

set(SDKCONFIG_DEFAULTS
${MICROPY_PORT_DIR}/boards/sdkconfig.base
${MICROPY_PORT_DIR}/boards/sdkconfig.ble
${MICROPY_BOARD_DIR}/sdkconfig.partition

boards/sdkconfig.base
boards/sdkconfig.ble
boards/ESP32_GENERIC_C3/sdkconfig.c3usb
../../../../boards/esp32/MICROLITE_C3/sdkconfig.partition
)

message (STATUS "mpconfigboard.cmake: PROJECT_DIR=${PROJECT_DIR}")

set(USER_C_MODULES
${PROJECT_DIR}/micropython-modules/micropython.cmake
${CMAKE_CURRENT_LIST_DIR}/../../../micropython-modules/micropython.cmake
)

if(NOT MICROPY_FROZEN_MANIFEST)
set(MICROPY_FROZEN_MANIFEST ${MICROPY_PORT_DIR}/boards/manifest.py)
endif()
list(APPEND EXTRA_COMPONENT_DIRS ${CMAKE_CURRENT_LIST_DIR}/../../../dependencies/tflite-micro-esp-examples/components/esp-tflite-micro)

0 comments on commit eb1f616

Please sign in to comment.