Skip to content

Commit b5c65b1

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

File tree

1 file changed

+32
-6
lines changed

1 file changed

+32
-6
lines changed

tools/copy-libs.sh

Lines changed: 32 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -377,23 +377,28 @@ for item; do
377377
fi
378378
done
379379

380-
# ASFLAGS mit Prefix-Logik
380+
# ASFLAGS mit korrigierter Include-Verkürzung (ein String wie Python-Version)
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 - KORRIGIERT wie Python-Version
387389
if [[ -n "$REL_INC" ]]; then
388390
echo " \"-iprefix\", join(FRAMEWORK_DIR, \"tools\", \"sdk\", \"$IDF_TARGET\")," >> "$AR_PLATFORMIO_PY"
391+
# Verarbeite REL_INC korrekt - Flag und Pfad sind getrennt
389392
IFS=' ' read -ra rel_inc_array <<< "$REL_INC"
390393
i=0
391394
while [ $i -lt ${#rel_inc_array[@]} ]; do
392395
if [[ "${rel_inc_array[$i]}" == "-iwithprefixbefore" ]]; then
396+
# Nächstes Element ist der Pfad
393397
if [ $((i+1)) -lt ${#rel_inc_array[@]} ]; then
394398
path="${rel_inc_array[$((i+1))]}"
395-
echo " \"-iwithprefix\", \"include/$path\"," >> "$AR_PLATFORMIO_PY"
396-
i=$((i+2))
399+
# KORRIGIERT: Ein String wie Python-Version
400+
echo " \"-iwithprefix/include/$path\"," >> "$AR_PLATFORMIO_PY"
401+
i=$((i+2)) # Überspringe Flag und Pfad
397402
else
398403
i=$((i+1))
399404
fi
@@ -402,6 +407,7 @@ if [[ -n "$REL_INC" ]]; then
402407
fi
403408
done
404409
fi
410+
405411
echo " ]," >> "$AR_PLATFORMIO_PY"
406412
echo "" >> "$AR_PLATFORMIO_PY"
407413

@@ -438,22 +444,27 @@ echo " \"$last_item\"" >> "$AR_PLATFORMIO_PY"
438444
echo " ]," >> "$AR_PLATFORMIO_PY"
439445
echo "" >> "$AR_PLATFORMIO_PY"
440446

441-
# CCFLAGS mit Prefix-Logik
447+
# CCFLAGS mit korrigierter Include-Verkürzung (ein String wie Python-Version)
442448
echo " CCFLAGS=[" >> "$AR_PLATFORMIO_PY"
443449
set -- $PIO_CC_FLAGS
444450
for item; do
445451
echo " \"$item\"," >> "$AR_PLATFORMIO_PY"
446452
done
453+
454+
# Füge Include-Verkürzung aus REL_INC hinzu - KORRIGIERT wie Python-Version
447455
if [[ -n "$REL_INC" ]]; then
448456
echo " \"-iprefix\", join(FRAMEWORK_DIR, \"tools\", \"sdk\", \"$IDF_TARGET\")," >> "$AR_PLATFORMIO_PY"
457+
# Verarbeite REL_INC korrekt - Flag und Pfad sind getrennt
449458
IFS=' ' read -ra rel_inc_array <<< "$REL_INC"
450459
i=0
451460
while [ $i -lt ${#rel_inc_array[@]} ]; do
452461
if [[ "${rel_inc_array[$i]}" == "-iwithprefixbefore" ]]; then
462+
# Nächstes Element ist der Pfad
453463
if [ $((i+1)) -lt ${#rel_inc_array[@]} ]; then
454464
path="${rel_inc_array[$((i+1))]}"
455-
echo " \"-iwithprefix\", \"include/$path\"," >> "$AR_PLATFORMIO_PY"
456-
i=$((i+2))
465+
# KORRIGIERT: Ein String wie Python-Version
466+
echo " \"-iwithprefix/include/$path\"," >> "$AR_PLATFORMIO_PY"
467+
i=$((i+2)) # Überspringe Flag und Pfad
457468
else
458469
i=$((i+1))
459470
fi
@@ -462,6 +473,7 @@ if [[ -n "$REL_INC" ]]; then
462473
fi
463474
done
464475
fi
476+
465477
echo " \"-MMD\"" >> "$AR_PLATFORMIO_PY"
466478
echo " ]," >> "$AR_PLATFORMIO_PY"
467479
echo "" >> "$AR_PLATFORMIO_PY"
@@ -503,6 +515,7 @@ done
503515

504516
set -- $LD_LIB_FILES
505517
for item; do
518+
#echo "***** Stripping $item"
506519
"$TOOLCHAIN-strip" -g "$item"
507520
cp "$item" "$AR_SDK/lib/"
508521
done
@@ -537,10 +550,13 @@ for item; do
537550
fi
538551
done
539552

553+
# end generation of platformio-build.py
540554
cat configs/pio_end.txt >> "$AR_PLATFORMIO_PY"
541555

556+
# replace double backslashes with single one
542557
DEFINES=`echo "$DEFINES" | tr -s '\'`
543558

559+
# target flags files
544560
FLAGS_DIR="$AR_SDK/flags"
545561
mkdir -p "$FLAGS_DIR"
546562
echo -n "$DEFINES" > "$FLAGS_DIR/defines"
@@ -556,9 +572,16 @@ if [ -d "managed_components/espressif__esp32-camera/driver/private_include/" ];
556572
cp -r "managed_components/espressif__esp32-camera/driver/private_include/cam_hal.h" "$AR_SDK/include/espressif__esp32-camera/driver/include/"
557573
fi
558574

575+
# sdkconfig
559576
cp -f "sdkconfig" "$AR_SDK/sdkconfig"
577+
578+
# dependencies.lock
560579
cp -f "dependencies.lock" "$AR_SDK/dependencies.lock"
561580

581+
# gen_esp32part.py
582+
# cp "$IDF_PATH/components/partition_table/gen_esp32part.py" "$AR_GEN_PART_PY"
583+
584+
# copy precompiled libs (if we need them)
562585
function copy_precompiled_lib(){
563586
lib_file="$1"
564587
lib_name="$(basename $lib_file)"
@@ -568,6 +591,7 @@ function copy_precompiled_lib(){
568591
fi
569592
}
570593

594+
# idf ld scripts
571595
mkdir -p "$AR_SDK/ld"
572596
set -- $LD_SCRIPT_DIRS
573597
for item; do
@@ -586,6 +610,7 @@ for lib in "openthread" "espressif__esp-tflite-micro" "bt" "espressif__esp_modem
586610
fi
587611
done
588612

613+
# Handle Mem Variants
589614
mkdir -p "$AR_SDK/$MEMCONF/include"
590615
mv "$PWD/build/config/sdkconfig.h" "$AR_SDK/$MEMCONF/include/sdkconfig.h"
591616
for mem_variant in `jq -c '.mem_variants_files[]' configs/builds.json`; do
@@ -604,5 +629,6 @@ for mem_variant in `jq -c '.mem_variants_files[]' configs/builds.json`; do
604629
fi
605630
done;
606631

632+
# Add IDF versions to sdkconfig
607633
echo "#define CONFIG_ARDUINO_IDF_COMMIT \"$IDF_COMMIT\"" >> "$AR_SDK/$MEMCONF/include/sdkconfig.h"
608634
echo "#define CONFIG_ARDUINO_IDF_BRANCH \"$IDF_BRANCH\"" >> "$AR_SDK/$MEMCONF/include/sdkconfig.h"

0 commit comments

Comments
 (0)