Skip to content

Commit 41a1cbe

Browse files
committed
[wip] build just libarduino_tinyusb.a
1 parent 7d5c20a commit 41a1cbe

File tree

2 files changed

+38
-1
lines changed

2 files changed

+38
-1
lines changed

build.sh

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ COPY_OUT=0
1717
DEPLOY_OUT=0
1818

1919
function print_help() {
20-
echo "Usage: build.sh [-s] [-A <arduino_branch>] [-I <idf_branch>] [-i <idf_commit>] [-c <path>] [-t <target>] [-b <build|menuconfig|idf_libs|copy_bootloader|mem_variant>] [config ...]"
20+
echo "Usage: build.sh [-s] [-A <arduino_branch>] [-I <idf_branch>] [-i <idf_commit>] [-c <path>] [-t <target>] [-b <build|menuconfig|reconfigure|idf_libs|copy_bootloader|mem_variant>] [config ...]"
2121
echo " -s Skip installing/updating of ESP-IDF and all components"
2222
echo " -A Set which branch of arduino-esp32 to be used for compilation"
2323
echo " -I Set which branch of ESP-IDF to be used for compilation"
@@ -58,6 +58,7 @@ while getopts ":A:I:i:c:t:b:sd" opt; do
5858
b=$OPTARG
5959
if [ "$b" != "build" ] &&
6060
[ "$b" != "menuconfig" ] &&
61+
[ "$b" != "reconfigure" ] &&
6162
[ "$b" != "idf_libs" ] &&
6263
[ "$b" != "copy_bootloader" ] &&
6364
[ "$b" != "mem_variant" ]; then

build_arduino_tinyusb.sh

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
#/bin/bash
2+
3+
if ! idf.py --version >& /dev/null ; then
4+
cat > /dev/stderr << EOF
5+
ERROR: This script requires a full Espressif IDF install.
6+
Suggested use:
7+
8+
sudo docker run -it --rm -v \$PWD:/project -w /project espressif/idf:v4.4 $0
9+
10+
EOF
11+
exit 1
12+
fi
13+
14+
source ./tools/config.sh
15+
16+
TINYUSB_REPO_URL="https://github.com/hathach/tinyusb.git"
17+
TINYUSB_REPO_DIR="$AR_COMPS/arduino_tinyusb/tinyusb"
18+
19+
#
20+
# CLONE/UPDATE TINYUSB
21+
#
22+
echo "Updating TinyUSB..."
23+
if [ ! -d $TINYUSB_REPO_DIR ]; then
24+
git clone $TINYUSB_REPO_URL $TINYUSB_REPO_DIR
25+
else
26+
git -C $TINYUSB_REPO_DIR fetch && \
27+
git -C $TINYUSB_REPO_DIR pull --ff-only
28+
fi
29+
if [ $? -ne 0 ]; then exit 1; fi
30+
31+
# generate ninja files
32+
./build.sh -t esp32s3 -b reconfigure -s
33+
34+
# compile and extract library
35+
TINYUSB_LIB_FILE=esp-idf/arduino_tinyusb/libarduino_tinyusb.a
36+
(cd build && ninja $TINYUSB_LIB_FILE && cp $TINYUSB_LIB_FILE ..)

0 commit comments

Comments
 (0)