1
0
mirror of https://github.com/esp8266/Arduino.git synced 2025-04-24 08:45:10 +03:00

1635 Commits

Author SHA1 Message Date
david gauchard
0049090e48
comments in ClientContext::connect() (#7961)
* add comment
2021-04-05 15:09:27 +02:00
david gauchard
1c57b3408c
fix WiFiClient::write(from flash or iram) (#7951)
* fix WiFiClient::write(flash or iram)

* fix emulation on host
2021-04-04 11:31:45 +02:00
Dirk O. Kaar
eedb009c6d
Bug-fix release 6.12.1: a documentation error was reported by a user; dropped bit-patterns that masked the stop-bit fixed. (#7938) 2021-03-28 13:23:37 -07:00
david gauchard
c1118dfce3
Stream::Send fixes: doc + StreamConstPtr byte-by-byte + missing SSL availableForWrite (#7935)
* StreamConstPtr: fix doc + reading flash space byte-by-byte
* add missing availableForWrite wrapper in wificlient-ssl
* WiFiClientSecure-ctx: add missing availableForWrite()
2021-03-25 16:00:41 +01:00
Maxim Prokhorov
3ff573103b Fix WiFi events with 32byte wide SSIDs 2021-03-25 02:38:25 +03:00
Earle F. Philhower, III
fdc295dfae
Fix typo in EEPROM debug message (#7934)
Fix #7933
2021-03-22 08:05:33 -07:00
virtualmix
edcbdbea45
Update Root Certificate (#7932)
The root certificate used in the example to connect to api.github.com has expired.
A new certificate was issued on March 3, 2021 and should be valid for a year.
2021-03-21 13:35:11 -07:00
david gauchard
3b1e8eab20
rename ClientContext::wait_until_sent() to wait_until_acked() (#7896)
* rename ClientContext::wait_until_sent() to wait_until_acked()

While looking at #6348 and #6369, and after checking into lwIP sources, it
appears that the tests in ClientContext::wait_until_sent() effectively wait
for all acks on current output buffer. Comments are added.

* host tests counterpart
2021-03-21 14:56:20 +01:00
Drzony
1b922edad1
Added broadcastIP method to WiFiSTA class (#7899) 2021-03-16 08:01:04 -07:00
Manuel Domínguez-Dorado
2406fe8fb8
Adds the method setSSLVersions() also to WiFiClientSecure in order to use that new feature. (#7925)
Co-authored-by: Manuel Domínguez Dorado <manuel.dominguez@enzinatec.com>
2021-03-15 13:21:53 -07:00
Earle F. Philhower, III
7475ba7ff3
Add setSSLVersion call to SSL object (#7920)
* Add setSSLVersion call to SSL object

Allow users to only allow specific TLS versions for connections with an
additional call in their app, similar to the setCiphers call.

Fixes #7918

* Add SSL level options to WiFiServerSecure
2021-03-15 12:22:06 -07:00
Dirk O. Kaar
55cee059fe
EspSoftwareSerial minor release 6.12.0 completes adaptation to new Stream::send() (#7923) 2021-03-15 02:24:25 -07:00
Drzony
48e1ccbff8
Added ESP32 compatible methods for setting/getting sleep mode (#7901) 2021-03-14 20:48:54 -07:00
M Hightower
9d82ebe6f7
Add example for using ESP.rebootIntoUartDownloadMode() (#7897) 2021-03-14 20:36:06 -07:00
Takayuki 'January June' Suwa
47b8947e72
ESP8266WebServer: Add variadic template version of collectHeaders() (#7296)
* More user-friendly, less RODATA usage.

eg. `webServer.collectHeaders(F("Content-Type"), F("Origin"));`

In this example, less about 20 bytes than the traditional way.
2021-03-14 19:55:25 -07:00
Earle F. Philhower, III
8ffe41b7df
Enable 128K virtual memory via external SPI SRAM (#6994)
Provides a transparently accessible additional block of RAM of 128K to
8MB by using an external SPI SRAM.  This memory is managed using the UMM
memory manager and can be used by the core as if it were internal RAM
(albeit much slower to read or write).

The use case would be for things which are quite large but not
particularly frequently used or compute intensive.  For example, the SSL
buffers of 16K++ are a good fit for this, as are the contents of Strings
(both to avoid main heap fragmentation as well as allowing Strings of
>30KB).

A fully associative LRU cache is used to limit the SPI bus bottleneck,
and background writeback is supported.

Uses a define in boards.txt to enable.  If this value is not defined,
then the entire VM routines should not be linked in to user apps
so there should be no space penalty w/o it.

UMM `malloc` and `new` are modified to support internal and external
heap regions.  By default, everything comes from the standard heap, but
a call to `ESP.setExternalHeap()` before the allocation (followed by a
call to `ESP.resetHeap()` will make the allocation come from external
RAM.  See the `virtualmem.ino` example for use.

If there is no external RAM installed, the `setExternalHeap` call is a
no-op.

The String and BearSSL libraries have been modified to use this external
RAM automatically.

Theory of Operation:

The Xtensa core generates a hardware exception (unrelated to C++
exceptions) when an address that's defined as invalid for load or store.
The XTOS ROM routines capture the machine state and call a standard C
exception handler routine (or the default one which resets the system).

We hook into this exception callback and decode the EXCVADDR (the
address being accessed) and use the exception PC to read out the
faulting instruction. We decode that instruction and simulate it's
behavior (i.e. either loading or storing some data to a
register/external memory) and then return to the calling application.

We use the hardware SPI interface to talk to an external SRAM/PSRAM,
and implement a simple cache to minimize the amount of times we need
to go out over the (slow) SPI bus. The SPI is set up in a DIO mode
which uses no more pins than normal SPI, but provides for ~2X faster
transfers.  SIO mode is also supported.

NOTE: This works fine for processor accesses, but cannot be used by
any of the peripherals' DMA. For that, we'd need a real MMU.

Hardware Configuration (only use 3.3V compatible SRAMs!):

  SPI byte-addressible SRAM/PSRAM: 23LC1024 or smaller
    CS   -> GPIO15
    SCK  -> GPIO14
    MOSI -> GPIO13
    MISO -> GPIO12
 (note these are GPIO numbers, not the Arduino Dxx pin names.  Refer
  to your ESP8266 board schematic for the mapping of GPIO to pin.)

Higher density PSRAM (ESP-PSRAM64H/etc.) should work as well, but
I'm still waiting on my chips so haven't done any testing.  Biggest
concern is their command set and functionality in DIO mode.  If DIO
mode isn't supported, then a fallback to SIO is possible.

This PR originated with code from @pvvx's esp8266web server at
https://github.com/pvvx/esp8266web (licensed in the public domain)
but doesn't resemble it much any more.  Thanks, @pvvx!

Keep a list of the last 8 lines in RAM (~.5KB of RAM) and use that to
speed up things like memcpys and other operations where the source and
destination addresses are inside VM RAM.

A custom set of SPI routines is used in the VM system for speed and code
size (and because the core cannot be dependent on a library).

Because UMM manages RAM in 8 byte chunks, attempting to manage the
entire 1M available space on a 1M PSRAM causes the block IDs to
overflow, crashing things at some point.  Limit the UMM allocation to
only 256K in this case.  The remaining space can manually be assigned to
buffers/etc. managed by the application, not malloc()/free().
2021-03-14 18:44:02 -07:00
david gauchard
c720c0d9e8
Stream::send() (#6979) 2021-03-14 17:36:20 -07:00
Earle F. Philhower, III
656a33e6f8
BREAKING - Use IRAM_ATTR in place of ICACHE_RAM_ATTR (#7921)
Update the core to use the define that the ESP32 uses, IRAM_ATTR, for
placing code in DRAM.
2021-03-14 16:56:47 -07:00
Dirk O. Kaar
6743a65987
Minor EspSoftwareSerial release 6.11.7, for deprecated ICACHE_RAM_ATTR in upcoming ESP8266 Arduino core 3.0.0. (#7922) 2021-03-14 16:15:37 -07:00
Develo
7fbf620ab6
Merge branch 'master' into wifi_mesh_update_2.2 2021-03-14 16:41:13 -03:00
Earle F. Philhower, III
e99df4fe1a
Add I2S class support (#7874)
Fixes #427

Adds a basic I2S class based off of the Arduino-SAMD core.  The raw
i2s_xxx functions are still a better  way to use I2S due to their
flexibility, but this will allow basic Arduino sketches to work.
2021-03-07 08:14:07 -08:00
Chris van Marle
c90c329a48
Track creation time of LittleFS FS (#7873) 2021-03-02 17:50:00 -08:00
david gauchard
807ed51d0f
AP & dhcp-server: fix uninitialized variables (#7905) 2021-03-03 01:12:01 +01:00
Dirk O. Kaar
e3fe7a5776
EspSoftwareSerial, bump up Arduino library manager related files 6.11.6 (#7891) 2021-02-21 11:04:37 -08:00
Dirk O. Kaar
f42ab617e9
Update to EspSoftwareSerial 6.11.5 (#7889) 2021-02-21 09:23:20 -08:00
Michael Pöttgen
bc3daef76d
WIFI_RESUME improve speed and example (#7877)
Improve resume speed by passing in last known BSSID
Provide a simpler example for WIFI_SHUTDOWN/WIFI_RESUME
Add documentation for WIFI_SHUTDOWN and WIFI_RESUME.
2021-02-15 13:51:37 -08:00
Earle F. Philhower, III
a886515ce9
Fix ESP8266SdFat architecture, Windows CI (#7866)
* Fix ESP8266SdFat architecture

Avoid problems reported in
https://forum.arduino.cc/index.php?topic=726897.msg4889319

* Fix Windows CI, python3 now *maybe* exists

Python3 used to be called "python.exe" on earlier VMs, but it looks like
the image has been updated and a "python3.exe" does now exist.  Update
the CI script to first check it "python3" exists, and if not then do the
copy hack, OTW do nothing.
2021-02-08 12:02:49 -08:00
Dirk O. Kaar
6c564c269c
EspSoftwareSerial bug-fix release 6.11.4 (#7862) 2021-02-06 15:10:24 -08:00
hreintke
27da34760b
At MDNS.end() also release services (#7859) 2021-02-04 14:46:13 +01:00
Dirk O. Kaar
53e5688453
Update to EspSoftwareSerial 6.11.3: prepares for ESP8266 Arduino core PR 6979. (#7840) 2021-01-26 01:03:56 +01:00
Erriez
d90015e326
Merge branch 'master' into feature/issue-2246-multi-wifi-hidden 2021-01-19 16:12:54 +01:00
Paulo Cabral Sanz
85e2ffffe1
Allow users to inherit and override CertStore (#7827)
Make installCertStore virtual so we can inherit from CertStore and override it
Create CertStoreBase to inherit from
2021-01-18 11:59:20 -08:00
Earle F. Philhower, III
f5fd5912fe
Allow specifying waveform generator in source code (#7800)
* Allow specifying waveform generator in source code

Allows code to explicitly specify which waveform generator it wants,
without needing to use one of the 100 IDE menus or adding a `-D`
compile-time define.

Uses weakrefs to allow for apps to call `enablePhaseLockedWaveform();`
within their `setup()` (or anywhere, really) and have the phase locked
versions override the default waveform generators automatically.

For example:

````
void setup() {
  // Uncomment following line to use phase-locked waveform generator
  // enablePhaseLockedWaveform();
  Serial.begin(115200);
  pinMode(LED_BUILTIN, OUTPUT);     // Initialize the LED_BUILTIN pin as an output
  analogWriteRange(1000);
}
void loop() {
  analogWrite(LED_BUILTIN, 100);
  delay(1000);                      // Wait for a second
  analogWrite(LED_BUILTIN, 900);
  delay(2000);                      // Wait for two seconds (to demonstrate the active low LED)
}
````

Also adds an example showing it's use.

Address @dok-net's comments and also remove the _weak/_bound version of
startWaveform() since it's invariant of the actual waveform generator.
2021-01-17 15:57:26 -08:00
Paulo Cabral Sanz
e938739115
Prevent nullptr dereference on OOM (#7823) 2021-01-12 14:55:57 -08:00
Paulo Cabral Sanz
07241dd407
Avoid UB and abort on nullptr buffer (#7822)
* Avoid UB and abort on nullptr buffer
* Report OOM on return value
2021-01-12 22:39:55 +01:00
Paulo Cabral Sanz
98a19ab245
Protect against server hijacking error handling (#7811)
If a server returns "HTTP/1.x -8 OK", for example, it can misguide an application developer into freeing less-important memory so the request can be retried and succeed, when the problem is in the server.

_returnCode is never used anywhere else, but it could still contain a negative value returned by a broken server and therefore could cause troubles in the future (if _returnCode is in fact used)
2021-01-07 21:22:36 -08:00
M Hightower
2f5979f1f0
Verify IRAM sum results using DRAM as reference. (#7812)
Make verify fail more visible.

Updated example irammem.info to show performance and test int16 handling
when IRAM is used.

Removed 4K performance test. It didn't show any new information over the 1K test.
2021-01-07 20:45:15 -08:00
Dirk O. Kaar
f959cb321b
EspSoftwareSerial 6.11.2: Delegate<> assign operators added. (#7815)
Addresses compilation errors with pending PRs due to commit 95fb104562
2021-01-07 20:36:58 -08:00
Earle F. Philhower, III
da138456a6
Fix header FSM in webserver, fix Windows uploads (#7805)
When a file upload ends in \r\n (i.e. a Windows formatted text file) the
sequence of bytes on the wire is `\r\n\r\n----...boundary-marker...`.

When the FSM in Webserver was evaluating the stream, that 2nd `\r` would
be written as valid data and the FSM parser would be reset and see `\n`
as the 1st character, which wouldn't match.  This would a) add an extra
`\r` to uploaded files, and b) cause uploads to hang.

Fix by checking on a header FSM mismatch if the next character input
could possibly match our marker, and if so handle it properly.

Fixes #7803
2021-01-01 13:07:59 -08:00
Dirk O. Kaar
a25895a764
Minor EspSoftwareSerial release 6.11.1 (#7804)
* Minor EspSoftwareSerial release 6.11.0: more GPIOs for ESP32

* EspSoftwareSerial: Fix unused parameter warning.

* Revert "Minor EspSoftwareSerial release 6.11.0 (#7802)"

This reverts commit 229903a24d508288b237afd20de7baf3ff29b74d.
2020-12-31 12:56:44 -08:00
Dirk O. Kaar
229903a24d
Minor EspSoftwareSerial release 6.11.0 (#7802)
* Minor EspSoftwareSerial release 6.11.0: more GPIOs for ESP32

* EspSoftwareSerial: Fix unused parameter warning.
2020-12-31 10:54:12 -08:00
David Luna
a3a7a23a92
Typo error in ESP8266WiFiGeneric.h (#7797)
Error in copyright text about Arduino Wifi library
2020-12-27 22:15:26 +01:00
Earle F. Philhower, III
c487ca5233
Update to SdFat 2.0.2, speed SD access (#7779)
* Update to upstream SdFat 2.0.2

Increases the read/write performance for SD card accesses
by a significant amount, up to 5x (3+MB/s) in testing.

Fixes #7772 

* Add SDFS::availableForWrite handler

Peek into the sector cache to determine the maximum number of
bytes that can be written w/o needing a (slow) SD operation.

Fixes #7650
2020-12-23 11:39:12 -08:00
Earle F. Philhower, III
9de8373f1b
BREAKING - Upgrade to upstream newlib 4.0.0 release (#7708)
* Upgrade to upstream newlib 4.0.0 release

Includes 64 bit time_t and 5 years of updates.

Binary incompatible with libraries which use time_t (due to the size
difference).  Recompiling with the new newlib should be sufficient for
most libraries, assuming source is available.

* Remove tools/sdk/libc directory, it isn't used anywhere

Somewhere along the line the copy of libc in tools/sdl/libc was taken
out of the build process.  Files in there are not used, take add'l time
to build and install on a toolchain release, and just cause confusion.
Remove them.

* Fix 64-bit time for LittleFS

The core was setting 64-bit times automatically on new file creation or
updates, but would fail when attempting to read them back due to 64/32b
confusion.

Now attempt to read 64b time, and if that fails fallback to reading 32b
time to allow both old and new FS to preserve timestamps.

* Update to jjsuwa-sys3175 additions to GCC and newlib

@jjsuwa-sys3175 contributed multiple patches to GCC, included in
the toolchain, as well as a slightly faster pgm_read_byte() macro.

* Rebuild w/addl GCC patches, new BearSSL flags

* Remove copied libgcc.a file, is contained in toolchain
2020-12-23 11:21:38 -08:00
david gauchard
51c2a1437b
more lwIP physical interfaces (#6680)
This commit adds W5500 W5100 and ENC28j60 drivers from @njh with credits
They are available in libraries/
An example is added in W5500 examples directory

plus:
* Extract dhcp server from lwip2 and add it to the core as a class.
  It must always be present, it is linked and can be called by fw on boot.
  So it cannot be stored in a library.
* ethernet: static or dhcp works
* PPPServer: example
* bring WiFi.config() to the lwIP generic interface (argument reorder common function)
* move hostname() from WiFI-STA to generic interface
* remove non readable characters from dhcp-server comments
* dhcp-server: magic_cookie is part of bootp rfc
* fixes from https://github.com/d-a-v/W5500lwIP/issues/17
* enable lwip_hook_dhcp_parse_option()
* +ethernet tcp client example in w5500 library examples
2020-12-22 22:36:21 +01:00
Earle F. Philhower, III
35d22edeec
Rationalize File timestamp callback (#7785)
Fixes #7775

Clean up the passing/setting of custom File time callbacks and add a
host test verifying they work.  Existing core was not passing custom
timeCallbacks set at the FS level down to open()ed files, resulting in
them calling the default time(nullptr) and reporting wrong file modify
times.
2020-12-22 10:41:11 +01:00
Earle F. Philhower, III
f1dc6e90ee
Update to LittleFS v2.3 (#7787)
Minor performance improvement and LFS_READONLY added, enabling smaller
code for things like eboot should we want to us it in a bootloader/etc.
2020-12-21 21:21:42 -08:00
Zakary Kamal Ismail
032db6fc81
WiFiServerSecure: Cache SSL sessions (#7774)
* WiFiServerSecure: Cache the SSL sessions

* Add SSL session caching to HTTPS server examples

* Document server SSL session caching

* Fix an incomplete sentence in the documentation

* Document BearSSL::Session

* Use the number of sessions instead of the buffer size in ServerSessions' constructors
2020-12-21 21:13:43 -08:00
david gauchard
7dbef42ada
LEAmDNS fixes (#7786)
* LEAmDNS2 removed
* LEAmDNSv1: fix macro name
2020-12-22 01:29:00 +01:00
Dirk O. Kaar
dbe7eb89b9
EspSoftwareSerial bug fix release 6.10.1: preciseDelay() could delay() for extremely long time, if period duration was exceeded on entry. (#7771) 2020-12-15 12:22:57 -08:00