Skip to content

Commit fa11c1c

Browse files
authored
Update copy-libs.sh
1 parent 2ab0f17 commit fa11c1c

File tree

1 file changed

+11
-11
lines changed

1 file changed

+11
-11
lines changed

tools/copy-libs.sh

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -370,7 +370,7 @@ cat configs/pio_start.txt > "$AR_PLATFORMIO_PY"
370370

371371
# Process include directories and implement include path shortening
372372
# This is equivalent to the Python shorthen_includes() function
373-
# We collect shortened include paths and copy all header files to the SDK
373+
# We collect shortened include paths and copy all header files to the esp32-arduino-libs
374374
REL_INC="" # Will contain the shortened include paths
375375
set -- $INCLUDES
376376

@@ -409,7 +409,7 @@ for item; do
409409
# Add to shortened include paths (using GCC's -iwithprefix mechanism)
410410
REL_INC+="-iwithprefixbefore $fname$out_sub "
411411

412-
# Copy all header files to the SDK include directory
412+
# Copy all header files to the esp32-arduino-libs include directory
413413
# This ensures all headers are available at build time
414414
for f in `find "$item" -name '*.h'`; do
415415
rel_f=${f#*$item}
@@ -449,18 +449,18 @@ else
449449
echo " \"-march=rv32imc\"," >> "$AR_PLATFORMIO_PY" # RISC-V architecture
450450
fi
451451

452-
# Add shortened include paths for assembly files
452+
# Add shortened include paths for assembly files using esp32-arduino-libs structure
453453
# This implements the same logic as the Python shorthen_includes() function
454454
if [[ -n "$REL_INC" ]]; then
455-
echo " \"-iprefix\", join(FRAMEWORK_DIR, \"tools\", \"esp32-arduino-libs\", \"$IDF_TARGET\")," >> "$AR_PLATFORMIO_PY"
455+
echo " \"-iprefix\", join(FRAMEWORK_DIR, \"tools\", \"esp32-arduino-libs\", \"$IDF_TARGET\", \"include\")," >> "$AR_PLATFORMIO_PY"
456456
# Parse the REL_INC string and convert -iwithprefixbefore to -iwithprefix
457457
IFS=' ' read -ra rel_inc_array <<< "$REL_INC"
458458
i=0
459459
while [ $i -lt ${#rel_inc_array[@]} ]; do
460460
if [[ "${rel_inc_array[$i]}" == "-iwithprefixbefore" ]]; then
461461
if [ $((i+1)) -lt ${#rel_inc_array[@]} ]; then
462462
path="${rel_inc_array[$((i+1))]}"
463-
echo " \"-iwithprefix/include/$path\"," >> "$AR_PLATFORMIO_PY"
463+
echo " \"-iwithprefix/$path\"," >> "$AR_PLATFORMIO_PY"
464464
i=$((i+2)) # Skip both flag and path
465465
else
466466
i=$((i+1))
@@ -517,17 +517,17 @@ for item; do
517517
echo " \"$item\"," >> "$AR_PLATFORMIO_PY"
518518
done
519519

520-
# Add shortened include paths for C/C++ compilation
520+
# Add shortened include paths for C/C++ compilation using esp32-arduino-libs structure
521521
# This is the core of the include path shortening mechanism
522522
if [[ -n "$REL_INC" ]]; then
523-
echo " \"-iprefix\", join(FRAMEWORK_DIR, \"tools\", \"esp32-arduino-libs\", \"$IDF_TARGET\")," >> "$AR_PLATFORMIO_PY"
523+
echo " \"-iprefix\", join(FRAMEWORK_DIR, \"tools\", \"esp32-arduino-libs\", \"$IDF_TARGET\", \"include\")," >> "$AR_PLATFORMIO_PY"
524524
IFS=' ' read -ra rel_inc_array <<< "$REL_INC"
525525
i=0
526526
while [ $i -lt ${#rel_inc_array[@]} ]; do
527527
if [[ "${rel_inc_array[$i]}" == "-iwithprefixbefore" ]]; then
528528
if [ $((i+1)) -lt ${#rel_inc_array[@]} ]; then
529529
path="${rel_inc_array[$((i+1))]}"
530-
echo " \"-iwithprefix/include/$path\"," >> "$AR_PLATFORMIO_PY"
530+
echo " \"-iwithprefix/$path\"," >> "$AR_PLATFORMIO_PY"
531531
i=$((i+2))
532532
else
533533
i=$((i+1))
@@ -586,8 +586,8 @@ for item; do
586586
PIO_LIBS+="\"$item\""
587587
done
588588

589-
# Strip debug symbols from libraries and copy them to SDK
590-
# This reduces the size of the final SDK package
589+
# Strip debug symbols from libraries and copy them to esp32-arduino-libs
590+
# This reduces the size of the final esp32-arduino-libs package
591591
set -- $LD_LIB_FILES
592592
for item; do
593593
"$TOOLCHAIN-strip" -g "$item" # Remove debug symbols
@@ -683,7 +683,7 @@ for item; do
683683
done
684684
done
685685

686-
# Strip debug symbols from specific large libraries to reduce SDK size
686+
# Strip debug symbols from specific large libraries to reduce esp32-arduino-libs size
687687
for lib in "openthread" "espressif__esp-tflite-micro" "bt" "espressif__esp_modem" "espressif__esp-zboss-lib" "espressif__esp-zigbee-lib" "espressif__mdns" "espressif__esp-dsp" "espressif__esp32-camera" "joltwallet__littlefs"; do
688688
if [ -f "$AR_SDK/lib/lib$lib.a" ]; then
689689
echo "Stripping $AR_SDK/lib/lib$lib.a"

0 commit comments

Comments
 (0)