Skip to content

Commit

Permalink
Script improvements, rainmaker and esp-sr
Browse files Browse the repository at this point in the history
  • Loading branch information
me-no-dev committed Mar 10, 2022
1 parent 78b3992 commit 79f7b0e
Show file tree
Hide file tree
Showing 14 changed files with 87 additions and 31 deletions.
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
.DS_Store
.vscode
components/arduino/
components/esp-face/
components/esp-dl/
components/esp-sr/
components/esp32-camera/
components/esp_littlefs/
components/esp-rainmaker/
Expand Down
4 changes: 1 addition & 3 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,7 @@
# CMakeLists in this exact order for cmake to work correctly
cmake_minimum_required(VERSION 3.5)

if(IDF_TARGET STREQUAL "esp32")
set(EXTRA_COMPONENT_DIRS ${CMAKE_SOURCE_DIR}/components/esp-rainmaker/components)
endif()
set(EXTRA_COMPONENT_DIRS ${CMAKE_SOURCE_DIR}/components/esp-rainmaker/components)

include($ENV{IDF_PATH}/tools/cmake/project.cmake)
project(arduino-lib-builder)
Expand Down
18 changes: 18 additions & 0 deletions build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -97,9 +97,22 @@ if [ "$BUILD_TYPE" != "all" ]; then
print_help
fi
configs="configs/defconfig.common;configs/defconfig.$TARGET"

# Target Features Configs
for target_json in `jq -c '.targets[]' configs/builds.json`; do
target=$(echo "$target_json" | jq -c '.target' | tr -d '"')
if [ "$TARGET" == "$target" ]; then
for defconf in `echo "$target_json" | jq -c '.features[]' | tr -d '"'`; do
configs="$configs;configs/defconfig.$defconf"
done
fi
done

# Configs From Arguments
for conf in $CONFIGS; do
configs="$configs;configs/defconfig.$conf"
done

echo "idf.py -DIDF_TARGET=\"$TARGET\" -DSDKCONFIG_DEFAULTS=\"$configs\" $BUILD_TYPE"
rm -rf build sdkconfig
idf.py -DIDF_TARGET="$TARGET" -DSDKCONFIG_DEFAULTS="$configs" $BUILD_TYPE
Expand All @@ -121,7 +134,12 @@ for target_json in `jq -c '.targets[]' configs/builds.json`; do
fi

echo "* Target: $target"

# Build Main Configs List
main_configs="configs/defconfig.common;configs/defconfig.$target"
for defconf in `echo "$target_json" | jq -c '.features[]' | tr -d '"'`; do
main_configs="$main_configs;configs/defconfig.$defconf"
done

# Build IDF Libs
idf_libs_configs="$main_configs"
Expand Down
19 changes: 12 additions & 7 deletions configs/builds.json
Original file line number Diff line number Diff line change
Expand Up @@ -34,20 +34,23 @@
"targets":[
{
"target": "esp32s3",
"idf_libs":["qio","80m"],
"features":[],
"idf_libs":["qio","80m","qio_ram"],
"bootloaders":[
["qio","120m"],
["qio","80m"],
["dio","80m"],
["opi_flash","opi_ram","80m"]
["qio","120m","qio_ram"],
["qio","80m","qio_ram"],
["dio","80m","qio_ram"],
["opi","80m","opi_ram"]
],
"mem_variants":[
["opi_ram","80m"],
["opi_flash","opi_ram","80m"]
["qio","80m","opi_ram"],
["opi","80m","opi_ram"],
["opi","80m","qio_ram"]
]
},
{
"target": "esp32s2",
"features":["qio_ram"],
"idf_libs":["qio","80m"],
"bootloaders":[
["qio","80m"],
Expand All @@ -63,6 +66,7 @@
},
{
"target": "esp32c3",
"features":[],
"idf_libs":["qio","80m"],
"bootloaders":[
["qio","80m"],
Expand All @@ -78,6 +82,7 @@
},
{
"target": "esp32",
"features":["qio_ram"],
"idf_libs":["dio","40m"],
"bootloaders":[
["qio","80m"],
Expand Down
1 change: 1 addition & 0 deletions configs/defconfig.common
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
CONFIG_AUTOSTART_ARDUINO=y
CONFIG_ARDUINO_UDP_RUN_CORE0=y
# CONFIG_WS2812_LED_ENABLE is not set
3 changes: 2 additions & 1 deletion configs/defconfig.esp32
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ CONFIG_BT_STACK_NO_LOG=y
CONFIG_BT_ALLOCATION_FROM_SPIRAM_FIRST=y
CONFIG_BT_BLE_DYNAMIC_ENV_MEMORY=y
CONFIG_ESP32_SPIRAM_SUPPORT=y
# CONFIG_SPIRAM_BOOT_INIT is not set
CONFIG_SPIRAM_MALLOC_ALWAYSINTERNAL=4096
CONFIG_SPIRAM_TRY_ALLOCATE_WIFI_LWIP=y
CONFIG_SPIRAM_MALLOC_RESERVE_INTERNAL=0
Expand Down Expand Up @@ -72,3 +71,5 @@ CONFIG_PTHREAD_TASK_STACK_SIZE_DEFAULT=2048
CONFIG_SPI_FLASH_ERASE_YIELD_DURATION_MS=10
CONFIG_SPI_FLASH_ERASE_YIELD_TICKS=2
CONFIG_SPI_FLASH_WRITE_CHUNK_SIZE=4096
# CONFIG_USE_WAKENET is not set
# CONFIG_USE_MULTINET is not set
3 changes: 2 additions & 1 deletion configs/defconfig.esp32s2
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ CONFIG_COMPILER_WARN_WRITE_STRINGS=y
# CONFIG_SPI_SLAVE_ISR_IN_IRAM is not set
CONFIG_ESP32S2_DEFAULT_CPU_FREQ_240=y
CONFIG_ESP32S2_SPIRAM_SUPPORT=y
# CONFIG_SPIRAM_BOOT_INIT is not set
CONFIG_SPIRAM_MALLOC_ALWAYSINTERNAL=4096
CONFIG_SPIRAM_TRY_ALLOCATE_WIFI_LWIP=y
CONFIG_SPIRAM_MALLOC_RESERVE_INTERNAL=0
Expand Down Expand Up @@ -74,3 +73,5 @@ CONFIG_PTHREAD_TASK_STACK_SIZE_DEFAULT=2048
CONFIG_SPI_FLASH_ERASE_YIELD_DURATION_MS=10
CONFIG_SPI_FLASH_ERASE_YIELD_TICKS=2
CONFIG_SPI_FLASH_WRITE_CHUNK_SIZE=4096
# CONFIG_USE_WAKENET is not set
# CONFIG_USE_MULTINET is not set
5 changes: 4 additions & 1 deletion configs/defconfig.esp32s3
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ CONFIG_BLE_MESH=y
# CONFIG_SPI_SLAVE_ISR_IN_IRAM is not set
CONFIG_ESP32S3_DEFAULT_CPU_FREQ_240=y
CONFIG_ESP32S3_SPIRAM_SUPPORT=y
# CONFIG_SPIRAM_BOOT_INIT is not set
CONFIG_SPIRAM_MALLOC_ALWAYSINTERNAL=4096
CONFIG_SPIRAM_TRY_ALLOCATE_WIFI_LWIP=y
CONFIG_SPIRAM_MALLOC_RESERVE_INTERNAL=0
Expand Down Expand Up @@ -76,3 +75,7 @@ CONFIG_PTHREAD_TASK_STACK_SIZE_DEFAULT=2048
CONFIG_SPI_FLASH_ERASE_YIELD_DURATION_MS=10
CONFIG_SPI_FLASH_ERASE_YIELD_TICKS=2
CONFIG_SPI_FLASH_WRITE_CHUNK_SIZE=4096
CONFIG_SR_WN_MODEL_WN8_QUANT=y
CONFIG_SR_WN_WN8_HIESP=y
CONFIG_SR_MN_ENGLISH=y
CONFIG_SR_MN_EN_MULTINET5_SINGLE_RECOGNITION_QUANT8=y
File renamed without changes.
4 changes: 3 additions & 1 deletion configs/defconfig.opi_ram
Original file line number Diff line number Diff line change
@@ -1 +1,3 @@
CONFIG_SPIRAM_MODE_OCT=y
CONFIG_SPIRAM_MODE_OCT=y
CONFIG_SPIRAM_IGNORE_NOTFOUND=y
# CONFIG_SPIRAM_MEMTEST is not set
1 change: 1 addition & 0 deletions configs/defconfig.qio_ram
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
# CONFIG_SPIRAM_BOOT_INIT is not set
8 changes: 5 additions & 3 deletions tools/copy-libs.sh
Original file line number Diff line number Diff line change
Expand Up @@ -196,7 +196,7 @@ for item; do
add_next=0
is_script=0
is_dir=0
elif [[ "${item:0:23}" != "-mfix-esp32-psram-cache" && "${item:0:18}" != "-fmacro-prefix-map" ]]; then
elif [[ "${item:0:23}" != "-mfix-esp32-psram-cache" && "${item:0:18}" != "-fmacro-prefix-map" && "${item:0:17}" != "-Wl,--start-group" && "${item:0:15}" != "-Wl,--end-group" ]]; then
LD_FLAGS+="$item "
PIO_LD_FLAGS+="$item "
fi
Expand Down Expand Up @@ -359,6 +359,7 @@ for item; do
done
fi
done
echo " join(FRAMEWORK_DIR, \"tools\", \"sdk\", \"$IDF_TARGET\", env.BoardConfig().get(\"build.arduino.memory_type\", \"$MEMCONF\"), \"include\")," >> "$AR_PLATFORMIO_PY"
echo " join(FRAMEWORK_DIR, \"cores\", env.BoardConfig().get(\"build.core\"))" >> "$AR_PLATFORMIO_PY"
echo " ]," >> "$AR_PLATFORMIO_PY"
echo "" >> "$AR_PLATFORMIO_PY"
Expand All @@ -383,7 +384,7 @@ done
echo " LIBPATH=[" >> "$AR_PLATFORMIO_PY"
echo " join(FRAMEWORK_DIR, \"tools\", \"sdk\", \"$IDF_TARGET\", \"lib\")," >> "$AR_PLATFORMIO_PY"
echo " join(FRAMEWORK_DIR, \"tools\", \"sdk\", \"$IDF_TARGET\", \"ld\")," >> "$AR_PLATFORMIO_PY"
echo " join(FRAMEWORK_DIR, \"tools\", \"sdk\", \"$IDF_TARGET\", \"$MEMCONF\")" >> "$AR_PLATFORMIO_PY"
echo " join(FRAMEWORK_DIR, \"tools\", \"sdk\", \"$IDF_TARGET\", env.BoardConfig().get(\"build.arduino.memory_type\", \"$MEMCONF\"))" >> "$AR_PLATFORMIO_PY"
echo " ]," >> "$AR_PLATFORMIO_PY"
echo "" >> "$AR_PLATFORMIO_PY"

Expand Down Expand Up @@ -473,7 +474,8 @@ echo "#define CONFIG_ARDUINO_IDF_COMMIT \"$IDF_COMMIT\"" >> "$AR_SDK/include/con
echo "#define CONFIG_ARDUINO_IDF_BRANCH \"$IDF_BRANCH\"" >> "$AR_SDK/include/config/sdkconfig.h"

# Handle Mem Variants
mkdir -p "$AR_SDK/$MEMCONF"
mkdir -p "$AR_SDK/$MEMCONF/include"
mv "$AR_SDK/include/config/sdkconfig.h" "$AR_SDK/$MEMCONF/include/sdkconfig.h"
for mem_variant in `jq -c '.mem_variants_files[]' configs/builds.json`; do
file=$(echo "$mem_variant" | jq -c '.file' | tr -d '"')
out=$(echo "$mem_variant" | jq -c '.out' | tr -d '"')
Expand Down
7 changes: 6 additions & 1 deletion tools/copy-mem-variant.sh
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,14 @@ source ./tools/config.sh

echo "IDF_TARGET: $IDF_TARGET, MEMCONF: $MEMCONF"

# Add IDF versions to sdkconfig
echo "#define CONFIG_ARDUINO_IDF_COMMIT \"$IDF_COMMIT\"" >> "build/config/sdkconfig.h"
echo "#define CONFIG_ARDUINO_IDF_BRANCH \"$IDF_BRANCH\"" >> "build/config/sdkconfig.h"

# Handle Mem Variants
rm -rf "$AR_SDK/$MEMCONF"
mkdir -p "$AR_SDK/$MEMCONF"
mkdir -p "$AR_SDK/$MEMCONF/include"
mv "build/config/sdkconfig.h" "$AR_SDK/$MEMCONF/include/sdkconfig.h"
for mem_variant in `jq -c '.mem_variants_files[]' configs/builds.json`; do
file=$(echo "$mem_variant" | jq -c '.file' | tr -d '"')
src=$(echo "$mem_variant" | jq -c '.src' | tr -d '"')
Expand Down
42 changes: 30 additions & 12 deletions tools/update-components.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@
source ./tools/config.sh

CAMERA_REPO_URL="/~https://github.com/espressif/esp32-camera.git"
FACE_REPO_URL="/~https://github.com/espressif/esp-dl.git"
DL_REPO_URL="/~https://github.com/espressif/esp-dl.git"
SR_REPO_URL="/~https://github.com/espressif/esp-sr.git"
RMAKER_REPO_URL="/~https://github.com/espressif/esp-rainmaker.git"
DSP_REPO_URL="/~https://github.com/espressif/esp-dsp.git"
LITTLEFS_REPO_URL="/~https://github.com/joltwallet/esp_littlefs.git"
Expand Down Expand Up @@ -63,14 +64,26 @@ fi
if [ $? -ne 0 ]; then exit 1; fi

#
# CLONE/UPDATE ESP-FACE
# CLONE/UPDATE ESP-DL
#

if [ ! -d "$AR_COMPS/esp-face" ]; then
git clone $FACE_REPO_URL "$AR_COMPS/esp-face"
if [ ! -d "$AR_COMPS/esp-dl" ]; then
git clone $DL_REPO_URL "$AR_COMPS/esp-dl"
else
git -C "$AR_COMPS/esp-face" fetch && \
git -C "$AR_COMPS/esp-face" pull --ff-only
git -C "$AR_COMPS/esp-dl" fetch && \
git -C "$AR_COMPS/esp-dl" pull --ff-only
fi
if [ $? -ne 0 ]; then exit 1; fi

#
# CLONE/UPDATE ESP-SR
#

if [ ! -d "$AR_COMPS/esp-sr" ]; then
git clone $SR_REPO_URL "$AR_COMPS/esp-sr"
else
git -C "$AR_COMPS/esp-sr" fetch && \
git -C "$AR_COMPS/esp-sr" pull --ff-only
fi
if [ $? -ne 0 ]; then exit 1; fi

Expand All @@ -93,8 +106,13 @@ if [ $? -ne 0 ]; then exit 1; fi
#

if [ ! -d "$AR_COMPS/esp-rainmaker" ]; then
git clone $RMAKER_REPO_URL "$AR_COMPS/esp-rainmaker"
git -C "$AR_COMPS/esp-rainmaker" checkout f1b82c71c4536ab816d17df016d8afe106bd60e3
git clone $RMAKER_REPO_URL "$AR_COMPS/esp-rainmaker" && \
git -C "$AR_COMPS/esp-rainmaker" submodule update --init --recursive
# git -C "$AR_COMPS/esp-rainmaker" checkout f1b82c71c4536ab816d17df016d8afe106bd60e3
else
git -C "$AR_COMPS/esp-rainmaker" fetch && \
git -C "$AR_COMPS/esp-rainmaker" pull --ff-only && \
git -C "$AR_COMPS/esp-rainmaker" submodule update --init --recursive
fi
if [ $? -ne 0 ]; then exit 1; fi

Expand All @@ -104,10 +122,10 @@ if [ $? -ne 0 ]; then exit 1; fi

if [ ! -d "$AR_COMPS/esp-dsp" ]; then
git clone $DSP_REPO_URL "$AR_COMPS/esp-dsp"
cml=`cat "$AR_COMPS/esp-dsp/CMakeLists.txt"`
echo "if(IDF_TARGET STREQUAL \"esp32\" OR IDF_TARGET STREQUAL \"esp32s2\" OR IDF_TARGET STREQUAL \"esp32s3\")" > "$AR_COMPS/esp-dsp/CMakeLists.txt"
echo "$cml" >> "$AR_COMPS/esp-dsp/CMakeLists.txt"
echo "endif()" >> "$AR_COMPS/esp-dsp/CMakeLists.txt"
# cml=`cat "$AR_COMPS/esp-dsp/CMakeLists.txt"`
# echo "if(IDF_TARGET STREQUAL \"esp32\" OR IDF_TARGET STREQUAL \"esp32s2\" OR IDF_TARGET STREQUAL \"esp32s3\")" > "$AR_COMPS/esp-dsp/CMakeLists.txt"
# echo "$cml" >> "$AR_COMPS/esp-dsp/CMakeLists.txt"
# echo "endif()" >> "$AR_COMPS/esp-dsp/CMakeLists.txt"
else
git -C "$AR_COMPS/esp-dsp" fetch && \
git -C "$AR_COMPS/esp-dsp" pull --ff-only
Expand Down

0 comments on commit 79f7b0e

Please sign in to comment.