Skip to content

Commit 2cbcd16

Browse files
authored
OPI optimize / strip *.a
1 parent 6c91f5d commit 2cbcd16

File tree

2 files changed

+27
-2
lines changed

2 files changed

+27
-2
lines changed

configs/defconfig.opi_ram

+7
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,10 @@
11
CONFIG_SPIRAM_MODE_OCT=y
22
CONFIG_SPIRAM_IGNORE_NOTFOUND=y
33
# CONFIG_SPIRAM_MEMTEST is not set
4+
CONFIG_LCD_RGB_ISR_IRAM_SAFE=y
5+
CONFIG_GDMA_CTRL_FUNC_IN_IRAM=y
6+
# bounce buffer mode relies on GDMA EOF interrupt to be service-able
7+
CONFIG_GDMA_ISR_IRAM_SAFE=y
8+
# Enable the XIP-PSRAM feature, so the ext-mem cache won't be disabled when SPI1 is operating the main flash
9+
CONFIG_SPIRAM_FETCH_INSTRUCTIONS=y
10+
CONFIG_SPIRAM_RODATA=y

tools/copy-libs.sh

+20-2
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,13 @@ PIO_LD_FLAGS=""
7171
PIO_LD_FUNCS=""
7272
PIO_LD_SCRIPTS=""
7373

74+
TOOLCHAIN_PREFIX=""
75+
if [ "$IS_XTENSA" = "y" ]; then
76+
TOOLCHAIN="xtensa-$IDF_TARGET-elf"
77+
else
78+
TOOLCHAIN="riscv32-esp-elf"
79+
fi
80+
7481
#collect includes, defines and c-flags
7582
str=`cat build/compile_commands.json | grep arduino-lib-builder-gcc.c | grep command | cut -d':' -f2 | cut -d',' -f1`
7683
str="${str:2:${#str}-1}" #remove leading space and quotes
@@ -402,13 +409,13 @@ for item; do
402409
mkdir -p "$out_cpath$rel_p"
403410
cp -n $f "$out_cpath$rel_p/"
404411
done
405-
for f in `find "$item" -name '*.inc'`; do
412+
for f in `find "$item" -name '*.inc'`; do
406413
rel_f=${f#*$item}
407414
rel_p=${rel_f%/*}
408415
mkdir -p "$out_cpath$rel_p"
409416
cp -n $f "$out_cpath$rel_p/"
410417
done
411-
# Temporary measure to fix issues caused by https://github.com/espressif/esp-idf/commit/dc4731101dd567cc74bbe4d0f03afe52b7db9afb#diff-1d2ce0d3989a80830fdf230bcaafb3117f32046d16cf46616ac3d55b4df2a988R17
418+
# Temporary measure to fix issues caused by https://github.com/espressif/esp-idf/commit/dc4731101dd567cc74bbe4d0f03afe52b7db9afb#diff-1d2ce0d3989a80830fdf230bcaafb3117f32046d16cf46616ac3d55b4df2a988R17
412419
if [[ "$fname" == "bt" && "$out_sub" == "/include/$IDF_TARGET/include" && -f "$ipath/controller/$IDF_TARGET/esp_bt_cfg.h" ]]; then
413420
mkdir -p "$AR_SDK/include/$fname/controller/$IDF_TARGET"
414421
cp -n "$ipath/controller/$IDF_TARGET/esp_bt_cfg.h" "$AR_SDK/include/$fname/controller/$IDF_TARGET/esp_bt_cfg.h"
@@ -434,6 +441,8 @@ done
434441

435442
set -- $LD_LIB_FILES
436443
for item; do
444+
#echo "***** Stripping $item"
445+
"$TOOLCHAIN-strip" -g "$item"
437446
cp "$item" "$AR_SDK/lib/"
438447
done
439448

@@ -507,6 +516,7 @@ function copy_precompiled_lib(){
507516
lib_file="$1"
508517
lib_name="$(basename $lib_file)"
509518
if [[ $LD_LIBS_SEARCH == *"$lib_name"* ]]; then
519+
"$TOOLCHAIN-strip" -g "$lib_file"
510520
cp "$lib_file" "$AR_SDK/ld/"
511521
fi
512522
}
@@ -523,6 +533,13 @@ for item; do
523533
done
524534
done
525535

536+
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" "joltwallet__littlefs"; do
537+
if [ -f "$AR_SDK/lib/lib$lib.a" ]; then
538+
echo "Stripping $AR_SDK/lib/lib$lib.a"
539+
"$TOOLCHAIN-strip" -g "$AR_SDK/lib/lib$lib.a"
540+
fi
541+
done
542+
526543
# Handle Mem Variants
527544
mkdir -p "$AR_SDK/$MEMCONF/include"
528545
mv "$PWD/build/config/sdkconfig.h" "$AR_SDK/$MEMCONF/include/sdkconfig.h"
@@ -538,6 +555,7 @@ for mem_variant in `jq -c '.mem_variants_files[]' configs/builds.json`; do
538555
file=$(echo "$mem_variant" | jq -c '.file' | tr -d '"')
539556
out=$(echo "$mem_variant" | jq -c '.out' | tr -d '"')
540557
mv "$AR_SDK/$out" "$AR_SDK/$MEMCONF/$file"
558+
"$TOOLCHAIN-strip" -g "$AR_SDK/$MEMCONF/$file"
541559
fi
542560
done;
543561

0 commit comments

Comments
 (0)