1
0
mirror of https://github.com/esp8266/Arduino.git synced 2025-04-22 21:23:07 +03:00

3678 Commits

Author SHA1 Message Date
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
Anders
a49f047096 - Move all Strings to flash and optimize String usage, saving 4-5 kB of RAM.
- Replace const with constexpr where possible.

- Use default constructor instead of copy constructor for IPAddress variable initialization.

- Add MeshTypeConversionFunctions namespace around TypeConversionFunctions.

- Add MeshUtilityFunctions namespace around UtilityFunctions.

- Add ESP8266WIFIMESH_DISABLE_COMPATIBILITY preprocessor flag to retain compatibility with old code despite new namespaces.

- Add setLogEntryLifetimeMs and setBroadcastResponseTimeoutMs methods to EspnowMeshBackend.

- Move FloodingMesh constant definitions from header to .cpp file to reduce the risk of extra RAM consumption.

- Add deactivateAP method to FloodingMesh.

- Make deactivateAP static and add new non-static deactivateControlledAP method to MeshBackendBase.

- Add example of how to transfer null values using multiStrings to HelloEspnow.ino.

- Improve documentation.

- Improve comments.
2019-12-22 19:09:04 +01: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
jennytoo
70c337001c Fix sending headers in #send_P(int, PGM_P, PGM_P, size_t) (#6881)
The method #send(int, char*, char*[, size_t])) is a virtual method which
calculates the size of the content then calls #send_P(int, PGM_P, PGM_P,
size_t). This particular implementation of #send_P differs from the other
implementations of #send and #send_P in that it uses #sendContent for
headers and always calls #sendContent_P for contents even when the
contents is not specified.

The method #sendContent is intended for body and prepends the chunksize
in chunk mode but this breaks the HTTP protocol which does not expect a
chunksize prior to the headers.

Fix is simply to do the same thing as all the other methods - call
_currentClient.write and only call #sendContent_P if there is content to
send.
2019-12-10 09:47:26 +01:00
Earle F. Philhower, III
759ba27b62 Use 128B chunks instead of 1B writes in Print::print(FlashStringHelper) (#6893)
Fixes #6524

Should help with speed of output when printing large flash strings to
things like a file or a TCP connection.

Use a 128 byte chunk in a temp buffer to send data using write(),
reducing the # of write calls by ~128x.
2019-12-09 23:04:49 -03:00
Earle F. Philhower, III
7605dc1643
Only set flashmode byte when uploading an executable (#6891)
Fixes #6880

The updater was patching in the proper flashmode configuration byte for
all uploads, apps and filesystems.  This ended up corrupting one byte on
every FS upload.

Change updated to only patch theflashmode if it is doing an app.
2019-12-08 19:34:04 -07:00
Earle F. Philhower, III
1189417d9f
Rebuild eboot.elf to include #6823 changes (#6890)
Just ran a "make" in the bootloaders/eboot dir to regenerate the
eboot.elf file we use to link binaries with.

Fixes #6863
2019-12-08 13:07:51 -07:00
Dirk O. Kaar
8a6a7f7480 Non-parity modes save 56 bytes of heap memory. (#6882)
Hardened code in non-parity mode against setting parity case by case.
Waveform generator is back after one release without.
2019-12-05 08:25:44 -03:00
Matthias Hertel
a738884387 Handle HEAD requests for static files correctly (#6837)
* Handle HEAD requests for static files correctly

* Handle HEAD requests for static files correctly
2019-12-04 18:23:25 +01:00
LeisureLadi
5aefed2f4b Update PROGMEM.rst (#6872)
* Update PROGMEM.rst

Include array of strings in the description, since the examples in Arduino do not consider the right pointer size

* Update PROGMEM.rst
2019-12-04 13:14:14 +01:00
david gauchard
e08b22c5b5
sdk:22x-191122 (#6879)
* sdk:22x191122
another firmware to test
not default: v2.2.1-119-ga0b1311 (shows as SDK:2.2.2-dev(a58da79) in debug mode)
default unchanged

* and the obj files
2019-12-04 11:41:51 +01:00
Anders
962a23d253 - Make it possible to transfer Strings containing null values via ESP-NOW and FloodingMesh.
- Add uint8ArrayToMultiString and bufferedUint8ArrayToMultiString TypeConversionFunctions to facilitate transfer of Strings containing null values.

- Add HKDF to CryptoInterface.

- Add ChaCha20 + Poly1305 AEAD to CryptoInterface.

- Add customizable nonce generator to CryptoInterface.

- Add ability to automatically encrypt/decrypt ESP-NOW messages via AEAD (ChaCha20 + Poly1305), independent from encrypted ESP-NOW connections.

- Greatly improve performance of incrementSessionKey, espnowGetMessageID, espnowSetMessageID and all non-template TypeConversionFunctions. The average performance increase is roughly a factor 5. Fun fact: Printing a MAC to a HEX String is now over twice as fast when using TypeConversionFunctions compared to using standard functionality like sprintf.

- Add uint64ToUint8Array and uint8ArrayToUint64 TypeConversionFunctions.

- Make it possible to use String values as ESP-NOW and FloodingMesh key seeds, instead of just requiring plain key arrays.

- Add customizable responseTransmittedHook to sendEspnowResponses.

- Add _responsesToSendMutex to make the new responseTransmittedHook safe to use.

- Remove verboseModePrinting from sendPeerRequestConfirmations method to reduce performance variations.

- Fix faulty messageID generation in FloodingMesh.

- Make assert checks more complete and easier to understand in the setMetadataDelimiter method of FloodingMesh.

- Rename EspnowEncryptionKey to EspnowEncryptedConnectionKey since there are now multiple encryption keys.

- Rename acceptsUnencryptedRequests to acceptsUnverifiedRequests, unencryptedMessageID to unsynchronizedMessageID, receivedEncryptedMessage to receivedEncryptedTransmission, since there are now multiple modes of encryption.

- Rename resultArrayLength to outputLength in CryptoInterface and remove its value restrictions in order to match the BearSSL functionality.

- Improve performance of FloodingMesh::encryptedBroadcast.

- Rename FloodingMesh methods maxUnencryptedMessageSize/maxEncryptedMessageSize to maxUnencryptedMessageLength/maxEncryptedMessageLength, so that String length naming is consistent within the library.

- Update examples to illustrate the new features.

- Improve comments.
2019-12-04 02:30:16 +01:00
david gauchard
326083044a
webserver: fix sending char* (#6878)
* webserver: fix sending char*

* add missing char*  overload
2019-12-04 00:51:51 +01:00
david gauchard
ee24cffc5a
fix device tests (#6861)
* help in makefile

* fix some device tests, http_server is pending

* fix webserver test, one test is disabled due to general python2->3 failure

* remove debug strings

* minimize diff

* set reset method back to the default one on generic board

* fix vcc range check from datasheet
vcc is read as 2.9V here, datasheet says 2.5-3.6, old low limit was 3v

* tell python to decode string
2019-12-03 23:26:54 +01:00
StanJ
2309a1c9cb removed TWI_CLOCK_STRETCH_MULTIPLIER (#6867) 2019-12-03 14:45:58 -03:00
Earle F. Philhower, III
074a8016bf
Remove user_interface.h from gdbstub includes (#6862)
* Remove user_interface.h from gdbstub includes

Avoid a warning by not including the unneeded "user_interface.h" from
gdbstub.c.  Leftover from original stub code from the SDK, this include
is unnecessary in the Arduino core.

* Add example to ensure gdbstub compiles in CI

Ensure the same user_interface warning doesn't occur in the future by
adding the example shown in the GDB docs to the CI build process.
2019-12-01 15:39:08 -07:00
StanJ
cc6d346aa5 added clock stretch yield, [issue 2162] fixed twi::status (#6860) 2019-12-01 01:21:54 -03:00
Dirk O. Kaar
22b2687a25 Conflict with pre-included Arduino.h (the indirect includes thereof) (#6853)
* Conflict with pre-included Arduino.h (the indirect includes thereof) resolved.

* Include both time.h and sys/time.h
2019-11-28 15:31:57 -03:00
david gauchard
40f5a99d03 back to 2.7.0-dev (#6850) 2019-11-27 23:54:24 -03:00
david gauchard
bc204a9bfa
release 2.6.2 (#6849) 2.6.2 2019-11-28 01:38:43 +01:00
Dirk O. Kaar
c37903c33b Uninitialized stack object can have unintended bad values (#6846) 2019-11-27 20:27:52 -03:00
Dirk O. Kaar
ec7ae4ed44 Using clockCyclesPerMicrosecond() in host build fails (#6844)
* At least the F_CPU define in host mock.h is needed by host Arduino.h - need to include Arduino.h further down in mock.h for this to work.

* Geting the include order right
2019-11-27 13:29:15 -03:00
Dirk O. Kaar
7ab1f615ac F_CPU is available and is 80000000 (#6841) 2019-11-26 10:32:13 -07:00
Earle F. Philhower, III
56fe2bfe73
[BREAKING] Update FS plugin info for python3 compat (#6807)
The FS uploader plugins need to be updated to use python3 and not
python, or they will fail on Windows (or Linux boxes without an
installed python2 interpreter).

Update the documents to point to the new versions.
2019-11-26 08:43:18 -07:00
Develo
32792483cc Fix pointer arithmetic (#6830)
Actually advance position while looping
2019-11-24 11:42:17 +01:00
Earle F. Philhower, III
8f6e0dd339 Allow for POSTs larger than a few 100 bytes (#6800)
This is all @dirkx , whose PR unfortunately got borked when we were
trying to update it to the new format.  As @dirkx said:

When sending POST responses of well over a K - _write() may not sent it
all. Make sure we do -- but cap the individual writes - as somehow large
2-3k blobs seem to cause instability (on my 12F units).

Supercedes #2528
2019-11-24 01:53:29 -03:00
david gauchard
05d28bc045 reset artificial timezone when using newlib (#6828) 2019-11-24 00:19:16 -03:00
david gauchard
8b3b60056a
switch to firmware 2.2.x-190703 by default (#6826) 2019-11-24 01:00:18 +01:00
david gauchard
8ec93dcd26 use wificlient.available() where relevant (#6827) 2019-11-23 20:12:37 -03:00
Dirk O. Kaar
a35edca07a EspSoftwareSerial: ctor/begin() compatibility to AVR/ESP8266/ESP32 (#6814)
* EspSoftwareSerial: ctor/begin() compatibility to AVR/ESP8266/ESP32 HW release 6.2.0

* Release 6.2.1: In loopback example, explicit pin settings and for ESP32, realistic max. bps for single stop bit config.

* Loopback example can exploit new invert API in HardwareSerial

* EspSoftwareSerial 6.3.0
2019-11-22 14:26:00 -03:00
Mike Nix
5b500e4e34 Move eboot_command_clear to after firmware copy. (#6823)
The eboot command was cleared from the rtc mem before the firmware copy
making it possible for a power failure during an OTA update to brick the
esp until the firmware was loaded via USB because of a partial firmware
copy that would never be restarted.

Moving the eboot_command_clear to after the copy ensures that any partial
copy is restarted at next power on.
2019-11-21 22:37:12 -03:00
Earle F. Philhower, III
ebae47c13a
Expand BSSL stack (#6819)
Fixes #6811 which found an issue where connecting to scripts.google.com
would *occasionally* cause a crash.  On inspection, it was found that up
to 5828 bytes of stack were used once in a while, so expand the stack to
5900 bytes to cover this case plus a little extra.
2019-11-20 18:05:38 -07:00