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

220 Commits

Author SHA1 Message Date
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
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
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
c1e439d447
fix lwip-v1.4 compilation (#5935) 2019-03-31 23:04:42 +02: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
7745e99046
Revert to nonos-sdk 2.2.1, new sdk-switching option in IDE menu for generic board only (#5763)
This commit allows switching SDK firmware:

nonos-sdk-pre-v3 shipped with release 2.5.0 has issues:

    * Some boards show erratic behavior (radio connection is quickly lost), with an unknown cause.
      These boards work well with previous nonos-sdk-2.2.1 firmware (#5736)

    * Overall performances seem to have decreased (#5513)

This PR restores sdk2.2.1 (as in core-2.4.2).

SDK-pre-3.0 - which has brought long awaited fixes (WiFi sleep modes) - is still available through a menu option available only with generic board.

BREAKING

    * new define `-DNONOSDK221=1` or `-DNONOSDK3V0=1`

    * for external build systems: new library directory: `tools/sdk/lib/<version>/lib`

    * PIO: variable `PIO_FRAMEWORK_ARDUINO_ESPRESSIF_SDK3` is needed for sdk-pre-v3.


Fix #5736
2019-02-19 13:10:49 +01:00
Earle F. Philhower, III
c9ce96652f
Move __PRETTY_FUNCTION__ to progmem (#5758)
Match __FUNCTION__ linking, keep C++ function names out of rodata/heap.
2019-02-13 23:28:06 +00:00
david gauchard
5f68e61b26
lwip2: ipv6: fix udp_new() #5744 (#5752)
From: @oddstr13
(https://github.com/d-a-v/esp82xx-nonos-linklayer/pull/28)

Initialize pcb->local_ip.type depending on whether we have IPv4, IPv4+IPv6 or IPv6 networking stack.

Fixes esp8266/Arduino#5744
Closes esp8266/Arduino#5745
2019-02-11 11:03:09 +01:00
Earle F. Philhower, III
29bb7fc4c1
Fix pgm_read_ptr() (#5735)
Fix dereferencing in pgm_read_ptr() macro on 8266 and host.

Fixes #5733
2019-02-07 18:47:44 +00:00
david gauchard
7d512c4c7c
IPv6: DHCP6 & NTP fix (lwIP fix from David J. Fiddes D.J@fiddes.net) (#5649)
* +dhcp6_set_ntp_servers (lwIP patch from David J. Fiddes D.J@fiddes.net)
2019-01-30 09:33:22 +01:00
Earle F. Philhower, III
a9fb6db0c8
Update to latest BearSSL code. (#5669) 2019-01-25 18:59:05 +00:00
SmartBlug
5e4c2e9750 Add capability to have light static DHCP lease (#5594)
* Add capability to have light static DHCP lease

* added ESP8266WiFi StaticLease sample

* Update StaticLease to IPv4
2019-01-25 02:25:04 +00:00
Earle F. Philhower, III
ab9d4ad57b
Fix pgm_read_float() macro definitions (#5666)
Add in missing derefeence in pgm_read_float macro which was causing
compile errors.
2019-01-25 01:11:14 +00:00
david gauchard
7c5be91430 dynamic WiFi.hostname("newname") (#5652)
* dynamic WiFi.hostname("newname")

* WiFi.hostname() back to String return type

* no silent hostname fix but proceed with debug message and returning false
2019-01-24 17:13:20 -03:00
Earle F. Philhower, III
bff3a6d963 GDB support w/new toolchain and UART driver (#5559)
* Add full gdb support with uart/Serial integration

* Fix GDB merge errors

* Update to unpatched GDB protocol specification

It appears that Espressif patched the open source xtensa GDB port in
order to build their old GDB executable and their old gdbstub (basically
removing any register in a generic xtensa and only leaving those
present in the chip they synthesized).  Their GDBStub also assumed this
behavior.

Unpatched upstream GNU GDB now expects all the registers in
xtensa-config.c to be sent/read on a 'g' command.  Change the GDB stub
to send "xxxxxxxx"s (legal per the spec) for unimplemented registers.
This makes the 'g' response much longer, but it's results are cached
and in an interactive debugger it isn't noticeable.

* Fix .iram.literal to come before .iram.text for GDB

* Move functions to flash, call using wrappers

All functions which are not interrupt or exception called are now in
flash. A small IRAM wrapper enables flash when processing main GDB ops
by calling Cache_Read_Enable_New() and then jumping to the main flash
code.  This seems to work for catching exceptions, data and code breaks,
and Ctrl-C.

The UART ISR handler and exception handler register-saving bits of
code in ASM are still in IRAM.

GDB IRAM usage is now about 670 bytes.

* Remove LWIP2 builder commit

* Add documentation and gdbstub_init header

Add some simple GDB documentation to the main tree showing a worked
example.

Adds the definition of `void gdbstub_init()` to <GDBStub.h>

* Clean up GDB include and library dir

Replace GDBstub.h with the version in the internal/ directory, and
adjust stub code accordingly.  This way, only one copy of a file called
"GDBstub.h" will exist.

Update the gdbcommands and replace the obsolete ESPRESSIF readme with
@kylefleming's version since we're mainly doing serial, not TCP,
connected debugging.

Bump the library rev. number since this is a pretty big functionality
change.

Minor documentation tweak.

* Undo much of UART refactoring, set fifo IRQ to 16

Remove the refactoring of pin control and other little things not directly
related to GDB processing.  Should greatly reduce the diff size in uart.c.
Should also remove any register value changes (intended or otherwise)
introduced in the original PR from @kylefleming.

Set the FIFO interrupt to 16 chars when in GDB mode, matching the latest
UART configuration for highest speed.

* Add architecture comments, cleanup uart.c code

Comments added to UART.c trying to explain (as best as I understand it)
the changes done to support GDB and how they interact with standard
operation.

Fix the uart_uninit to stop the ISR and then free appropriately.

Fix uart_isr_handle_data (GDB's shim for sending chars to the 8266 app)
to do the exact same thing as the standard UART handler including set
the overflow properly and either discard or overwrite in that case.

Fix serial reception when GDB enabled by enabling the user recv ISR.

Remove commented attributes from gdbstub, leftover from the move to
flash.

General logic cleanup per comments in the PR.

* Also set the UART flags for HW error in GDB

Ensure we also check the UART flags and set the uart status
appropriately when in GDB mode.
2019-01-23 17:51:35 -03:00
david gauchard
7ee503d353
lwip2: dhcp-server addon from @SmartBlug #5594 (#5613) 2019-01-16 01:26:20 +01:00
Earle F. Philhower, III
c08ef514f6
Silently eat \rs in PEM decoder in BearSSL (#5598)
There is a bug in the BearSSL PEM decoder when Windows EOLs (\r\n) are
passed in.  Avoid the issue by silenly discarding \rs as they are read
from the PEM source in the C code, to keep my sanity by avoiding reworking
the pseudo-Forth parser code.

Fixes #5591
2019-01-07 09:24:38 -08:00
david gauchard
b26c19e82e lwip2 fixes: turn off random delay before sntp request (#5567)
+update dhcp6 patch: update ip_addr_set_zero_ip6 to use IP_SET_TYPE_VAL, avoiding compilation warning
2018-12-29 18:40:39 -03:00
david gauchard
cac22e3576
fix dhcp6 in upstream lwIP (#5560) 2018-12-27 19:29:04 +01:00
Earle F. Philhower, III
9def8b0669
Move exceptions back out of IRAM (#5556)
PR #5538 made exceptions disabled by default and changed some file names
which didn't get updated in the linker file, resulting in exceptions ending up
back in IRAM.
2018-12-26 12:59:13 -08:00
Earle F. Philhower, III
2388102a97 Make exceptions off by default (#5538)
Scripts, makefiles, and users who do no changes will not have exceptions
enabled during builds.  This should avoid the sketch inflation issue for
users who are space constrained, while allowing users who care about
exceptions to enable them through the IDE.
2018-12-21 23:38:41 -03:00
david gauchard
95a5c5e60a let lwIP route packets, do not let SDK teaching how to do so (#5526) 2018-12-21 19:38:22 -03:00
Max Prokhorov
d6c743027d Fix negative SPIFFS size (#5522) 2018-12-18 23:33:41 -03:00
Earle F. Philhower, III
8ede8f1459
Move libstdc++-nox out of IRAM (#5492)
The new non-exception libstdc++ was not referenced in the linker script,
allowing it to end up in IRAM when not needed.  Add the line to match
and move it into IROM where it belongs.
2018-12-13 12:26:03 -08:00
Earle F. Philhower, III
8c7dc4a2ab
Update to latest BearSSL w/es22519 fix (#5468) 2018-12-10 07:36:58 -08:00
Earle F. Philhower, III
8a8848829c Update to Newlib c0f3596 with regexp/fnmatch (#5457) 2018-12-09 15:36:22 -03:00
david gauchard
0db6ec4ba8 lwip2: 3 sntp servers, autoip (169.254), esp-ping, espconn (#5444)
* lwip2: better handling of ipv4_addr/t type + 3 sntp servers

* bump lwip2 version

* Only with FEATURES=1: 3 sntp servers and AutoIP enabled (169.254 when dhcp server fails)

* Only with FEATURES=1: 3 sntp servers and AutoIP enabled (169.254 when dhcp server fails)

* local CI runner: select build type

* new ipv4_addr/t definition makes things easier for IPAddress

* update local CI runner

* lwip2 changes

* lwip2: port esp-ping and espconn
2018-12-07 21:24:38 -03:00
Earle F. Philhower, III
6d42a26cc2
Update BearSSL to latest toolchain (#5449)
Remove the -fno-jump-tables since the new toolchain places these tables
in ROM now.  Rebuild using the toolchain.  Saves 1-3KB of flash and
has 0 RAM impact plus may make certain bits marginally faster by using
a LUT instead of a if-else-else chain.
2018-12-07 10:02:42 -08:00
Earle F. Philhower, III
8e248064b9
Update toolchain and bins to 2.5.0-2 autobuild (#5441)
The complete toolchain, including mkspiffs, esptool, C, C++, newlib,
and others (BearSSL excluded) is now built and uploaded with a single
command to ensure repeatability and minimize manual mistakes.  All
OSes and architectures are built at a time.

Update to 2.5.0-2 throught the chain.
2018-12-05 18:38:48 -08:00
Earle F. Philhower, III
e44bcfe8e4 Make exceptions a configurable menu (#5434)
* Make exceptions a configurable menu

Add a menu, Exceptions, which allows exceptions to be disabled for ROM
sensitive scripts.  Default is enabled.

* Update to latest JSON builder
2018-12-04 22:31:40 -03:00
Earle F. Philhower, III
aacc6edf69 Add 64-bit %ll printf format support (#5435)
* Fix the template.json with latest core patches

* Add 64-bit %ll printf format support

Adds support for %lld, %llx, etc. 64-bit integer printing, useful
for logging timestamps and other things.

Fixes #5430

* Remove unwanted updated JSON
2018-12-04 20:46:17 -03:00
Earle F. Philhower, III
f770d1a213 Add %z and %x to printf backend (#5424)
* Add %z and %x to printf backend

%z is a C99 format used for size_t and was not included in any printf.
On the 8266 it's a no-op as size_t==int, so ignore it and things just
work.

%x lowercase support added back in (wasn't present in nano-printf).

* Update to toolchain built newlib, fix link error

Previous commit was a hand build and copy, this one used the full
toolchain and should not include atexit().
2018-12-03 17:26:31 -03:00
Earle F. Philhower, III
2f907f47bb
Fix pgmspace 32-bit read macros (#5425)
Looks like the pgm_read_(32bit) defines were not used in the main core, and
they contained syntax errors when invoked due to some bad bracket/parens.

Fix the macros
2018-12-03 11:14:10 -08:00
Earle F. Philhower, III
6280e98b03 Enable exceptions, update to optimized newlib, migrate to new toolchain (#5376)
* Move to PROGMEM aware libc, allow PSTR in printf()

A Newlib (libc) patch is in progress to move the _P functions from inside
Arduino into first-class citizens in libc.  This Arduino patch cleans up
code that's been migrated there.  Binaries for the new libs are included
because it seems they're part of the Arduino git tree, and should be
replaced with @igrr built ones when/if the Newlib changes are accepted.

Notable changes/additions for Arduino:
Allow for use of PROGMEM based format and parameter strings in all
*printf functions.  No need for copying PSTR()s into RAM before printing
them out (transparently saves heap space when using _P functions) and
makes it easier to print out constant strings for applications.

Add "%S" (capital-S) format that I've been told, but cannot verify,
is used in Arduino to specify a PROGMEM string parameter in printfs,
as an alias for "%s" since plain "%s" can now handle PROGMEM.

Optimized the memcpy_P, strnlen_P, and strncpy_P functions to use 32-bit
direct reads whenver possible (source and dest alignment mediated), but
there is still room for improvement in others.

Finally, move several constant arrays from RODATA into PROGMEM and
update their accessors.  Among these are the ctype array, ~260 bytes,
mprec* arrays, ~300 bytes, and strings/daycounts in the time
formatting functions, ~200 bytes.  All told, sketches will see from
300 to 800 additional RAM heap free on startup (depending on their
use of these routines).

* Fix merge error in #ifdef/#endif

* Fix host test using the newlib generic pgmspace.h

Host tests now use the sys/pgmspace.h for compiles instead of the
ESP8266-specific version.

* Update with rebuilt libraries using latest newlib

* Include binaries built directly from @igrr repo

Rebuild the binaries using a git clone of
https://github.com/igrr/newlib-xtensa

Build commands for posterity:
````
rm -rf ./xtensa-lx106-elf/
./configure --prefix=<DIR>/esp8266/tools/sdk/libc --with-newlib \
            --enable-multilib --disable-newlib-io-c99-formats \
            --disable-newlib-supplied-syscalls \
            --enable-newlib-nano-formatted-io --enable-newlib-reent-small \
            --enable-target-optspace \
            --program-transform-name="s&^&xtensa-lx106-elf-&" \
            --disable-option-checking --with-target-subdir=xtensa-lx106-elf \
            --target=xtensa-lx106-elf
rm -f etc/config.cache
CROSS_CFLAGS="-fno-omit-frame-pointer -DSIGNAL_PROVIDED -DABORT_PROVIDED"\
             " -DMALLOC_PROVIDED" \
  PATH=<DIR>/esp8266/tools/xtensa-lx106-elf/bin/:$PATH \
  make all install
````

* Fix merge define conflict in c_types.h

* Fix strlen_P misaligned source error

Include fix from newlib-xtensa/fix-strlen branch cleaning up misaligned
access on a non-aligned source string.

* Fix strlen_P and strcpy_P edge cases

Ran the included test suite on ESP8266 tstring.c with the following defines:
 #define MAX_1 50
 #define memcmp memcmp_P
 #define memcpy memcpy_P
 #define memmem memmem_P
 #define memchr memchr_P
 #define strcat strcat_P
 #define strncat strncat_P
 #define strcpy strcpy_P
 #define strlen strlen_P
 #define strnlen strnlen_P
 #define strcmp strcmp_P
 #define strncmp strncmp_P

Uncovered edge case and return value problems in the optimized versions of
the strnlen_P and strncpy_P functions.  Corrected.

* Fix memcpy_P return value

memcpy-1.c test suite showed error in return value of memcpy_P.  Correct it.

* Fix strnlen_P/strlen_P off-by-4 error

Random crashes, often on String constructors using a PSTR, would occur due
to the accelerated strnlen_P going past the end of the string. Would make
debug builds fail, too (ESP.getVersionString() failure).

Fix to fall through to normal copy on a word that's got a 0 byte anywhere
in it.

* Add device tests for libc functional verification

Add test suite used to debug libc optimized _P functions to the device
tests.

* Rebuild from igrr's repo (same source as prior)

Rebuild .a from igrr's repo at 347260af117b4177389e69fd4d04169b11d87a97

* WIP - add exceptions

* Fix exception to have 0-terminator

* Move some exception constants to TEXT from RODATA

* Remove throw stubs

* Move more exception stuff to ROM

* Enable exceptions in platform.io

* Remove atexit, is duplicated in rebuilt lib

Need to look at the quick-toolchain options, there seems to be a definition
for atexit defined there (libgcc?) that needs to be excised.  For now,
remove our local do-nothing copy.

* Update libgcc to remove soft-fp functions

The esp-quick-toolchain generated libgcc.a needed to have the soft-FP routines
that are in ROM removed from it.  Remove them in the new esp-quick-toolchain
and update.

* Fix merge typos in Makefile

* Add unhandled exception handler to postmortem

* Return our atexit() handler

* Latest stdc++, minimize exception emercengy area

* Remove atexit from newlib

atexit was defined in newlib strongly, but we also define a noop atexit in core.
Since we never exit, use the core's noop and delete the atexit from libc.a

Updated in esp-quick-toolchain as well.

* Move __FUNCTION__ static strings to PROGMEM

__FUNCTION__ is unlikely to be a timing sensitive variable, so move it to
PROGMEM and not RODATA (RAM) using linker magic.

asserts() now should take no RAM for any strings.

* Clean up linker file, update to latest stdc++

* Update to latest stdc++ which doesn't call strerror

* Update to GCC5.1 exception emergency allocator

Using GCC 5.1's emergency memory allocator for exceptions, much less
space is required in programs which do not use exceptions and when
space is allocated it is managed more efficiently.

* Initial try with new compiler toolchain

* Include newlib built from esp-quick-toolchain

* Update JSON with all new esp-quick-toolchain builds

* Use 64bit Windows compiler on 64bit Windows

* Dump std::exception.what() when possible

When doing the panic on unhandled exceptions, try and grab the
.what() pointer and dump it as part of the termination info.
Makes it easy to see mem errors (std::bad_alloc) or std::runtime_error
strings.

* Use scripted install from esp-quick-toolchain

Makes sure proper libraries and includes are present by using a
scripted installation from esp-quick-install instead of a manual
one.

* Update eqk to remove atexit, fix packaging diff
2018-12-03 03:37:14 -03:00
apicquot
4b16fa0a33 Added 2M generic boards (#5404)
* added generic boards
2M (SPIFFS 128K)
2M (SPIFFS 256K)
2018-12-01 14:10:17 -08:00
david gauchard
4f86a68b56
fix espconn and err_t (#5392) 2018-11-29 18:17:33 +01:00
david gauchard
5c4db3acf4
IPv6 on esp8266-nonos-sdk and arduino (#5136) 2018-11-27 23:07:47 +01:00
Develo
3d70f43277
cleanup/unify flash sector size define value (#5327)
* cleanup/unify sector size define value

* replicate spi_flash_sec_size.h file for host tests

* further flash geometry cleanup, remove host test duplicate file
2018-11-24 02:59:12 -03:00
david gauchard
74ca42f829 Sketch emulation on host (#5342)
* WIP compile examples on host with 'make examples'

* WIP bufferize tcp input

* WIP Makefile

* WIP network to rework, tcp/udp to factorize, udp addresses broken

* minor changes to the core

* WIP basic udp working

* WIP mdns

* WIP mcast receiving, not sending

* WIP mdns OK

* beta version

* SSL + doc

* update travis host test command

* licenses

* typo

* doc: arduino builder is not around: declare functions before calling them

* fix with latest SSL PR, compile in 32 bits mode

* fix make clean

* make -m32 optional

* 32bits compiler ability tester

* WIP

* WIP (fix 1 vtable error, still another one to hunt with using spiffs)

* example astyle

* fix os_printf_plus

* load / save mock spiffs

* fix style

* fix using spiffs/mock

* don't mess ram

* update doc

* remove leftover

* optimization -Os except for CI, rename ARCH32 to FORCE32

* revert useless cast (not even compiled)

* remove unused function

* use proper type for pointer arithmetics

* makefile: sketch object and cpp file moved to bin/ directories
easier to clean, and IDE don't like them

* changes for review

* make use of %zd

* less verbose makefile by default (option)

* update readme
2018-11-20 18:51:45 -02:00
Earle F. Philhower, III
2f4380777e Move BearSSL from STACK_PROXY to a real, thunked 2nd stack (#5168)
* Update to BearSSL 0.6+ release, add AES_CCM modes

Pull in latest BearSSL head (0.6 + minor additions) release and add AES_CCM
modes to the encryption options.

* Enable the aes_ccm initialization in client/server

* Initial attempt

* Working code with second stack thunking

* Remove #ifdefs in .S file, not needed.

* Clean up thunks and remove separate stack flag

* Fix PIO assembler errors

* Remove #ifdef code changes, ensure same code as PC

Remove "#ifdef ESP8266;...;#else;...;#endif" brackets in BearSSL to
ensure the host-tested code is the same as the ESP8266-run code.

* Move to latest BearSSL w/EC progmem savings

* Merge with master

* Add br_thunk_* calls to do ref counting, painting

Add reference counting br_thunk_add/del_ref() to replace stack handling code
in the class.

Add in stack painting and max usage calculation.

* Add in postmortem stack dump hooks

When a crash occurs while in the second stack, dump the BSSL stack and
then also the stack that it was called from (either cont or sys).

* Update stack dump to match decoder expectations

* Move thunk to code core for linkiage

The thunk code needs to be visible to the core routines, so move it to the
cores/esp8266 directory.  Probably need to refactor the stack setup and the
bearssl portion to avoid dependency on bearssl libs in cores/esp8266

* Add 2nd stack dump utility routine

* Refactor once more, update stack size, add stress

Make stack_thunks generic, remove bearssl include inside of cores/esp8266.

Allocate the stack on a WiFiServerSecure object creation to avoid
fragmentation since we will need to allocate the stack to do any
connected work, anyway.

A stress test is now included which checks the total BearSSL second
stack usage for a variety of TLS handshake and certificate options
from badssl.org.

* Update to latest to-thunks branch

* Add BearSSL device test using stack stress

Run a series of SSL connection and transmission tests that stress
BearSSL and its stack usage to the device tests.

Modify device tests to include a possible SPIFFS generation and
upload when a make_spiffs.py file is present in a test directory.

* Use bearssl/master branch, not /to-thunks branch

Update to use the merged master branch of bearssl.  Should have no code
changes.
2018-11-14 23:29:24 -03:00
Develo
e948ad1999
deprecate RTC_REG macros in favor of TIMER_REG macros (old typo in macro names) (#5326) 2018-11-09 14:53:58 -03:00
Earle F. Philhower, III
42c977bd4d
Patch axTLS CVEs and fix CA verification (#5270)
Apply patches developed by Sze Yiu Chau <schau@purdue.edu> which
correct a vulnerability in X509 parsing.

See CVE-2018-16150 and CVE-2018-16149 for more info.

CA certification validation was broken by a change put in during warning
cleanup a long time ago.  This binary now includes the 1-line correction
and HTTPSRequestCACert now works again (before was failing
because the key usages in certs were not properly read).
2018-10-24 12:47:11 -07:00
david gauchard
a1e59e9c01 update to lwIP-2.1.0: partial SACK support by default (de-selectable in menu) (#5126)
* update to lwIP-2.1.0rc1: partial SACK support
fix #4176

* hash fix

* get some flash back due to mistake in conf (fragmentation & reassembly was incorrectly enabled)
(ahah I scared you)

* add missing include files

* update to lwip-2.1.0(release) + remove unused lwIP's include files

* lwIP release 2.1.0, SACK is now default, bigger, no-SACK is selectable

* fix ldscript

* pio

* rename 'sack' option to 'feat'ure option, + IP fragmentation/reassembly

* merge, fix pio

* change internal/hidden string

* pio: more lwip2 configuration: + without sack for no change in flash footprint
2018-10-09 16:27:27 -03:00
david gauchard
8ef21ca3ae Update to the last version of nonos-sdk V2, WiFi addons (#5210)
* fwupdate

* fw update to latest version:
WPA working, WEP+Open disabled by default. Need API change.

* helpers to follow sdk updates

* remove compare scripts - made a separate PR for them

* add wep api, restore original espressif comment (wep enabled does not prevent wpa)

* libmain was not up to date

* experimental: DTIM setting in WiFi.setSleepMode(WIFI_LIGHT/MODEM_SLEEP, DTIM-value)
with new getter: .getListenInterval() / .isSleepLevelMax()

* fixes

* fix debug message

* when not using listenInterval, set wifi sleep level to min

* update documentation

* update doc
2018-10-09 10:21:23 -03:00
Kyle Fleming
9c46a81fb6 Consolidate .iram.text matcher in linker to wildcard matcher (#4356) 2018-10-04 20:09:53 -07:00
Earle F. Philhower, III
5137d4da11
Update to BearSSL 0.6+ release, add AES_CCM modes (#5164)
Pull in latest BearSSL head (0.6 + minor additions) release and add AES_CCM
modes to the encryption options. Enable the aes_ccm initialization in client/server

The EC mul20 and square20 code was identical in two different files,
but because these copies were static, we ended up with an extra 6k of
duplicated code. Updated BearSSL to make them shared, saving 6KB.
2018-09-27 20:30:19 -07:00
Earle F. Philhower, III
38779149d0 Move ICACHE_* to unique sections, local LD script (#5150)
* Move ICACHE_* to unique sections, local LD script

Similar to PROGMEM changes, make the name of each ICACHE_* variable/fuction
unique to avoid issues with section conflicts.

Also rename the generated LD linker script to avoid issue with older copies
of the eagle.app.v6.common.ld which were generated by the build process
in a global directory before being moved to the {build.path}.  The linker
would use the older, generated *.ld file instead of the generated one, which
would lead to runtime failures on some systems and cause the VTABLE location
to not correspond to the IDE menu selection.

Fixes #5115, and is an update to #5117 and #5116.

* Update boards.txt.py and platform.io build
2018-09-21 15:33:54 -03:00
Earle F. Philhower, III
aa8c53537a
Undo 5117 changes to ICACHE macros (#5130)
With the changes in PR #5117, blink and other examples compile but the 8266
gets stuck in a reset loop.  Undo the changes from that commit until we can
figure out the root cause and fix it.
2018-09-12 08:56:15 -07:00
Ivan Grokhotkov
8f438b18db Update axTLS to e634adf (#5125) 2018-09-12 07:49:42 -07:00