aboutsummaryrefslogtreecommitdiff
path: root/circuitpython/extmod/ulab/build
diff options
context:
space:
mode:
Diffstat (limited to 'circuitpython/extmod/ulab/build')
-rw-r--r--circuitpython/extmod/ulab/build/esp32-cmake.sh35
-rw-r--r--circuitpython/extmod/ulab/build/esp32.sh41
-rw-r--r--circuitpython/extmod/ulab/build/rp2.sh24
3 files changed, 100 insertions, 0 deletions
diff --git a/circuitpython/extmod/ulab/build/esp32-cmake.sh b/circuitpython/extmod/ulab/build/esp32-cmake.sh
new file mode 100644
index 0000000..0093c5b
--- /dev/null
+++ b/circuitpython/extmod/ulab/build/esp32-cmake.sh
@@ -0,0 +1,35 @@
+#!/bin/bash
+
+export BUILD_DIR=$(pwd)
+
+echo "--- CLONING ULAB ---"
+git clone --depth 1 https://github.com/v923z/micropython-ulab.git ulab
+
+echo "--- CLONING MICROPYTHON ---"
+git clone --depth 1 https://github.com/micropython/micropython.git
+
+echo "--- CLONING ESP-IDF ---"
+cd $BUILD_DIR/micropython/
+git clone --depth 1 -b v4.0.2 --recursive https://github.com/espressif/esp-idf.git
+
+echo "--- INSTALL ESP-IDF ---"
+cd $BUILD_DIR/micropython/esp-idf
+./install.sh
+. ./export.sh
+
+echo "--- MPY-CROSS ---"
+cd $BUILD_DIR/micropython/mpy-cross
+make
+
+echo "--- ESP32 SUBMODULES ---"
+cd $BUILD_DIR/micropython/ports/esp32
+make submodules
+
+echo "--- PATCH MAKEFILE ---"
+cp $BUILD_DIR/micropython/ports/esp32/Makefile $BUILD_DIR/micropython/ports/esp32/MakefileOld
+echo "BOARD = GENERIC" > $BUILD_DIR/micropython/ports/esp32/Makefile
+echo "USER_C_MODULES = \$(BUILD_DIR)/ulab/code/micropython.cmake" >> $BUILD_DIR/micropython/ports/esp32/Makefile
+cat $BUILD_DIR/micropython/ports/esp32/MakefileOld >> $BUILD_DIR/micropython/ports/esp32/Makefile
+
+echo "--- MAKE ---"
+make
diff --git a/circuitpython/extmod/ulab/build/esp32.sh b/circuitpython/extmod/ulab/build/esp32.sh
new file mode 100644
index 0000000..d5571cd
--- /dev/null
+++ b/circuitpython/extmod/ulab/build/esp32.sh
@@ -0,0 +1,41 @@
+#!/bin/bash
+
+export BUILD_DIR=$(pwd)
+
+git clone https://github.com/v923z/micropython-ulab.git ulab
+git clone https://github.com/micropython/micropython.git
+
+cd $BUILD_DIR/micropython/
+git checkout tags/v1.14
+
+git submodule update --init
+cd ./mpy-cross && make # build cross-compiler (required)
+
+cd $BUILD_DIR/micropython/ports/esp32
+make ESPIDF= # will display supported ESP-IDF commit hashes
+# output should look like: """
+# ...
+# Supported git hash (v3.3): 9e70825d1e1cbf7988cf36981774300066580ea7
+# Supported git hash (v4.0) (experimental): 4c81978a3e2220674a432a588292a4c860eef27b
+
+ESPIDF_VER=9e70825d1e1cbf7988cf36981774300066580ea7
+
+mkdir $BUILD_DIR/micropython/esp32
+
+cd $BUILD_DIR/micropython/esp32
+git clone https://github.com/espressif/esp-idf.git esp-idf
+cd $BUILD_DIR/micropython/esp32/esp-idf
+git checkout $ESPIDF_VER
+git submodule update --init --recursive # get idf submodules
+pip install -r ./requirements.txt # install python reqs
+
+curl https://dl.espressif.com/dl/xtensa-esp32-elf-linux64-1.22.0-80-g6c4433a-5.2.0.tar.gz | tar xvz
+
+cd $BUILD_DIR/micropython/ports/esp32
+# temporarily add esp32 compiler to path
+export PATH=$BUILD_DIR/micropython/esp32/esp-idf/xtensa-esp32-elf/bine:$PATH
+export ESPIDF=$BUILD_DIR/micropython/esp32/esp-idf
+export BOARD=GENERIC # board options are in ./board
+export USER_C_MODULES=$BUILD_DIR/ulab # include ulab in firmware
+
+make submodules & make all
diff --git a/circuitpython/extmod/ulab/build/rp2.sh b/circuitpython/extmod/ulab/build/rp2.sh
new file mode 100644
index 0000000..e89ab13
--- /dev/null
+++ b/circuitpython/extmod/ulab/build/rp2.sh
@@ -0,0 +1,24 @@
+#!/bin/bash
+
+export BUILD_DIR=$(pwd)
+export MPY_DIR=$BUILD_DIR/micropython
+export ULAB_DIR=$BUILD_DIR/../code
+
+if [ ! -d $ULAB_DIR ]; then
+ printf "Cloning ulab\n"
+ ULAB_DIR=$BUILD_DIR/ulab/code
+ git clone https://github.com/v923z/micropython-ulab.git ulab
+fi
+
+if [ ! -d $MPY_DIR ]; then
+ printf "Cloning MicroPython\n"
+ git clone https://github.com/micropython/micropython.git micropython
+fi
+
+cd $MPY_DIR
+git submodule update --init
+cd ./mpy-cross && make # build cross-compiler (required)
+
+cd $MPY_DIR/ports/rp2
+rm -r build
+make USER_C_MODULES=$ULAB_DIR/micropython.cmake