Skip to content

Commit 4bd2e3b

Browse files
committed
sanity check linkage
1 parent 0e6158a commit 4bd2e3b

File tree

1 file changed

+87
-9
lines changed

1 file changed

+87
-9
lines changed

tests/sanity_check.sh

Lines changed: 87 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -3,18 +3,20 @@
33
root=$(git rev-parse --show-toplevel)
44
source "$root/tests/common.sh"
55

6-
pushd "$root"/tools
7-
python3 get.py -q
8-
python3 makecorever.py --git-root "$root" "$root/cores/esp8266/core_version.h"
9-
popd
6+
#pushd "$root"/tools
7+
#python3 get.py -q
8+
#python3 makecorever.py --git-root "$root" "$root/cores/esp8266/core_version.h"
9+
#popd
1010

1111
pushd "$cache_dir"
1212

13-
gcc="$root/tools/xtensa-lx106-elf/bin/xtensa-lx106-elf-gcc"\
14-
" -I$root/cores/esp8266"\
15-
" -I$root/tools/sdk/include"\
16-
" -I$root/variants/generic"\
17-
" -I$root/tools/sdk/libc/xtensa-lx106-elf"
13+
cflags="-mlongcalls -g -free -fipa-pta -Werror=return-type -mlongcalls -mtext-section-literals -falign-functions=4"
14+
gcc=$"$root/tools/xtensa-lx106-elf/bin/xtensa-lx106-elf-gcc
15+
$cflags
16+
-I$root/cores/esp8266 \
17+
-I$root/tools/sdk/include \
18+
-I$root/variants/generic \
19+
-I$root/tools/sdk/libc/xtensa-lx106-elf"
1820

1921
$gcc --verbose
2022

@@ -43,3 +45,79 @@ cat << EOF > sdk.c
4345
EOF
4446

4547
$gcc -c sdk.c
48+
49+
cat << EOF > iostream.cpp
50+
#include <iostream>
51+
void foo() {
52+
std::cout << "hello world";
53+
}
54+
EOF
55+
56+
$gcc -c iostream.cpp
57+
58+
cat << EOF > regex.cpp
59+
#include <string>
60+
#include <regex>
61+
62+
bool bar(std::string v) {
63+
std::regex r("HELLO", std::regex_constants::ECMAScript | std::regex_constants::icase);
64+
if (std::regex_search(v, r))
65+
return true;
66+
return false;
67+
}
68+
EOF
69+
70+
$gcc -c regex.cpp
71+
72+
cp "$root/tools/sdk/ld/eagle.flash.1m.ld" "local.eagle.flash.ld.h"
73+
preprocess=$"$gcc \
74+
-DFP_IN_IROM \
75+
-DVTABLES_IN_FLASH \
76+
-DMMU_IRAM_SIZE=0x8000 \
77+
-DMMU_ICACHE_SIZE=0x8000 \
78+
-CC -E -P"
79+
80+
$preprocess \
81+
"$root/tools/sdk/ld/eagle.app.v6.common.ld.h" \
82+
-o "local.eagle.app.v6.common.ld"
83+
cat local.eagle.app.v6.common.ld
84+
85+
$preprocess \
86+
"local.eagle.flash.ld.h" \
87+
-o "local.eagle.flash.ld"
88+
cat local.eagle.flash.ld
89+
90+
libs=$"-lhal -lphy -lpp -lnet80211 -llwip6-1460-feat -lwpa \
91+
-lcrypto -lmain -lwps -lbearssl -lespnow -lsmartconfig \
92+
-lairkiss -lwpa2 -lstdc++ -lm -lc -lgcc"
93+
objects="arduino.o coredecls.o features.o sdk.o iostream.o"
94+
95+
link=$"$root/tools/xtensa-lx106-elf/bin/xtensa-lx106-elf-gcc
96+
-nostdlib
97+
-u app_entry
98+
-mlongcalls
99+
-L$cache_dir
100+
-L$root/tools/sdk/lib/NONOSDK305
101+
-L$root/tools/sdk/lib
102+
-L$root/tools/sdk/ld
103+
-Wl,-T,local.eagle.flash.ld
104+
-Wl,--no-check-sections
105+
-Wl,-Map,xtensa.map
106+
-Wl,--gc-sections
107+
-Wl,--defsym,app_entry=0xaaaaaaaa
108+
-Wl,--defsym,abort=0xfefefefe
109+
-Wl,--defsym,malloc=0xfefefefe
110+
-Wl,--defsym,free=0xfefefefe
111+
-Wl,--defsym,_read_r=0xfefefefe
112+
-Wl,--defsym,_lseek_r=0xfefefefe
113+
-Wl,--defsym,_write_r=0xfefefefe
114+
-Wl,--defsym,_close_r=0xfefefefe
115+
-Wl,--defsym,_free_r=0xfefefefe
116+
-Wl,--defsym,_malloc_r=0xfefefefe
117+
-Wl,--defsym,_realloc_r=0xfefefefe
118+
-Wl,--defsym,_calloc_r=0xfefefefe
119+
-Wl,--defsym,_fstat_r=0xfefefefe
120+
-Wl,--start-group $objects $libs -Wl,--end-group"
121+
122+
$link -o xtensa.elf
123+
cat xtensa.map

0 commit comments

Comments
 (0)