* Remove warnings, errors during host tests in CI
Debug strings often included format parameters which did not exactly match
the passed in format parameters, resulting in warnings in the host test build
process like
````
/home/runner/work/Arduino/Arduino/libraries/ESP8266WiFi/src/ESP8266WiFiAP.cpp:107:20: warning: format ‘%u’ expects argument of type ‘unsigned int’, but argument 3 has type ‘size_t’ {aka ‘long unsigned int’} [-Wformat=]
107 | DEBUG_WIFI("[AP] SSID length %u, too long or missing!\n", ssid_len);
| ~~~~~~~~
| |
| size_t {aka long unsigned int}
````
Fix by applying casting or PRxxx macros as appropriate.
Also, fix one debug message which was trying to use a `String` as a `char *`:
````
/home/runner/work/Arduino/Arduino/libraries/ESP8266WiFi/src/ESP8266WiFiMulti.cpp: In member function ‘wl_status_t ESP8266WiFiMulti::connectWiFiMulti(uint32_t)’:
/home/runner/work/Arduino/Arduino/libraries/ESP8266WiFi/src/ESP8266WiFiMulti.cpp:331:34: warning: format ‘%s’ expects argument of type ‘char*’, but argument 3 has type ‘String’ [-Wformat=]
331 | DEBUG_WIFI_MULTI("[WIFIM] Connecting %s\n", ssid);
````
* Clean up SpeedTest.ino host build
* EspSoftwareSerial 6.14.0: Add API for selecting Rx GPIO PULLUP at runtime.
* EspSoftwareSerial: bug fix 6.14.1: Set default RX pullup once in ctor, prevents flipping of that state on begin().
* ESP8266WebServer - drop current HC_WAIT_READ connection sooner when another has data
Safari sometimes opens two connections when loading a page and only
sends a request over the second one, resulting in a 5 second wait
(HTTP_MAX_DATA_WAIT) before the request is processed. This commit
drops the current connection after 30ms (HTTP_MAX_DATA_AVAILABLE_WAIT)
when there is a new connection with data available or the buffer of
pending TCP clients is full (currently 5).
Use a formatting function to give more human-readable output formats
for flash bandwidth. When the test starts and ends in less than one
millisecond, report as "Infinite".
Sample output:
````
Creating 512KB file, may take a while...
==> Time to write 512KB in 256b chunks = 6641 milliseconds
==> Created file size = 524288
Reading 512KB file sequentially in 256b chunks
==> Time to read 512KB sequentially in 256b chunks = 211 milliseconds = 2.48 MB/s
Reading 512KB file MISALIGNED in flash and RAM sequentially in 256b chunks
==> Time to read 512KB sequentially MISALIGNED in flash and RAM in 256b chunks = 212 milliseconds = 2.47 MB/s
Reading 512KB file in reverse by 256b chunks
==> Time to read 512KB in reverse in 256b chunks = 367 milliseconds = 1.43 MB/s
Writing 64K file in 1-byte chunks
==> Time to write 64KB in 1b chunks = 1249 milliseconds = 52.47 KB/s
Reading 64K file in 1-byte chunks
==> Time to read 64KB in 1b chunks = 296 milliseconds = 221.41 KB/s
````
esp_yield() now also calls esp_schedule(), original esp_yield() function renamed to esp_suspend().
Don't use delay(0) in the Core internals, libraries and examples. Use yield() when the code is
supposed to be called from CONT, use esp_yield() when the code can be called from either CONT or SYS.
Clean-up esp_yield() and esp_schedule() declarations across the code and use coredecls.h instead.
Implement helper functions for libraries that were previously using esp_yield(), esp_schedule() and
esp_delay() directly to wait for certain SYS context tasks to complete. Correctly use esp_delay()
for timeouts, make sure scheduled functions have a chance to run (e.g. LwIP_Ethernet uses recurrent)
Related issues:
- #6107 - discussion about the esp_yield() and esp_delay() usage in ClientContext
- #6212 - discussion about replacing delay() with a blocking loop
- #6680 - pull request introducing LwIP-based Ethernet
- #7146 - discussion that originated UART code changes
- #7969 - proposal to remove delay(0) from the example code
- #8291 - discussion related to the run_scheduled_recurrent_functions() usage in LwIP Ethernet
- #8317 - yieldUntil() implementation, similar to the esp_delay() overload with a timeout and a 0 interval
- =default for default ctor, destructor, move ctor and the assignment move
- use `std::unique_ptr<WiFiClient>` instead of raw pointer to the client
- implement `virtual std::unique_ptr<WiFiClient> WiFiClient::clone()` to safely copy the WiFiClientSecure instance, without accidentally slicing it (i.e. using the pointer with incorrect type, calling base WiFiClient virtual methods)
- replace headers pointer array with `std::unique_ptr<T[]>` to simplify the move operations
- substitute userAgent with the default one when it is empty
(may be a subject to change though, b/c now there is a global static `String`)
Allow HTTPClient to be placed inside of movable classes (e.g. std::optional, requested in the linked issue) or to be returned from functions. Class logic stays as-is, only the underlying member types are changed.
Notice that WiFiClient connection object is now copied, and the internal ClientContext will be preserved even after the original WiFiClient object was destroyed.
replaces #8236resolves#8231
and, possibly #5734
These changes are needed to address bugs that can emerge with the improved optimization from the GCC 10.3 compiler.
Updated performance inline functions `mmu_get_uint8()`, ... and `mmu_set_uint8()`, ... to comply with strict-aliasing rules.
Without this change, stale data may be referenced. This issue was revealed in discussions on https://github.com/esp8266/Arduino/issues/8261#issue-963529268
Changes to avoid over-optimization of 32-bit wide transfers from IRAM, turning into 8-bit or 16-bit transfers by the new GCC 10.3 compiler. This has been a reoccurring/tricky problem for me with the new compiler.
So far referencing the 32-bit value loaded by way of an Extended ASM R/W output register has stopped the compiler from optimizing down to an 8-bit or 16-bit transfer.
Example:
```cpp
uint32_t val;
__builtin_memcpy(&val, v32, sizeof(uint32_t));
asm volatile ("" :"+r"(val)); // inject 32-bit dependency
...
```
Updated example `irammem.ino`
* do a simple test of compliance to strict-aliasing rules
* For `mmu_get_uint8()`, added tests to evaluate if 32-bit wide transfers were converted to an 8-bit transfer.
When reading from a `Stream`, like `File`, using a temporary buffer is counterproductive because it complexifies the code and increases memory usage.
It's also a source of confusion because it can create dangling pointers in the `JsonDocument`.
The only benefit of using a buffer is the reading speed, but I don't think speed is the focus in this example; if it were, it would use a buffer in `saveConfig()` too.
When LittleFS.begin() or SDFS.begin() is called after the filesystem is
already mounted, don't unmount/remount. When an unmount happens, all old
Files become invalid (but the core doesn't know this), so you would end
up with random crashes in FS code.
Now, check for _mounted, and if so just return immediately from begin().
This mimics the original SPIFFS code.
Fixes https://github.com/earlephilhower/ESP8266Audio/issues/407
* Fix PRxxx printf format macros
Update toolchain (newlib) to supply proper definitions for PRxxx macros.
Fixes#8220
Added a PRxxx macro to an example to ensure CI will catch any problem like
this in the future.
* Recover the BearSSL crash stack before the Heap is initialized and zeros it.
* Added comments for hwdt_pre_sdk_init()
* Keep Basic ASM version of app_entry_redefinable and removed alternate "C"/Extended ASM version. Update comments.
* Improved example HwdtStackDump to use StackThunk
When using previous IDE versions, the use of an invalid category value caused a warning to be displayed on every compilation:
WARNING: Category 'Network' in library lwIP_PPP is not valid. Setting to 'Uncategorized'
WARNING: Category 'Network' in library lwIP_enc28j60 is not valid. Setting to 'Uncategorized'
WARNING: Category 'Network' in library lwIP_w5500 is not valid. Setting to 'Uncategorized'
WARNING: Category 'Network' in library lwIP_w5500 is not valid. Setting to 'Uncategorized'
List of valid category values:
https://arduino.github.io/arduino-cli/latest/library-specification/#libraryproperties-file-format
MMU option with 48K IRAM shared. This happended after changes that
increased IRAM code size that caused free IRAM for Heap to fall
below ~16K, then "new" would OOM out in WiFiClientSecureBearSSL.
Added private function to try IRAM first then switch to DRAM on fail
to WiFiClientSecureBearSSL for iobuff allocations.
* Added comments for ets_install_uart_printf and corrected it usage.
* Correct case for hotkey 'p'.
Added conditional build around option 'p' to call stack_thunk_dump_stack
which can only print when debug is enabled.
* Don't crash when includeing LittleFS.h w/no FS
The LittleFS constructor could cause a divide-by-zero error and crash the
chip during pre-main startup (i.e. when the constructors were called).
Avoid by only initializing the LittleFS control structure when there is
a filesystem specified in the flash layout.
* Be even more paranoid on begin() and format()
Fixes#8079
Because WiFiClientSecure inherits WiFiClient, and WiFiClientSecureCtx also
inherits WiFiClient, they both end up in the list of TCP connections that
are used for WiFiClient::stopAllExcept(). This would cause the underlying
SSL connection to be closed whenever you attempted to
stopAllExcept(WiFiClientSecure)
Fix by adding a "_owned"(by) pointer in the WiFiClient object which points to
nullptr (default case) or to the associated lower-layer connection.
When stopping all connections except one, only look at the lowermost
connections.
* BREAKING - "i2s.h" removed, I2S library added
An "i2S.h" header was present in prior cores, but this conflicts with the
Arduino standard I2S.h header for the I2S class under Windows (because of
case insensitivity).
Initial 3.0.0 release has a redirect "i2s.h" file in the cores directory to
redirect to the "I2S.h" file in the library, but under Windows this resulted
in the IDE not building the I2S library and link errors.
Remove the offending header. Code will need to mode to including "I2S.h"
instead (which will include both the Arduino class as well as the low-level
definitions).
Fixes#8107
* Update examples to use proper I2S.h version
When multiple libraries contain files matching an #include directive in the program, the Arduino build system must pick
one to use for compilation. Multiple factors are used in order to make an intelligent determination of which library is
best.
In order to enhance this determination, the closeness of match between the library.properties name value and the
filename in the #include directive is being added as one of those factors. This new factor is referred to as
"Library Name Priority".
Unfortunately, this change can result in platform bundled libraries which had previously been correctly correctly chosen
no longer being given priority over their equivalent standalone libraries, which may be incompatible or not optimized
for the platform's boards.
This priority inversion only occurs when all the following conditions are true:
- There is a standalone library installed which provides a header filename collision.
- The platform bundled library is architecture optimized (e.g., architectures=esp32).
- The standalone library is architecture compatible (architectures=*).
- The standalone library has equal "Folder Name Priority".
- The standalone library has better "Library Name Priority" (e.g., name=SD vs name=SD(ESP32) for a library with primary
header file SD.h.
The fix is to simply give the platform bundled library a perfect "Library Name Priority".
Some platform bundled libraries were given a modified name as a workaround to a bug in the Arduino IDE's Library Manager
which caused Library Manager to always show the library as updatable under specific circumstances. That bug was fixed in
Arduino IDE 1.8.6, ~3 years ago.