Skip to content

Commit a396bcd

Browse files
authored
Merge branch 'master' into esptool_reset_method
2 parents fb31335 + 418b00f commit a396bcd

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

47 files changed

+530
-137
lines changed

boards.txt

+12
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,10 @@ generic.menu.FlashFreq.40=40MHz
7474
generic.menu.FlashFreq.40.build.flash_freq=40
7575
generic.menu.FlashFreq.80=80MHz
7676
generic.menu.FlashFreq.80.build.flash_freq=80
77+
generic.menu.FlashFreq.20=20MHz
78+
generic.menu.FlashFreq.20.build.flash_freq=20
79+
generic.menu.FlashFreq.26=26MHz
80+
generic.menu.FlashFreq.26.build.flash_freq=26
7781
generic.menu.FlashMode.dout=DOUT (compatible)
7882
generic.menu.FlashMode.dout.build.flash_mode=dout
7983
generic.menu.FlashMode.dout.build.flash_flags=-DFLASHMODE_DOUT
@@ -4754,6 +4758,10 @@ wifinfo.menu.FlashFreq.40=40MHz
47544758
wifinfo.menu.FlashFreq.40.build.flash_freq=40
47554759
wifinfo.menu.FlashFreq.80=80MHz
47564760
wifinfo.menu.FlashFreq.80.build.flash_freq=80
4761+
wifinfo.menu.FlashFreq.20=20MHz
4762+
wifinfo.menu.FlashFreq.20.build.flash_freq=20
4763+
wifinfo.menu.FlashFreq.26=26MHz
4764+
wifinfo.menu.FlashFreq.26.build.flash_freq=26
47574765
wifinfo.menu.eesz.1M64=1MB (FS:64KB OTA:~470KB)
47584766
wifinfo.menu.eesz.1M64.build.flash_size=1M
47594767
wifinfo.menu.eesz.1M64.build.flash_size_bytes=0x100000
@@ -5774,6 +5782,10 @@ wifi_slot.menu.FlashFreq.40=40MHz
57745782
wifi_slot.menu.FlashFreq.40.build.flash_freq=40
57755783
wifi_slot.menu.FlashFreq.80=80MHz
57765784
wifi_slot.menu.FlashFreq.80.build.flash_freq=80
5785+
wifi_slot.menu.FlashFreq.20=20MHz
5786+
wifi_slot.menu.FlashFreq.20.build.flash_freq=20
5787+
wifi_slot.menu.FlashFreq.26=26MHz
5788+
wifi_slot.menu.FlashFreq.26.build.flash_freq=26
57775789
wifi_slot.menu.FlashMode.dout=DOUT (compatible)
57785790
wifi_slot.menu.FlashMode.dout.build.flash_mode=dout
57795791
wifi_slot.menu.FlashMode.dout.build.flash_flags=-DFLASHMODE_DOUT

cores/esp8266/HardwareSerial.cpp

+12-3
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,15 @@ void HardwareSerial::end()
6060
_uart = NULL;
6161
}
6262

63+
void HardwareSerial::updateBaudRate(unsigned long baud)
64+
{
65+
if(!_uart) {
66+
return;
67+
}
68+
69+
uart_set_baudrate(_uart, baud);
70+
}
71+
6372
size_t HardwareSerial::setRxBufferSize(size_t size){
6473
if(_uart) {
6574
_rx_size = uart_resize_rx_buffer(_uart, size);
@@ -133,8 +142,8 @@ unsigned long HardwareSerial::detectBaudrate(time_t timeoutMillis)
133142
return detectedBaudrate;
134143
}
135144

136-
size_t HardwareSerial::readBytes(char* buffer, size_t size)
137-
{
145+
size_t HardwareSerial::readBytes(char* buffer, size_t size)
146+
{
138147
size_t got = 0;
139148

140149
while (got < size)
@@ -147,7 +156,7 @@ size_t HardwareSerial::readBytes(char* buffer, size_t size)
147156
got += read(buffer + got, std::min(size - got, avail));
148157
}
149158
return got;
150-
}
159+
}
151160

152161
#if !defined(NO_GLOBAL_INSTANCES) && !defined(NO_GLOBAL_SERIAL)
153162
HardwareSerial Serial(UART0);

cores/esp8266/HardwareSerial.h

+2
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,8 @@ class HardwareSerial: public Stream
8888

8989
void end();
9090

91+
void updateBaudRate(unsigned long baud);
92+
9193
size_t setRxBufferSize(size_t size);
9294
size_t getRxBufferSize()
9395
{

cores/esp8266/WString.cpp

+14-19
Original file line numberDiff line numberDiff line change
@@ -185,7 +185,7 @@ unsigned char String::changeBuffer(unsigned int maxStrLen) {
185185
size_t oldSize = capacity() + 1; // include NULL.
186186
if (isSSO()) {
187187
// Copy the SSO buffer into allocated space
188-
memmove(newbuffer, sso.buff, sizeof(sso.buff));
188+
memmove_P(newbuffer, sso.buff, sizeof(sso.buff));
189189
}
190190
if (newSize > oldSize)
191191
{
@@ -210,7 +210,7 @@ String & String::copy(const char *cstr, unsigned int length) {
210210
return *this;
211211
}
212212
setLen(length);
213-
memmove(wbuffer(), cstr, length + 1);
213+
memmove_P(wbuffer(), cstr, length + 1);
214214
return *this;
215215
}
216216

@@ -228,7 +228,7 @@ String & String::copy(const __FlashStringHelper *pstr, unsigned int length) {
228228
void String::move(String &rhs) {
229229
if(buffer()) {
230230
if(capacity() >= rhs.len()) {
231-
memmove(wbuffer(), rhs.buffer(), rhs.length() + 1);
231+
memmove_P(wbuffer(), rhs.buffer(), rhs.length() + 1);
232232
setLen(rhs.len());
233233
rhs.invalidate();
234234
return;
@@ -241,7 +241,7 @@ void String::move(String &rhs) {
241241
}
242242
if (rhs.isSSO()) {
243243
setSSO(true);
244-
memmove(sso.buff, rhs.sso.buff, sizeof(sso.buff));
244+
memmove_P(sso.buff, rhs.sso.buff, sizeof(sso.buff));
245245
} else {
246246
setSSO(false);
247247
setBuffer(rhs.wbuffer());
@@ -313,7 +313,7 @@ unsigned char String::concat(const String &s) {
313313
return 1;
314314
if (!reserve(newlen))
315315
return 0;
316-
memmove(wbuffer() + len(), buffer(), len());
316+
memmove_P(wbuffer() + len(), buffer(), len());
317317
setLen(newlen);
318318
wbuffer()[len()] = 0;
319319
return 1;
@@ -330,12 +330,7 @@ unsigned char String::concat(const char *cstr, unsigned int length) {
330330
return 1;
331331
if(!reserve(newlen))
332332
return 0;
333-
if (cstr >= wbuffer() && cstr < wbuffer() + len())
334-
// compatible with SSO in ram #6155 (case "x += x.c_str()")
335-
memmove(wbuffer() + len(), cstr, length + 1);
336-
else
337-
// compatible with source in flash #6367
338-
memcpy_P(wbuffer() + len(), cstr, length + 1);
333+
memmove_P(wbuffer() + len(), cstr, length + 1);
339334
setLen(newlen);
340335
return 1;
341336
}
@@ -739,21 +734,21 @@ void String::replace(const String& find, const String& replace) {
739734
char *foundAt;
740735
if(diff == 0) {
741736
while((foundAt = strstr(readFrom, find.buffer())) != NULL) {
742-
memmove(foundAt, replace.buffer(), replace.len());
737+
memmove_P(foundAt, replace.buffer(), replace.len());
743738
readFrom = foundAt + replace.len();
744739
}
745740
} else if(diff < 0) {
746741
char *writeTo = wbuffer();
747742
while((foundAt = strstr(readFrom, find.buffer())) != NULL) {
748743
unsigned int n = foundAt - readFrom;
749-
memmove(writeTo, readFrom, n);
744+
memmove_P(writeTo, readFrom, n);
750745
writeTo += n;
751-
memmove(writeTo, replace.buffer(), replace.len());
746+
memmove_P(writeTo, replace.buffer(), replace.len());
752747
writeTo += replace.len();
753748
readFrom = foundAt + find.len();
754749
setLen(len() + diff);
755750
}
756-
memmove(writeTo, readFrom, strlen(readFrom)+1);
751+
memmove_P(writeTo, readFrom, strlen(readFrom)+1);
757752
} else {
758753
unsigned int size = len(); // compute size needed for result
759754
while((foundAt = strstr(readFrom, find.buffer())) != NULL) {
@@ -767,9 +762,9 @@ void String::replace(const String& find, const String& replace) {
767762
int index = len() - 1;
768763
while(index >= 0 && (index = lastIndexOf(find, index)) >= 0) {
769764
readFrom = wbuffer() + index + find.len();
770-
memmove(readFrom + diff, readFrom, len() - (readFrom - buffer()));
765+
memmove_P(readFrom + diff, readFrom, len() - (readFrom - buffer()));
771766
int newLen = len() + diff;
772-
memmove(wbuffer() + index, replace.buffer(), replace.len());
767+
memmove_P(wbuffer() + index, replace.buffer(), replace.len());
773768
setLen(newLen);
774769
wbuffer()[newLen] = 0;
775770
index--;
@@ -797,7 +792,7 @@ void String::remove(unsigned int index, unsigned int count) {
797792
char *writeTo = wbuffer() + index;
798793
unsigned int newlen = len() - count;
799794
setLen(newlen);
800-
memmove(writeTo, wbuffer() + index + count, newlen - index);
795+
memmove_P(writeTo, wbuffer() + index + count, newlen - index);
801796
wbuffer()[newlen] = 0;
802797
}
803798

@@ -829,7 +824,7 @@ void String::trim(void) {
829824
unsigned int newlen = end + 1 - begin;
830825
setLen(newlen);
831826
if(begin > buffer())
832-
memmove(wbuffer(), begin, newlen);
827+
memmove_P(wbuffer(), begin, newlen);
833828
wbuffer()[newlen] = 0;
834829
}
835830

cores/esp8266/esp8266_undocumented.h

+21
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,27 @@ extern int rom_i2c_readReg_Mask(int, int, int, int, int);
1111

1212
extern int uart_baudrate_detect(int, int);
1313

14+
/*
15+
ROM function, uart_buff_switch(), is used to switch printing between UART0 and
16+
UART1. It updates a structure that only controls a select group of print
17+
functions. ets_putc() and ets_uart_printf() are examples and are not affected by
18+
calls to ets_install_putc1().
19+
20+
Use:
21+
0 for UART0, also clears RX FIFO
22+
1 for UART1
23+
*/
24+
extern void uart_buff_switch(uint8_t);
25+
26+
/*
27+
ROM function, ets_uart_printf(), prints on the UART selected by
28+
uart_buff_switch(). Supported format options are the same as vprintf(). Also
29+
has cooked newline behavior. No flash format/string support; however, ISR safe.
30+
Also, uses a static function in ROM to print characters which is only
31+
controlled by uart_buff_switch().
32+
*/
33+
extern int ets_uart_printf(const char *format, ...) __attribute__ ((format (printf, 1, 2)));
34+
1435
extern void ets_delay_us(uint32_t us);
1536

1637
#ifdef __cplusplus

cores/esp8266/spiffs_api.cpp

+15
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,21 @@
2525

2626
using namespace fs;
2727

28+
29+
// Deprecated functions, to be deleted in next release
30+
int32_t spiffs_hal_write(uint32_t addr, uint32_t size, uint8_t *src) {
31+
return flash_hal_write(addr, size, src);
32+
}
33+
int32_t spiffs_hal_erase(uint32_t addr, uint32_t size) {
34+
return flash_hal_erase(addr, size);
35+
}
36+
int32_t spiffs_hal_read(uint32_t addr, uint32_t size, uint8_t *dst) {
37+
return flash_hal_read(addr, size, dst);
38+
}
39+
40+
41+
42+
2843
namespace spiffs_impl {
2944

3045
FileImplPtr SPIFFSImpl::open(const char* path, OpenMode openMode, AccessMode accessMode)

cores/esp8266/spiffs_api.h

+20
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,26 @@ extern "C" {
3939

4040
using namespace fs;
4141

42+
// The following are deprecated symbols and functions, to be removed at the next major release.
43+
// They are provided only for backwards compatibility and to give libs a chance to update.
44+
45+
extern "C" uint32_t _SPIFFS_start __attribute__((deprecated));
46+
extern "C" uint32_t _SPIFFS_end __attribute__((deprecated));
47+
extern "C" uint32_t _SPIFFS_page __attribute__((deprecated));
48+
extern "C" uint32_t _SPIFFS_block __attribute__((deprecated));
49+
50+
#define SPIFFS_PHYS_ADDR ((uint32_t) (&_SPIFFS_start) - 0x40200000)
51+
#define SPIFFS_PHYS_SIZE ((uint32_t) (&_SPIFFS_end) - (uint32_t) (&_SPIFFS_start))
52+
#define SPIFFS_PHYS_PAGE ((uint32_t) &_SPIFFS_page)
53+
#define SPIFFS_PHYS_BLOCK ((uint32_t) &_SPIFFS_block)
54+
55+
extern int32_t spiffs_hal_write(uint32_t addr, uint32_t size, uint8_t *src) __attribute__((deprecated));
56+
extern int32_t spiffs_hal_erase(uint32_t addr, uint32_t size) __attribute__((deprecated));
57+
extern int32_t spiffs_hal_read(uint32_t addr, uint32_t size, uint8_t *dst) __attribute__((deprecated));
58+
59+
60+
61+
4262
namespace spiffs_impl {
4363

4464
int getSpiffsMode(OpenMode openMode, AccessMode accessMode);

0 commit comments

Comments
 (0)