Skip to content

Commit c130c17

Browse files
author
Me No Dev
committed
Merge remote-tracking branch 'esp8266/master'
2 parents 246edd3 + 15aed3b commit c130c17

File tree

22 files changed

+361
-115
lines changed

22 files changed

+361
-115
lines changed

cores/esp8266/core_esp8266_main.cpp

+3
Original file line numberDiff line numberDiff line change
@@ -127,6 +127,9 @@ static void do_global_ctors(void) {
127127
extern "C" void __gdb_init() {}
128128
extern "C" void gdb_init(void) __attribute__ ((weak, alias("__gdb_init")));
129129

130+
extern "C" void __gdb_do_break(){}
131+
extern "C" void gdb_do_break(void) __attribute__ ((weak, alias("__gdb_do_break")));
132+
130133
void init_done() {
131134
system_set_os_print(1);
132135
gdb_init();

cores/esp8266/core_esp8266_postmortem.c

+5
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,8 @@
2929
#include "cont.h"
3030

3131
extern void __real_system_restart_local();
32+
extern void gdb_do_break();
33+
3234
extern cont_t g_cont;
3335

3436
static const char* s_panic_file = 0;
@@ -184,11 +186,14 @@ void __assert_func(const char *file, int line, const char *func, const char *wha
184186
s_panic_file = file;
185187
s_panic_line = line;
186188
s_panic_func = func;
189+
gdb_do_break();
187190
}
188191

189192
void __panic_func(const char* file, int line, const char* func) {
190193
s_panic_file = file;
191194
s_panic_line = line;
192195
s_panic_func = func;
196+
gdb_do_break();
193197
abort();
194198
}
199+

cores/esp8266/umm_malloc/umm_malloc.c

+2
Original file line numberDiff line numberDiff line change
@@ -841,13 +841,15 @@ static int check_poison_block( umm_block *pblock ) {
841841

842842
pc_cur = pc + sizeof(UMM_POISONED_BLOCK_LEN_TYPE);
843843
if (!check_poison(pc_cur, UMM_POISON_SIZE_BEFORE, "before")) {
844+
printf("block start: %08x\n", pc + sizeof(UMM_POISONED_BLOCK_LEN_TYPE) + UMM_POISON_SIZE_BEFORE);
844845
UMM_HEAP_CORRUPTION_CB();
845846
ok = 0;
846847
goto clean;
847848
}
848849

849850
pc_cur = pc + *((UMM_POISONED_BLOCK_LEN_TYPE *)pc) - UMM_POISON_SIZE_AFTER;
850851
if (!check_poison(pc_cur, UMM_POISON_SIZE_AFTER, "after")) {
852+
printf("block start: %08x\n", pc + sizeof(UMM_POISONED_BLOCK_LEN_TYPE) + UMM_POISON_SIZE_BEFORE);
851853
UMM_HEAP_CORRUPTION_CB();
852854
ok = 0;
853855
goto clean;

doc/changes.md

+35-1
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,40 @@ title: Change Log
44

55
## Current version
66

7+
### Core
8+
- Fix NMI interrupt handler alignment
9+
- Update SDK to 1.5.3
10+
- umm_malloc: print block start address before heap corruption callback is triggered
11+
- If GDBStub library is used, break into gdb on assert and panic
12+
13+
### Libraries
14+
15+
- SNI support in WiFiClientSecure (#1285)
16+
- Update axTLS to 139914f
17+
- HTTPClient: return error when HTTPClient::begin is called with HTTPS URL without certificate fingerprint (#1941)
18+
- HTTPClient: fix default port not being set
19+
- HTTPClient: fix handling of chunked transfer encoding (#1975)
20+
- ESP8266SSDP: switch SSDP send arguments around
21+
- ESP8266WiFi: fix UdpContext::peek to return int (#1946)
22+
- ESP8266WiFi: fix WiFiSleepType_t values to match SDK ones
23+
- LwIP: use gcc-built LwIP by default (#1926)
24+
- LwIP: fix crash in igmp_start_timer (#1826)
25+
- HTTPClient: include non-standard ports in Host: header
26+
- ESP8266WiFi: Prevent WiFi config corruption (#1997 #1856 #1699 #1675)
27+
- GDBStub: fix section attribute for core gdbstub functions
28+
29+
### Tools
30+
31+
- Python 3 compatibility for get.py
32+
- Device side test library and test runner
33+
- Fix ARM toolchain files permissions (#2004)
34+
35+
36+
## 2.2.0
37+
April 18, 2016
38+
39+
Package link: `http://arduino.esp8266.com/versions/2.2.0/package_esp8266com_index.json`.
40+
741
### Core
842
- Leverage realloc() in String::changeBuffer()
943
- Clean up core files
@@ -25,7 +59,6 @@ title: Change Log
2559
- Don't set RF mode on boot unless it was overridden
2660
- Change build.board property for boards which renumber pins like NodeMCU (#1878)
2761
- Fix Exception 2 when using printf or vprintf
28-
- Add ARM tools (#269)
2962

3063
### Libraries
3164
- Update axTLS to 5b4be7d
@@ -55,6 +88,7 @@ title: Change Log
5588

5689

5790
### Tools
91+
- Add ARM tools (#269)
5892

5993
---
6094
## 2.1.0

libraries/ESP8266HTTPClient/src/ESP8266HTTPClient.cpp

+7-2
Original file line numberDiff line numberDiff line change
@@ -844,8 +844,13 @@ bool HTTPClient::sendHeader(const char * type)
844844
header += "1";
845845
}
846846

847-
header += String(F("\r\nHost: ")) + _host +
848-
F("\r\nUser-Agent: ") + _userAgent +
847+
header += String(F("\r\nHost: ")) + _host;
848+
if (_port != 80 && _port != 443)
849+
{
850+
header += ':';
851+
header += String(_port);
852+
}
853+
header += String(F("\r\nUser-Agent: ")) + _userAgent +
849854
F("\r\nConnection: ");
850855

851856
if(_reuse) {

libraries/ESP8266WiFi/src/ESP8266WiFiSTA.cpp

+5
Original file line numberDiff line numberDiff line change
@@ -140,6 +140,11 @@ wl_status_t ESP8266WiFiSTAClass::begin(const char* ssid, const char *passphrase,
140140
ETS_UART_INTR_DISABLE();
141141

142142
if(WiFi._persistent) {
143+
// workaround for #1997: make sure the value of ap_number is updated and written to flash
144+
// to be removed after SDK update
145+
wifi_station_ap_number_set(2);
146+
wifi_station_ap_number_set(1);
147+
143148
wifi_station_set_config(&conf);
144149
} else {
145150
wifi_station_set_config_current(&conf);

libraries/ESP8266WiFi/src/WiFiClientSecure.cpp

+5-1
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ class SSLContext {
6666
public:
6767
SSLContext() {
6868
if (_ssl_ctx_refcnt == 0) {
69-
_ssl_ctx = ssl_ctx_new(SSL_SERVER_VERIFY_LATER | SSL_DEBUG_OPTS | SSL_CONNECT_IN_PARTS, 0);
69+
_ssl_ctx = ssl_ctx_new(SSL_SERVER_VERIFY_LATER | SSL_DEBUG_OPTS | SSL_CONNECT_IN_PARTS | SSL_READ_BLOCKING, 0);
7070
}
7171
++_ssl_ctx_refcnt;
7272
}
@@ -592,3 +592,7 @@ extern "C" void* ax_port_realloc(void* ptr, size_t size, const char* file, int l
592592
extern "C" void ax_port_free(void* ptr) {
593593
free(ptr);
594594
}
595+
596+
extern "C" void ax_wdt_feed() {
597+
optimistic_yield(10000);
598+
}

libraries/ESP8266WiFi/src/include/ssl.h

+1
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,7 @@ typedef struct SSL_ SSL;
8585
#define SSL_DISPLAY_CERTS 0x00200000
8686
#define SSL_DISPLAY_RSA 0x00400000
8787
#define SSL_CONNECT_IN_PARTS 0x00800000
88+
#define SSL_READ_BLOCKING 0x01000000
8889

8990
/* errors that can be generated */
9091
#define SSL_OK 0

libraries/GDBStub/src/internal/gdbstub-cfg.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,6 @@ are called when the flash is disabled (eg due to a Ctrl-C at the wrong time), th
5656
likely crash.
5757
*/
5858
#define ATTR_GDBINIT ICACHE_FLASH_ATTR
59-
#define ATTR_GDBFN
59+
#define ATTR_GDBFN ICACHE_RAM_ATTR
6060

6161
#endif

libraries/GDBStub/src/internal/gdbstub.c

+5
Original file line numberDiff line numberDiff line change
@@ -787,4 +787,9 @@ void ATTR_GDBINIT gdbstub_init() {
787787
#endif
788788
}
789789

790+
void ATTR_GDBFN gdbstub_do_break_wrapper() {
791+
gdbstub_do_break();
792+
}
793+
794+
extern void gdb_do_break() __attribute__((weak, alias("gdbstub_do_break_wrapper")));
790795
extern void gdb_init() __attribute__((weak, alias("gdbstub_init")));

package/package_esp8266com_index.template.json

+2-2
Original file line numberDiff line numberDiff line change
@@ -177,8 +177,8 @@
177177
},
178178
{
179179
"host": "arm-linux-gnueabihf",
180-
"url": "http://arduino.esp8266.com/linuxarm-xtensa-lx106-elf-g46f160f.tar.gz",
181-
"archiveFileName": "linuxarm-xtensa-lx106-elf-g46f160f.tar.gz",
180+
"url": "http://arduino.esp8266.com/linuxarm-xtensa-lx106-elf-g46f160f-2.tar.gz",
181+
"archiveFileName": "linuxarm-xtensa-lx106-elf-g46f160f-2.tar.gz",
182182
"checksum": "SHA-256:1ac752bac7fff6be95ce10f56689f155fefea09e4ef710dbd75cb573798ff9c0",
183183
"size": "34929527"
184184
}

tests/device/Makefile

+2-1
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,8 @@ ifneq ("$(NO_RUN)","1")
7171
$(RUNNER_DEBUG_FLAG) \
7272
-p $(UPLOAD_PORT) \
7373
-n $(basename $(notdir $@)) \
74-
-o $(LOCAL_BUILD_DIR)/test_result.xml
74+
-o $(LOCAL_BUILD_DIR)/test_result.xml \
75+
`test -f $(addsuffix .py, $(basename $@)) && echo "-m $(addsuffix .py, $(basename $@))" || echo ""`
7576
endif
7677

7778
$(BUILD_DIR):
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
2+
env = dict()
3+
4+
def setup(test_name):
5+
global env
6+
if not test_name in env:
7+
env[test_name] = dict()
8+
func_env = env[test_name]
9+
def decorator(func):
10+
def func_wrapper():
11+
return func(env[test_name])
12+
func_env['setup'] = func_wrapper
13+
return func_wrapper
14+
return decorator
15+
16+
17+
18+
def teardown(test_name):
19+
global env
20+
if not test_name in env:
21+
env[test_name] = dict()
22+
func_env = env[test_name]
23+
def decorator(func):
24+
def func_wrapper():
25+
return func(env[test_name])
26+
func_env['teardown'] = func_wrapper
27+
return func_wrapper
28+
return decorator
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,12 @@
1+
Flask==0.10.1
2+
itsdangerous==0.24
3+
Jinja2==2.8
14
junit-xml==1.6
5+
MarkupSafe==0.23
26
pexpect==4.0.1
37
ptyprocess==0.5.1
48
pyserial==3.0.1
9+
PyYAML==3.11
510
six==1.10.0
6-
wheel==0.24.0
11+
Werkzeug==0.11.9
12+
wheel==0.24.0

tests/device/libraries/BSTest/runner.py

+24-8
Original file line numberDiff line numberDiff line change
@@ -8,15 +8,19 @@
88
import argparse
99
import serial
1010
import subprocess
11+
import imp
1112
from urlparse import urlparse
1213
from junit_xml import TestSuite, TestCase
1314
try:
1415
from cStringIO import StringIO
1516
except:
1617
from StringIO import StringIO
18+
import mock_decorators
1719

1820
debug = False
1921

22+
sys.path.append(os.path.abspath(__file__))
23+
2024
def debug_print(*args, **kwargs):
2125
if not debug:
2226
return
@@ -29,17 +33,18 @@ class BSTestRunner(object):
2933
TIMEOUT = 2
3034
CRASH = 3
3135

32-
def __init__(self, spawn_obj, name):
36+
def __init__(self, spawn_obj, name, mocks):
3337
self.sp = spawn_obj
3438
self.tests = []
3539
self.reset_timeout = 2
3640
self.name = name
41+
self.mocks = mocks
3742

3843
def get_test_list(self):
3944
self.sp.sendline('-1')
4045
timeout = 10
4146
while timeout > 0:
42-
res = self.sp.expect(['>>>>>bs_test_menu_begin', EOF])
47+
res = self.sp.expect(['>>>>>bs_test_menu_begin', EOF, TIMEOUT])
4348
if res == 0:
4449
break
4550
timeout-=1
@@ -49,15 +54,15 @@ def get_test_list(self):
4954
while True:
5055
res = self.sp.expect(['>>>>>bs_test_item id\=(\d+) name\="([^\"]*?)" desc="([^"]*?)"',
5156
'>>>>>bs_test_menu_end',
52-
EOF])
57+
EOF, TIMEOUT])
5358
if res == 0:
5459
m = self.sp.match
5560
t = {'id': m.group(1), 'name': m.group(2), 'desc': m.group(3)}
5661
self.tests.append(t)
5762
debug_print('added test', t)
5863
elif res == 1:
5964
break
60-
elif res == 2:
65+
elif res >= 2:
6166
time.sleep(0.1)
6267

6368
debug_print('got {} tests'.format(len(self.tests)))
@@ -75,8 +80,14 @@ def run_tests(self):
7580
else:
7681
test_output = StringIO()
7782
self.sp.logfile = test_output
83+
if name in self.mocks:
84+
print('setting up mocks')
85+
self.mocks[name]['setup']()
7886
t_start = time.time()
7987
result = self.run_test(index)
88+
if name in self.mocks:
89+
print('tearing down mocks')
90+
self.mocks[name]['teardown']()
8091
t_stop = time.time()
8192
self.sp.logfile = None
8293
test_case.elapsed_sec = t_stop - t_start
@@ -96,7 +107,7 @@ def run_test(self, index):
96107
self.sp.sendline('{}'.format(index))
97108
timeout = 10
98109
while timeout > 0:
99-
res = self.sp.expect(['>>>>>bs_test_start', EOF])
110+
res = self.sp.expect(['>>>>>bs_test_start', EOF, TIMEOUT])
100111
if res == 0:
101112
break
102113
time.sleep(0.1)
@@ -147,8 +158,8 @@ def spawn_port(port_name, baudrate=115200):
147158
def spawn_exec(name):
148159
return pexpect.spawn(name, timeout=0)
149160

150-
def run_tests(spawn, name):
151-
tw = BSTestRunner(spawn, name)
161+
def run_tests(spawn, name, mocks):
162+
tw = BSTestRunner(spawn, name, mocks)
152163
tw.get_test_list()
153164
return tw.run_tests()
154165

@@ -159,6 +170,7 @@ def parse_args():
159170
parser.add_argument('-e', '--executable', help='Talk to the test executable')
160171
parser.add_argument('-n', '--name', help='Test run name')
161172
parser.add_argument('-o', '--output', help='Output JUnit format test report')
173+
parser.add_argument('-m', '--mock', help='Set python script to use for mocking purposes')
162174
return parser.parse_args()
163175

164176
def main():
@@ -178,8 +190,12 @@ def main():
178190
if spawn_func is None:
179191
debug_print("Please specify port or executable", file=sys.stderr)
180192
return 1
193+
mocks = {}
194+
if args.mock is not None:
195+
mocks_mod = imp.load_source('mocks', args.mock)
196+
mocks = mock_decorators.env
181197
with spawn_func(spawn_arg) as sp:
182-
ts = run_tests(sp, name)
198+
ts = run_tests(sp, name, mocks)
183199
if args.output:
184200
with open(args.output, "w") as f:
185201
TestSuite.to_file(f, [ts])

tests/device/test_FS/test_FS.ino

+1-1
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ TEST_CASE("files can be renamed", "[fs]")
9090
}
9191
}
9292

93-
TEST_CASE("FS::info works")
93+
TEST_CASE("FS::info works","[fs]")
9494
{
9595
REQUIRE(SPIFFS.begin());
9696
FSInfo info;
+18
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
-----BEGIN CERTIFICATE-----
2+
MIICzzCCAbcCCQCUajf39FoF8jANBgkqhkiG9w0BAQsFADAWMRQwEgYDVQQDDAtj
3+
YS50bHMudGVzdDAeFw0xNjA0MjIxMTU1MTla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