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

3738 Commits

Author SHA1 Message Date
Develo
083a8875ea
Update reference.rst 2020-08-13 16:17:13 -04:00
Develo
3c76e76ae0
Update reference.rst
Missing ), clarifications
2020-08-13 16:08:48 -04:00
Develo
69549ad2b4
Update reference.rst
Add flush() method.
2020-08-13 15:17:47 -04:00
Develo
db8d82c155
Update reference.rst
Clarify blocking case for write()
2020-08-13 14:37:27 -04:00
Develo
39524baeb3
Fixes #7484 2020-08-12 18:24:00 -04:00
standby24x7
683b8e606c
Fix spelling typos in files under doc/esp8266wifi (#7520)
This patch fixes some spelling typos in following files
bearssl-client-secure-class.rst
client-class.rst
scan-class.rst
scan-examples.rst
server-examples.rst
2020-08-12 08:28:22 -07:00
david gauchard
6feda9ebda
base64 class uses String, adding harmless #include (#7517) 2020-08-11 14:30:39 +02:00
david gauchard
777323709b
webserver: add define WEBSERVER_HAS_HOOK when ::addHook() is present (#7515)
This allows conditional compilation for external libraries
2020-08-11 02:15:46 +02:00
Takayuki 'January June' Suwa
fc2426a5e9
sys/pgmspace.h: Refactor inline asm (#7510)
* Refactor asm tabs for `.S` cosmetics

* Avoid fixed regname (`a14`) allocation

* Remove unnecessary explicit cast and word masking
2020-08-08 17:29:30 -07:00
david gauchard
79fc0b3b4a
CI: on host: force 64 bit mode like make -j2 CI implicitly does (#7513)
It allows to run CI tests on computers having gcc-multilib installed
2020-08-07 17:17:29 +02:00
Earle F. Philhower, III
3e567e9489
Add SerialEvent() callback to loop processing (#7505)
* Add SerialEvent() callback to loop processing

Match the AVR SerialEvent implicit callback.  Callback is executed
in normal user mode, not IRQ, so standard processing can be uses.

Fixes #752 after 5 years. :)

* Fix style
2020-08-05 20:13:37 -04:00
Earle F. Philhower, III
9afb084159
Clean up minor warnings from LGTM.com (#7500)
* Clean up minor warnings from LGTM.com

LGTM (Semmie) is a tool, bought by GitHub last year, that conducts basic
linting tasks on code and HTML.

Clean up the warnings identified in the latest report:
https://lgtm.com/projects/g/esp8266/Arduino/?mode=list

No functionality should change, however this may fix some issues with
the perl utilities not exiting properly on a Ctrl-C from the command
line.

* Back out HTML changes and rerun boards.txt.py
2020-08-03 19:19:04 -07:00
Earle F. Philhower, III
a8e35a579c
Add valgrind mocked test to CI (#7501)
Run valgrind on host mock example runs to catch more bugs in CI.  These
tests would have caught the problem in #7464 before users did.

Add a list of some randomly picked examples to run, and add an option to
run the loop exactly once in the host mock routine, so the test will
actually exit under valgrind.
2020-08-03 19:00:51 -07:00
Earle F. Philhower, III
fc1aa554cd
Remove warnings when buinding NoAssert (#7499)
Parameters that are only used in an assert() statement are unused when
the NoAssert-NDEBUG option is used.  This causes the following unused
parameter warnings while building:

````
/home/earle/Arduino/hardware/esp8266com/esp8266/cores/esp8266/Crypto.cpp: In function 'String {anonymous}::createBearsslHmac(const br_hash_class*, uint8_t, const String&, const void*, size_t, size_t)':
/home/earle/Arduino/hardware/esp8266com/esp8266/cores/esp8266/Crypto.cpp:101:71: warning: unused parameter 'hashTypeNaturalLength' [-Wunused-parameter]
  101 | String createBearsslHmac(const br_hash_class *hashType, const uint8_t hashTypeNaturalLength, const String &message, const void *hashKey, const size_t hashKeyLength, const size_t hmacLength)
      |                                                         ~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~
/home/earle/Arduino/hardware/esp8266com/esp8266/cores/esp8266/Crypto.cpp: In function 'String {anonymous}::createBearsslHmacCT(const br_hash_class*, uint8_t, const String&, const void*, size_t, size_t)':
/home/earle/Arduino/hardware/esp8266com/esp8266/cores/esp8266/Crypto.cpp:153:73: warning: unused parameter 'hashTypeNaturalLength' [-Wunused-parameter]
  153 | String createBearsslHmacCT(const br_hash_class *hashType, const uint8_t hashTypeNaturalLength, const String &message, const void *hashKey, const size_t hashKeyLength, const size_t hmacLength)
      |                                                           ~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~
````

Mark them unused in the code to avoid the error.  The assert() still
works.
2020-08-03 18:03:23 -07:00
Peter
3be0cbb385
Typo (#7502) 2020-08-03 07:42:22 -07:00
drhideg
d92e1edac8
Basic authentication with ESP8266httpUpdate (#7190)
Add ability to use basic access authentication with ESP8266httpUpdate
2020-07-30 08:55:29 -07:00
Drzony
85ea47e9bc
Fixed PUYA flash write buffer alignment (#7491)
* Fixed PUYA flash write buffer alignment (round up)
2020-07-30 11:03:49 -04:00
david gauchard
1041a9d752
webhook/http1.1: prevent from losing a new client while waiting (#7492) 2020-07-30 01:26:56 +02:00
Peter
d5187790bd
Mention OTA Update class blocks flash mode changes (#7321)
Add mention that OTA Update class will block changes to flash mode bits if the image is uncompressed, and link to the recent discussion on this.

Co-authored-by: Earle F. Philhower, III <earlephilhower@yahoo.com>
2020-07-29 11:37:32 -04:00
Earle F. Philhower, III
a679869155
BREAKING - analogWriteRange 8-bit default (#7456)
Matching standard Arduino cores, make the default analogWrite() take
values from 0...255.  Users can always use the analogWriteRange() call
to change to a different setup.

Add a `analogWriteResolution` which takes a number of bits and sets
the range from 0...(1<<bits)-1, part of the standard Arduino API.

Remove the PWMRANGE define.  It's non-standard and not generally valid
(i.e. it's fixed at 1024 of 256, but the real range varies depending on
what you last set).

Also add note about the change and how to fix pre 3.0 applications.

Fixes #2895
2020-07-28 17:39:38 -07:00
david gauchard
33083861c8
webserver hook: allow to handle external http protocol (#7459)
* webhook api
* simplify webserver debug printouts, move text to flash
* Hook examples in HelloServer example
* print executable code address in example
* simplify example per @mcspr suggestion
2020-07-28 23:34:26 +02:00
Earle F. Philhower, III
63b41bcfab
Use root cert, not fingerprint for api.github.com (#7490)
In the HTTPS example we were using a fingerprint which changes almost
daily as the github.com certificates are regenerated.  Replace this with
a trust anchor based on the ultimate root CA that github.com uses to
sign their certificates.  Assuming they don't change CAs, this
certificate should be good until 2030+

Fixes #7489
2020-07-28 12:11:00 -07:00
Earle F. Philhower, III
355b291614
CVE-2020-12638 workaround for WPA downgrade attack (#7486)
* CVE-2020-12638 workaround for WPA downgrade attack

When connected to an encrypted (WEP/WPA) router, a rogue packet can
cause the ESP8266 WiFi stack to drop to an unecrypted rogue network of
the same SSID.

Handle this by dropping the WiFi connection immediately and reconnecting
to the stored WPA/WEP network requested by the application, whenever the
AUTHMODE changes to OPEN from a secured mode.

https://lbsfilm.at/blog/wpa2-authenticationmode-downgrade-in-espressif-microprocessors
for more details.
2020-07-26 10:11:14 -07:00
M Hightower
e815b9219b
Correct stack string buffer length. (#7488)
Co-authored-by: Earle F. Philhower, III <earlephilhower@yahoo.com>
2020-07-26 10:01:21 -07:00
Jorg Neves Bliesener
0e12906950
Initialize _ledPin (#7487)
* Initialize _ledPin

_ledPin should be initialized to -1 in the constructor to avoid setting a random pin when calling Updater::end without having called Updater::begin before. This happens, for example, in the Homie software

* Fix field sequence
2020-07-26 12:39:55 -04:00
david gauchard
83fc47f6d9
Small update to ease manual release generation (#7467) 2020-07-22 22:34:21 -07:00
Earle F. Philhower, III
555c9ebdf8
Update FP for tls.mbed.org (#7479) 2020-07-22 22:26:00 -07:00
Earle F. Philhower, III
f42cf7a5a4
Fix uninitted class variables from #7464 (#7478)
PR #7464 removed the reset of client authentication settings when server
authentication settings were changed, however it never did initialize
the client authentication information to nullptr in the constructor.
This can result in crashes during connections when client certs are not
applied.

Fix by resetting the client authenticaion variables on object
construction.
2020-07-22 22:10:44 -07:00
Develo
c94d36d80e
Comment out verify step in eboot.c (#7468)
* Comment out verify step in eboot.c

Meant for #7458 , but still requires a recompiled eboot.elf.

* Rebuild eboot.elf from changed source

Co-authored-by: Earle F. Philhower, III <earlephilhower@yahoo.com>
2020-07-20 23:24:51 -04:00
Earle F. Philhower, III
91427a1695
Keep client certs when server authentication set (#7464)
WiFiClientSecure.setInsecure() was clearing the secret key (but not the
_chain public client cert) incorrectly.  The other server authentication
modes also had the same effect.

The only way for it to work would be if the app first set the server
authentication method and then the client keys.  There's no good reason
for this.

Adjust the connection to only clear the server id methods and leave the
client ID untouched.

Fixes #7455
2020-07-17 14:02:17 -07:00
Earle F. Philhower, III
c3c61a5f75
Fix typo in platform.txt causing device test fails (#7463)
When stacksmash protection was added, the variable used by the compile
lines and the boards.txt.py generator is "build_stacksmash_flags".
Unfortunately, the default variable name  in the platform.txt is
"build_stacksmash" w/o the "_flags."
2020-07-16 20:49:43 -07:00
Benoît Blanchon
c18f7cb1e6
Made ESP8266WebServer::client() return a reference (fixes #7075) (#7080) 2020-07-17 02:13:29 +02:00
Zakary Kamal Ismail
3c1bd65a76
WebServer: Allow client to send many requests on the same connection (#7414)
* WebServer: Allow client to send many requests on the same connection

* WebServer: Keep the connection alive with a client by default

* WebServer: Use the request's HTTP version and Connection header to set the default keep alive value

* Fix a typo in a comment
2020-07-16 13:53:48 -07:00
kinafu
709ba7981e
Change BSSL_CertStore test URL (#7370)
github.com forwards to www.github.com
So reaching out for "www.github.com" returns HTTP 304 instead of the nice HTTP 204
2020-07-16 12:07:40 -07:00
david gauchard
dfd5a4f12b
replace old Ethernet Arduino-library with v2, submoduled (#6812) 2020-07-16 19:34:55 +02:00
Earle F. Philhower, III
3bd24587e1
Transition from TravisCI to GitHub CI (#7444)
Convert the continuous integration process to use GitHub's internal
CI cloud.  Allows us to run up to 20 jobs in parallel, speeding up
CI immensely.  Keep a short Travis-CI run, too, just for sanity and backup.

Uses new keys and secret when publishing a release to
esp8266.github.io.
2020-07-14 22:02:47 -07:00
Earle F. Philhower, III
f8091311a3
Update to BearSSL version lost in GCC10 update (#7453)
The GCC10 PR accidentally reverted to an older BearSSL commit.  There should
be no code changes, but to keep everything clean move it back ahead to the
proper commit.
2020-07-14 08:05:52 -07:00
david gauchard
e58bb60f87
webserver: do not count "plain" in argument list (#6768)
* webserver: do not count "plain" in argument list (it is still available though)
2020-07-13 12:40:27 +02:00
standby24x7
1134194edc
Fix spelling typos in readme.rst (#7447)
This patch fixes some spelling typos in doc/esp8266wifi/readme.rst

Co-authored-by: Earle F. Philhower, III <earlephilhower@yahoo.com>
2020-07-10 11:22:52 -07:00
david gauchard
2d4a601c18
webserver: string optimization (#7446)
* webserver: string optimization

* fix
2020-07-10 10:11:51 -07:00
Dirk Mueller
83158affa8
Pass String by const reference [3.0] (#6583)
Passing String by value means a full copy-constructor/temporary
string creation which is slightly inefficient. Avoid that
by using const references.
2020-07-10 13:27:51 +02:00
Huldar
df9bc38bce
Grammar fixes (#7441)
Added a bunch of missing "the"s and "a"s mostly. Didn't change any of the coding examples or the meaning of this example. Great example though, thanks.
2020-07-09 20:35:19 -07:00
Develo
a6ccad4a24
Update Arduino.h (#7440) 2020-07-09 13:22:52 -07:00
david gauchard
af1bc71a9e
remove lwip-v1.4 specific code (#7436)
* remove lwip-v1.4 specific code

* ditto

* ditto

* fix ip4_addr definition

* CI: change debug builds to use IPv6, remove regular IPv6 builds

* ditto

* split pio CI in four (because they last twice the time of the other builds)

* remove option from pio

* remove lwIP-1.4 from doc

* restore pio CI splitting

* fix CI debug6 script

* ditto
2020-07-09 09:59:49 -07:00
Earle F. Philhower, III
70e4457041
Remove axTLS from code and documentation (#7437) 2020-07-09 09:21:38 -07:00
standby24x7
1ead157558
Fix spelling typos in files under packages dir (#7439)
This patch fixes spelling typos found in following files
README.md
esp8266-arduino-doc.bash
2020-07-09 10:32:29 -04:00
Earle F. Philhower, III
252cb1d968
Remove wget dump during CI (#7438)
Add -q quiet option to wget while downloading Arduino to minimize the
size of the output log.
2020-07-08 08:19:15 -07:00
Earle F. Philhower, III
c663c55926
Free space of overwritten files in LittleFS (#7434)
* Free space of overwritten files in LittleFS

Fixes #7426

LittleFS doesn't update the on-flash data structures when a file is
reopened as O_TRUNC until the file is closed.  This means the space of
the original, inaccessible file cannot be used, causing OOS errors in
cases when a large file is being overwritten.

Explicitly call the file sync operation to update the on-flash metadata
as soon as a file is opened.  For normal files it's a no-op, but for
O_TRUNC modes it will free the space, allowing full overwrite of large
files.

* Add host test case for change
2020-07-07 17:14:30 -07:00
Earle F. Philhower, III
d979b57d76
Upgrade to GCC 10.1 toolchain (#6294)
* Upgrade to GCC 9.1 toolchain

* Rebuilt using pure GNU binutils and GCC

Remove dependencies on earlier forked GNU utilities (gcc-xtensa,
binutils-gdb-xtensa) and just use GCC sources, unmodified (except for
patches in the esp-quick-toolchain directories).

* Rebuild bearssl using new toolchain

* Fix GDBstub linkage options

GDB works with pure GNU GCC and pure GNU binutils now.  Still warnings
galore, but tested with the example sketch in the docs.

* Fix digitalRead alias warning

* Remove gdb stub warnings w/a pragma

* Fix deprecated implicit copy ctors in IP code

Fix some warnings present in GCC8/9 in the IPAddress code

In AddressListIterator there was a copy constructor which simply copied
the structure bit-for-bit.  That's the default operation, so remove it
to avoid the warning there.

IPAddress, add a default copy constructor since the other copy
constructors are simply parsing from one format into a native ip_addr_t.

@d-a-v, can you give these a look over and see if they're good (since
IP stuff is really your domain).

* Fix AxTLS alias function defs to match real code

* Fix WiFiClientSecure implicit default copy ctor

These both use shared-ptrs to handle refcnts to allocated data, so using
the default copy constructor is fine (and has been in use for a long
time).

* Dummy size for heap to avoid GCC 8/9 warnings

Make GCC think _heap_start is large enough to avoid the basic (and
incorrect) bounds-checking warnings it produces.  The size chosen is
arbitrary and does not affect the actual size of the heap in any way.

* Make heap an undefined extend array

Instead of a bogus size, use an indefinite size for the heap to avoid
GCC warnings

* Trivial tab to space fix

* Update SDFat to remove FatFile warnings

* Fix ticker function cast warnings in GCC 9

The callback function is defined to take a (void*) as parameter, but our
templates let users use anything that fits inside sizeof(void*) to be
passed in.  Add pragmas to stop GCC warnings about this, since we
already check the size of the type will fit in the allocated space.

* Remove GCC support fcn that's in ROM

Manually delete the divdi3.so from the libgcc.a library by running the
updated EQT's 9.1-post script.

* Make exceptions work again, get std::regex up

Exceptions are broken on all builds (GCC4.8-9.1) due to the removal of
the PROGMEM non-32b read exception handler (added in the unstable
pre3.0.0).

Build the exception code with -mforce-l32 and patch
accordingly to avoid LoadStore errors.

Apply patches to select portions of the regex lib which use _stype_
(which is now in flash).

* Rebuild Bearssl using latest GCC push

* Automate building of BearSSL and LWIP w/new toolchain

* Workaround g++ template section problem for exception strings

G++ seems to throw out the section attributes for templates.  This means
that the __EXCSTR(a synonym for "PSTR()") is ignored and exception.what
strings are stored in RODATA, eating up RAM.

Workaround by using the linker to place the strings keying off their name
("*__exception_what__*").

* Rebuild moving exception.what to unique names

Exception.whats are now all in __exception_what__ and can be moved by
the linker to flash.  Works aroung G++ issue with segments being lost in
templates.

* Rebuild with new LWIP locking

* Update to latest libs, save iram

Move two GCC FP support routines out of iram since they are in ROM
already, saving some add'l IRAM.  Same list as gcc 4.8.

* Update BearSSL to latest release

* Fix umm_perf reference to ROM function

* Fix "reinterpret_case is not a constexpr" error

In GCC 9 (and 8 from what I read on SO), a cast of a const int to a
function pointer (via explicit or implicit reinterpret_cast) is not a
constexpr.
````
/home/earle/Arduino/hardware/esp8266com/esp8266/cores/esp8266/umm_malloc/umm_performance.cpp:45:36: error: a reinterpret_cast is not a constant expression
   45 | int constexpr (*_rom_putc1)(int) = (int (*)(int))(void*)0x40001dcc;
      |                                    ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
````

Remove the constexpr, potentially increasing heap usage by 4 bytes in
debug mode.

* Update libc.a to latest rev

* Full rebuild of toolchain and libs

* Upgrade to GCC 9.2, released in August 2019

Add builds for all 5 cross-compiles to pass CI

* Move to --std=gnu++14 (C++14 + GNU extensions)

* Fix Ticker merge conflict

* Fix json merge conflict

* One more merge diff fix

* Reapply Ticker.h casting warning fixes for gcc9

* Update with fixes from Sming repo for PSTR and ASM

* Upgrade to -gnu4 toolchain

* Move to gnu5 build with add'l softFP from ROM

* Move add'l softFP from IRAM to flash

Per @mikee47, we miss sone add'l soft-FP routined in the linker which
makes them end up in IRAM.  Move them explicitly into flash, like a
couple others we have already done this for.

* Move to std=c++17/c17 in platform, remove abs/round

Move to C++17 and C17 standards on the compiler options.

Remove "register" from core since it is deprecated.

Remove the #define abs() and #define round() which a) overwrote the
C stdlib definitions, poorly, and b) broke the GCC core code which used
"abs" as an internal function name.

Now abs() returns an integer, and not whatever was being absoluted.
fabs() etc. can be used if users need fload/double suport.

round() returns a double now, which is basically what it was returning
in the original case since adding/subtracting by a FP.

* Use std::abs/round to replace the macro definitions

Per discussion w/@devyte, preserve the abs() and round() functionality
via the using statement.

* Remove using std::abs which conflicted with C lib headers

* Add 2nd arg (exception handler) to ets_isr_t

Disassembly of the ROM shows there are 2 params to the ets_isr_t
callback.  The first is the arg passed in, the second is a pointer to an
exception frame where you can get info about when the IRQ happened.

* Move the gdbstub example to a subdir

The Arduino IDE and the build CI don't build it without a subdir, so
make one for gdbstub's example so it's visible and tested.

* Fix ets_irq_arratch redefinition and core IRQ handlers

Remove a duplicated, different declaration for ets_irq_attach from
ets_sys.h.  It never really even matched the other declaration in the
same header.

Update the core to IRQ handlers to fix the prototype and include the
2nd, unused frame parameter.

* Actually rebuild the libc.a using GCC 9.2

* Fix SPISlave interrupt attach's 2nd parameter

* Rebuild eboot.elf with GCC 9

* Update to latest SoftwareSerial for Delegate fix

* Upgrade to GCC 9.3

* Rebuild all arch toolchains

* Move to GCC 10.1

* Merge master and fix eboot build

GCC10 now uses `-fno-common` so the eboot global variables were being
placed in IRAM.  Adjust the makefile and rebuild to fix.

* Built complete toolchain for all archs

* Pull in latest PSTR changes and fix GCC10.1 build

Somehow the prior GCC build's -mforce32 patch wasn't applying correctly,
but I was still able to get a binary.  Fixed.  Also pulled in latest
PSTR changes in progmem.h

* Update platform.io to platform C/C++ standards

* Use PR's toolchain in platformio build

* Fix several asm warnings in PIO build

* Optional stack smash protection -fstack-protector

Add a menu to enable GCC's built-in stack smash protection.  When a
subroutine goes past its end of stack, generate a crashdump on function
exit like:

````
GCC detected stack overrun
Stack corrupted, stack smash detected.

>>>stack>>>

ctx: cont
sp: 3fffff20 end: 3fffffc0 offset: 0000
3fffff20:  40202955 00000001 0000001c 4020287e
3fffff30:  feefeffe 000000fd 00000000 00000000
...
<<<stack<<<
````

Disabled by default because there is a small per-function code overhead
(and CPU time if the function is called very frequently and is very
small).

BearSSL and LWIP are not built using stack smash detection, yet.

* Fix duplicated stc=gnu99/c17 in build

* Dump faulting function PC in stack overflow

Report a fake exception to have the exception decoder print the actual
faulting function.  This won't tell you where in the function the issue
happened, but it will tell you the function name first and foremost.

* Rebuild with Platform.io JSON tag in release tgzs
2020-07-07 11:12:43 -07:00
david gauchard
7b48b9de5f
boards: 4dsystems (gen4iod) updates (#7433)
* boards: 4dsystems (gen4iod) updates
2020-07-07 17:10:05 +02:00