-
Notifications
You must be signed in to change notification settings - Fork 71
/
fix_printf.sh
executable file
·75 lines (66 loc) · 2.86 KB
/
fix_printf.sh
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
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
#!/bin/bash
for dir in esp32 esp32s2 esp32c3 esp32s3 esp32c2 esp32c6 esp32_host esp32c5 esp32c61; do
if [ $dir = esp32 ]; then
TOOLCHAIN="xtensa-esp32-elf"
elif [ $dir = esp32s2 ]; then
TOOLCHAIN="xtensa-esp32s2-elf"
elif [ $dir = esp32c3 -o $dir = esp32c2 -o $dir = esp32c6 -o $dir = esp32_host -o $dir = esp32c5 -o $dir = esp32c61 ]; then
TOOLCHAIN="riscv32-esp-elf"
elif [ $dir = esp32s3 ]; then
TOOLCHAIN="xtensa-esp32s3-elf"
else
echo "$dir does not exist"
fi
if [ -d "$dir" ]; then
chmod -x $dir/*;
cd $dir
git status libsmartconfig.a | grep "modified\|new file" >/dev/null 2>&1
if [ $? -eq 0 ]; then
echo $dir/libsmartconfig.a fixed
$TOOLCHAIN-objcopy --redefine-sym printf=sc_printf libsmartconfig.a
fi
git status libpp.a | grep "modified\|new file" >/dev/null 2>&1
if [ $? -eq 0 ]; then
echo $dir/libpp.a fixed
$TOOLCHAIN-objcopy --redefine-sym printf=pp_printf libpp.a
$TOOLCHAIN-objcopy --redefine-sym ets_printf=pp_printf libpp.a
fi
git status libnet80211.a | grep "modified\|new file" >/dev/null 2>&1
if [ $? -eq 0 ]; then
echo $dir/libnet80211.a fixed
$TOOLCHAIN-objcopy --redefine-sym printf=net80211_printf libnet80211.a
fi
git status libtarget.a | grep "modified\|new file" >/dev/null 2>&1
if [ $? -eq 0 ]; then
echo $dir/libtarget.a fixed
$TOOLCHAIN-objcopy --redefine-sym printf=target_printf libtarget.a
fi
git status libmesh.a | grep "modified\|new file" >/dev/null 2>&1
if [ $? -eq 0 ]; then
echo $dir/libmesh.a fixed
$TOOLCHAIN-objcopy --redefine-sym printf=mesh_printf libmesh.a
$TOOLCHAIN-objcopy --redefine-sym ets_printf=mesh_printf libmesh.a
fi
git status libcore.a | grep "modified\|new file" >/dev/null 2>&1
if [ $? -eq 0 ]; then
echo $dir/libcore.a fixed
$TOOLCHAIN-objcopy --redefine-sym printf=core_printf libcore.a
$TOOLCHAIN-objcopy --redefine-sym ets_printf=core_printf libcore.a
fi
git status libespnow.a | grep "modified\|new file" >/dev/null 2>&1
if [ $? -eq 0 ]; then
echo $dir/libespnow.a fixed
$TOOLCHAIN-objcopy --redefine-sym ets_printf=espnow_printf libespnow.a
$TOOLCHAIN-objcopy --redefine-sym printf=espnow_printf libespnow.a
fi
git status libwapi.a | grep "modified\|new file" >/dev/null 2>&1
if [ $? -eq 0 ]; then
echo $dir/libwapi.a fixed
$TOOLCHAIN-objcopy --redefine-sym ets_printf=wapi_printf libwapi.a
$TOOLCHAIN-objcopy --redefine-sym printf=wapi_printf libwapi.a
fi
cd ..
else
echo "$dir does not exist"
fi
done;