Skip to content

Commit cd658e7

Browse files
committed
Merge remote-tracking branch 'esporigin/esp8266' into SPIFFS-OTA
2 parents a7846ae + d31aa5a commit cd658e7

File tree

6 files changed

+29
-20
lines changed

6 files changed

+29
-20
lines changed

hardware/esp8266com/esp8266/cores/esp8266/WString.cpp

+11-5
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,7 @@ ICACHE_FLASH_ATTR String::String(double value, unsigned char decimalPlaces) {
118118
}
119119

120120
ICACHE_FLASH_ATTR String::~String() {
121-
os_free(buffer);
121+
free(buffer);
122122
}
123123

124124
// /*********************************************/
@@ -133,7 +133,7 @@ inline void String::init(void) {
133133

134134
void ICACHE_FLASH_ATTR String::invalidate(void) {
135135
if(buffer)
136-
os_free(buffer);
136+
free(buffer);
137137
buffer = NULL;
138138
capacity = len = 0;
139139
}
@@ -150,12 +150,18 @@ unsigned char ICACHE_FLASH_ATTR String::reserve(unsigned int size) {
150150
}
151151

152152
unsigned char ICACHE_FLASH_ATTR String::changeBuffer(unsigned int maxStrLen) {
153-
char *newbuffer = (char *) os_realloc(buffer, maxStrLen + 1);
153+
size_t newSize = (maxStrLen + 16) & (~0xf);
154+
char *newbuffer = (char *) malloc(newSize);
154155
if(newbuffer) {
156+
memset(newbuffer, 0, newSize);
157+
memcpy(newbuffer, buffer, len);
158+
if (buffer)
159+
free(buffer);
160+
capacity = newSize - 1;
155161
buffer = newbuffer;
156-
capacity = maxStrLen;
157162
return 1;
158163
}
164+
buffer = newbuffer;
159165
return 0;
160166
}
161167

@@ -192,7 +198,7 @@ void ICACHE_FLASH_ATTR String::move(String &rhs) {
192198
rhs.len = 0;
193199
return;
194200
} else {
195-
os_free(buffer);
201+
free(buffer);
196202
}
197203
}
198204
buffer = rhs.buffer;

hardware/esp8266com/esp8266/cores/esp8266/core_esp8266_postmortem.c

+14-11
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
1-
/*
1+
/*
22
postmortem.c - output of debug info on sketch crash
33
Copyright (c) 2015 Ivan Grokhotkov. All rights reserved.
44
This file is part of the esp8266 core for Arduino environment.
5-
5+
66
This library is free software; you can redistribute it and/or
77
modify it under the terms of the GNU Lesser General Public
88
License as published by the Free Software Foundation; either
@@ -42,25 +42,28 @@ void __wrap_system_restart_local() {
4242

4343
struct rst_info rst_info = {0};
4444
system_rtc_mem_read(0, &rst_info, sizeof(rst_info));
45-
if (rst_info.reason != REASON_SOFT_WDT_RST &&
45+
if (rst_info.reason != REASON_SOFT_WDT_RST &&
4646
rst_info.reason != REASON_EXCEPTION_RST &&
47-
rst_info.reason != REASON_WDT_RST)
47+
rst_info.reason != REASON_WDT_RST)
4848
{
4949
return;
5050
}
5151

5252
ets_install_putc1(&uart_write_char_d);
5353

5454
if (rst_info.reason == REASON_EXCEPTION_RST) {
55-
ets_printf("\nException (%d):\nepc1=0x%08x epc2=0x%08x epc3=0x%08x excvaddr=0x%08x depc=0x%08x\n",
55+
ets_printf("\nException (%d):\nepc1=0x%08x epc2=0x%08x epc3=0x%08x excvaddr=0x%08x depc=0x%08x\n",
5656
rst_info.exccause, rst_info.epc1, rst_info.epc2, rst_info.epc3, rst_info.excvaddr, rst_info.depc);
5757
}
58+
else if (rst_info.reason == REASON_SOFT_WDT_RST) {
59+
ets_printf("\nSoft WDT reset\n");
60+
}
5861

5962
uint32_t cont_stack_start = (uint32_t) &(g_cont.stack);
6063
uint32_t cont_stack_end = (uint32_t) g_cont.stack_end;
6164
uint32_t stack_end;
6265

63-
// amount of stack taken by interrupt or exception handler
66+
// amount of stack taken by interrupt or exception handler
6467
// and everything up to __wrap_system_restart_local
6568
// (determined empirically, might break)
6669
uint32_t offset = 0;
@@ -80,13 +83,13 @@ void __wrap_system_restart_local() {
8083
}
8184
else {
8285
ets_printf("\nctx: sys \n");
83-
stack_end = 0x3fffffb0;
84-
// it's actually 0x3ffffff0, but the stuff below ets_run
86+
stack_end = 0x3fffffb0;
87+
// it's actually 0x3ffffff0, but the stuff below ets_run
8588
// is likely not really relevant to the crash
8689
}
87-
90+
8891
ets_printf("sp: %08x end: %08x offset: %04x\n", sp, stack_end, offset);
89-
92+
9093
// print_pcs(sp + offset, stack_end);
9194
print_stack(sp + offset, stack_end);
9295
delayMicroseconds(10000);
@@ -102,7 +105,7 @@ static void print_stack(uint32_t start, uint32_t end) {
102105
// rough indicator: stack frames usually have SP saved as the second word
103106
bool looksLikeStackFrame = (values[2] == pos + 0x10);
104107

105-
ets_printf("%08x: %08x %08x %08x %08x %c\n",
108+
ets_printf("%08x: %08x %08x %08x %08x %c\n",
106109
pos, values[0], values[1], values[2], values[3], (looksLikeStackFrame)?'<':' ');
107110
}
108111
ets_printf("<<<stack<<<\n");

hardware/esp8266com/esp8266/doc/reference.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ title: Reference
2626
* [size](#size)
2727
* [name](#name)
2828
* [close](#close)
29-
* [WiFi(ESP8266WiFi library)](#wifiesp8266wifi-library)
29+
* [WiFi(ESP8266WiFi library)](#wifiesp8266wifi-library)
3030
* [Ticker](#ticker)
3131
* [EEPROM](#eeprom)
3232
* [I2C (Wire library)](#i2c-wire-library)
@@ -382,7 +382,7 @@ Size can be anywhere between 4 and 4096 bytes.
382382
whenever you wish to save changes to flash. `EEPROM.end()` will also commit, and will
383383
release the RAM copy of EEPROM contents.
384384

385-
EEPROM library uses one sector of flash located at 0x7b000 for storage.
385+
EEPROM library uses one sector of flash located just after the SPIFFS.
386386

387387
Three examples included.
388388

hardware/esp8266com/esp8266/libraries/ESP8266WebServer/src/ESP8266WebServer.cpp

+2-2
Original file line numberDiff line numberDiff line change
@@ -130,10 +130,10 @@ void ESP8266WebServer::_prepareHeader(String& response, int code, const char* co
130130

131131
sendHeader("Content-Type", content_type, true);
132132
if (_contentLength != CONTENT_LENGTH_UNKNOWN && _contentLength != CONTENT_LENGTH_NOT_SET) {
133-
sendHeader("Content-Length", String(_contentLength).c_str());
133+
sendHeader("Content-Length", String(_contentLength));
134134
}
135135
else if (contentLength > 0){
136-
sendHeader("Content-Length", String(contentLength).c_str());
136+
sendHeader("Content-Length", String(contentLength));
137137
}
138138
sendHeader("Connection", "close");
139139
sendHeader("Access-Control-Allow-Origin", "*");
-300 Bytes
Binary file not shown.
Binary file not shown.

0 commit comments

Comments
 (0)