Skip to content

Commit 1cec1dd

Browse files
authored
Update ASFLAGS for pioarduino (#317)
* Update ASFLAGS for esp32p4 target and default for riscv targets * Refactor assembler flags extraction in copy-libs.sh Refactor assembler flags handling to streamline the extraction of -march, -mabi, and -mlongcalls flags from CXX and CC flags.
1 parent 0209f1f commit 1cec1dd

File tree

1 file changed

+12
-5
lines changed

1 file changed

+12
-5
lines changed

tools/copy-libs.sh

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -318,16 +318,23 @@ done
318318

319319
mkdir -p "$AR_SDK"
320320

321+
# Keep only -march, -mabi and -mlongcalls flags for Assembler
322+
PIOARDUINO_AS_FLAGS=$(
323+
{
324+
echo "$PIOARDUINO_CXX_FLAGS" | grep -oE '\-march=[^[:space:]]*|\-mabi=[^[:space:]]*|\-mlongcalls'
325+
echo "$PIOARDUINO_CC_FLAGS" | grep -oE '\-march=[^[:space:]]*|\-mabi=[^[:space:]]*|\-mlongcalls'
326+
} | awk '!seen[$0]++' | paste -sd ' '
327+
)
328+
321329
# start generation of pioarduino-build.py
322330
AR_PIOARDUINO_PY="$AR_SDK/pioarduino-build.py"
323331
cat configs/pioarduino_start.txt > "$AR_PIOARDUINO_PY"
324332

325333
echo " ASFLAGS=[" >> "$AR_PIOARDUINO_PY"
326-
if [ "$IS_XTENSA" = "y" ]; then
327-
echo " \"-mlongcalls\"" >> "$AR_PIOARDUINO_PY"
328-
else
329-
echo " \"-march=rv32imc\"" >> "$AR_PIOARDUINO_PY"
330-
fi
334+
set -- $PIOARDUINO_AS_FLAGS
335+
for item; do
336+
echo " \"$item\"," >> "$AR_PIOARDUINO_PY"
337+
done
331338
echo " ]," >> "$AR_PIOARDUINO_PY"
332339
echo "" >> "$AR_PIOARDUINO_PY"
333340

0 commit comments

Comments
 (0)