@@ -12,29 +12,40 @@ BUILD_DIR="build-mp_camera"
1212
1313# Parse arguments
1414usage () {
15- echo " Usage: $0 -m <micropython_path> [-i <idf_path>] [-b <board>] [-v <board_variant>] [-c <camera_model>]"
15+ echo " Usage: $0 <micropython_path> [-i <idf_path>] [-b <board>] [-v <board_variant>] [-c <camera_model>]"
16+ echo " "
17+ echo " Arguments:"
18+ echo " <path> Path to MicroPython directory (required)"
1619 echo " "
1720 echo " Options:"
18- echo " -m <path> Path to MicroPython directory (required)"
1921 echo " -i <path> Path to ESP-IDF directory (optional, default: $IDF_PATH_DEFAULT )"
2022 echo " -b <board> Board name (optional, e.g. ESP32_GENERIC_S3, default: $BOARD )"
2123 echo " -v <variant> Board variant (optional, e.g. SPIRAM_OCT)"
2224 echo " -c <model> Camera model (optional, e.g. FREENOVE_ESP32S3_CAM)"
2325 echo " -h Show this help message"
2426 echo " "
2527 echo " Examples:"
26- echo " $0 -m ~/privat/micropython"
27- echo " $0 -m ~/privat/micropython -i ~/esp/esp-idf"
28- echo " $0 -m ~/privat/micropython -b ESP32_GENERIC_S3"
29- echo " $0 -m ~/privat/micropython -b ESP32_GENERIC_S3 -v SPIRAM_OCT"
30- echo " $0 -m ~/privat/micropython -b ESP32_GENERIC_S3 -c FREENOVE_ESP32S3_CAM"
28+ echo " $0 ~/privat/micropython"
29+ echo " $0 ~/privat/micropython -i ~/esp/esp-idf"
30+ echo " $0 ~/privat/micropython -b ESP32_GENERIC_S3"
31+ echo " $0 ~/privat/micropython -b ESP32_GENERIC_S3 -v SPIRAM_OCT"
32+ echo " $0 ~/privat/micropython -b ESP32_GENERIC_S3 -c FREENOVE_ESP32S3_CAM"
3133 exit 1
3234}
3335
36+ # Check required arguments first
37+ if [ -z " $1 " ]; then
38+ echo " Error: MicroPython path is required as first argument"
39+ echo " "
40+ usage
41+ fi
42+
43+ MICROPYTHON_PATH=" $1 "
44+ shift
45+
3446# Parse command line options
35- while getopts " m: i:b:v:c:h" opt; do
47+ while getopts " i:b:v:c:h" opt; do
3648 case $opt in
37- m) MICROPYTHON_PATH=" $OPTARG " ;;
3849 i) IDF_PATH=" $OPTARG " ;;
3950 b) BOARD=" $OPTARG " ;;
4051 v) BOARD_VARIANT=" $OPTARG " ;;
@@ -44,13 +55,6 @@ while getopts "m:i:b:v:c:h" opt; do
4455 esac
4556done
4657
47- # Check required arguments
48- if [ -z " $MICROPYTHON_PATH " ]; then
49- echo " Error: MicroPython path is required (-m option)"
50- echo " "
51- usage
52- fi
53-
5458# Validate paths
5559if [ ! -d " $MICROPYTHON_PATH " ]; then
5660 echo " Error: MicroPython directory not found: $MICROPYTHON_PATH "
@@ -97,8 +101,16 @@ echo ""
97101echo " Setting up ESP-IDF environment..."
98102source " $IDF_PATH /export.sh"
99103
104+ # Check and initialize camera API submodules if needed
105+ cd " $MODULE_PATH "
106+ if git submodule status | grep -q ' ^-' ; then
107+ echo " Initializing camera API submodules ..."
108+ git submodule update --init --depth 1
109+ fi
110+
100111# Change to MicroPython ESP32 port directory
101112cd " $MICROPYTHON_PATH /ports/esp32"
113+ make BOARD=$BOARD submodules
102114
103115# Build idf.py command with optional parameters
104116IDF_CMD=" idf.py -B $BUILD_DIR "
0 commit comments