1
0
mirror of https://github.com/esp8266/Arduino.git synced 2025-04-21 10:26:06 +03:00

3540 Commits

Author SHA1 Message Date
Earle F. Philhower, III
d0316a13fc
Merge branch 'master' into pr-eboot-cs-fix 2020-02-02 15:18:01 -08:00
StanJ
63b73bf181
add Low-Power demo (#6989)
* add Low-Power demo
2020-02-01 21:57:21 -03:00
ramirocarra
378c1f14c7
Update ESP8266HTTPClient.cpp (#7051)
sendRequest has a major problem when sending a big payload, the comparator in the IF loop has its two operators changed, so the last part of payload is never sent
2020-02-01 20:11:00 -03:00
Dirk Mueller
a2141803f1
Code size optimisation of ESP.getResetReason() (#7029)
* Code size optimisation of ESP.getResetReason()

doing if/else snakes for something that is a switch/case
is wasteful, as it repeatedly evaluates the same if() condition.
Also repeating strcpy_P is adding code bloat.

This simplification reduces size from 111 to 41 bytes.

* add break statement also to default case
2020-01-30 13:07:34 -08:00
M Hightower
fe7faf701e Added dependencies for eboot.ld and Makefile to Makefile.
Updated eboot.ld to not fill with zeros through the CS field
on its way to the CRC.
Added size test to elf2bin.py
2020-01-29 13:26:58 -08:00
liebman
9e9515b49f clear _canReuse in setUrl if its not a local redirect (#7039) 2020-01-28 00:35:16 -03:00
Dirk O. Kaar
bb696dd204 host build: optimistic_yield() wrongly delays() instead of avoiding excessive yields (#6802)
* optimistic_yield is a yield, not a delay, and avoids yielding if last yield has occurred recently enough.

* Suppress an unused argument warning.

Co-authored-by: Earle F. Philhower, III <earlephilhower@yahoo.com>
2020-01-27 16:47:39 -08:00
LeisureLadi
7b0fa3554c Update LEAmDNS.cpp (fix issue #6982) (#7025)
* Update LEAmDNS.cpp (issue #6982)

Check m_pUDPContext before calling functions to reset WiFi event callbacks, stop probing ... to close #6982

* Update LEAmDNS.cpp

Co-authored-by: Earle F. Philhower, III <earlephilhower@yahoo.com>
2020-01-27 16:08:30 -08:00
M Hightower
0c6be9e114 Made changes to include "ESP8266_" with ITEAD board names, {build.board}, (#7024)
as proposed by https://github.com/esp8266/Arduino/pull/6972#issue-358508056.
@ttytyper 's changes have been incorporate into this PR
The build flag ARDUINO_SONOFF_... should now appear as ARDUINO_ESP8266_SONOFF_...
@ttytyper, @mcspr, and @d-a-v thanks!
2020-01-27 14:44:08 -08:00
david gauchard
0989932669
allow ".bin.gz" filter in updater file selector (#7026) 2020-01-26 00:56:46 +01:00
Dirk O. Kaar
baf223c6cb Release 6.7.1 (#7034) 2020-01-25 23:54:32 +01:00
david gauchard
6e37ee36f8
fix CI: switch to python3 for pio (#7035) 2020-01-25 22:55:34 +01:00
Dirk Mueller
158039e414 Reduce mem footprint of ESP.getResetInfo() (#7030)
This function has excessively long datastrings that can
better be stored in flash, reducing runtime memory footprint.

Also detailed formatting only makes sense when there is an
exception or a watchdog. In other cases instead of printing
an unhelpful "flag: 0" we can just return the ResetReason, which
is much more readable.

Saves about 120 bytes of (data) memory.
2020-01-22 06:00:11 -08:00
Earle F. Philhower, III
00440cd84a
Remove memory leak on multiple calls to initCertStore (#7021)
In some cases, `initCertStore` may need to be called multiple times
(i.e. to update certs w/oa reboot).  In that case, the saved file names
leaked when the new ones were `malloc()`'d.

Fix by freeing the old strings, if present.
2020-01-17 10:10:17 -08:00
M Hightower
b930c4c3e6 boards.txt.py: Fix packagegen to use newfilestr instead of filestr when writing file. (#7018)
Three missing boards are now in package/package_esp8266com_index.template.json.
2020-01-17 18:24:47 +01:00
Earle F. Philhower, III
bb6243a17b
Use a python3 script to call python3 (#6960)
* Use a python3 script to call python3

It's odd, but because Windows requires a full Python3 install we must
have an executable called "tools/python3/python3" to use Python3 in the
toolchain.

Before, we simply symlinked to /usr/bin/python3 (for Linux) or
/usr/local/bin/python3 (Mac).  Unfortunately, depending on the method of
installation, on MacOS the Python3 executable can be in /usr/bin/python3
instead.

To avoid the entire issue, unify the Mac and Linux python3 placeholders
to use python3 itself to jump to the real executable.

Fixes #6931

* Explicitly remove old symlink to python3

The tar extraction for the updated python3 tarball will fail on systems
that already have a symlink in /tools/python3/python3 because the tar
extractor attempts to open the *target of the symlink* (i.e. the actual
interpreter in /usr/bin or /usr/local/bin).

Add a commented hack to destroy this symlink before expanding the
tarballs, if the file exists.  This is safe to do since it will be
overwritten by any extractions of the python3 tarball later in the
process.

Co-authored-by: david gauchard <gauchard@laas.fr>
2020-01-14 06:53:17 -08:00
Earle F. Philhower, III
0d38ea7308
Add back mklittlefs for linux32 target (#7011)
Fixes #7006

mklittlefs for 32-bit Linux disappeared from the packages.json.  Looks
like a transient build problem on the older eqt release (later builds
look fine).  Add it back, pointing to the first successful mklittlefs
build for lin32.

Co-authored-by: Develo <deveyes@gmail.com>
2020-01-11 09:16:46 -08:00
Earle F. Philhower, III
677007f481
Define MAX_SERVOS to 12, like original Servo.h (#6999)
Fixes #6997
2020-01-08 20:30:44 -08:00
Earle F. Philhower, III
5bc3079217
Fix Updater potential overflow, add host tests (#6954)
* Fix Updater potential overflow, add host tests

Fixes #4674

The Updater class could, when exactly 4K bytes were in the buffer but
not yet written to flash, allow overwriting data written to it beyond
the passed-in size parameter.

Fix per @jason-but's suggestion, and add a host test (plus minor changes
to Updater code to support host testing).

* Add missed mock file

* Remove most testing ifdefs fro updater

Per @mcspr's suggestion, we can pass in fake link symbols allowing
Updater to take the address of `_FS_start`/etc. even when building on
the host for testing.

There is still a single remaining wifi_set_power_mode ifdef'd and a
duplication of the digitalWrite/pinMode for testing vs. host building.

Co-authored-by: Develo <deveyes@gmail.com>
2020-01-08 17:38:28 -08:00
LaborEtArs
5e537e5783 Updating _port to really used port and made _port accessible (#7003)
* Updating _port to really used port and made _port accessible

* 2. Try
2020-01-08 21:36:39 -03:00
Earle F. Philhower, III
b4d2ab102b
Fix boolean/logical & mixup in LittleFS open (#6996)
To mimic SPIFFs behavior, we automatically create subdirectories when a
file is opened in a subdir.

The check mixed up a bitmask check with a boolean AND.  Fix it.
2020-01-07 10:55:42 -08:00
JasperHorn
8242d72271 Add LittleFS support to ESP8266WebServer.serveStatic() (#6987)
* Remove trailing whitespace

* Improve "is file" check for LittleFS support

The previous implementation was based on a quirk of SPIFFS (that exists
returns false for directories) so it wouldn't work with LittleFS. This
implementation works with both.

Co-authored-by: Develo <deveyes@gmail.com>
2020-01-04 20:33:05 -08:00
Earle F. Philhower, III
d4d89244bd
Add SDFS::Dir::fileTime callback (#6985)
Forgot to add a Dir->fileTime override, resulting in it always returning
(time_t)0, or Jan 1, 1970.

Add the override, returning the proper lastWriteTime.

Fixes #6981
2020-01-04 11:36:47 -08:00
Earle F. Philhower, III
753b5a581a
Update LittleFS to latest upstream head (#6986) 2020-01-04 09:59:06 -08:00
Earle F. Philhower, III
b62d8c7633
Update BearSSL, increase SSL stack (#6980)
Only minor updates to headers and no functionality change on the
portions that we use in the ESP8266.

@Teddyz reported random crashes while running against a local MQTT
server and was able to report stack usages of up to 6136 bytes.
Increase the SSL stack to a little more than that, once again.
2020-01-04 08:18:14 -08:00
Dirk Mueller
de307623b2 Move a couple larger strings from rodata to flash (#6976) 2020-01-02 22:26:08 -03:00
Earle F. Philhower, III
fa5040d5da
Only update LittleFS timestamp when opened write (#6956)
Fixes #6955

LittleFS was updating the timestamp on any close, not only for files
when they were opened for writing.  This could lead to excessive writes
to the flash.

Preserve the LFS flags, and only update the timestamp if the file was
opened for writing.
2019-12-30 15:43:26 -08:00
Earle F. Philhower, III
2492043669
Skip . and .. on LittleFS::dir::rewind() (#6959)
Fixes #6958

To match SPIFFS, we get rid of the "." and ".." dirents when we open a
directory on LittleFS.  Do the same on a rewind().
2019-12-30 14:23:14 -08:00
Dirk Mueller
5d5200af41 Reduce temporary string creation in HTTPClient::sendHeader (#6937)
* Reduce temporary string creation/reallocation in HTTPClient

This improves both performance due to fewer memory allocations/copies
as well as reduces code size by ~ 25% (150 bytes)

* Add more correct reservation calculation

Co-authored-by: Develo <deveyes@gmail.com>
2019-12-28 19:48:47 -08:00
StanJ
3197d2ac4e Issue2524 allow clocks below 100KHz (#6934)
* change bus clock (busywait) to be programmable [issue 2524], remove unused slave STOP function

* change bus clock (busywait) to be programmable [issue 2524], remove unused slave STOP function

* change bus clock (busywait) to be programmable [issue 2524], remove unused slave STOP function

* correct for underflow < 233Hz

* change bus clock (busywait) to be programmable [issue 2524], convert tabs to spaces

* updated minimum I2C speed for calculated bus clock
2019-12-28 19:07:38 -03:00
Dirk O. Kaar
809e5c967a EspSoftwareSerial, release 6.6.1 (#6943)
* Bug fixes to EspSoftwareSerial, release 6.6.0

Various improvements to the Delegate class template.
Memory footprint reduction of SoftwareSerial instances based on 3rd party contribution by @dirkmueller

* Bug fix EspSoftwareSerial, delegate template programming for > 3 platforms is interesting.

Co-authored-by: Earle F. Philhower, III <earlephilhower@yahoo.com>
Co-authored-by: Develo <deveyes@gmail.com>
2019-12-28 13:26:38 -08:00
Dirk Mueller
bea9cfc3a0 PROGMEM footprint cleanup for responseCodeToString (#6950)
* PROGMEM footprint cleanup for responseCodeToString

Doing returns with String/FlashStringHelper conversion for every
case means that the code for doing that is duplicated, which
is wasteful. doing it only once saves about 250 bytes (50%) of
code size.

* Remove "I'm a teapot" error code

* Add inline code comment to explain rationale
2019-12-27 19:02:57 -03:00
Dirk Mueller
698ffc3498 Various String handling cleanups (#6945)
Use the proper api (::clear(), isEmpty()) instead of doing
comparisons/assignments of empty strings. Also fix mixture
of tabs and spaces in the source code.
2019-12-26 17:03:18 -03:00
Dirk Mueller
6c2ab25087 Code size optimisations for ESP.getFullVersion() (#6936)
This saves about ~ 60 bytes of flash usage (50% reduction of
the total function size)
2019-12-23 17:52:16 -08:00
Dirk O. Kaar
99aeeadb4d EspSoftwareSerial 6.5.4 (#6932) 2019-12-21 08:24:13 -08:00
M Hightower
30bfdad458 Added missing "if (umm_heap == NULL) {..." to umm_free_heap_size_lw (#6929)
also called through xPortGetFreeHeapSize, umm_free_heap_size, ...

Co-authored-by: Earle F. Philhower, III <earlephilhower@yahoo.com>
2019-12-20 15:45:16 -08:00
Earle F. Philhower, III
52d84b1ead
Add a CRC32 over progmem and ESP.checkFlashCRC (#6566)
* Add a CRC32 over progmem and ESP.checkFlashCRC

Automatically embed a CRC32 of the program memory (including bootloader
but excluding any filesystems) in all images in unused space in the
bootloader block.

Add a call, ESP.checkFlashCRC() which returns false if the calculated
CRC doesn't match the one stored in the image (i.e. flash corruption).

Fixes #4165

* Add example that corrupts itself, comments

Show CRC checking catch a 1-bit error in program code by corrupting a
large array, and then return it to clean and verify the CRC matches once
again.

Add comments to the CRC check routine

Clean up pylint complaints on crc32bin.py

* Check linker script for CRC space in bootsector

Add an assertion in the eboot linker file to guarantee that we have at
least 8 bytes of unused space at the end of the boot sector to patch in
the CRC.  If not, the eboot link will fail.

* Add note about what to do if CRC check fails

Per discussion with @d-a-v.

When the CRC check fails, you could *try* to do certain things (but may
not succeed since there is known flash corruption at that point).  List
a few ideas for application authors.

* Only single, flash/ram friendly crc32() function

* Combine the CRC calc and bin generation in 1 step

Per discussion w/@mcspr, combine the CRC calculation with the binary
generation, removing the additional build step.
2019-12-20 14:38:35 -08:00
Earle F. Philhower, III
9985a32914
Add documentation for compressed OTA, fix bug (#6924)
* Add documentation for compressed OTA, fix bug

Fixes #6923

Documents the user steps needed to do a compressed upload, and notes the
2-step process needed for deploying compressed uploads to the field for
the first time.

Fixes a bug in serial output formatting discovered by @AdrianEddy.

Adds additional contributors for uzlib, per @pfalcon.

* Update README for esptool.py, too
2019-12-20 09:22:10 -08:00
Dirk O. Kaar
622baa1659 Bug-fix release EspSoftwareSerial 6.5.3 (#6922)
* EspSoftwareSerial 6.5.0 public release.

* EspSoftwareSerial bug fix public release 6.5.1

* Release 6.5.2, examples changed only, simplified adding WiFi setup etc. by moving logger setup up to the front.

* Parity bug fix: Overflow condition caused data and parity to get out of sync permanently.
2019-12-20 15:37:40 +01:00
Earle F. Philhower, III
ba22113f21
Fix Windows CI build (#6927)
Remove chocolatey (Win package manager) usage because it seems to often
have issues.  Use the main sources for Python3 and sed, instead.

Fix size printouts to use a simpler script which should work under
Windows and all UNIX-like OSes.
2019-12-19 17:14:33 -08:00
Earle F. Philhower, III
1d0bc5efdf
Allow GZIP compressed flash updates (#6820)
* Allow GZIP compressed flash updates

Modified the bootloader to be able to take stored updates in compressed
GZIP format (i.e. the output of "gzip -9 xxx.bin") and decompress them
on-the-fly to their final destination.  This can work for apps and for
filesystems (when used with the 2-step update option).

Allow eboot to be built using -Os/2 optimizations by fixing some portions
which failed when any optimizations were used.  Add -Wall and use data
and function sections to reduce size.  Use -Os to minimize size.

Remove obsolete esptool-ck calls to build a .ROM image, we don't use it.

Move all uninitted variables to RAM from IRAM, allowing 8-bit access.

Hook in @d-a-v and @pfalcon's uzlib port to actually do the
decompression.  Do not use any CRC checking which saves space.  Since we
have overwritten all of flash by the time we know id the CRC matches,
there's nothing we could have done anyway.

Adjust the Updater class to support GZIP files and not attempt to patch
them.

Bootloader builds to 0xd90 out of 0xfff bytes.

* Add @d-a-v's patch for httpupdate

https://github.com/esp8266/Arduino/pull/6820#pullrequestreview-326541014

* Update uzlib to point to pfalcon++

For now, because there are some self-test failures with @d-a-v's esp8266
branch (whose cool new features we don't actually use in eboot now)
start with pfalcon's 2.9 release and add the 2 patches (clcidx to code
from IRAM/RODATA, and the Windows test file renaming) needed to build
and run successfully.

* Add (c) notice for uzlib to README
2019-12-18 09:17:38 -08:00
david gauchard
d40dbb4584
device tests: some of them can be run on host (#6912)
* device tests: mock scripts + rename some tests to enable mock-testing them

* move symbol
2019-12-16 19:20:07 +01:00
david gauchard
d1237fd016 back to 2.7.0-dev (#6917) 2019-12-16 13:41:15 -03:00
david gauchard
3d128e5c78
release 2.6.3 (#6916) 2.6.3 2019-12-16 14:42:16 +01:00
StanJ
5612738636 change to make inline helpers truly inline [issue 6875] (#6898)
* change to make inline helpers truly inline [issue 6875]

* pulled the inline helpers out of the TWI class [issue 6875]

* removed some inlines causing issues [issue 6875]

* removed 2 more inlines from slave timeout section [issue 6875]

* removed 2 more inline attributes on public functions, moved twi_scl_valley up into the master section [issue 6875]
2019-12-15 14:38:33 -03:00
Erdem UNCUOĞLU
1d052834a4 fix for #6904: NodeMCU v1.0 board option "Builtin Led" not working. (#6905) 2019-12-12 14:51:49 -03:00
James Marlowe
eb6418f641 POST http client example (#2704)
* POST http client example

* avoid deprecated api

* Update PostHttpClient.ino

style, comments

* Update PostHttpClient.ino
2019-12-11 14:55:52 -08:00
Earle F. Philhower, III
d012adc9bb Add hh (byte) format for printf and scanf (#6896)
Fixes #4660

Add in support for byte-wide scanf and printf (%hh..) in printf and
scanf.  Allows reading into a byte array one byte at a time.
2019-12-10 21:29:07 +01:00
david gauchard
72a4dde64f
sntp callback: use a recurrent schedule function (#6888) 2019-12-10 11:41:42 +01:00
david gauchard
3e6c25c21b
udp: limit buffer depth (#6895)
This commit avoids OOMs on an udp corner case where a delay() in the main
loop would allow memory filling.

A memory leak has been observed with such semantically forbidden delay,
unsolved yet, and preventing to use a simple counter instead of walking
through a linked list.  The count limit is however small.
2019-12-10 11:04:49 +01:00