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

321 Commits

Author SHA1 Message Date
Earle F. Philhower, III
93ef9e7005
Upgrade to https: serving for JSON, links in docs (#5992)
* Upgrade to https: serving for JSON, links in docs

Fixes #5480

* Update boards.rst documentation

* Update more documentation http: refs to https:

* Remove obsolete staging info

* Drop obsolete versions from JSON programatically

After the final merge is done on the JSON, strip out any named versions
from the final product.

Removing 1.6.5-* and 2.5.0-beta(1,2,3) for now.

* Remove 2.4.0-rc(0/1) from JSON, too
2019-04-30 23:55:03 -07:00
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
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
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
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
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
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
Ivan Kravets
d507c799f7 PlatformIO: Append FLASHMODE_* macro (#5813) 2019-02-26 01:22:07 +00:00
Robin Richtsfeld
ca2f31a6f2 Make signing.py Python2.6+ and Python3+ compat (#5807)
Make the signing header generation work under Python2.6+ and Python 3+.
2019-02-25 21:01:47 +00:00
Ivan Kravets
167f39dab6 PlatformIO: Make exceptions off by default #5538 (#5814) 2019-02-23 23:25:33 +00:00
Earle F. Philhower, III
53f51b5811
Clean up uploader.py, use implied paths (#5805)
No need to explicitly send in full paths for esptool and pyserial Python
libs because they're in well known locations relative to upload.py.

Make upload.py calculate these on-the-fly and clean up platform.txt.
2019-02-21 21:40:45 +00:00
Earle F. Philhower, III
472faf73a2
Use Pythonic way of calling esptool, avoid fork(#5797)
Simply import the pyserial and esptool modules directly into upload.py
instead of trying to fake things with os.fork()s.  Reduces code and is
more Pythonic.
2019-02-21 19:03:15 +00:00
david gauchard
044568c220 fix python regexp, '_' was missing (#5791) 2019-02-19 20:10:51 -03: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
9790e1cb7c Use esptool.py to handle sketch upload, make python available on Windows, too (#5635)
* Add esptool.py, pyserial, and python to JSON

Add installation of python on Win32/Win64, and on all systems install
esptool.py and pyserial.

* Initial esptool.py upload test

* First successfull esptool.py upload

* Patch in verbose flag operation

* Replace esptool-ck.exe with Python equivalent

Remove need for binary esptool-ck.exe by implementing the same logic as
esptool-ck uses in Python.  Only image creation is supported, and only
in the Arduino standard mode (with its custom bootloader and ROM
layout).

* Remove all esptool-ck.exe, hook Windows Python

Remove all references to esptool-ck and use Python on Windows and Linux
for all recipes where possible.

* Use python to make core_version as well

Avoid ugly bash and CMD.exe tricks in platform.txt by using python to
make the core_version header.

* Rename conflicting script, clean up packager

* Windows test passes

Need to make sure Python2 and Python3 compatible and paths are munged
properly to avoid eaccidentally escaping things when calling esptool.py

Able to compile, build a BIN and upload via esptool.py on a Windows
machine without Python installed globally, only as part of the Arduino
tools package.

* Use github sources for pyserial

* Erase calibration or all flash before programming

Add back in erase support by calling esptool.py twice (since it does not
support chained operations like esptool-ck.exe).

* Make 460K default speed, remove 961K

961K doesn't seem to work with esptool, so make 460K the default upload
speed and remove 961K.

Even at this lower speed, esptool.py is much faster to upload (even
before taking into account the compression when doing things like SPIFFS
and code upload).

* Make erase and upload work again

Arduino does not support a upload.#.cmd pattern, so we need to do
everything in a single command line.  Make it cleaner by introducing a
Python wrapper script which will run the same executable with different
sets of commands (since we need to erase a block w/a separate invocation
from the real upload).

Update boards.txt to use the new options format, placing the esptool
command as "version" when there is no "erase_flash" or "erase_region" to
be done to keep things simple.

* Move esptool/pyserial to submodules

Since esptool.py and pyserial are coming directly from github repos,
there is no need to include them as a tool in package.json.

* Restore 921K upload opt, silent downgrade to 460k

To enable full backward compatibility, restore the 921k option for
upload speed but silently change it to 460k in the upload.py script.

Add error checking on upload.py
2019-02-18 13:43:09 +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
Odd Stråbø
5948b0fc52 msys2 support for tools/get.py (#5751) 2019-02-11 12:18:03 +01: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
Carlos Ruiz
82be4d02dc Wrap get.py's "if __name__ == '__main__':" into a function so it can be externally called (#4475)
Adding the Arduino repo as a git submodule can be very useful for version control. However, `git submodule update` is not enough, as the tools need to be downloaded through `get.py`. Wrapping the main code in that script into its own function allows an external Python script to import the module and execute its functionality without relying on the unsafe `execfile` (or `Popen`). The main advantage would be easy flow control in case of error (eg: issue #4464).
2019-02-07 16:31:37 +00:00
brendanvanbreda
c68fa39181 XinaBox CW01: DIO flash mode (#5720) 2019-02-05 14:59:20 +01:00
Earle F. Philhower, III
848fbf5b4a
Update conf.py from git tag, fix sphinx warnings (#5716)
Fixes #5671

Implements https://protips.readthedocs.io/git-tag-version.html

Fix a myriad of minor Sphinx warnings generated in the docs.
2019-02-04 20:19:23 +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
david gauchard
cef5deecb5
generic esp8266 board: Use flash mode DOUT by default, in place of QIO (#5601) 2019-01-15 23:52:21 +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
Earle F. Philhower, III
1f13c73ced
Speed up CI builds with caching hacks (#5539) 2019-01-05 10:53:39 -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
david gauchard
e3bc3c226b
Fixes for IPv6, added in CI (#5557) 2018-12-27 16:13:48 +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
68f5a3d0d3 Keep signing commands in platform.txt on release (#5491)
* Keep signing commands in platform.txt on release

The boards packager was deleting what was at the time it was written
unused lines in fht platform.txt file before deploying to Arduino.
One of these lines is now needed for signing to work, so don't delete
it.

Also, explicitly call "python signing.py" because it looks like Arduino
is sanitizing/removing executable bits on files when extracting from
boards manager installations.

Fixes #5483

* Create the build subdir, if needed, for autosign

If the temporary build/core directory isn't available, make it in order
that Updater.cpp will see the generated signing header and not the one
in the main core.
2018-12-13 11:23:22 -03: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
e4c6030e48 fix OTA (#5454)
https://github.com/esp8266/Arduino/issues/4283#issuecomment-445447030
2018-12-08 17:45:23 -03:00