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

3942 Commits

Author SHA1 Message Date
david gauchard
a5308d6ef4
String: add missing long long operator implementations (#7888) 2021-02-19 08:38:43 -08:00
Foddis Gabriele
d41b4037cc
board manager: + Agrumino lemon v4 (#7883) 2021-02-19 08:21:16 -08:00
twischer
83f5f29cfd
Support to reboot into UART download mode (#7854)
without any external wiring.

This patch introduces the new method
Esp.rebootIntoUartDownloadMode()

When the user calls this method the ESP8266 reboots into the UART
download mode. In this mode the user can use esptool.py to flash a new
firmware file. The following command was used to test it:
$ esptool.py --before no_reset --after soft_reset --chip esp8266 \
    --port /dev/ttyUSB0 --baud 460800 write_flash 0x0 firmware.bin

The implementation is based on the original implementation in the
boot ROM. Some parts of the original implementation can be found in
[1]. This patch is a squashed and simplified version of [2]. The non
squashed version might be helpful in case of debugging issues.

[1] https://github.com/twischer/xtensa-subjects/blob/master/reversed/bootrom.c
[2] https://github.com/twischer/Arduino/tree/reboot_uart_download_full

Signed-off-by: Timo Wischer <twischer@freenet.de>
2021-02-17 08:25:52 -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
e4435fa306
Update board-specific defines (#7875)
Fixes #6805

Update the build.board for several boards which were originally added
with a generic type.
2021-02-14 14:42:50 +01:00
david gauchard
483519f852
String: compatibility with 64 bits scalars (#7863)
time_t is now 64 bits. String(time_t) was ambiguous
tests added
2021-02-13 08:47:47 -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
Earle F. Philhower, III
07b4c09b90
eboot: .RODATA, upstream uzlib, move CRC, save 112 bytes (#7844)
RODATA can be copied automatically by the bootrom, so no reason not to
allow its use for strings and constants in eboot.c

Revert to pfalcon's original uzlib since the single patch to remove
RODATA is not required.

Rationalize eboot.ld linker script, clean up BSS and init it in code.

Saves 112 bytes of space in the bootloader sector by removing the
extra code associated with literal loads.

* Move CRC out of bootload sector

We added protection to only erase the bootload sector when flashing an
image when the new sector != the old sector.  This was intended to
minimize the chance of bricking (i.e. if there was a powerfail during
flashing of the boot sector the chip would be dead).

Unfortunately, by placing the CRC inside the eboot sector *every*
application will have a unique eboot sector (due to the crc/len), so
this protection doesn't work.

Move the CRC into the first 8 bytes of IROM itself.  This frees up extra
space in the boot sector and ensures that eboot won't be reflashed
unless there really is an eboot change.
2021-02-07 16:32:56 -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
Earle F. Philhower, III
20413f817b
Update toolchain to support std::remainder (#7849)
Update newlib to enable the __ieee754_remainder(f) calls required by
std::remainder and others.

Add device test for std::remainder variants.

Fixes #7845
2021-01-29 12:30:42 -08:00
Earle F. Philhower, III
39d14530ff
Add a check for all URLs in the package file (#7848)
Avoid issues like #7847 by downloading and checking SHA for each file in
the package.json bundle.
2021-01-28 08:56:45 -08:00
Earle F. Philhower, III
600c5d7c0b
Fix typo in 32-bit Windows package JSON (#7847)
Fatfingered the 32-bit Windows pointer to the Python interpreter.  Our
CI and my own testing missed due to being on 64-bit Windows.

For 2.7.4 release, I'll add a file of the appropriate name to the
release for now, but this will correct things for 3.0.0 and forward.
2021-01-28 08:08:03 -08:00
Earle F. Philhower, III
c2393d05be
Fix improper GENERIC board IDs (#7839)
A couple board types reported ESP8266_GENERIC instead of their proper
types in boards.txt (and in defined generated therefrom/etc.).

Give them proper board types based on their names, like other modules.
2021-01-27 00:06:12 -08:00
Michael Kluge
f2d83ba43d
allow to set pin to OUTPUT_OPEN_DRAIN in analogWriteMode (#7841)
* allow to set pin to OUTPUT_OPEN_DRAIN in analogWrite

* remove parameter with default value

* Update core_esp8266_wiring_pwm.cpp

* update documentation accordingly
2021-01-26 23:56:43 -08: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
Earle F. Philhower, III
349e67f7f5
Fix I2S reported rate for 24b mode (#7838)
Adjust the number of bittimes when returning the real I2S rate.
2021-01-24 09:59:20 -08:00
Earle F. Philhower, III
f0e8f8eac4
Update eboot to build with C17, not C99 standard (#7837)
No functional change.  Make the main core and eboot build using the
same C standard version (gnu17).
2021-01-23 16:24:15 -08:00
Earle F. Philhower, III
e0cfb5a995
Add 24-bit mode to I2S (#7835)
Add basic 24 bit mode to the I2S API with a i2s_set_bits() call.
By default 16b mode is still used, but if i2s_set_bits(24) is run
before i2s_begin() then the HW will drive 24-bits of data.  This
data must be left-aligned (i.e. bits 31..8) in 4-byte samples.

Fixes #5244 (the HW doesn't support 8 or 32 bits, only 16 or 24).
2021-01-23 14:40:29 -08:00
david gauchard
b3fe0aab19
Hexdump fix&update (#7831)
* hexdump() must be "C"; add ascii data in dump
* remove previous version
2021-01-22 23:04:22 +01:00
Valerii Koval
11a2fb3872
Dynamically configure exceptions support (#7834) 2021-01-22 17:08:45 +02:00
Develo
2402958208
Merge pull request #7629 from Erriez/feature/issue-2246-multi-wifi-hidden
Add support for hidden SSID's Multi WiFi
2021-01-21 01:11:21 -03: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
M Hightower
a4b6003c2e
Replacement for Boot ROM aes_unwrap (#7773)
* Replacement for Boot ROM aes_unwrap

* Removed unnecessary test
2021-01-13 15:43:55 -08:00
Earle F. Philhower, III
dbc5e4164c
Supersede #3856, remove undef min/max (#7824)
Remove a straggler `undef min/max` from core header
Supersedes #3856
2021-01-12 17:58:04 -08:00
M Hightower
df5e113b88
HeapSelectDram for pvPortMalloc, ... (#7790)
* Add inline always option to HeapSelect

* Add option to force DRAM for pvPort... APIs

* revert print_loc premature change

* Renamed macro to be more specific, FORCE_ALWAYS_INLINE to FORCE_ALWAYS_INLINE_HEAP_SELECT
2021-01-12 15:08:41 -08:00
Paulo Cabral Sanz
e938739115
Prevent nullptr dereference on OOM (#7823) 2021-01-12 14:55:57 -08:00
M Hightower
0203dea024
Added replacement for the Boot ROM _xtos_set_exception_handler (#7820)
Added replacement for the Boot ROM `_xtos_set_exception_handler`
to handle installing our replacement `_xtos_c_wrapper_handler`.

Simplified install in the non 32-bit exception module to make use of the
improved `_xtos_set_exception_handler`

Reorganized and improved comments.
2021-01-12 22:51:26 +01: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
Earle F. Philhower, III
34545a160d
Invalid read return value fix (#7817)
Fixes #7814.

Return 0, not MAXINT, when a read is called on a File without a backing
instance of a SPIFFS/LittleFS/SD File.
2021-01-08 20:08:36 -08: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
Earle F. Philhower, III
adbd23b6e2
Add stub for analogReference (#7809)
Fixes #6410

We actually provide a function prototype for `analogReference()` in
`Arduino.h`, but no implementation.  Add a dummy one that only supports
DEFAULT (like other Arduino boards).
2021-01-07 21:14:14 -08:00
M Hightower
67e1dfc5a4
Extended ASM got fussy when using different optimizations. ie. HWDT (#7816)
resets. It seems you should not use input registers for scratch registers.
Add an extra output register instead. No code size increase.

Light refactoring for readability

Added "C" reference code for Extended ASM

Save two cycles by loading a0 early in exc-c-wrapper-handler.S

Use optimization O2
Net change in size, 0 bytes with optimization. Save 4 bytes w/o Optimization.
With changes and "O2" save 3 cycles on write and 6 cycles on read.
2021-01-07 21:05:24 -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
david gauchard
43f44e4b13
emulation on host: millis()/micros() now start at 0 (#7810)
emulation on host: millis()/micros() now start at 0
2021-01-05 12:21:16 +01:00
Earle F. Philhower, III
100a8df33f
Reduce BearSSL code size by not -O2 FSMs (#7807)
The FSMs that drive the encryption logic are not performance critical,
but they are very large.  Build BearSSL using -Os on them, leaving -O2
everywhere else (i.e. encryption) for speed.

Saves 1-2KB of flash for SSL applications.
2021-01-03 22:47:39 +01: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
david gauchard
5b42e73baa
upgrade arduino in CI (#7716)
Thanks to @matthijskooijman, @per1234 and @earlephilhower
2020-12-31 23:19:58 +01: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
Dirk O. Kaar
84260dcb44
Write loop could lead to wdt with low bitrates or large buffers. Fixes #7746 (#7799) 2020-12-30 16:05:20 -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
david gauchard
5c29517d11
lwip2: use pvPortXalloc/vPortFree and "-free -fipa-pta" (#7793)
lwip2: use pvPortXalloc/vPortFree instead of malloc/free and add gcc's '-free -fipa-pta' options
2020-12-24 10:56:21 -08:00
Earle F. Philhower, III
5356c87b5b
Use smarter cache key, cache Arduino IDE (#7791)
Thanks to @mcspr.  Make sure the cached toolchain is only valid when the
package.json file is identical.  Also, add the Arduino IDE to the cache
to avoid re-downloads.
2020-12-23 15:00:04 -08: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
e25ad86c91
mock: +hexdump() from debug.cpp (#7789) 2020-12-22 22:50:53 +01:00