Skip to content

Commit f3a492e

Browse files
committed
Merge branch 'master' into pr-eraseconfig-reset
2 parents 40fba0a + b7f7b74 commit f3a492e

File tree

5 files changed

+91
-34
lines changed

5 files changed

+91
-34
lines changed

README.md

+3-3
Original file line numberDiff line numberDiff line change
@@ -28,9 +28,9 @@ ESP8266 Arduino core comes with libraries to communicate over WiFi using TCP and
2828

2929
Starting with 1.6.4, Arduino allows installation of third-party platform packages using Boards Manager. We have packages available for Windows, Mac OS, and Linux (32 and 64 bit).
3030

31-
- Install the current upstream Arduino IDE at the 1.8.9 level or later. The current version is on the [Arduino website](https://www.arduino.cc/en/software).
32-
- Start Arduino and open the Preferences window.
33-
- Enter ```https://arduino.esp8266.com/stable/package_esp8266com_index.json``` into the *File>Preferences>Additional Boards Manager URLs* field of the Arduino IDE. You can add multiple URLs, separating them with commas.
31+
- [Download and install Arduino IDE 1.x or 2.x](https://www.arduino.cc/en/software)
32+
- Start Arduino and open the Preferences window
33+
- Enter `https://arduino.esp8266.com/stable/package_esp8266com_index.json` into the *File>Preferences>Additional Boards Manager URLs* field of the Arduino IDE. You can add multiple URLs, separating them with commas.
3434
- Open Boards Manager from Tools > Board menu and install *esp8266* platform (and don't forget to select your ESP8266 board from Tools > Board menu after installation).
3535

3636
#### Latest release [![Latest release](https://img.shields.io/github/release/esp8266/Arduino.svg)](https://github.com/esp8266/Arduino/releases/latest/)

cores/esp8266/core_esp8266_main.cpp

+5
Original file line numberDiff line numberDiff line change
@@ -166,6 +166,11 @@ extern "C" void __esp_delay(unsigned long ms) {
166166
extern "C" void esp_delay(unsigned long ms) __attribute__((weak, alias("__esp_delay")));
167167

168168
bool esp_try_delay(const uint32_t start_ms, const uint32_t timeout_ms, const uint32_t intvl_ms) {
169+
if (!timeout_ms) {
170+
esp_yield();
171+
return true;
172+
}
173+
169174
uint32_t expired = millis() - start_ms;
170175
if (expired >= timeout_ms) {
171176
return true; // expired

cores/esp8266/umm_malloc/umm_malloc.cpp

+9-7
Original file line numberDiff line numberDiff line change
@@ -928,7 +928,7 @@ void *umm_realloc(void *ptr, size_t size) {
928928

929929
uint16_t c;
930930

931-
size_t curSize;
931+
[[maybe_unused]] size_t curSize;
932932

933933
UMM_CHECK_INITIALIZED();
934934

@@ -1089,7 +1089,8 @@ void *umm_realloc(void *ptr, size_t size) {
10891089
STATS__FREE_BLOCKS_UPDATE(-prevBlockSize);
10901090
STATS__FREE_BLOCKS_ISR_MIN();
10911091
blockSize += prevBlockSize;
1092-
POISON_CHECK_SET_POISON((void *)&UMM_DATA(c), size); // Fix allocation so ISR poison check is good
1092+
// Fix new allocation such that poison checks from an ISR pass.
1093+
POISON_CHECK_SET_POISON_BLOCKS((void *)&UMM_DATA(c), blockSize);
10931094
UMM_CRITICAL_SUSPEND(id_realloc);
10941095
UMM_POISON_MEMMOVE((void *)&UMM_DATA(c), ptr, curSize);
10951096
ptr = (void *)&UMM_DATA(c);
@@ -1111,7 +1112,7 @@ void *umm_realloc(void *ptr, size_t size) {
11111112
#else
11121113
blockSize += (prevBlockSize + nextBlockSize);
11131114
#endif
1114-
POISON_CHECK_SET_POISON((void *)&UMM_DATA(c), size);
1115+
POISON_CHECK_SET_POISON_BLOCKS((void *)&UMM_DATA(c), blockSize);
11151116
UMM_CRITICAL_SUSPEND(id_realloc);
11161117
UMM_POISON_MEMMOVE((void *)&UMM_DATA(c), ptr, curSize);
11171118
ptr = (void *)&UMM_DATA(c);
@@ -1123,7 +1124,7 @@ void *umm_realloc(void *ptr, size_t size) {
11231124
void *oldptr = ptr;
11241125
if ((ptr = umm_malloc_core(_context, size))) {
11251126
DBGLOG_DEBUG("realloc %i to a bigger block %i, copy, and free the old\n", blockSize, blocks);
1126-
POISON_CHECK_SET_POISON((void *)&UMM_DATA(c), size);
1127+
(void)POISON_CHECK_SET_POISON(ptr, size);
11271128
UMM_CRITICAL_SUSPEND(id_realloc);
11281129
UMM_POISON_MEMCPY(ptr, oldptr, curSize);
11291130
UMM_CRITICAL_RESUME(id_realloc);
@@ -1186,7 +1187,8 @@ void *umm_realloc(void *ptr, size_t size) {
11861187
blockSize = blocks;
11871188
#endif
11881189
}
1189-
POISON_CHECK_SET_POISON((void *)&UMM_DATA(c), size);
1190+
// Fix new allocation such that poison checks from an ISR pass.
1191+
POISON_CHECK_SET_POISON_BLOCKS((void *)&UMM_DATA(c), blockSize);
11901192
UMM_CRITICAL_SUSPEND(id_realloc);
11911193
UMM_POISON_MEMMOVE((void *)&UMM_DATA(c), ptr, curSize);
11921194
ptr = (void *)&UMM_DATA(c);
@@ -1204,7 +1206,7 @@ void *umm_realloc(void *ptr, size_t size) {
12041206
void *oldptr = ptr;
12051207
if ((ptr = umm_malloc_core(_context, size))) {
12061208
DBGLOG_DEBUG("realloc %d to a bigger block %d, copy, and free the old\n", blockSize, blocks);
1207-
POISON_CHECK_SET_POISON((void *)&UMM_DATA(c), size);
1209+
(void)POISON_CHECK_SET_POISON(ptr, size);
12081210
UMM_CRITICAL_SUSPEND(id_realloc);
12091211
UMM_POISON_MEMCPY(ptr, oldptr, curSize);
12101212
UMM_CRITICAL_RESUME(id_realloc);
@@ -1230,7 +1232,7 @@ void *umm_realloc(void *ptr, size_t size) {
12301232
void *oldptr = ptr;
12311233
if ((ptr = umm_malloc_core(_context, size))) {
12321234
DBGLOG_DEBUG("realloc %d to a bigger block %d, copy, and free the old\n", blockSize, blocks);
1233-
POISON_CHECK_SET_POISON((void *)&UMM_DATA(c), size);
1235+
(void)POISON_CHECK_SET_POISON(ptr, size);
12341236
UMM_CRITICAL_SUSPEND(id_realloc);
12351237
UMM_POISON_MEMCPY(ptr, oldptr, curSize);
12361238
UMM_CRITICAL_RESUME(id_realloc);

cores/esp8266/umm_malloc/umm_malloc_cfg.h

+13-7
Original file line numberDiff line numberDiff line change
@@ -619,8 +619,16 @@ extern bool umm_poison_check(void);
619619
void *umm_poison_realloc_fl(void *ptr, size_t size, const char *file, int line);
620620
void umm_poison_free_fl(void *ptr, const char *file, int line);
621621
#define POISON_CHECK_SET_POISON(p, s) get_poisoned(p, s)
622-
#define UMM_POISON_SKETCH_PTR(p) ((void*)((uintptr_t)p + sizeof(UMM_POISONED_BLOCK_LEN_TYPE) + UMM_POISON_SIZE_BEFORE))
623-
#define UMM_POISON_SKETCH_PTRSZ(s) (s - sizeof(UMM_POISONED_BLOCK_LEN_TYPE) - UMM_POISON_SIZE_BEFORE - UMM_POISON_SIZE_AFTER)
622+
#define POISON_CHECK_SET_POISON_BLOCKS(p, s) \
623+
do { \
624+
size_t super_size = (s * sizeof(umm_block)) - (sizeof(((umm_block *)0)->header)); \
625+
get_poisoned(p, super_size); \
626+
} while (false)
627+
#define UMM_POISON_SKETCH_PTR(p) ((void *)((uintptr_t)p + sizeof(UMM_POISONED_BLOCK_LEN_TYPE) + UMM_POISON_SIZE_BEFORE))
628+
#define UMM_POISON_SKETCH_PTRSZ(p) (*(UMM_POISONED_BLOCK_LEN_TYPE *)p)
629+
#define UMM_POISON_MEMMOVE(t, p, s) memmove(UMM_POISON_SKETCH_PTR(t), UMM_POISON_SKETCH_PTR(p), UMM_POISON_SKETCH_PTRSZ(p))
630+
#define UMM_POISON_MEMCPY(t, p, s) memcpy(UMM_POISON_SKETCH_PTR(t), UMM_POISON_SKETCH_PTR(p), UMM_POISON_SKETCH_PTRSZ(p))
631+
624632
#if defined(UMM_POISON_CHECK_LITE)
625633
/*
626634
* We can safely do individual poison checks at free and realloc and stay
@@ -641,13 +649,11 @@ void umm_poison_free_fl(void *ptr, const char *file, int line);
641649
#define POISON_CHECK() 1
642650
#define POISON_CHECK_NEIGHBORS(c) do {} while (false)
643651
#define POISON_CHECK_SET_POISON(p, s) (p)
644-
#define UMM_POISON_SKETCH_PTR(p) (p)
645-
#define UMM_POISON_SKETCH_PTRSZ(s) (s)
652+
#define POISON_CHECK_SET_POISON_BLOCKS(p, s)
653+
#define UMM_POISON_MEMMOVE(t, p, s) memmove((t), (p), (s))
654+
#define UMM_POISON_MEMCPY(t, p, s) memcpy((t), (p), (s))
646655
#endif
647656

648-
#define UMM_POISON_MEMMOVE(t, p, s) memmove(UMM_POISON_SKETCH_PTR(t), UMM_POISON_SKETCH_PTR(p), UMM_POISON_SKETCH_PTRSZ(s))
649-
#define UMM_POISON_MEMCPY(t, p, s) memcpy(UMM_POISON_SKETCH_PTR(t), UMM_POISON_SKETCH_PTR(p), UMM_POISON_SKETCH_PTRSZ(s))
650-
651657
#if defined(UMM_POISON_CHECK) || defined(UMM_POISON_CHECK_LITE)
652658
/*
653659
* Overhead adjustments needed for free_blocks to express the number of bytes

doc/installing.rst

+61-17
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,9 @@ This is the suggested installation method for end users.
99
Prerequisites
1010
~~~~~~~~~~~~~
1111

12-
- Arduino 1.6.8, get it from `Arduino
13-
website <https://www.arduino.cc/en/Main/OldSoftwareReleases#previous>`__.
1412
- Internet connection
15-
- Python 3 interpreter (Mac/Linux only, Windows installation supplies its own)
13+
- Arduino IDE 1.x or 2.x (https://www.arduino.cc/en/software)
14+
- (macOS/Linux only) Python ≥3.7 (https://python.org)
1615

1716
Instructions
1817
~~~~~~~~~~~~
@@ -33,6 +32,7 @@ For more information on the Arduino Board Manager, see:
3332

3433
- https://www.arduino.cc/en/guide/cores
3534

35+
3636
Using git version
3737
-----------------
3838

@@ -42,12 +42,12 @@ developers.
4242
Prerequisites
4343
~~~~~~~~~~~~~
4444

45-
- Arduino 1.6.8 (or newer, current working version is 1.8.5)
46-
- git
45+
- Internet connection
46+
- Arduino IDE 1.x or 2.x (https://www.arduino.cc/en/software)
47+
- git (https://git-scm.com)
4748
- Python ≥3.7 (https://python.org)
4849
- terminal, console, or command prompt (depending on your OS)
49-
- Internet connection
50-
- Uninstalling any core version installed via Board Manager
50+
- **Uninstalling any core version installed via Board Manager**
5151

5252
Instructions - Windows 10
5353
~~~~~~~~~~~~~~~~~~~~~~~~~
@@ -59,7 +59,7 @@ Instructions - Windows 10
5959
- Install git for Windows (if not already; see https://git-scm.com/download/win)
6060

6161
- Open a command prompt (cmd) and go to Arduino default directory. This is typically the
62-
*sketchbook* directory (usually ``C:\users\{username}\Documents\Arduino`` where the environment variable ``%USERPROFILE%`` usually contains ``C:\users\{username}``)
62+
*sketchbook* directory (usually ``C:\Users\{username}\Documents\Arduino`` where the environment variable ``%USERPROFILE%`` usually contains ``C:\Users\{username}``)
6363

6464
- Clone this repository into hardware/esp8266com/esp8266 directory.
6565

@@ -101,14 +101,15 @@ Instructions - Windows 10
101101
--- boards.txt
102102
--- LICENSE
103103
104-
- Initialize the submodules
104+
- Initialize submodules to fetch external libraries
105105
106106
.. code:: bash
107107
108108
cd %USERPROFILE%\Documents\Arduino\hardware\esp8266com\esp8266
109109
git submodule update --init
110110
111-
If error messages about missing files related to ``SoftwareSerial`` are encountered during the build process, it should be because this step was missed and is required.
111+
Not doing this step would cause build failure when attempting to include ``SoftwareSerial.h``, ``Ethernet.h``, etc.
112+
See our `.gitmodules file <https://github.com/esp8266/Arduino/blob/master/.gitmodules>`__ for the full list.
112113
113114
- Download binary tools
114115
@@ -181,14 +182,16 @@ Instructions - Other OS
181182
--- boards.txt
182183
--- LICENSE
183184
184-
- Initialize the submodules
185+
- Initialize submodules to fetch external libraries
185186
186187
.. code:: bash
187188
188189
cd esp8266
189190
git submodule update --init
190-
191-
If error messages about missing files related to ``SoftwareSerial`` are encountered during the build process, it should be because this step was missed and is required.
191+
192+
193+
Not doing this step would cause build failure when attempting to include ``SoftwareSerial.h``, ``Ethernet.h``, etc.
194+
See our `.gitmodules file <https://github.com/esp8266/Arduino/blob/master/.gitmodules>`__ for the full list.
192195
193196
- Download binary tools
194197
@@ -197,9 +200,10 @@ Instructions - Other OS
197200
cd tools
198201
python3 get.py
199202
200-
If you get an error message stating that python3 is not found, you will need to install it (most modern UNIX-like OSes provide Python 3 as
201-
part of the default install). To install you will need to use ``sudo yum install python3``, ``sudo apt install python3``, or ``brew install python3``
202-
as appropriate. On the Mac you may get an error message like:
203+
204+
If you get an error message stating that python3 is not found, you will need to install it (most modern UNIX-like OSes provide Python 3 as
205+
part of the default install). To install you will need to use ``sudo yum install python3``, ``sudo apt install python3``, or ``brew install python3``
206+
as appropriate. On the Mac you may get an error message like:
203207
204208
.. code:: bash
205209
@@ -214,7 +218,8 @@ Instructions - Other OS
214218
self._sslobj.do_handshake()
215219
ssl.SSLCertVerificationError: [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: unable to get local issuer certificate (_ssl.c:1056)
216220
217-
This is because Homebrew on the Mac does not always install the required SSL certificates by default. Install them manually (adjust the Python 3.7 as needed) with:
221+
222+
This is because Homebrew on the Mac does not always install the required SSL certificates by default. Install them manually (adjust the Python 3.7 as needed) with:
218223
219224
.. code:: bash
220225
@@ -231,6 +236,44 @@ Instructions - Other OS
231236
git status
232237
git pull
233238
239+
Maintaining
240+
~~~~~~~~~~~
241+
242+
To keep up with the development branch
243+
244+
.. code:: bash
245+
246+
git switch --recurse-submodules --discard-changes master
247+
git pull --recurse-submodules
248+
cd tools
249+
python3 get.py
250+
251+
Pull requests
252+
~~~~~~~~~~~~~
253+
254+
To test not yet merged Pull Request, first you have to find its ID number. This is the sequence of digits right after the pull request title.
255+
256+
Open terminal and cd into the directory where the repository was previously cloned. For example, 12345 is the Pull Request ID
257+
258+
.. code:: bash
259+
260+
git fetch origin pull/12345/head
261+
git switch --detach --recurse-submodules --discard-changes FETCH_HEAD
262+
263+
When Pull Request updates packaged tools, make sure to also fetch their latest versions.
264+
265+
.. code:: bash
266+
267+
cd tools
268+
python3 get.py
269+
270+
To go back to using the development branch
271+
272+
.. code:: bash
273+
274+
git switch --recurse-submodules --discard-changes master
275+
git pull --recurse-submodules
276+
234277
Using PlatformIO
235278
----------------
236279
@@ -245,5 +288,6 @@ BeagleBone, CubieBoard).
245288
- `PlatformIO IDE <https://platformio.org/platformio-ide?utm_source=arduino-esp8266>`__
246289
- `PlatformIO Core <https://docs.platformio.org/en/latest/core.html?utm_source=arduino-esp8266>`__ (command line tool)
247290
- `Advanced usage <https://docs.platformio.org/en/latest/platforms/espressif8266.html?utm_source=arduino-esp8266>`__ - custom settings, uploading to LittleFS, Over-the-Air (OTA), staging version
291+
- `Using Arduino Framework Staging Version <https://docs.platformio.org/en/stable/platforms/espressif8266.html?utm_source=arduino-esp8266#using-arduino-framework-with-staging-version>`__ - install development version of the Core
248292
- `Integration with Cloud and Standalone IDEs <https://docs.platformio.org/en/latest/ide.html?utm_source=arduino-esp8266>`__ - Cloud9, Codeanywhere, Eclipse Che (Codenvy), Atom, CLion, Eclipse, Emacs, NetBeans, Qt Creator, Sublime Text, VIM, Visual Studio, and VSCode
249293
- `Project Examples <https://docs.platformio.org/en/latest/platforms/espressif8266.html?utm_source=arduino-esp8266#examples>`__

0 commit comments

Comments
 (0)