Skip to content

Commit a1b20ca

Browse files
committed
Test - linkage sanity check
Check C++ in addition to C code Check for known issue w/ newlib-4.5.0 when expecting wide characters support Check that compiler can build and link .elf using default build flags & defines
1 parent ec1d3a5 commit a1b20ca

File tree

1 file changed

+106
-5
lines changed

1 file changed

+106
-5
lines changed

tests/sanity_check.sh

Lines changed: 106 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -10,11 +10,25 @@ 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=$"
14+
-Os
15+
-g
16+
-free
17+
-fipa-pta
18+
-Werror=return-type
19+
-Wpointer-arith
20+
-fno-inline-functions
21+
-mtext-section-literals
22+
-mlongcalls
23+
-falign-functions=4
24+
-ffunction-sections
25+
-fdata-sections"
26+
gcc=$"$root/tools/xtensa-lx106-elf/bin/xtensa-lx106-elf-gcc
27+
$cflags
28+
-I$root/cores/esp8266 \
29+
-I$root/tools/sdk/include \
30+
-I$root/variants/generic \
31+
-I$root/tools/sdk/libc/xtensa-lx106-elf"
1832

1933
$gcc --verbose
2034

@@ -43,3 +57,90 @@ cat << EOF > sdk.c
4357
EOF
4458

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

0 commit comments

Comments
 (0)