Skip to content

Commit e1acb00

Browse files
authored
fix Assembler flag extraction for pio
1 parent 0b31fd2 commit e1acb00

File tree

1 file changed

+12
-7
lines changed

1 file changed

+12
-7
lines changed

tools/copy-libs.sh

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -322,18 +322,23 @@ done
322322

323323
mkdir -p "$AR_SDK"
324324

325+
# Keep only -march, -mabi and -mlongcalls flags for Assembler
326+
PIO_AS_FLAGS=$(
327+
{
328+
echo "$PIO_CXX_FLAGS" | grep -oE '\-march=[^[:space:]]*|\-mabi=[^[:space:]]*|\-mlongcalls'
329+
echo "$PIO_CC_FLAGS" | grep -oE '\-march=[^[:space:]]*|\-mabi=[^[:space:]]*|\-mlongcalls'
330+
} | awk '!seen[$0]++' | paste -sd ' '
331+
)
332+
325333
# start generation of pioarduino-build.py
326334
AR_PLATFORMIO_PY="$AR_SDK/pioarduino-build.py"
327335
cat configs/pio_start.txt > "$AR_PLATFORMIO_PY"
328336

329337
echo " ASFLAGS=[" >> "$AR_PLATFORMIO_PY"
330-
if [ "$IS_XTENSA" = "y" ]; then
331-
echo " \"-mlongcalls\"" >> "$AR_PLATFORMIO_PY"
332-
elif [ "$IDF_TARGET" = "esp32p4" ]; then
333-
echo " \"-march=rv32imafc_zicsr_zifencei_xesppie\"" >> "$AR_PLATFORMIO_PY"
334-
else
335-
echo " \"-march=rv32imc_zicsr_zifencei\"" >> "$AR_PLATFORMIO_PY"
336-
fi
338+
set -- $PIO_AS_FLAGS
339+
for item; do
340+
echo " \"$item\"," >> "$AR_PLATFORMIO_PY"
341+
done
337342
echo " ]," >> "$AR_PLATFORMIO_PY"
338343
echo "" >> "$AR_PLATFORMIO_PY"
339344

0 commit comments

Comments
 (0)