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

3349 Commits

Author SHA1 Message Date
Earle F. Philhower, III
f6dd826437
Fix MFLN probe and allow returning whether MFLN succeeded or not after a connection. (#6000)
Fixes #5996

* Add extensions to probe message for EC, others

probeMFLN was failing on some connection attempts to servers which only
supported EC based ciphers because it did not include the proper TLS
handshake extensions to list what kinds of ECs it supported.

Add those to the probeMFLN ClientHello message to make probes pass.

* Add client.getMFLNStatus method, returns MFLN state

After a connection it is useful to check whether MFLN negotiation
succeeded.  getMFLNStatus returns a bool (valid only after
client.connect() succeeds, of course) indicating whether the requested
buffer sizes were negotiated successfully.
2019-04-25 12:40:26 -07:00
Earle F. Philhower, III
d9b0480f09
New menu option to minimize BSSL ROM with only RSA (#6006)
* New menu option to minimize BSSL ROM with only RSA

Adds a menu option and define to limit BearSSL to older RSA connection
options.  This saves ~45K program memory and can speed up connections
since EC, while more secure, is significantly slower on the chip.
The supported ciphers are identical to the ones that axTLS supported.

Fixes #6005

* Add default SSLFLAGS(blank) to platform.txt

* Fix unused variable warning

* Add clarifying comment to menu items
2019-04-25 11:13:26 -07:00
Earle F. Philhower, III
72c21feff6
Make chars unsigned by default, matching ESP8266 (#6013)
Force GCC to run with -funsigned-char during host tests  to make
the PC match the default behaviour used by the xtensa GCC port.

As noted in #6010.  Thanks @MichaelBrunn3r
2019-04-24 08:44:36 -07:00
Max Prokhorov
c5efb922ca PlatformIO: generate core_version.h when using feature/stage (#5917)
* platformio: generate core_version.h when using feature/stage

* quote command line

* Modify CPPFLAGS conditionally
2019-04-23 23:36:42 +03:00
Michael Brunner
4e0e4e4340 Added notice to update submodules to test README (#6008)
Some users didn't know they had to update the submodules before running tests on host (see esp8266/Arduino/issues/5910). Added a notice to prevent wasting time of users new to git
2019-04-23 15:04:26 +02:00
Dirk O. Kaar
0dd6549c36 ISR code must be in ICACHE_RAM - the check was commited in ab125162bf (#6002) 2019-04-20 15:35:56 +02:00
david gauchard
ab125162bf ISR: check for address in IRAM (#5995) 2019-04-19 06:40:18 -07:00
david gauchard
2c36cfe04d
mock on host: compile without rtti (no dynamic_cast<>(), like on native) (#5994)
* mock on host: compile without rtti (no dynamic_cast<>(), like on native)
2019-04-17 18:27:30 +02:00
Dirk O. Kaar
b4e8b2f6e0 Submodule SoftwareSerial: small footprint reduction. (#5993) 2019-04-17 07:39:59 -07:00
david gauchard
6156a54145 polledTimeout: ensures timeType is unsigned (#5991) 2019-04-16 14:29:50 -04:00
Earle F. Philhower, III
3b9db65ea3 Add String::toDouble from upstream Arduino core (#5986)
Fixes #5985
2019-04-15 00:33:15 +02:00
Christian Zöller
e3de77f671 Fixed paths in documentation (#5983) 2019-04-14 10:31:09 -07:00
Develo
755f61b86a
Update station-class.rst (#5977)
Clarify ESP8266WiFiSTAClass::BSSID()
2019-04-12 17:09:52 -04:00
Dirk O. Kaar
3cb2ec4ed0 Correct mistake with library version numbering (#5981)
Now version 5.0.3 - also available via Arduino library manager now (eps8266, esp32).
2019-04-12 08:20:56 -07:00
david gauchard
96cfdb3ec7
reenable ARP queuing in lwIP2 by courtesy of @aboulfad (#5978)
https://github.com/esp8266/Arduino/issues/3481#issuecomment-482293996
https://github.com/d-a-v/esp82xx-nonos-linklayer/pull/33
it was removed by error on 9 oct 2018 a1e59e9c01 (diff-8a46852651388faec204ec21c86b8098L586)
2019-04-12 12:14:02 +02:00
Earle F. Philhower, III
1c6e762203
Add note about needing 0.4 esp8266fs uploader (#5976)
Update the docs to point to the later version of the 8266 sketch data
uploader and inform existing users of the need to upgrade.

Fixes #5845
2019-04-12 04:59:05 +03:00
Earle F. Philhower, III
885276e75c
Unaligned access support for pgm_read_word/dword (#5692)
* Unaligned access support for pgm_read_word/dword

* Fix pgm_read_ptr_aligned() per #5735

* Allow users to use aligned-only via a #define

Adding -DPGM_READ_UNALIGNED=0 or #define PGM_READ_UNALIGNED 0 will
change the default at compile-time to only aligned (faster, but less
compatible) macro implementations.

Default is still to allow unaligned accesses.
2019-04-11 22:24:49 +03:00
Dirk O. Kaar
882d5ba422 Fix SoftwareSerial for inverse logic mode, release tag 5.0.2. (#5972) 2019-04-11 16:41:23 +02:00
Jeroen88
667816ebe0 BearSSL Max Fragment Length Negotation and Node.js server (#5929)
* Minor bug fixes in Maximum Fragment Length Negotation example, mainly giving background processes some time in fetch()

* Minor layout changes to pass travis tests

* Use PolledTimeout for timeout
2019-04-11 14:21:04 +02:00
Gijs Noorlander
f950d53d82 Make SPIFFS garbage collection publicly available (#5944)
Original issue: https://github.com/esp8266/Arduino/issues/2870
2019-04-10 20:27:23 +03:00
Earle F. Philhower, III
9712170276
Fix String.replace overlapping strcpy (#5966)
* Fix String.replace overlapping strcpy

Fixes #5949

Adds a test from the issue above and fixes the problem valgrind found.

Additional pathological memcpy->memmove fixes
2019-04-10 17:21:15 +03:00
Earle F. Philhower, III
4b596d8fb1 Fix boards-manager install issues on Linux and Windows (#5898)
* Fix packaged python paths for Windows

Fixes #5881

The path to python.exe on Windows needs to change depending on whether
it is installed via the boards manager or GIT (similar to the compiler
paths).  Adjust accordingly.

* Add python-placeholder to make boardsmanager happy

An empty "python" directory will be created by the boards-manager
installer.  Required because all archs need all tools defined.

* Make the placeholder include a symlink for "python"

* Fix esptool windows python path

Fixes a typo in the python path for Windows for upload.

* Fix esptool windows python path

Fixes a typo in the python path for Windows for upload.

* Fix tools path when in GIT mode for upload
2019-04-10 07:32:50 -04:00
Earle F. Philhower, III
0f4c9f7103 Split IRAM into 2 linker sections to move std::fcn (#5922)
* Split IRAM into 2 linker sections to move std::fcn

Callbacks need to be placed in IRAM when being called from an IRQ (like
the SPISlave callbacks).

This can be done by hacking the std::functional header and making every
single specialization of the template into an IRAM section, which would
take a lot of space for no benefit in the majority of cases.

The alternate is to specify the single instantiation types/operators
required, but the problem is the flash segment matcher would match them
before the IRAM section was begun, and rules for them would just not be
applied.

Get around this by splitting the IRAM section definition into .text and
.text1.  This is linker syntactic sugar and does not actually change the
on-chip layout.  But it does allow us to put the exception vectors at
the required absolute addresses and add single functions to IRAM.

* Add .text1 segment to space used calculation in IDE

* All functional callers are now placed in IRAM

* Write out the .text1 segment to the BIN

The extra segment name needs to be placed into the output binary as
well, or else only the init code gets stored and none of the real app is
present.  This leads to an infinite boot loop.

This change adds in the segment to the generated image.
2019-04-10 10:49:31 +02:00
Earle F. Philhower, III
fa0db2e3ab Fix crash in certain PMEM printf format parsing (#5968)
In some cases the printf implememtation would call an internal puts()
implementation which did not use pgm_read_byte() to access the format
string.  In many operating modes this would work, but in interrupts or
when flash was disabled you'd get crashes.

Updated newlib to use pgm_read_byte in that one spot and recompiled.
2019-04-10 09:33:09 +02:00
Dirk O. Kaar
e1c8bf8df2 Update EspSoftwareSerial to release 5.0.0. (#5965)
* Update EspSoftwareSerial to release 5.0.0.

(Includes half-duplex patch for SerialStress.ino)

* Updated EspSoftwareSerial to allow Platformio builds that lack defaults for RX/TX defines.
2019-04-09 16:14:02 -04:00
david gauchard
77451d6ec9
Hardware SPI BREAKING: unswap mode 2 and 3 for portability (#5948)
* Hardware SPI BREAKING: unswap mode 2 and 3 for portability
use SPI.restoreEsp8266LegacyMode2And3() for former behaviour
2019-04-06 01:13:09 +02:00
david gauchard
a1796f455a
lwIP-v2: new patch to randomize tcp source ports (#5906)
ref: d-a-v/esp82xx-nonos-linklayer#31
origin: #5902
me-no-dev/ESPAsyncTCP#108

Following the links above is instructive.
To summarize:

    * currently and from a long time lwIP tcp client connections always uses the same tcp source port number right after boot
    * this port number is increased everytime a new one is needed (= new tcp client connection)
      (to be noted, linux has the same increasing behavior)
    * when connecting to the same server (right after boot), the triplet (esp-ip-address, source port, destination port) are the same, and may hit remote server list of sockets in time-wait-state (previous connection unproperly closed from the same esp). Consequently the new connection fails when it happens.
    * this is happening only when debugging (esp reboots often, in less time than time-wait expiration), so the nasty effect is amplified especially when bugs are being chased
    * efforts had been done when espressif's lwIP implementation wasn't open source, with WiFiClient::setLocalPortStart() #632 but it must be explicitely called with a different random number at every reboot. Efficient but not ideal.

This PR uses espressif firmware's r_rand() everytime a new local source port is needed. A different source port number is now showed by tcpdump right after boot. Source port range and duplication is verified everytime in lwIP's src/core/tcp.c:tcp_new_port(). It is implemented as a local patch for upstream lwIP so it is valid not only with WiFiClient but also with @me-no-dev's Async libraries (they don't use WiFiClient).

WiFiClient::setLocalPortStart() is still usable with the same effects as before.
2019-04-05 17:26:51 +02:00
david gauchard
9a2ed274f3 polledTimeout: add option to use CPU count instead of millis() (#5870)
* polledTimeout: add option to use CPU count instead of millis()

* use more "using" alias

* more c++/clear code, using typename (thanks @devyte)

* rename class name to include unit, introduce timeMax() and check it with assert()

* remove useless defines

* improve api readability, add micro-second unit

* update example

* mock: emulate getCycleCount, add/fix polledTimeout CI test

* + nano-seconds, assert -> message, comments, host test

* allow 0 for timeout (enables immediate timeout, fix division by 0)

* typo, set member instead of local variable

* unify error message

* slight change on checkExpired() allows "never expired"
also removed printed message, add YieldAndDelay, simplify calculations

* remove traces of debug.h/cpp in this PR

* include missing <limits> header

* back to original expired test, introduce boolean _neverExpires, fix reset(), getTimeout() is invalid

* fix expiredOneShot with _timeout==0 check

* reenable getTimeout()

* expose checkExpired with unit conversion

* fix timing comments, move critical code to iram

* add member ::neverExpires and use it where relevant

* improve clarity

* remove exposed checkExpired(), adapt LEAmDNS with equivalent

* add API ::resetToNeverExpires(), use it in LEAmDNS

* remove offending constness from ::flagged() LEAmDNS (due do API fix in PolledTimeout)

* simplify "Fast" base classes

* minor variable rename

* Fix examples

* compliance with good c++ manners

* minor changes for consistency

* add missing const

* expired() and bool() moved to iram

* constexpr compensation computing

* add/update comments

* move neverExpires and alwaysExpired
2019-04-05 10:50:53 -03:00
david gauchard
f0eb5509a0
use static_assert to check on fw structure changes over updates (fix) (#5946) 2019-04-03 23:17:09 +02:00
david gauchard
ca79f2ce39
use static_assert to check on fw structure changes over updates (#5939) 2019-04-02 00:44:27 +02:00
Evgeny Dontsov
68c0a1cc9e sta_config_equal (#5937)
* sta_config_equal

* sta_config_equal bug update
2019-04-01 15:38:09 -03:00
david gauchard
c1e439d447
fix lwip-v1.4 compilation (#5935) 2019-03-31 23:04:42 +02:00
ufocia
f139519061 Correct out of bounds condition and remove an unnecessary cast (#5924)
C arrays are 0 indexed, accordingly writing to array[255] actually writes to the 256th position, which is naturally out of bounds of a 255 item array. increasing the size of the array to 256 corrects that error. Also, 0 is an int and requires a cast into a char, '\0' is just a cleaner (a more syntactically pedantic) way to achieve the same end.
2019-03-27 17:27:20 -07:00
david gauchard
2e75e88c49
bugfix: restore WiFi::setSleepMode functionality with sdk-2.2.x (#5919) 2019-03-26 14:07:49 +01:00
Zachary Drew
7a2e935f53 Fix OTA in AP mode (#5894)
OTA is broken in AP mode because ESP8266mDNS is checking whether the station is connected before processing. Change the logic to WiFi.isConnected() OR WiFi.softAPgetStationNum()>0 fixes the issue.
2019-03-21 12:05:16 -07:00
Ahmed El Sharnoby
e829221833 Fix ssdp (#5750)
* Update ESP8266SSDP.h

Fix SSDP bug: The response to M-Search Packet with ST field set to UUID should be with the UUID not the Device Type
Integrated 'uuid:' prefix into the char array of the _uuid

* Update ESP8266SSDP.cpp

Fix SSDP bug: The response to M-Search Packet with ST field set to UUID should be with the UUID not the Device Type
Integrated 'uuid:' prefix into the char array of the _uuid

* include 'uuid:' in format String and in flash

* Update ESP8266SSDP.cpp
2019-03-21 18:21:48 +01:00
Max Prokhorov
8961bba94e LEAmDNS: remove implicit debug statements (#5895) 2019-03-21 17:04:12 +01:00
Juppit
b270f4907c include submodules with git clone --recursive (#5882)
* include submodules
You may also need to run this update recursively ('git submodule update --init --recursive').
2019-03-21 15:48:23 +01:00
Juppit
70c3547eb3 Update link in platform.txt (#5900)
The link to the Arduino-IDE-1.5-3rd-party-Hardware-specification has changed in the meantime,
from https://github.com/arduino/Arduino/wiki/Arduino-IDE---1.5-3rd-party-Hardware-specification
to https://github.com/arduino/Arduino/wiki/Arduino-IDE-1.5-3rd-party-Hardware-specification
2019-03-21 13:54:55 +01:00
Earle F. Philhower, III
54240d2cc5
Fix String::replace() garbage at end of string (#5897)
* Fix String::replace() 

Fixes #5883 and supercedes #5890

The replace() function was using len() while in the middle of buffer
operations.  In SSO mode len() is not stored separately and is a call to
strlen(), which may not be legal if you're in the middle of overwriting
the SSO buffer, as was the case in ::replace when the replacement string
was longer than the find string.  This caused potential garbage at the
end of the string when accessed.  Instead, just cache the length in a
local while doing the operation.

Add in test cases from #5890 as well as some new ones that fail on the
unmodified core.

* Fix stack smashing error on 64b

When pointers are 8 bytes long, the size of a String is larger than 16
chars.  Increase the allocated array we're using in the test to avoid a
"stack smashing" error.

* Manually call destructor in test

Just for clarity, manually call the destructor for the Strings() that
are "placement new'd" in the String tests.  It is a no-op for the
existing test, since thanks to SSO there are no memory allocations, but
will help in case someone adds tests later which include longer strings.
2019-03-20 06:18:04 -07:00
Jiri Bilek
64e30b270b Fix the changed structure of the input file (#5891)
The input file containing certificates has changed.
2019-03-18 15:15:59 -07:00
Earle F. Philhower, III
68bcc41429 Fix SSID reporting for 32-char SSIDs (#5889)
Fixes 5853
2019-03-17 23:06:41 -03:00
david gauchard
d19fc3b647
fix boards.txt.py with python3 (#5887)
* fix boards.txt.py with python3

* fix boards.txt.py to generate same order when using python2 or python3
2019-03-16 23:27:44 +01:00
david gauchard
a3ea816e65
add optional espressif fw nonos-sdk 2.2.x (19.03.13) (#5873) 2019-03-14 13:35:26 +01:00
david gauchard
e5b4de3633
fix DEBUG macros (#5728)
* fix DEBUG macros

All fmt strings in flash
fix #5658

This also allows to avoid warnings and easy mistakes with (no brace):
    if (something)
        DEBUGV("blah");

* use newlib unaligned-compatible printf for DEBUGV

* remove useless putprintf since ::printf already uses ets_putc
2019-03-14 11:19:21 +01:00
Earle F. Philhower, III
9365f6d116
Fix Serial.write(0) overloading (#5878)
Add missing "using Print::write" to the HWSerial class to get the proper
overrides to make Serial.write(0) and Serial1.write(0) work as expected.
2019-03-13 18:06:15 -07:00
liebman
e46ccae9d5 optionally allow redirects on HTTPClient & OTA updates (#5009)
* optionally allow redirects on http OTA updates

* Refactored HTTPClient::begin(url...) & setURL functions, now only beginInternal parses URL, sets ports
Added HTTPRedirect example.

* fix indentation for style check

* add space after while for style check

* don't use deprecated begin method in redirect example

* moved redirect handling code to HTTPClient.
only GET and HEAD requests are currently handled automatically
Redirects that fail to be automatically handled return the redirect code as before

* added support for POST/303 redirect
added device redirect tests

* add missing getLocation() implementation

* if the new location is only a path then only update the URI
2019-03-13 01:51:17 +01:00
Thomas Friedrichsmeier
071eeb8b67 Allow to disable DHCP gateway offer when set up of AP. (#4421) 2019-03-13 00:28:41 +01:00
Earle F. Philhower, III
02f54e85fd
Reimplement SD.h write methods exactly in File (#5861)
* Reimplement SD.h write methods exactly in File

Replace the individual override with the existing SD.h File's
implementation for all methods of File::write.

Fixes #5846

* Add add'l tests

* Fix Print and File incompatible writes w/casts

Print and File have ambiguous resolutions for single-argument
write(0)s.

Fix by adding explicit methods.  A write of any integer will not be a
const char* write (i.e. won't write a string) but will instead just
write the integer truncated to 8 bits (as makes sense).

* Use 256byte chunks in ::write template

Reduce stack requirements for templated writes to 256bytes, matching the
size uses in WiFiClient/etc. (from 512bytes).  Reduces the chance of
stack overflow.

* Move write(int) methods up to Print.h

Remove some technical debt by moving the ::write(int/short/long) methods
out of FS and HardwareSerial and up into Print.h.
2019-03-12 13:58:00 -07:00
Tomoatsu Shimada
192aaa4291 Adjust python module search path to avoid picking up pre-existing pyserial/esptool instead of one under tools/ (#5854) 2019-03-09 09:35:30 -08:00