8000 Merge branch 'master' into createtime · esp8266/Arduino@454feeb · GitHub
[go: up one dir, main page]

Skip to content

Commit 454feeb

Browse files
Merge branch 'master' into createtime
2 parents 9db7e78 + 50a491b commit 454feeb

File tree

20 files changed

+672
-92
lines changed

20 files changed

+672
-92
lines changed

.travis.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,11 +24,15 @@ jobs:
2424
- name: "Platformio (1)"
2525
stage: build
2626
script: $TRAVIS_BUILD_DIR/tests/platformio.sh
27+
install:
28+
- sudo apt-get install python3-pip python3-setuptools
2729
env:
2830
- BUILD_PARITY=even
2931
- name: "Platformio (2)"
3032
stage: build
3133
script: $TRAVIS_BUILD_DIR/tests/platformio.sh
34+
install:
35+
- sudo apt-get install python3-pip python3-setuptools
3236
env:
3337
- BUILD_PARITY=odd
3438

boards.txt

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6637,18 +6637,18 @@ espectro.menu.baud.3000000.upload.speed=3000000
66376637

66386638
##############################################################
66396639
sonoff.name=ITEAD Sonoff
6640-
sonoff.build.board=SONOFF_SV
6640+
sonoff.build.board=ESP8266_SONOFF_SV
66416641
sonoff.build.extra_flags=-DESP8266
66426642
sonoff.build.flash_size=1M
66436643
sonoff.build.variant=itead
66446644
sonoff.menu.BoardModel.sonoffBasic=ITEAD Sonoff Basic
6645-
sonoff.menu.BoardModel.sonoffBasic.build.board=SONOFF_BASIC
6645+
sonoff.menu.BoardModel.sonoffBasic.build.board=ESP8266_SONOFF_BASIC
66466646
sonoff.menu.BoardModel.sonoffS20=ITEAD Sonoff S20
6647-
sonoff.menu.BoardModel.sonoffS20.build.board=SONOFF_S20
6647+
sonoff.menu.BoardModel.sonoffS20.build.board=ESP8266_SONOFF_S20
66486648
sonoff.menu.BoardModel.sonoffSV=ITEAD Sonoff SV
6649-
sonoff.menu.BoardModel.sonoffSV.build.board=SONOFF_SV
6649+
sonoff.menu.BoardModel.sonoffSV.build.board=ESP8266_SONOFF_SV
66506650
sonoff.menu.BoardModel.sonoffTH=ITEAD Sonoff TH
6651-
sonoff.menu.BoardModel.sonoffTH.build.board=SONOFF_TH
6651+
sonoff.menu.BoardModel.sonoffTH.build.board=ESP8266_SONOFF_TH
66526652
sonoff.upload.tool=esptool
66536653
sonoff.upload.maximum_data_size=81920
66546654
sonoff.upload.wait_for_upload_port=true

bootloaders/eboot/Makefile

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -29,13 +29,13 @@ CFLAGS += $(INC)
2929

3030
CFLAGS += $(UZLIB_FLAGS)
3131

32-
LDFLAGS += -nostdlib -Wl,--no-check-sections -Wl,--gc-sections -umain
32+
LDFLAGS += -nostdlib -Wl,--no-check-sections -Wl,--gc-sections -umain -Wl,-Map,$(@:.elf=.map)
3333

3434
LD_SCRIPT := -Teboot.ld
3535

36-
APP_OUT:= eboot.elf
37-
APP_AR := eboot.a
38-
APP_FW := eboot.bin
36+
APP_OUT := eboot.elf
37+
APP_AR := eboot.a
38+
APP_FW := eboot.bin
3939

4040

4141
all: $(APP_OUT)
@@ -49,13 +49,14 @@ tinfgzip.o: $(UZLIB_PATH)/tinfgzip.c $(UZLIB_PATH)/uzlib.h $(UZLIB_PATH)/uzlib_c
4949
$(APP_AR): $(TARGET_OBJ_PATHS) tinflate.o tinfgzip.o
5050
$(AR) cru $@ $^
5151

52-
$(APP_OUT): $(APP_AR)
52+
$(APP_OUT): $(APP_AR) eboot.ld | Makefile
5353
$(LD) $(LD_SCRIPT) $(LDFLAGS) -Wl,--start-group -Wl,--whole-archive $(APP_AR) -Wl,--end-group -o $@
5454

5555
clean:
5656
rm -f *.o
5757
rm -f $(APP_AR)
5858
rm -f $(APP_OUT)
59+
rm -f *.map
5960

6061

6162
.PHONY: all clean default

bootloaders/eboot/eboot.elf

136 Bytes
Binary file not shown.

bootloaders/eboot/eboot.ld

Lines changed: 18 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -154,12 +154,24 @@ SECTIONS
154154
*(.gnu.linkonce.b.*)
155155
. = ALIGN (8);
156156
_bss_end = ABSOLUTE(.);
157-
/* CRC stored in last 8 bytes */
158-
ASSERT((. < 4096 - 8), "Error: No space for CRC in bootloader sector.");
159-
. = _stext + 4096 - 8;
160-
_crc_size = .;
161-
. = . + 4;
162-
_crc_val = .;
157+
_free_space = 4096 - 17 - (. - _stext);
158+
/*
159+
The boot loader checksum must be before the CRC, which is written by elf2bin.py.
160+
This leaves 16 bytes after the checksum for the CRC placed at the end of the
161+
4096-byte sector. */
162+
_cs_here = (ALIGN((. + 1), 16) == ALIGN(16)) ? (ALIGN(16) - 1) : (. + 0x0F);
163+
164+
/*
165+
The filling (padding) and values for _crc_size and _crc_val are handled by
166+
elf2bin.py. With this, we give values to the symbols without explicitly
167+
assigning space. This avoids the linkers back *fill* operation that causes
168+
trouble.
169+
170+
The CRC info is stored in last 8 bytes. */
171+
_crc_size = _stext + 4096 - 8;
172+
_crc_val = _stext + 4096 - 4;
173+
ASSERT((4096 > (17 + (. - _stext))), "Error: No space for CS and CRC in bootloader sector.");
174+
ASSERT((_crc_size > _cs_here), "Error: CRC must be located after CS.");
163175
} >iram1_0_seg :iram1_0_phdr
164176

165177
.lit4 : ALIGN(4)

cores/esp8266/Esp.cpp

Lines changed: 23 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -468,34 +468,37 @@ bool EspClass::checkFlashCRC() {
468468

469469

470470
String EspClass::getResetReason(void) {
471-
char buff[32];
472-
if (resetInfo.reason == REASON_DEFAULT_RST) { // normal startup by power on
473-
strcpy_P(buff, PSTR("Power on"));
474-
} else if (resetInfo.reason == REASON_WDT_RST) { // hardware watch dog reset
475-
strcpy_P(buff, PSTR("Hardware Watchdog"));
476-
} else if (resetInfo.reason == REASON_EXCEPTION_RST) { // exception reset, GPIO status won’t change
477-
strcpy_P(buff, PSTR("Exception"));
478-
} else if (resetInfo.reason == REASON_SOFT_WDT_RST) { // software watch dog reset, GPIO status won’t change
479-
strcpy_P(buff, PSTR("Software Watchdog"));
480-
} else if (resetInfo.reason == REASON_SOFT_RESTART) { // software restart ,system_restart , GPIO status won’t change
481-
strcpy_P(buff, PSTR("Software/System restart"));
482-
} else if (resetInfo.reason == REASON_DEEP_SLEEP_AWAKE) { // wake up from deep-sleep
483-
strcpy_P(buff, PSTR("Deep-Sleep Wake"));
484-
} else if (resetInfo.reason == REASON_EXT_SYS_RST) { // external system reset
485-
strcpy_P(buff, PSTR("External System"));
486-
} else {
487-
strcpy_P(buff, PSTR("Unknown"));
471+
const __FlashStringHelper* buff;
472+
473+
switch(resetInfo.reason) {
474+
// normal startup by power on
475+
case REASON_DEFAULT_RST: buff = F("Power On"); break;
476+
// hardware watch dog reset
477+
case REASON_WDT_RST: buff = F("Hardware Watchdog"); break;
478+
// exception reset, GPIO status won’t change
479+
case REASON_EXCEPTION_RST: buff = F("Exception"); break;
480+
// software watch dog reset, GPIO status won’t change
481+
case REASON_SOFT_WDT_RST: buff = F("Software Watchdog"); break;
482+
// software restart ,system_restart , GPIO status won’t change
483+
case REASON_SOFT_RESTART: buff = F("Software/System restart"); break;
484+
// wake up from deep-sleep
485+
case REASON_DEEP_SLEEP_AWAKE: buff = F("Deep-Sleep Wake"); break;
486+
// // external system reset
487+
case REASON_EXT_SYS_RST: buff = F("External System"); break;
488+
default: buff = F("Unknown"); break;
488489
}
489490
return String(buff);
490491
}
491492

492493
String EspClass::getResetInfo(void) {
493-
if(resetInfo.reason != 0) {
494+
if (resetInfo.reason >= REASON_WDT_RST && resetInfo.reason <= REASON_SOFT_WDT_RST) {
494495
char buff[200];
495-
sprintf(&buff[0], "Fatal exception:%d flag:%d (%s) epc1:0x%08x epc2:0x%08x epc3:0x%08x excvaddr:0x%08x depc:0x%08x", resetInfo.exccause, resetInfo.reason, (resetInfo.reason == 0 ? "DEFAULT" : resetInfo.reason == 1 ? "WDT" : resetInfo.reason == 2 ? "EXCEPTION" : resetInfo.reason == 3 ? "SOFT_WDT" : resetInfo.reason == 4 ? "SOFT_RESTART" : resetInfo.reason == 5 ? "DEEP_SLEEP_AWAKE" : resetInfo.reason == 6 ? "EXT_SYS_RST" : "???"), resetInfo.epc1, resetInfo.epc2, resetInfo.epc3, resetInfo.excvaddr, resetInfo.depc);
496+
sprintf_P(buff, PSTR("Fatal exception:%d flag:%d (%s) epc1:0x%08x epc2:0x%08x epc3:0x%08x excvaddr:0x%08x depc:0x%08x"),
497+
resetInfo.exccause, resetInfo.reason, getResetReason().c_str(),
498+
resetInfo.epc1, resetInfo.epc2, resetInfo.epc3, resetInfo.excvaddr, resetInfo.depc);
496499
return String(buff);
497500
}
498-
return String("flag: 0");
501+
return getResetReason();
499502
}
500503

501504
struct rst_info * EspClass::getResetInfoPtr(void) {

cores/esp8266/core_esp8266_postmortem.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ static void ets_printf_P(const char *str, ...) {
8989
vsnprintf(destStr, sizeof(destStr), str, argPtr);
9090
va_end(argPtr);
9191
while (*c) {
92-
ets_putc(*(c++));
92+
ets_uart_putc1(*(c++));
9393
}
9494
}
9595

@@ -147,10 +147,10 @@ void __wrap_system_restart_local() {
147147
// (determined empirically, might break)
148148
uint32_t offset = 0;
149149
if (rst_info.reason == REASON_SOFT_WDT_RST) {
150-
offset = 0x1b0;
150+
offset = 0x1a0;
151151
}
152152
else if (rst_info.reason == REASON_EXCEPTION_RST) {
153-
offset = 0x1a0;
153+
offset = 0x190;
154154
}
155155
else if (rst_info.reason == REASON_WDT_RST) {
156156
offset = 0x10;

libraries/ESP8266HTTPClient/src/ESP8266HTTPClient.cpp

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -549,7 +549,8 @@ bool HTTPClient::setURL(const String& url)
549549
DEBUG_HTTPCLIENT("[HTTP-Client][setURL] new URL not the same protocol, expected '%s', URL: '%s'\n", _protocol.c_str(), url.c_str());
550550
return false;
551551
}
552-
// disconnect but preserve _client
552+
// disconnect but preserve _client (clear _canReuse so disconnect will close the connection)
553+
_canReuse = false;
553554
disconnect(true);
554555
return beginInternal(url, nullptr);
555556
}
@@ -680,7 +681,8 @@ int HTTPClient::sendRequest(const char * type, const uint8_t * payload, size_t s
680681
if (payload && size > 0) {
681682
size_t bytesWritten = 0;
682683
const uint8_t *p = payload;
683-
while (bytesWritten < size) {
684+
size_t originalSize = size;
685+
while (bytesWritten < originalSize) {
684686
int written;
685687
int towrite = std::min((int)size, (int)HTTP_TCP_BUFFER_SIZE);
686688
written = _client->write(p + bytesWritten, towrite);

libraries/ESP8266HTTPUpdateServer/src/ESP8266HTTPUpdateServer-impl.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,12 +21,12 @@ static const char serverIndex[] PROGMEM =
2121
<body>
2222
<form method='POST' action='' enctype='multipart/form-data'>
2323
Firmware:<br>
24-
<input type='file' accept='.bin' name='firmware'>
24+
<input type='file' accept='.bin,.bin.gz' name='firmware'>
2525
<input type='submit' value='Update Firmware'>
2626
</form>
2727
<form method='POST' action='' enctype='multipart/form-data'>
2828
FileSystem:<br>
29-
<input type='file' accept='.bin' name='filesystem'>
29+
<input type='file' accept='.bin,.bin.gz' name='filesystem'>
3030
<input type='submit' value='Update FileSystem'>
3131
</form>
3232
</body>

libraries/ESP8266mDNS/src/LEAmDNS.cpp

Lines changed: 24 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -114,33 +114,20 @@ bool MDNSResponder::begin(const char* p_pcHostname, const IPAddress& p_IPAddress
114114
IPAddress sta = WiFi.localIP();
115115
IPAddress ap = WiFi.softAPIP();
116116

117-
if (!sta.isSet() && !ap.isSet())
117+
if (sta.isSet())
118118
{
119-
120-
DEBUG_EX_INFO(DEBUG_OUTPUT.printf_P(PSTR("[MDNSResponder] internal interfaces (STA, AP) are not set (none was specified)\n")));
121-
return false;
119+
DEBUG_EX_INFO(DEBUG_OUTPUT.printf_P(PSTR("[MDNSResponder] STA interface selected\n")));
120+
ipAddress = sta;
122121
}
123-
124-
if (ap.isSet())
122+
else if (ap.isSet())
125123
{
126-
127-
if (sta.isSet())
128-
{
129-
DEBUG_EX_INFO(DEBUG_OUTPUT.printf_P(PSTR("[MDNSResponder] default interface AP selected over STA (none was specified)\n")));
130-
}
131-
else
132-
{
133-
DEBUG_EX_INFO(DEBUG_OUTPUT.printf_P(PSTR("[MDNSResponder] default interface AP selected\n")));
134-
}
124+
DEBUG_EX_INFO(DEBUG_OUTPUT.printf_P(PSTR("[MDNSResponder] AP interface selected\n")));
135125
ipAddress = ap;
136-
137126
}
138127
else
139128
{
140-
141-
DEBUG_EX_INFO(DEBUG_OUTPUT.printf_P(PSTR("[MDNSResponder] default interface STA selected (none was specified)\n")));
142-
ipAddress = sta;
143-
129+
DEBUG_EX_INFO(DEBUG_OUTPUT.printf_P(PSTR("[MDNSResponder] standard interfaces are not up, please specify one in ::begin()\n")));
130+
return false;
144131
}
145132

146133
// continue to ensure interface is UP
@@ -215,18 +202,26 @@ bool MDNSResponder::begin(const char* p_pcHostname, const IPAddress& p_IPAddress
215202
*/
216203
bool MDNSResponder::close(void)
217204
{
205+
bool bResult = false;
218206

219-
m_GotIPHandler.reset(); // reset WiFi event callbacks.
220-
m_DisconnectedHandler.reset();
207+
if (0 != m_pUDPContext)
208+
{
209+
m_GotIPHandler.reset(); // reset WiFi event callbacks.
210+
m_DisconnectedHandler.reset();
221211

222-
_announce(false, true);
223-
_resetProbeStatus(false); // Stop probing
212+
_announce(false, true);
213+
_resetProbeStatus(false); // Stop probing
214+
_releaseServiceQueries();
215+
_releaseUDPContext();
216+
_releaseHostname();
224217

225-
_releaseServiceQueries();
226-
_releaseUDPContext();
227-
_releaseHostname();
228-
229-
return true;
218+
bResult = true;
219+
}
220+
else
221+
{
222+
DEBUG_EX_INFO(DEBUG_OUTPUT.printf_P(PSTR("[MDNSResponder] close: Ignoring call to close!\n")););
223+
}
224+
return bResult;
230225
}
231226

232227
/*

0 commit comments

Comments
 (0)
0