Skip to content

Commit 27f8893

Browse files
authored
Merge pull request esp8266#3 from earlephilhower/reducei2ciram
Reducei2ciram
2 parents 1c421e8 + 3552bfc commit 27f8893

28 files changed

+642
-138
lines changed

README.md

+7-7
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,9 @@ Arduino core for ESP8266 WiFi chip
99

1010
# Arduino on ESP8266
1111

12-
This project brings support for ESP8266 chip to the Arduino environment. It lets you write sketches using familiar Arduino functions and libraries, and run them directly on ESP8266, no external microcontroller required.
12+
This project brings support for the ESP8266 chip to the Arduino environment. It lets you write sketches, using familiar Arduino functions and libraries, and run them directly on ESP8266, with no external microcontroller required.
1313

14-
ESP8266 Arduino core comes with libraries to communicate over WiFi using TCP and UDP, set up HTTP, mDNS, SSDP, and DNS servers, do OTA updates, use a file system in flash memory, work with SD cards, servos, SPI and I2C peripherals.
14+
ESP8266 Arduino core comes with libraries to communicate over WiFi using TCP and UDP, set up HTTP, mDNS, SSDP, and DNS servers, do OTA updates, use a file system in flash memory, and work with SD cards, servos, SPI and I2C peripherals.
1515

1616
# Contents
1717
- Installing options:
@@ -71,9 +71,9 @@ python get.py
7171
### Using PlatformIO
7272

7373
[PlatformIO](https://platformio.org?utm_source=github&utm_medium=arduino-esp8266) is an open source ecosystem for IoT
74-
development with a cross-platform build system, library manager and full support
75-
for Espressif (ESP8266) development. It works on the popular host OS: macOS, Windows,
76-
Linux 32/64, Linux ARM (like Raspberry Pi, BeagleBone, CubieBoard).
74+
development with a cross-platform build system, a library manager, and full support
75+
for Espressif (ESP8266) development. It works on the following popular host operating systems: macOS, Windows,
76+
Linux 32/64, and Linux ARM (like Raspberry Pi, BeagleBone, CubieBoard).
7777

7878
- [What is PlatformIO?](https://docs.platformio.org/en/latest/what-is-platformio.html?utm_source=github&utm_medium=arduino-esp8266)
7979
- [PlatformIO IDE](https://platformio.org/platformio-ide?utm_source=github&utm_medium=arduino-esp8266)
@@ -95,7 +95,7 @@ Documentation for latest development version: https://arduino-esp8266.readthedoc
9595

9696
### Issues and support ###
9797

98-
[ESP8266 Community Forum](https://www.esp8266.com/u/arduinoanswers) is a well-established community for questions and answers about Arduino for ESP8266. If you need help, have a "How do I..." type question, have a problem with a 3rd party lib not hosted in this repo, or just want to discuss how to approach a problem, please ask there.
98+
[ESP8266 Community Forum](https://www.esp8266.com/u/arduinoanswers) is a well-established community for questions and answers about Arduino for ESP8266. If you need help, have a "How do I..." type question, have a problem with a 3rd party library not hosted in this repo, or just want to discuss how to approach a problem, please ask there.
9999

100100
If you find the forum useful, please consider supporting it with a donation. <br />
101101
[![Donate](https://img.shields.io/badge/paypal-donate-yellow.svg)](https://www.paypal.com/webscr?cmd=_s-xclick&hosted_button_id=4M56YCWV6PX66)
@@ -107,7 +107,7 @@ Please provide as much context as possible, as well as the information requested
107107
- ESP8266 Arduino core version which you are using (you can check it in Boards Manager)
108108
- your sketch code; please wrap it into a code block, see [Github markdown manual](https://help.github.com/articles/basic-writing-and-formatting-syntax/#quoting-code)
109109
- when encountering an issue that happens at run time, attach the serial output. Wrap it into a code block, just like the code.
110-
- for issues which happen at compile time, enable verbose compiler output in the IDE preferences, and attach that output (also inside a code block)
110+
- for issues that happen at compile time, enable verbose compiler output in the IDE preferences, and attach that output (also inside a code block)
111111
- ESP8266 development board model
112112
- IDE settings (board choice, flash size)
113113
- etc

boards.txt

+61-1
Original file line numberDiff line numberDiff line change
@@ -482,6 +482,8 @@ generic.menu.baud.512000.windows=512000
482482
generic.menu.baud.512000.upload.speed=512000
483483
generic.menu.baud.921600=921600
484484
generic.menu.baud.921600.upload.speed=921600
485+
generic.menu.baud.3000000=3000000
486+
generic.menu.baud.3000000.upload.speed=3000000
485487

486488
##############################################################
487489
esp8285.name=Generic ESP8285 Module
@@ -752,6 +754,8 @@ esp8285.menu.baud.512000.windows=512000
752754
esp8285.menu.baud.512000.upload.speed=512000
753755
esp8285.menu.baud.921600=921600
754756
esp8285.menu.baud.921600.upload.speed=921600
757+
esp8285.menu.baud.3000000=3000000
758+
esp8285.menu.baud.3000000.upload.speed=3000000
755759

756760
##############################################################
757761
espduino.name=ESPDuino (ESP-13 Module)
@@ -763,7 +767,7 @@ espduino.menu.ResetMethod.v1=ESPduino-V1
763767
espduino.menu.ResetMethod.v1.upload.resetmethod=ck
764768
espduino.menu.UploadTool.esptool=Serial
765769
espduino.menu.UploadTool.esptool.upload.tool=esptool
766-
espduino.menu.UploadTool.esptool.upload.verbose=-vv
770+
espduino.menu.UploadTool.esptool.upload.verbose=--trace
767771
espduino.menu.UploadTool.espota=OTA
768772
espduino.menu.UploadTool.espota.upload.tool=espota
769773
espduino.upload.tool=esptool
@@ -946,6 +950,8 @@ espduino.menu.baud.512000.windows=512000
946950
espduino.menu.baud.512000.upload.speed=512000
947951
espduino.menu.baud.921600=921600
948952
espduino.menu.baud.921600.upload.speed=921600
953+
espduino.menu.baud.3000000=3000000
954+
espduino.menu.baud.3000000.upload.speed=3000000
949955

950956
##############################################################
951957
huzzah.name=Adafruit Feather HUZZAH ESP8266
@@ -1132,6 +1138,8 @@ huzzah.menu.baud.512000.windows=512000
11321138
huzzah.menu.baud.512000.upload.speed=512000
11331139
huzzah.menu.baud.921600=921600
11341140
huzzah.menu.baud.921600.upload.speed=921600
1141+
huzzah.menu.baud.3000000=3000000
1142+
huzzah.menu.baud.3000000.upload.speed=3000000
11351143

11361144
##############################################################
11371145
inventone.name=Invent One
@@ -1318,6 +1326,8 @@ inventone.menu.baud.512000.windows=512000
13181326
inventone.menu.baud.512000.upload.speed=512000
13191327
inventone.menu.baud.921600=921600
13201328
inventone.menu.baud.921600.upload.speed=921600
1329+
inventone.menu.baud.3000000=3000000
1330+
inventone.menu.baud.3000000.upload.speed=3000000
13211331

13221332
##############################################################
13231333
cw01.name=XinaBox CW01
@@ -1507,6 +1517,8 @@ cw01.menu.baud.512000.windows=512000
15071517
cw01.menu.baud.512000.upload.speed=512000
15081518
cw01.menu.baud.921600=921600
15091519
cw01.menu.baud.921600.upload.speed=921600
1520+
cw01.menu.baud.3000000=3000000
1521+
cw01.menu.baud.3000000.upload.speed=3000000
15101522

15111523
##############################################################
15121524
espresso_lite_v1.name=ESPresso Lite 1.0
@@ -1696,6 +1708,8 @@ espresso_lite_v1.menu.baud.512000.windows=512000
16961708
espresso_lite_v1.menu.baud.512000.upload.speed=512000
16971709
espresso_lite_v1.menu.baud.921600=921600
16981710
espresso_lite_v1.menu.baud.921600.upload.speed=921600
1711+
espresso_lite_v1.menu.baud.3000000=3000000
1712+
espresso_lite_v1.menu.baud.3000000.upload.speed=3000000
16991713

17001714
##############################################################
17011715
espresso_lite_v2.name=ESPresso Lite 2.0
@@ -1885,6 +1899,8 @@ espresso_lite_v2.menu.baud.512000.windows=512000
18851899
espresso_lite_v2.menu.baud.512000.upload.speed=512000
18861900
espresso_lite_v2.menu.baud.921600=921600
18871901
espresso_lite_v2.menu.baud.921600.upload.speed=921600
1902+
espresso_lite_v2.menu.baud.3000000=3000000
1903+
espresso_lite_v2.menu.baud.3000000.upload.speed=3000000
18881904

18891905
##############################################################
18901906
phoenix_v1.name=Phoenix 1.0
@@ -2074,6 +2090,8 @@ phoenix_v1.menu.baud.512000.windows=512000
20742090
phoenix_v1.menu.baud.512000.upload.speed=512000
20752091
phoenix_v1.menu.baud.921600=921600
20762092
phoenix_v1.menu.baud.921600.upload.speed=921600
2093+
phoenix_v1.menu.baud.3000000=3000000
2094+
phoenix_v1.menu.baud.3000000.upload.speed=3000000
20772095

20782096
##############################################################
20792097
phoenix_v2.name=Phoenix 2.0
@@ -2263,6 +2281,8 @@ phoenix_v2.menu.baud.512000.windows=512000
22632281
phoenix_v2.menu.baud.512000.upload.speed=512000
22642282
phoenix_v2.menu.baud.921600=921600
22652283
phoenix_v2.menu.baud.921600.upload.speed=921600
2284+
phoenix_v2.menu.baud.3000000=3000000
2285+
phoenix_v2.menu.baud.3000000.upload.speed=3000000
22662286

22672287
##############################################################
22682288
nodemcu.name=NodeMCU 0.9 (ESP-12 Module)
@@ -2449,6 +2469,8 @@ nodemcu.menu.baud.512000.windows=512000
24492469
nodemcu.menu.baud.512000.upload.speed=512000
24502470
nodemcu.menu.baud.921600=921600
24512471
nodemcu.menu.baud.921600.upload.speed=921600
2472+
nodemcu.menu.baud.3000000=3000000
2473+
nodemcu.menu.baud.3000000.upload.speed=3000000
24522474

24532475
##############################################################
24542476
nodemcuv2.name=NodeMCU 1.0 (ESP-12E Module)
@@ -2635,6 +2657,8 @@ nodemcuv2.menu.baud.512000.windows=512000
26352657
nodemcuv2.menu.baud.512000.upload.speed=512000
26362658
nodemcuv2.menu.baud.921600=921600
26372659
nodemcuv2.menu.baud.921600.upload.speed=921600
2660+
nodemcuv2.menu.baud.3000000=3000000
2661+
nodemcuv2.menu.baud.3000000.upload.speed=3000000
26382662

26392663
##############################################################
26402664
modwifi.name=Olimex MOD-WIFI-ESP8266(-DEV)
@@ -2841,6 +2865,8 @@ modwifi.menu.baud.512000.windows=512000
28412865
modwifi.menu.baud.512000.upload.speed=512000
28422866
modwifi.menu.baud.921600=921600
28432867
modwifi.menu.baud.921600.upload.speed=921600
2868+
modwifi.menu.baud.3000000=3000000
2869+
modwifi.menu.baud.3000000.upload.speed=3000000
28442870

28452871
##############################################################
28462872
thing.name=SparkFun ESP8266 Thing
@@ -3027,6 +3053,8 @@ thing.menu.baud.512000.windows=512000
30273053
thing.menu.baud.512000.upload.speed=512000
30283054
thing.menu.baud.921600=921600
30293055
thing.menu.baud.921600.upload.speed=921600
3056+
thing.menu.baud.3000000=3000000
3057+
thing.menu.baud.3000000.upload.speed=3000000
30303058

30313059
##############################################################
30323060
thingdev.name=SparkFun ESP8266 Thing Dev
@@ -3213,6 +3241,8 @@ thingdev.menu.baud.512000.windows=512000
32133241
thingdev.menu.baud.512000.upload.speed=512000
32143242
thingdev.menu.baud.921600=921600
32153243
thingdev.menu.baud.921600.upload.speed=921600
3244+
thingdev.menu.baud.3000000=3000000
3245+
thingdev.menu.baud.3000000.upload.speed=3000000
32163246

32173247
##############################################################
32183248
esp210.name=SweetPea ESP-210
@@ -3399,6 +3429,8 @@ esp210.menu.baud.512000.windows=512000
33993429
esp210.menu.baud.512000.upload.speed=512000
34003430
esp210.menu.baud.921600=921600
34013431
esp210.menu.baud.921600.upload.speed=921600
3432+
esp210.menu.baud.3000000=3000000
3433+
esp210.menu.baud.3000000.upload.speed=3000000
34023434

34033435
##############################################################
34043436
d1_mini.name=LOLIN(WEMOS) D1 R2 & mini
@@ -3585,6 +3617,8 @@ d1_mini.menu.baud.460800.macosx=460800
35853617
d1_mini.menu.baud.460800.upload.speed=460800
35863618
d1_mini.menu.baud.512000.windows=512000
35873619
d1_mini.menu.baud.512000.upload.speed=512000
3620+
d1_mini.menu.baud.3000000=3000000
3621+
d1_mini.menu.baud.3000000.upload.speed=3000000
35883622

35893623
##############################################################
35903624
d1_mini_pro.name=LOLIN(WEMOS) D1 mini Pro
@@ -3754,6 +3788,8 @@ d1_mini_pro.menu.baud.460800.macosx=460800
37543788
d1_mini_pro.menu.baud.460800.upload.speed=460800
37553789
d1_mini_pro.menu.baud.512000.windows=512000
37563790
d1_mini_pro.menu.baud.512000.upload.speed=512000
3791+
d1_mini_pro.menu.baud.3000000=3000000
3792+
d1_mini_pro.menu.baud.3000000.upload.speed=3000000
37573793

37583794
##############################################################
37593795
d1_mini_lite.name=LOLIN(WEMOS) D1 mini Lite
@@ -3980,6 +4016,8 @@ d1_mini_lite.menu.baud.460800.macosx=460800
39804016
d1_mini_lite.menu.baud.460800.upload.speed=460800
39814017
d1_mini_lite.menu.baud.512000.windows=512000
39824018
d1_mini_lite.menu.baud.512000.upload.speed=512000
4019+
d1_mini_lite.menu.baud.3000000=3000000
4020+
d1_mini_lite.menu.baud.3000000.upload.speed=3000000
39834021

39844022
##############################################################
39854023
d1.name=WeMos D1 R1
@@ -4166,6 +4204,8 @@ d1.menu.baud.460800.macosx=460800
41664204
d1.menu.baud.460800.upload.speed=460800
41674205
d1.menu.baud.512000.windows=512000
41684206
d1.menu.baud.512000.upload.speed=512000
4207+
d1.menu.baud.3000000=3000000
4208+
d1.menu.baud.3000000.upload.speed=3000000
41694209

41704210
##############################################################
41714211
espino.name=ESPino (ESP-12 Module)
@@ -4355,6 +4395,8 @@ espino.menu.baud.512000.windows=512000
43554395
espino.menu.baud.512000.upload.speed=512000
43564396
espino.menu.baud.921600=921600
43574397
espino.menu.baud.921600.upload.speed=921600
4398+
espino.menu.baud.3000000=3000000
4399+
espino.menu.baud.3000000.upload.speed=3000000
43584400

43594401
##############################################################
43604402
espinotee.name=ThaiEasyElec's ESPino
@@ -4541,6 +4583,8 @@ espinotee.menu.baud.512000.windows=512000
45414583
espinotee.menu.baud.512000.upload.speed=512000
45424584
espinotee.menu.baud.921600=921600
45434585
espinotee.menu.baud.921600.upload.speed=921600
4586+
espinotee.menu.baud.3000000=3000000
4587+
espinotee.menu.baud.3000000.upload.speed=3000000
45444588

45454589
##############################################################
45464590
wifinfo.name=WifInfo
@@ -4787,6 +4831,8 @@ wifinfo.menu.baud.512000.windows=512000
47874831
wifinfo.menu.baud.512000.upload.speed=512000
47884832
wifinfo.menu.baud.921600=921600
47894833
wifinfo.menu.baud.921600.upload.speed=921600
4834+
wifinfo.menu.baud.3000000=3000000
4835+
wifinfo.menu.baud.3000000.upload.speed=3000000
47904836

47914837
##############################################################
47924838
arduino-esp8266.name=Arduino
@@ -4985,6 +5031,8 @@ arduino-esp8266.menu.baud.512000.windows=512000
49855031
arduino-esp8266.menu.baud.512000.upload.speed=512000
49865032
arduino-esp8266.menu.baud.921600=921600
49875033
arduino-esp8266.menu.baud.921600.upload.speed=921600
5034+
arduino-esp8266.menu.baud.3000000=3000000
5035+
arduino-esp8266.menu.baud.3000000.upload.speed=3000000
49885036

49895037
##############################################################
49905038
gen4iod.name=4D Systems gen4 IoD Range
@@ -5172,6 +5220,8 @@ gen4iod.menu.baud.512000.windows=512000
51725220
gen4iod.menu.baud.512000.upload.speed=512000
51735221
gen4iod.menu.baud.921600=921600
51745222
gen4iod.menu.baud.921600.upload.speed=921600
5223+
gen4iod.menu.baud.3000000=3000000
5224+
gen4iod.menu.baud.3000000.upload.speed=3000000
51755225

51765226
##############################################################
51775227
oak.name=Digistump Oak
@@ -5359,6 +5409,8 @@ oak.menu.baud.460800.macosx=460800
53595409
oak.menu.baud.460800.upload.speed=460800
53605410
oak.menu.baud.512000.windows=512000
53615411
oak.menu.baud.512000.upload.speed=512000
5412+
oak.menu.baud.3000000=3000000
5413+
oak.menu.baud.3000000.upload.speed=3000000
53625414

53635415
##############################################################
53645416
wifiduino.name=WiFiduino
@@ -5545,6 +5597,8 @@ wifiduino.menu.baud.460800.macosx=460800
55455597
wifiduino.menu.baud.460800.upload.speed=460800
55465598
wifiduino.menu.baud.512000.windows=512000
55475599
wifiduino.menu.baud.512000.upload.speed=512000
5600+
wifiduino.menu.baud.3000000=3000000
5601+
wifiduino.menu.baud.3000000.upload.speed=3000000
55485602

55495603
##############################################################
55505604
wifi_slot.name=Amperka WiFi Slot
@@ -5841,6 +5895,8 @@ wifi_slot.menu.baud.512000.windows=512000
58415895
wifi_slot.menu.baud.512000.upload.speed=512000
58425896
wifi_slot.menu.baud.921600=921600
58435897
wifi_slot.menu.baud.921600.upload.speed=921600
5898+
wifi_slot.menu.baud.3000000=3000000
5899+
wifi_slot.menu.baud.3000000.upload.speed=3000000
58445900

58455901
##############################################################
58465902
wiolink.name=Seeed Wio Link
@@ -6027,6 +6083,8 @@ wiolink.menu.baud.512000.windows=512000
60276083
wiolink.menu.baud.512000.upload.speed=512000
60286084
wiolink.menu.baud.921600=921600
60296085
wiolink.menu.baud.921600.upload.speed=921600
6086+
wiolink.menu.baud.3000000=3000000
6087+
wiolink.menu.baud.3000000.upload.speed=3000000
60306088

60316089
##############################################################
60326090
espectro.name=ESPectro Core
@@ -6213,4 +6271,6 @@ espectro.menu.baud.512000.windows=512000
62136271
espectro.menu.baud.512000.upload.speed=512000
62146272
espectro.menu.baud.921600=921600
62156273
espectro.menu.baud.921600.upload.speed=921600
6274+
espectro.menu.baud.3000000=3000000
6275+
espectro.menu.baud.3000000.upload.speed=3000000
62166276

cores/esp8266/Arduino.h

+4-21
Original file line numberDiff line numberDiff line change
@@ -142,30 +142,9 @@ void timer0_detachInterrupt(void);
142142
void ets_intr_lock();
143143
void ets_intr_unlock();
144144

145-
#ifndef __STRINGIFY
146-
#define __STRINGIFY(a) #a
147-
#endif
148-
149-
// these low level routines provide a replacement for SREG interrupt save that AVR uses
150-
// but are esp8266 specific. A normal use pattern is like
151-
//
152-
//{
153-
// uint32_t savedPS = xt_rsil(1); // this routine will allow level 2 and above
154-
// // do work here
155-
// xt_wsr_ps(savedPS); // restore the state
156-
//}
157-
//
158-
// level (0-15), interrupts of the given level and above will be active
159-
// level 15 will disable ALL interrupts,
160-
// level 0 will enable ALL interrupts,
161-
//
162-
#define xt_rsil(level) (__extension__({uint32_t state; __asm__ __volatile__("rsil %0," __STRINGIFY(level) : "=a" (state) :: "memory"); state;}))
163-
#define xt_wsr_ps(state) __asm__ __volatile__("wsr %0,ps; isync" :: "a" (state) : "memory")
164-
165145
#define interrupts() xt_rsil(0)
166146
#define noInterrupts() xt_rsil(15)
167147

168-
169148
#define clockCyclesPerMicrosecond() ( F_CPU / 1000000L )
170149
#define clockCyclesToMicroseconds(a) ( (a) / clockCyclesPerMicrosecond() )
171150
#define microsecondsToClockCycles(a) ( (a) * clockCyclesPerMicrosecond() )
@@ -303,6 +282,10 @@ extern "C" void configTime(long timezone, int daylightOffset_sec,
303282

304283
#include "pins_arduino.h"
305284

285+
#ifndef PUYA_SUPPORT
286+
#define PUYA_SUPPORT 1
287+
#endif
288+
306289
#endif
307290

308291
#ifdef DEBUG_ESP_OOM

cores/esp8266/Esp.h

+1-3
Original file line numberDiff line numberDiff line change
@@ -209,9 +209,7 @@ class EspClass {
209209
#ifndef CORE_MOCK
210210
uint32_t EspClass::getCycleCount()
211211
{
212-
uint32_t ccount;
213-
__asm__ __volatile__("esync; rsr %0,ccount":"=a" (ccount));
214-
return ccount;
212+
return esp_get_cycle_count();
215213
}
216214

217215
#endif // !defined(CORE_MOCK)

cores/esp8266/WString.cpp

+6-1
Original file line numberDiff line numberDiff line change
@@ -330,7 +330,12 @@ unsigned char String::concat(const char *cstr, unsigned int length) {
330330
return 1;
331331
if(!reserve(newlen))
332332
return 0;
333-
memmove(wbuffer() + len(), cstr, length + 1);
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);
334339
setLen(newlen);
335340
return 1;
336341
}

0 commit comments

Comments
 (0)