Skip to content

OPI optimize / strip *.a #98

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 27 commits into from
Jun 6, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions configs/defconfig.opi_ram
Original file line number Diff line number Diff line change
@@ -1,3 +1,10 @@
CONFIG_SPIRAM_MODE_OCT=y
CONFIG_SPIRAM_IGNORE_NOTFOUND=y
# CONFIG_SPIRAM_MEMTEST is not set
CONFIG_LCD_RGB_ISR_IRAM_SAFE=y
CONFIG_GDMA_CTRL_FUNC_IN_IRAM=y
# bounce buffer mode relies on GDMA EOF interrupt to be service-able
CONFIG_GDMA_ISR_IRAM_SAFE=y
# Enable the XIP-PSRAM feature, so the ext-mem cache won't be disabled when SPI1 is operating the main flash
CONFIG_SPIRAM_FETCH_INSTRUCTIONS=y
CONFIG_SPIRAM_RODATA=y
22 changes: 20 additions & 2 deletions tools/copy-libs.sh
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,13 @@ PIO_LD_FLAGS=""
PIO_LD_FUNCS=""
PIO_LD_SCRIPTS=""

TOOLCHAIN_PREFIX=""
if [ "$IS_XTENSA" = "y" ]; then
TOOLCHAIN="xtensa-$IDF_TARGET-elf"
else
TOOLCHAIN="riscv32-esp-elf"
fi

#collect includes, defines and c-flags
str=`cat build/compile_commands.json | grep arduino-lib-builder-gcc.c | grep command | cut -d':' -f2 | cut -d',' -f1`
str="${str:2:${#str}-1}" #remove leading space and quotes
Expand Down Expand Up @@ -402,13 +409,13 @@ for item; do
mkdir -p "$out_cpath$rel_p"
cp -n $f "$out_cpath$rel_p/"
done
for f in `find "$item" -name '*.inc'`; do
for f in `find "$item" -name '*.inc'`; do
rel_f=${f#*$item}
rel_p=${rel_f%/*}
mkdir -p "$out_cpath$rel_p"
cp -n $f "$out_cpath$rel_p/"
done
# Temporary measure to fix issues caused by https://github.com/espressif/esp-idf/commit/dc4731101dd567cc74bbe4d0f03afe52b7db9afb#diff-1d2ce0d3989a80830fdf230bcaafb3117f32046d16cf46616ac3d55b4df2a988R17
# Temporary measure to fix issues caused by https://github.com/espressif/esp-idf/commit/dc4731101dd567cc74bbe4d0f03afe52b7db9afb#diff-1d2ce0d3989a80830fdf230bcaafb3117f32046d16cf46616ac3d55b4df2a988R17
if [[ "$fname" == "bt" && "$out_sub" == "/include/$IDF_TARGET/include" && -f "$ipath/controller/$IDF_TARGET/esp_bt_cfg.h" ]]; then
mkdir -p "$AR_SDK/include/$fname/controller/$IDF_TARGET"
cp -n "$ipath/controller/$IDF_TARGET/esp_bt_cfg.h" "$AR_SDK/include/$fname/controller/$IDF_TARGET/esp_bt_cfg.h"
Expand All @@ -434,6 +441,8 @@ done

set -- $LD_LIB_FILES
for item; do
#echo "***** Stripping $item"
"$TOOLCHAIN-strip" -g "$item"
cp "$item" "$AR_SDK/lib/"
done

Expand Down Expand Up @@ -507,6 +516,7 @@ function copy_precompiled_lib(){
lib_file="$1"
lib_name="$(basename $lib_file)"
if [[ $LD_LIBS_SEARCH == *"$lib_name"* ]]; then
"$TOOLCHAIN-strip" -g "$lib_file"
cp "$lib_file" "$AR_SDK/ld/"
fi
}
Expand All @@ -523,6 +533,13 @@ for item; do
done
done

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
if [ -f "$AR_SDK/lib/lib$lib.a" ]; then
echo "Stripping $AR_SDK/lib/lib$lib.a"
"$TOOLCHAIN-strip" -g "$AR_SDK/lib/lib$lib.a"
fi
done

# Handle Mem Variants
mkdir -p "$AR_SDK/$MEMCONF/include"
mv "$PWD/build/config/sdkconfig.h" "$AR_SDK/$MEMCONF/include/sdkconfig.h"
Expand All @@ -538,6 +555,7 @@ 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 '"')
mv "$AR_SDK/$out" "$AR_SDK/$MEMCONF/$file"
"$TOOLCHAIN-strip" -g "$AR_SDK/$MEMCONF/$file"
fi
done;

Expand Down