Skip to content

Commit 70c3b87

Browse files
authored
Add "esp32-small" build target (#111)
Seems to be just another hacky way to expand the build process. Maybe the whole thing should be restructured? The idea is to add a target for CYD that has 4MB flash and no PSRAM. On the other side the normal "esp32" build runs here ... So i really don't know it it's needed...
1 parent 2e2415e commit 70c3b87

1 file changed

Lines changed: 41 additions & 27 deletions

File tree

scripts/build_mpos.sh

Lines changed: 41 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -8,14 +8,15 @@ target="$1"
88
buildtype="$2"
99

1010
if [ -z "$target" ]; then
11-
echo "Usage: $0 target"
12-
echo "Usage: $0 <esp32 or unix or macOS>"
13-
echo "Example: $0 unix"
14-
echo "Example: $0 macOS"
15-
echo "Example: $0 esp32"
16-
echo "Example: $0 esp32s3"
17-
echo "Example: $0 unphone"
18-
echo "Example: $0 clean"
11+
echo "Usage: $0 target"
12+
echo "Usage: $0 <esp32 or esp32-small or unix or macOS>"
13+
echo "Example: $0 unix"
14+
echo "Example: $0 macOS"
15+
echo "Example: $0 esp32"
16+
echo "Example: $0 esp32-small"
17+
echo "Example: $0 esp32s3"
18+
echo "Example: $0 unphone"
19+
echo "Example: $0 clean"
1920
exit 1
2021
fi
2122

@@ -106,20 +107,27 @@ popd
106107
echo "Refreshing freezefs..."
107108
"$codebasedir"/scripts/freezefs_mount_builtin.sh
108109

109-
if [ "$target" == "esp32" -o "$target" == "esp32s3" -o "$target" == "unphone" ]; then
110-
partition_size="4194304"
111-
flash_size="16"
110+
if [ "$target" == "esp32" -o "$target" == "esp32s3" -o "$target" == "unphone" -o "$target" == "esp32-small" ]; then
111+
partition_size="4194304"
112+
flash_size="16"
112113
otasupport="--ota"
113114
extra_configs=""
114-
if [ "$target" == "esp32" ]; then
115+
if [ "$target" == "esp32" ]; then
115116
BOARD=ESP32_GENERIC
116117
BOARD_VARIANT=SPIRAM
118+
elif [ "$target" == "esp32-small" ]; then
119+
# No PSRAM, so do not set SPIRAM-specific options
120+
BOARD=ESP32_GENERIC
121+
BOARD_VARIANT=
122+
partition_size="3900000"
123+
flash_size="4"
124+
otasupport="" # too small for 2 OTA partitions + internal storage
117125
else # esp32s3 or unphone
118-
if [ "$target" == "unphone" ]; then
119-
partition_size="3900000"
120-
flash_size="8"
126+
if [ "$target" == "unphone" ]; then
127+
partition_size="3900000"
128+
flash_size="8"
121129
otasupport="" # too small for 2 OTA partitions + internal storage
122-
fi
130+
fi
123131
BOARD=ESP32_GENERIC_S3
124132
BOARD_VARIANT=SPIRAM_OCT
125133
# These options disable hardware AES, SHA and MPI because they give warnings in QEMU: [AES] Error reading from GDMA buffer
@@ -128,6 +136,12 @@ if [ "$target" == "esp32" -o "$target" == "esp32s3" -o "$target" == "unphone" ];
128136
# --py-freertos: add MicroPython FreeRTOS module to expose internals
129137
extra_configs="$extra_configs --py-freertos"
130138
fi
139+
140+
if [ "$BOARD_VARIANT" == "SPIRAM" -o "$BOARD_VARIANT" == "SPIRAM_OCT" ]; then
141+
# Camera only works on boards configured with spiram, otherwise the build breaks
142+
extra_configs="$extra_configs USER_C_MODULE=$codebasedir/micropython-camera-API/src/micropython.cmake"
143+
fi
144+
131145
manifest=$(readlink -f "$codebasedir"/manifests/manifest.py)
132146
frozenmanifest="FROZEN_MANIFEST=$manifest" # Comment this out if you want to make a build without any frozen files, just an empty MicroPython + whatever files you have on the internal storage
133147
echo "Note that you can also prevent the builtin filesystem from being mounted by umounting it and creating a builtin/ folder."
@@ -148,17 +162,17 @@ if [ "$target" == "esp32" -o "$target" == "esp32s3" -o "$target" == "unphone" ];
148162
# CONFIG_FREERTOS_GENERATE_RUN_TIME_STATS=y
149163
# CONFIG_ADC_MIC_TASK_CORE=1 because with the default (-1) it hangs the CPU
150164
# CONFIG_SPIRAM_XIP_FROM_PSRAM: load entire firmware into RAM to reduce SD vs PSRAM contention (recommended at https://github.com/MicroPythonOS/MicroPythonOS/issues/17)
151-
python3 make.py "$otasupport" --optimize-size --partition-size=$partition_size --flash-size=$flash_size esp32 BOARD=$BOARD BOARD_VARIANT=$BOARD_VARIANT \
152-
USER_C_MODULE="$codebasedir"/micropython-camera-API/src/micropython.cmake \
153-
USER_C_MODULE="$codebasedir"/secp256k1-embedded-ecdh/micropython.cmake \
154-
USER_C_MODULE="$codebasedir"/c_mpos/micropython.cmake \
155-
CONFIG_FREERTOS_USE_TRACE_FACILITY=y \
156-
CONFIG_FREERTOS_VTASKLIST_INCLUDE_COREID=y \
157-
CONFIG_FREERTOS_GENERATE_RUN_TIME_STATS=y \
158-
CONFIG_ADC_MIC_TASK_CORE=1 \
159-
$extra_configs \
160-
"$frozenmanifest"
161-
165+
set -x
166+
python3 make.py $otasupport --optimize-size --partition-size=$partition_size --flash-size=$flash_size esp32 BOARD=$BOARD BOARD_VARIANT=$BOARD_VARIANT \
167+
USER_C_MODULE="$codebasedir"/secp256k1-embedded-ecdh/micropython.cmake \
168+
USER_C_MODULE="$codebasedir"/c_mpos/micropython.cmake \
169+
CONFIG_FREERTOS_USE_TRACE_FACILITY=y \
170+
CONFIG_FREERTOS_VTASKLIST_INCLUDE_COREID=y \
171+
CONFIG_FREERTOS_GENERATE_RUN_TIME_STATS=y \
172+
CONFIG_ADC_MIC_TASK_CORE=1 \
173+
$extra_configs \
174+
"$frozenmanifest"
175+
set +x
162176
popd
163177
elif [ "$target" == "unix" -o "$target" == "macOS" ]; then
164178
manifest=$(readlink -f "$codebasedir"/manifests/manifest.py)

0 commit comments

Comments
 (0)