Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 14 additions & 2 deletions build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ if [ -z $DEPLOY_OUT ]; then
fi

function print_help() {
echo "Usage: build.sh [-s] [-n] [-A <arduino_branch>] [-I <idf_branch>] [-D <debug_level>] [-i <idf_commit>] [-c <path>] [-t <target>] [-b <build|menuconfig|reconfigure|idf-libs|copy-bootloader|mem-variant>] [config ...]"
echo "Usage: build.sh [-s] [-n] [-A <arduino_branch>] [-I <idf_branch>] [-D <debug_level>] [-i <idf_commit>] [-c <path>] [-t <target>] [-b <build|menuconfig|reconfigure|idf-libs|copy-bootloader|mem-variant|hosted>] [config ...]"
echo " -s Skip installing/updating of ESP-IDF and all components"
echo " -n Disable ccache"
echo " -A Set which branch of arduino-esp32 to be used for compilation"
Expand Down Expand Up @@ -87,7 +87,8 @@ while getopts ":A:I:i:c:t:b:D:sde" opt; do
[ "$b" != "reconfigure" ] &&
[ "$b" != "idf-libs" ] &&
[ "$b" != "copy-bootloader" ] &&
[ "$b" != "mem-variant" ]; then
[ "$b" != "mem-variant" ] &&
[ "$b" != "hosted" ]; then
print_help
fi
BUILD_TYPE="$b"
Expand Down Expand Up @@ -137,6 +138,11 @@ if [ "$BUILD_TYPE" != "all" ]; then
print_help
fi

if [ "$BUILD_TYPE" == "hosted" ]; then
./tools/build-hosted.sh
exit $?
fi

# Target Features Configs
for target_json in `jq -c '.targets[]' configs/builds.json`; do
target=$(echo "$target_json" | jq -c '.target' | tr -d '"')
Expand Down Expand Up @@ -226,6 +232,12 @@ for target_json in `jq -c '.targets[]' configs/builds.json`; do
idf.py -DIDF_TARGET="$target" -DSDKCONFIG_DEFAULTS="$idf_libs_configs" idf-libs
if [ $? -ne 0 ]; then exit 1; fi

# Build ESP-Hosted slave firmwares
if [ "$target" == "esp32p4" ]; then
./tools/build-hosted.sh
fi

# Build ESP-SR Models
if [ "$target" == "esp32s3" ] || [ "$target" == "esp32p4" ]; then
idf.py -DIDF_TARGET="$target" -DSDKCONFIG_DEFAULTS="$idf_libs_configs" srmodels_bin
if [ $? -ne 0 ]; then exit 1; fi
Expand Down
52 changes: 52 additions & 0 deletions tools/build-hosted.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
#!/bin/bash

CCACHE_ENABLE=1

export IDF_CCACHE_ENABLE=$CCACHE_ENABLE
source ./tools/config.sh

SLAVE_DIR="$AR_MANAGED_COMPS/espressif__esp_hosted/slave"

if [ ! -d "$SLAVE_DIR" ]; then
echo "ESP-Hosted component not found!"
exit 1
fi

VERSION_FILE="$SLAVE_DIR/main/esp_hosted_coprocessor_fw_ver.h"

if [ ! -f "$VERSION_FILE" ]; then
echo "Error: File $VERSION_FILE not found!"
exit 1
fi

MAJOR=$(grep "PROJECT_VERSION_MAJOR_1" "$VERSION_FILE" | sed 's/.*PROJECT_VERSION_MAJOR_1 \([0-9]*\).*/\1/')
MINOR=$(grep "PROJECT_VERSION_MINOR_1" "$VERSION_FILE" | sed 's/.*PROJECT_VERSION_MINOR_1 \([0-9]*\).*/\1/')
PATCH=$(grep "PROJECT_VERSION_PATCH_1" "$VERSION_FILE" | sed 's/.*PROJECT_VERSION_PATCH_1 \([0-9]*\).*/\1/')

if [ -z "$MAJOR" ] || [ -z "$MINOR" ] || [ -z "$PATCH" ]; then
echo "Error: Could not extract all version infos!"
echo "MAJOR: '$MAJOR', MINOR: '$MINOR', PATCH: '$PATCH'"
exit 1
fi

VERSION="$MAJOR.$MINOR.$PATCH"
echo "Building ESP-Hosted firmware $VERSION"

cd "$SLAVE_DIR"

OUTPUT_DIR="$AR_TOOLS/esp32-arduino-libs/hosted"
mkdir -p "$OUTPUT_DIR"

TARGETS=(
"esp32c5"
"esp32c6"
)

for target in "${TARGETS[@]}"; do
echo "Building for target: $target"
idf.py set-target "$target"
idf.py clean
idf.py build
cp "$SLAVE_DIR/build/network_adapter.bin" "$OUTPUT_DIR/$target-v$VERSION.bin"
echo "Build completed: $target-v$VERSION.bin"
done