Skip to content

Commit e80152e

Browse files
authored
Merge pull request #1 from MATTYGILO/codex/fix-workflow-integration-with-esp-idf-5.4
Add ESP-IDF 5.4 build helper
2 parents bf89b3f + e6b3215 commit e80152e

File tree

2 files changed

+59
-0
lines changed

2 files changed

+59
-0
lines changed

README.md

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,3 +9,17 @@ The repo's structure is designed to be easily implemented.
99
We have two possible cmakes to use:
1010
- src/base.cmake (Includes only tflite micro)
1111
- src/full.cmake (Includes additional libraries like ulab)
12+
13+
## Building for ESP-IDF 5.4
14+
15+
A helper script `scripts/build_and_check.sh` can be used to build the firmware for a given board using ESP-IDF 5.4. The script follows the same steps as the GitHub workflow and will fetch the required ESP-IDF release if missing.
16+
17+
```bash
18+
# Build firmware for the default MICROLITE board
19+
./scripts/build_and_check.sh
20+
21+
# Or specify a board
22+
./scripts/build_and_check.sh MICROLITE_S3
23+
```
24+
25+
The script expects the submodules to be accessible over the network in order to fetch Micropython and related dependencies.

scripts/build_and_check.sh

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
#!/bin/bash
2+
3+
set -e
4+
5+
BOARD=${1:-MICROLITE}
6+
IDF_VERSION=${IDF_VERSION:-v5.4}
7+
8+
# Update submodules required for build
9+
if [ ! -d third_party/micropython ]; then
10+
echo "Micropython submodule missing" >&2
11+
exit 1
12+
fi
13+
14+
git submodule update --init --recursive
15+
pushd third_party/micropython >/dev/null
16+
# ensure required nested submodules
17+
git submodule update --init lib/axtls
18+
git submodule update --init lib/berkeley-db-1.xx
19+
popd >/dev/null
20+
21+
# Fetch esp-idf if not already present
22+
if [ ! -d esp-idf ]; then
23+
git clone --branch "$IDF_VERSION" --depth 1 --recursive https://github.com/espressif/esp-idf.git
24+
pushd esp-idf >/dev/null
25+
./install.sh
26+
popd >/dev/null
27+
fi
28+
29+
# Source esp-idf environment
30+
source ./esp-idf/export.sh
31+
32+
# Build micropython cross compiler
33+
pushd third_party/micropython >/dev/null
34+
make -C mpy-cross V=1 clean all
35+
popd >/dev/null
36+
37+
# Build firmware for the selected board
38+
pushd boards/${BOARD} >/dev/null
39+
rm -rf build
40+
idf.py clean build
41+
chmod +x ../../scripts/assemble-unified-image-esp.sh
42+
../../scripts/assemble-unified-image-esp.sh ../../third_party/micropython/ports/esp32
43+
popd >/dev/null
44+
45+
echo "Build complete for board ${BOARD}"

0 commit comments

Comments
 (0)