-
Notifications
You must be signed in to change notification settings - Fork 13
Expand file tree
/
Copy pathfix_printf.sh
More file actions
executable file
·38 lines (35 loc) · 1.07 KB
/
Copy pathfix_printf.sh
File metadata and controls
executable file
·38 lines (35 loc) · 1.07 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
#!/bin/bash
for dir in */; do
dir=${dir%/}
if [ $dir = esp32 ]; then
TOOLCHAIN="xtensa-esp32-elf"
elif [ $dir = esp32s2 ]; then
TOOLCHAIN="xtensa-esp32s2-elf"
elif [ $dir = esp32s3 ]; then
TOOLCHAIN="xtensa-esp32s3-elf"
else
TOOLCHAIN="riscv32-esp-elf"
fi
if [ -d "$dir" ]; then
cd "$dir" || continue
for lib in *.a; do
echo $dir/$lib
if [ "$lib" = "librtc.a" ]; then
git status "$lib" | grep -E "modified|new file" >/dev/null 2>&1
if [ $? -eq 0 ]; then
echo "$dir/$lib fixed"
$TOOLCHAIN-objcopy --redefine-sym ets_printf=rtc_printf "$lib"
fi
continue
fi
git status "$lib" | grep -E "modified|new file" >/dev/null 2>&1
if [ $? -eq 0 ]; then
echo "$dir/$lib fixed"
$TOOLCHAIN-objcopy --redefine-sym ets_printf=phy_printf "$lib"
fi
done
cd ..
else
echo "$dir does not exist"
fi
done