Skip to content

Commit 19c81a4

Browse files
authored
Update copy-libs.sh
1 parent c5ac1a1 commit 19c81a4

File tree

1 file changed

+7
-31
lines changed

1 file changed

+7
-31
lines changed

tools/copy-libs.sh

Lines changed: 7 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -322,7 +322,7 @@ mkdir -p "$AR_SDK"
322322
AR_PLATFORMIO_PY="$AR_SDK/pioarduino-build.py"
323323
cat configs/pio_start.txt > "$AR_PLATFORMIO_PY"
324324

325-
# include dirs - SAMMLE REL_INC für Include-Verkürzung
325+
# include dirs - SAMMLE REL_INC für Include-Verkürzung UND kopiere Header
326326
REL_INC=""
327327
set -- $INCLUDES
328328

@@ -377,27 +377,23 @@ for item; do
377377
fi
378378
done
379379

380-
# ASFLAGS mit Include-Verkürzung basierend auf REL_INC
380+
# ASFLAGS mit Prefix-Logik
381381
echo " ASFLAGS=[" >> "$AR_PLATFORMIO_PY"
382382
if [ "$IS_XTENSA" = "y" ]; then
383383
echo " \"-mlongcalls\"," >> "$AR_PLATFORMIO_PY"
384384
else
385385
echo " \"-march=rv32imc\"," >> "$AR_PLATFORMIO_PY"
386386
fi
387-
388-
# Füge Include-Verkürzung aus REL_INC hinzu
389387
if [[ -n "$REL_INC" ]]; then
390388
echo " \"-iprefix\", join(FRAMEWORK_DIR, \"tools\", \"sdk\", \"$IDF_TARGET\")," >> "$AR_PLATFORMIO_PY"
391-
# Verarbeite REL_INC korrekt - Flag und Pfad sind getrennt
392389
IFS=' ' read -ra rel_inc_array <<< "$REL_INC"
393390
i=0
394391
while [ $i -lt ${#rel_inc_array[@]} ]; do
395392
if [[ "${rel_inc_array[$i]}" == "-iwithprefixbefore" ]]; then
396-
# Nächstes Element ist der Pfad
397393
if [ $((i+1)) -lt ${#rel_inc_array[@]} ]; then
398394
path="${rel_inc_array[$((i+1))]}"
399-
echo " \"-iwithprefix/$path\"," >> "$AR_PLATFORMIO_PY"
400-
i=$((i+2)) # Überspringe Flag und Pfad
395+
echo " \"-iwithprefix\", \"include/$path\"," >> "$AR_PLATFORMIO_PY"
396+
i=$((i+2))
401397
else
402398
i=$((i+1))
403399
fi
@@ -406,7 +402,6 @@ if [[ -n "$REL_INC" ]]; then
406402
fi
407403
done
408404
fi
409-
410405
echo " ]," >> "$AR_PLATFORMIO_PY"
411406
echo "" >> "$AR_PLATFORMIO_PY"
412407

@@ -443,26 +438,22 @@ echo " \"$last_item\"" >> "$AR_PLATFORMIO_PY"
443438
echo " ]," >> "$AR_PLATFORMIO_PY"
444439
echo "" >> "$AR_PLATFORMIO_PY"
445440

446-
# CCFLAGS mit Include-Verkürzung basierend auf REL_INC
441+
# CCFLAGS mit Prefix-Logik
447442
echo " CCFLAGS=[" >> "$AR_PLATFORMIO_PY"
448443
set -- $PIO_CC_FLAGS
449444
for item; do
450445
echo " \"$item\"," >> "$AR_PLATFORMIO_PY"
451446
done
452-
453-
# Füge Include-Verkürzung aus REL_INC hinzu
454447
if [[ -n "$REL_INC" ]]; then
455448
echo " \"-iprefix\", join(FRAMEWORK_DIR, \"tools\", \"sdk\", \"$IDF_TARGET\")," >> "$AR_PLATFORMIO_PY"
456-
# Verarbeite REL_INC korrekt - Flag und Pfad sind getrennt
457449
IFS=' ' read -ra rel_inc_array <<< "$REL_INC"
458450
i=0
459451
while [ $i -lt ${#rel_inc_array[@]} ]; do
460452
if [[ "${rel_inc_array[$i]}" == "-iwithprefixbefore" ]]; then
461-
# Nächstes Element ist der Pfad
462453
if [ $((i+1)) -lt ${#rel_inc_array[@]} ]; then
463454
path="${rel_inc_array[$((i+1))]}"
464-
echo " \"-iwithprefix/include/$path\"," >> "$AR_PLATFORMIO_PY"
465-
i=$((i+2)) # Überspringe Flag und Pfad
455+
echo " \"-iwithprefix\", \"include/$path\"," >> "$AR_PLATFORMIO_PY"
456+
i=$((i+2))
466457
else
467458
i=$((i+1))
468459
fi
@@ -471,7 +462,6 @@ if [[ -n "$REL_INC" ]]; then
471462
fi
472463
done
473464
fi
474-
475465
echo " \"-MMD\"" >> "$AR_PLATFORMIO_PY"
476466
echo " ]," >> "$AR_PLATFORMIO_PY"
477467
echo "" >> "$AR_PLATFORMIO_PY"
@@ -513,7 +503,6 @@ done
513503

514504
set -- $LD_LIB_FILES
515505
for item; do
516-
#echo "***** Stripping $item"
517506
"$TOOLCHAIN-strip" -g "$item"
518507
cp "$item" "$AR_SDK/lib/"
519508
done
@@ -548,13 +537,10 @@ for item; do
548537
fi
549538
done
550539

551-
# end generation of platformio-build.py
552540
cat configs/pio_end.txt >> "$AR_PLATFORMIO_PY"
553541

554-
# replace double backslashes with single one
555542
DEFINES=`echo "$DEFINES" | tr -s '\'`
556543

557-
# target flags files
558544
FLAGS_DIR="$AR_SDK/flags"
559545
mkdir -p "$FLAGS_DIR"
560546
echo -n "$DEFINES" > "$FLAGS_DIR/defines"
@@ -570,16 +556,9 @@ if [ -d "managed_components/espressif__esp32-camera/driver/private_include/" ];
570556
cp -r "managed_components/espressif__esp32-camera/driver/private_include/cam_hal.h" "$AR_SDK/include/espressif__esp32-camera/driver/include/"
571557
fi
572558

573-
# sdkconfig
574559
cp -f "sdkconfig" "$AR_SDK/sdkconfig"
575-
576-
# dependencies.lock
577560
cp -f "dependencies.lock" "$AR_SDK/dependencies.lock"
578561

579-
# gen_esp32part.py
580-
# cp "$IDF_PATH/components/partition_table/gen_esp32part.py" "$AR_GEN_PART_PY"
581-
582-
# copy precompiled libs (if we need them)
583562
function copy_precompiled_lib(){
584563
lib_file="$1"
585564
lib_name="$(basename $lib_file)"
@@ -589,7 +568,6 @@ function copy_precompiled_lib(){
589568
fi
590569
}
591570

592-
# idf ld scripts
593571
mkdir -p "$AR_SDK/ld"
594572
set -- $LD_SCRIPT_DIRS
595573
for item; do
@@ -608,7 +586,6 @@ for lib in "openthread" "espressif__esp-tflite-micro" "bt" "espressif__esp_modem
608586
fi
609587
done
610588

611-
# Handle Mem Variants
612589
mkdir -p "$AR_SDK/$MEMCONF/include"
613590
mv "$PWD/build/config/sdkconfig.h" "$AR_SDK/$MEMCONF/include/sdkconfig.h"
614591
for mem_variant in `jq -c '.mem_variants_files[]' configs/builds.json`; do
@@ -627,6 +604,5 @@ for mem_variant in `jq -c '.mem_variants_files[]' configs/builds.json`; do
627604
fi
628605
done;
629606

630-
# Add IDF versions to sdkconfig
631607
echo "#define CONFIG_ARDUINO_IDF_COMMIT \"$IDF_COMMIT\"" >> "$AR_SDK/$MEMCONF/include/sdkconfig.h"
632608
echo "#define CONFIG_ARDUINO_IDF_BRANCH \"$IDF_BRANCH\"" >> "$AR_SDK/$MEMCONF/include/sdkconfig.h"

0 commit comments

Comments
 (0)