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

3090 Commits

Author SHA1 Message Date
Earle F. Philhower, III
5632e8156f Fix repaintable stack calculation (#5821)
* Fix repaintable stack calculation

Fixes #5794 as found by @mattbradford83

* Overwrite last word of stack as well

Under-by-one error would not reset the absolute end of the stack, adjust
comparison to fix.
2019-02-26 22:37:42 -03:00
Earle F. Philhower, III
95cf925719
Add OOM check and debug message in CertStore (#5820)
Fixes #5819
2019-02-26 02:46:25 +00: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
Clemens Kirchgatterer
21926a69b6 emulation on host: fix wrong tty_restore instead of restore_tty variable (#5809) 2019-02-23 11:30:44 +01:00
Clemens Kirchgatterer
ef44211eea emulation on host: Add full UART driver emulation. (#5785)
* emulation on host: Add full UART driver emulation.

  This PR replaces the high level Serial mock with a more complete
  UART driver. This way the HardwareSerial works without any
  modifications. Additionally the driver supports UART0 and UART1
  at the same time (UART0 is directed to stdout and UART1 writes
  to stderr). RX is implemented by switching the terminal into raw
  non-blocking mode and injecting each key-press directly into the
  FIFO of UART0. A new command line switch -c was added to ignore
  CTRL-C and send it via serial as well. The decumentation was
  updated accordingly.

  Reading and setting of GPIOs does only write to stderr, when compiled
  with D=1. But this is subject to be replaced with a proper GPIO emu
  anyway. Reading from GPIO0 now returns 1 instead of 0 because this is
  most likely a low active input.

* Fixed unused variable.

* Remove unused functions, as long as there are no debug macros using them.

* Move user_interface.cc from MOCK_CPP_FILES_EMU to MOCK_CPP_FILES.

* Move optimistic_yield() from user_interface.cpp to Arduino.cpp

* Remove atexit() weak declaration (fixes segfault when calling atexit).

* Improve resetting of terminal after program exit, convert \r to \r\n.

* Show error, when STDOUT is not a TTY, minor code cleanung.
2019-02-22 16:50:55 +01: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
f08346a73e
Fix host emulation (sdk changes) (#5802) 2019-02-21 17:04:17 +01:00
david gauchard
3d41ccf032 fix typo in platform.txt (#5800)
fix #5798: from @AcuarioCat: There is a typo in platform.txt on line 87 that causes makecorever.py to fail.
2019-02-21 11:39:07 -03:00
Earle F. Philhower, III
22eed42d50 Use local copy of python distro to include a subdir (#5796) 2019-02-20 18:14:38 +01: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
david gauchard
e7e7a4da17
prepare allman style (#5774) 2019-02-18 01:10:44 +01:00
Clemens Kirchgatterer
b93b37fb81 emulation on host: Fix optimistic_yield(interval_us) (#5772)
optimistic_yield() takes micro seconds not milliseconds as interval parameter
2019-02-17 23:11:40 +01:00
Clemens Kirchgatterer
14f1b1d4a7 Add progress callback to Updater class. (#5754)
* Add progress callback to Updater class.

This is a backport of the same functionality in the ESP32 core.

* Add progress callback to Updater class.

* Add typedef for callback function.

* Fixed initializing order.

* Added missing include (functional).
2019-02-16 23:45:24 -03:00
Clemens Kirchgatterer
9f9c661d99 emulation on host: Make non essential ARDUINO LIBS optional. (#5771)
This patch splits ARDUINO_LIBS into two variables. The second variable is called OPT_ARDUINO_LIBS and can be overridden by the caller as it uses the ?= assignment operator. Additionally it unifies and simplifies collecting the files in common/ by using the addprefix macro. All changes should be 100% backwards compatible.
2019-02-16 22:50:27 +01:00
Clemens Kirchgatterer
2be374cc6c emulation on host: Add base64 decode library to mock files (#5764)
Fixes missing symbols during linking of sketches that use them.
2019-02-16 21:39:30 +01:00
Clemens Kirchgatterer
e721089e60 Fix hardcoded dependency of ArduinoOTA on mDNS (#5768)
Fixes #4643 

This is especially important when compiling for host mode, because ArduinoOTA is pulled in unconditionally by the Makefile in tests/host. Thus it breaks the build as soon as NO_GLOBAL_INSTANCES or NO_GLOBAL_MDNS is defined.
2019-02-16 10:44:43 -03:00
Clemens Kirchgatterer
9ba89ebaf4 emulation on host: Add missing ESP.*() mocking methods to EspClass. (#5765) 2019-02-16 00:05:18 +01:00
Clemens Kirchgatterer
d3a2ab9bb4 emulation on host: Add (some) missing macros for *_P() functions. (#5766) 2019-02-15 23:00:08 +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
6c5269a74b
fix UdpContext::(connect,listen) signature by using IPAddress (#5742)
* fix UdpContext::listen signature by using IPAddress
* fix UdpContext::connect signature by using IPAddress
  by courtesy of @AlfredLamoule
2019-02-11 13:46:40 +01: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
e51bd0d790
Fix minor C++ warnings in host "make test" run (#5747) 2019-02-08 20:19:37 +00:00
Earle F. Philhower, III
7369133681
Small String Optimization (#5690)
Reduce String memory overhead from 24 bytes to 16 bytes by limiting the
maximum string length to <64Kbytes (which is larger than heap so no
effective problem).

Add Small String Optimization, SSO, which instead of allocating pointers
to small strings on the heap will store the string in place of the
pointer in the class.  This should reduce memory fragmentation as

Save up to 12 chars (11 + \0) in String itself by using the terminating
\0 in the inline string as a flag to identify if this is a SSO or a heap
string.

Add a host test that verifies that no memory is allocated until a
full 11 characters are assigned to a string, as well as checking all
intermediate values.

No user code changes should be required to work with this optimization.
2019-02-08 17:37:43 +00:00
david gauchard
1959311180
UdpContext::setMulticastInterface(): fix for IPv6 (#5743)
Per 'udp_set_multicast_netif_addr()' signature and comments in lwIP sources:
An IPv4 address designating a specific interface must be used.
When an IPv6 address is given, the matching IPv4 in the same interface must be selected.

fix e3bc3c226b (r32235572)
2019-02-08 15:23:08 +01:00
david gauchard
82487e5d96
boards: Invent One: fix analog pin (#5741)
fix #5740
2019-02-08 12:37:44 +01:00
dav1901
c08efb52fb Adjust send_P to function the same as send (#5507) 2019-02-07 20:39:20 +00: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
Earle F. Philhower, III
d2a8e8acc2
Add debug messages on BSSL errors (#5723)
Add debugging output when DEBUG_ESP_SSL is defined.
Add dump of actual error when connect fails
2019-02-07 05:18:31 +00:00
Earle F. Philhower, III
e74b1e590b Use "bool" for "boolean" type (#5693)
Match current Arduino definition to avoid issues with comparison
operations.

https://github.com/arduino/Arduino/issues/2147
20ac20f629

Fixes #5440
2019-02-07 00:31:39 -03:00
Earle F. Philhower, III
f706c83b66 Move .C to .CPP in the code (#5696)
Use g++ to compile core files to get additional C++ checks on the code.

Also move libb64 constants to PROGMEM, saving ~128 bytes of heap when used.
2019-02-06 23:06:17 -03:00
Develo
24fa59df4b
Update README.md (#5732)
Version bumps, addition of espsoftwareserial to credits, minor text updates
2019-02-06 22:03:54 -03:00
Develo
ab4ce4082a
Update platform.txt (#5731)
version bump to next minor milestone
2019-02-06 18:31:18 -03:00
Develo
951aeffa76
Release 2.5.0 (#5724) 2.5.0 2019-02-06 00:23:47 -03:00
brendanvanbreda
c68fa39181 XinaBox CW01: DIO flash mode (#5720) 2019-02-05 14:59:20 +01:00
Jiří Engelthaler
c218d945a4 CaptivePortalAdvanced: Fix compatibility with Android (#5069)
Android refuses to show page with missing Content-Length header.
Prepare page data to String and send it with server.send
Moved respose strings to PROGMEM
2019-02-05 13:28:37 +01:00
hreintke
82789d201c Functional update, host and service probes (#5653)
* Functional update, host and service probes

* Fix ServiceMonitor.ino warnings

* Adding MDNSServiceQueryCallback functional
ServiceMonitor.ino needs some updates for web page but works on Serial output.

* DynamicServices Functional

* Fix ServiceMonitor to match latest MDNSServiceInfo

* Fix unused variable in LEAdns.h

* mDNS_Clock.ino fix

* example restyle

* Add keyValues and answerInfo

* Waring and formattin fix

* Change     struct MDNSServiceInfo   {  MDNSServiceInfo(MDNSResponder ...
to     struct MDNSServiceInfo { MDNSServiceInfo(MDNSResponder&

* Make AnswerType user friendly

* Update ServiceInfo example

* Code cleanup

* AnswerType update, Astyle update servicemonitor

* Update clock example to webserver

* Second typedef for probe callbacks
Change String -> const char* at multiple locations

* Optimizations

* Update callbacks to void

* esp32 compatibility

* std::map to const char*

* Fix emplace_back call

* Change Dynamic callback to void(...)

* Add WiFi events reset() in close()
2019-02-05 00:40:45 -03: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
Develo
04dc463153
Wire Examples based on AVR ones of the same name (#5713)
* Wire Examples based on AVR ones of the same name

* Overload for begin(), change in callback arg from int to size_t

* Update master_reader.ino

Astyle

* Update master_writer.ino

Astyle

* Update slave_receiver.ino

Remove warning

* Update slave_receiver.ino

Astyle
2019-02-04 14:47:29 -03:00
david gauchard
8412d11b02
host emulation fix (#5704) 2019-02-04 11:37:39 +01:00
apicquot
e43a586f0d Improved readString() for File (#5445)
* added new boards

* corrected block size error

* added board to last commit working well

* override of readString for File class
Stream::readString requires a timeout of 1 seconds + multiple memory resize

* correct indent
return if size 0 before reserve

* correct indent

* good indent

* stricter test for end of string

* same implementation than Stream by replacing timeRead by read

* reading file by block of 256

* make sure there is an end of string

* fixed bug for file size multiple of 256
string::concate(char*) needs a string terminator to work
2019-02-04 05:08:54 -03:00
Earle F. Philhower, III
8c01516f8a Allow unaligned input/output to SPI::transferBytes (#5709)
* Allow unaligned input/output to SPI::transferBytes

Fixes #4967

Support any alignment of input and output pointers and transfer lengths
in SPI::transferBytes.  Use 32-bit transfers and FIFO as much as
possible.

* Refactor misaligned transfer, avoid RMW to FIFO

The SPI FIFO can't properly do RMW (i.e. bytewise updates) because when
you read the FIFO you are actually reading the SPI read data, not what
was written into the write FIFO.

Refactor the transferBytes to take account of this.  For aligned input
and outputs, perform as before (but handle non-x4 sizes properly).  For
misaligned inputs, if it's unidirectional then do bytewise until the
direction data pointer is aligned and then do 32b accesses.  Fod
bidirectional and misaligned inputs, copy the output data to an aligned
buffer, do the transfer, then copy the read back data from temp aligned
buffer to the real input buffer.

* Fix comments, clean condition checks, save stack

Add more comments and adjust naming to be more informative in
transferBytes_ and *aligned_.  Save 64bytes of stack in double
misaligned case.

* Optimize misaligned transfers, reduce code size

On any misaligned input or output, always use a temp buffer.  No need
for special casing and bytewise ::transfer().  This should be faster as
bytewise ::transfer involves a significant number of IO register
accesses and setup.  Thanks to @devyte for the suggestion.
2019-02-03 12:17:06 -03:00
Earle F. Philhower, III
56268b166d
Fix memory related issues w/BearSSL server/client (#5706)
Because the constructors of the BSSL client and server add a reference
count to the stack_thunk, if there is no copy constructor defined then
the stack thunk reference count can get out of sync causing the stack
thunk memory to be freed while still in use.  That could cause random
crashes or hangs.

Add a very basic copy constructor to the WiFiClientSecure and
WiFiServerSecure objects, using the default operator= to duplicate
simple types and shared_ptr classes.

The _cipher_list element (used only w/custom ciphers) could be freed
while still in use if copies of the WiFiClientSecure object were made.

Use a shared_ptr which will only free when the last reference is
deleted.

The axTLS compatibility mode calls allocate and store elements needed
for SSL connections (unlike normal BearSSL calls).  These elements could
be freed mistakenly while still in use if copies of the WiFiClientSecure
were made by the app.

Convert to a separately managed shared_ptr to ensure they live as long
as any referencing objects before deletion.

Same done for the axTLS compatability for WiFiServerSecure.
2019-02-02 18:09:19 +00:00
david gauchard
1cacf92ce1 stop lwIP dhcp client when WiFi goes off. (#5703)
* stop lwIP dhcp client with WiFi goes off.

* stop dhcp-client when really unused
2019-02-01 14:33:26 -03:00