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
Dirk O. Kaar
efb8aaa5fb EspSoftwareSerial 5.3.0 version update (#6526) 2019-09-16 15:49:19 +02:00
Earle F. Philhower, III
8dd068eb40
Add memmove_P, use it in String to ensure F() safety (#6514)
memmove_P is now in libc, so use it to allow WString to handle F()
pointers without errors.

Supercedes #6368

Fixes #6384
2019-09-13 15:33:16 -07:00
Earle F. Philhower, III
990ec759f2 Fix tool name to point to proper JSON entry (#6513) 2019-09-13 11:17:09 +02:00
M Hightower
9629874038 Run makecorever.py before specific prebuild hooks. (#6504)
* Run makecorever.py before specific prebuild hooks.

When a sketch needs information that is in `core_version.h`, you
have to build a dummy sketch 1st to get `core_version.h` created.
Since `core_version.h` is created after the sketch is compiled.

Moved rebuild recipe hook for running `makecorever.py` core to run
before all _specific_ prebuild hooks. While this form of prebuild hook
is not explicitly listed, it seems like an intuitive expectation.

Recipie hooks of this form:
```
recipe.hooks.prebuild.NUMBER.pattern=...
```
build before recipies of this form:
```
recipe.hooks.SPECIFIC.prebuild.NUMBER.pattern=...
```
where `SPECIFIC` would be: sketch, libraries, core, linking, ...

* Added hack comment to platform.txt.
2019-09-12 23:33:40 -03:00
david gauchard
2d1acfa9a4
add or improve some debug messages (#6508) 2019-09-12 16:08:52 +02:00
david gauchard
0474eb9943
emulation on host: show timestamp on console output (#6507)
* emulation on host: option to add timestamp on console output
2019-09-12 14:00:27 +02:00
Mike Nix
d8531cb2c4 Ets intr lock nest (#6484)
* Replace the SDK's use of ets_intr_lock/unlock with nestable versions

Testing has shown that there are several paths in the SDK that result in nested
calls to ets_intr_lock() / ets_intr_unlock() which may be a problem.

These functions also do not preserve the enabled interrupt level and may
result in code running with interrupts enabled when that is not intended.
This issue has recently been fixed in the Arduino code by using
xt_rsil() / xt_wsr_ps() but still exists in the Espressif SDK code.

This commit is intended to fix that and should be used in addition to the above.

The maximum nesting I have seen is 2 and lock/unlock calls appear to be balanced.
A max of 7 levels of nesting leaves plenty of room for that to change.

* make ets_intr_lock_stack uint16_t and behave like the original on over/underflow

The PS register is 15 bits, we should store the whole thing as xt_wsr_ps()
writes the whole thing.

Also if there is an underflow, we should make sure interrupts are enabled.
Same goes for overflow making sure interrupts are disabled, although this
is less important.

* Rename ets_intr_(un)lock_nest to ets_intr_(un)lock

This saves having to modify libmain.a, libpp.a and libnet80211.a to use the
nested versions.
Adjusts fix_sdk_libs.sh accordingly.

* Remove ets_intr_(un)lock from the rom .ld as we no longer use them

* ets_post() wrapper to preserve interrupt state

Add a wrapper around the ets_post code in rom to preserve the interrupt enable state.

Rather than modifying the SDK libs, rename ets_post in the .ld file and call the
wrapper "ets_post" to replace it.

As far as I can establish, ets_post is the only rom function in use by our code or
the SDK libs we use that causes calls to ets_intr_(un)lock.

* Add IRAM_ATTR to ets_intr_(un)lock and ets_post wrappers.

* Throw in a few comments and make ets_intr_lock_stack* static.
2019-09-10 23:59:07 -03:00
Earle F. Philhower, III
1f86311d79
Add Win32 build to CI system (#6493)
Build a single INO under a Windows VM on Travis to ensure
that the Win32 toolchain works properly.

In build.py, instead of making a string with spaces and then
splitting on " ", just make the list itself with individual parameters.
This will allow spaces in paths to be supported properly.
2019-09-10 14:50:55 -07:00
Martin Berka
4f74ed8408 Edited OTA readme, added Stream Interface snippet (#6487)
* Edited OTA readme, added Stream Interface snippet

Reworded for easier understanding. Changes mostly in first half of page.

* OTA docs: corrected typos, misc edits near end

* Incorporated suggestions from earlephilhower

Extra ^, removed TODO
2019-09-10 11:44:19 -03:00
Earle F. Philhower, III
77c4f5e5cf
Add OSX build to CI, fix OSX builds (#6492)
Build a single sketch using a Travis-CI OSX instance to validate the
toolchain works properly on Macs.

Update the installed python3 symlink to point to the proper spot for OSX
(Python3 is in /usr/local/bin, not /usr/bin).

Fixes #6490
2019-09-07 18:31:17 -07:00
david gauchard
5ca0bde200 MDNS: fix random crash on startup (#6261)
* mDNS debug option + AP address is used by default when STA is also present

* mDNS: store network interface, checking it is up

* igmp: force on selected interface (avoid crash *sometimes*)

* fix for all lwip2 ipv4 ipv6 & lwip1

* mdns: IPAddress is not needed to reference associated interface

* mdns: debug: fix print warnings

* emulation: add ets_strncpy

* emulation: truly emulate AddrList (remove fake one)
2019-09-04 20:10:47 -07:00
david gauchard
273f4000f0
Experimental: add new WiFi (pseudo) modes: WIFI_SHUTDOWN & WIFI_RESUME (#6356)
* add new WiFimodes: WIFI_SHUTDOWN & WIFI_RESUME with example
* restore WiFi.onWiFiModeChange()
2019-09-05 03:01:01 +02:00
Dirk O. Kaar
db460388cd SoftwareSerial: Bring submodule in line with upstream release 5.2.9 (#6486) 2019-09-05 01:59:12 +02:00
david gauchard
291b321e62
ClientContext: restore use of two different pending booleans for connect and write #6483 2019-09-04 01:22:56 +02:00
Rushikesh Patel
07d8128b96 move timer functions to iram (#6466) 2019-09-02 15:17:12 -04:00
Dirk O. Kaar
0399bb1fee A port of ESP32 Arduino PR https://github.com/espressif/arduino-esp32/pull/3165 (#6477) 2019-09-02 08:11:41 -04:00
Earle F. Philhower, III
b6e58301af
Add Python3 dir to .gitignore (#6474) 2019-08-31 10:14:44 -07:00
Earle F. Philhower, III
901410fa00
Fix the python3 directory so scripts work on Win32 (#6472)
The get.py renamer uses some logic which results in the Win32 extracted
directory always ending up as `tools/python` and not `tools/python3`.
Adjust the zip archive and title to work around this (and the IDE
proper) issue.
2019-08-30 10:17:36 -07:00
Dirk O. Kaar
d04f768954 Use PolledTimeout for busy loop timeout (#6371) 2019-08-29 21:28:42 -04:00
david gauchard
85f1ea7c78
exceptions: optionally enforce c++ standards (#6333)
* exceptions: 3 choices: legacy, std::new never returns 0, or exceptions enabled
* arduino_new (doc, example, array)
2019-08-29 00:21:10 +02:00
Earle F. Philhower, III
0a031ce957
Move all scripts and documentation to Python3 (#6378)
* Move all scripts and documentation to Python3

Python 2 EOL is Jan 1, 2020.  Migrate scripts to run under Python 3.

Under Windows, we're already running Python 3.7, by dumb luck.  The
oddness is that the Windows standalone executable for Python 3 is called
"python" whereas under UNIX-like OSes it's called "python3" with
"python" always referring to the Python 2 executable.  The ZIP needs to
be updated to include a Python3.exe (copy of Python.exe) so that we can
use the same command lines under Linux and Windows, and to preserve my
sanity.

Fixes #6376

* Add new Windows ZIP with python3.exe file

* Sort options in boards.txt generation for repeatability

The order of the board opts dict changes depending on the Python version
and machine, so sort the options before printing them to get a stable
ordering.

* Re-add Python2 compatibility tweaks

Most scripts can run as Python 2 or Python 3 with minimal changes, so
re-add (and fix, as necessary) compatibility tweaks to the scripts.
2019-08-28 12:42:48 -07:00
Iscle
1800bb5abe BasicHttpsClient: Updated demo certificate fingerprint (#6462)
The previous certificate had already expired, I swapped it with the current one.
2019-08-28 11:48:34 -07:00
Dirk O. Kaar
e201f614e8 Fix reverse dependency core Updater -> library ESP8266WiFi (#6398)
* Per @earlephilhower suggestion

* Hints from @earlephilhower

* Namespace BearSSL in core "feels" wrong - using catch-all esp8266 instead.

* After review remarks by @earlephilhower
2019-08-28 11:07:04 -07:00
Earle F. Philhower, III
05969c6bf2
Remove ROM routines from libc.a, save progmem (#6432)
Dropped routines form libc.a which are present and usable in ROM:
`ar dv libc.a lib_a-strcmp.o lib_a-strlen.o lib_a-strncmp.o lib_a-strstr.o lib_a-memcmp.o lib_a-memcpy.o lib_a-memmove.o lib_a-memset.o lib_a-bzero.o`

Left strcpy and strncpy in libc.a because they silently support PROGMEM
accesses as required by GCC optimizations.

Saves ~628 bytes in AdvancedWebServer example, from IROM (not IRAM).

Also allows mem* and str* routines to be safely called from inside an
ISR.  Prior to this PR, these routines were stored in flash and not
IRAM, so they were technically illegal to call while in an ISR.

Fixes #6430
2019-08-28 09:39:05 -07:00
david gauchard
06f1865628
new network feature: NAPT (widely known as NAT) (#6360)
* lwIP: napt patches (enabled with lwip2 w/o IPv6 w/ features)
2019-08-28 17:51:14 +02:00
Earle F. Philhower, III
7436f3802a
Allow Print::println() to work with PROGMEM strings (#6450)
Adjust the ::write implementation in Print and its overridden copy in
UART to allow it to silentely accept PROGMEM strings (since there is no
write_P macro).

Fixes #6383
2019-08-28 07:59:19 -07:00
david gauchard
37bb628019
lwIP-1.4: use fixed locking functions (#6455) 2019-08-28 16:11:00 +02:00
david gauchard
45dbc65dba
standardizes processing of _delaying in lwIP callbacks (remove assert) (#6460) 2019-08-28 15:24:57 +02:00
david gauchard
ec4edf0b63
fix arduino builder command line (#6461) 2019-08-28 14:33:12 +02:00
david gauchard
0937b076c8
ClientContext: break timeout delays also on error while writing or connecting (#6454)
This PR stops the 1ms-delay loop also when a tcp error occurs (previously this was done only when tcp had just connected or a write/send had succeeded).
The tcp error can be any, in this case with pubsubclient it is "connection refused" after the mqtt server disappeared and pubsubclient tries to reconnect.
2019-08-27 15:26:27 +02:00
david gauchard
e56aed6540
remove unused upstream library (#6456) 2019-08-27 02:12:47 +02:00
Jeroen88
60d519e235 Bugfix/esp8266 http client (#6176) 2019-08-26 16:12:50 +02:00
david gauchard
55539ae941 fix _min and _max macros (#6374) 2019-08-19 18:42:44 -04:00
Earle F. Philhower, III
def85866be
Fix espduino verbose upload (#6426)
Fixes #6418
2019-08-18 20:22:07 -07:00
M Hightower
127199ab6d proposed umm_malloc improvements (#6274)
*   Correct critical section with interrupt level preserving and nest support
  alternative. Replace ets_intr_lock()/ets_intr_unlock() with uint32_t
  oldValue=xt_rsil(3)/xt_wrs(oldValue). Added UMM_CRITICAL_DECL macro to define
  storage for current state. Expanded UMM_CRITICAL_... to  use unique
  identifiers. This helpt facilitate gather function specific  timing
  information.

  Replace printf with something that is ROM or IRAM based so that a printf
  that occurs during an ISR malloc/new does not cause a crash. To avoid any
  reentry issue it should also avoid doing malloc lib calls.

  Refactor realloc to avoid memcpy/memmove while in critical section. This is
  only effective when realloc is called with interrupts enabled. The copy
  process alone can take over 10us (when copying more than ~498 bytes with a
  80MHz CPU clock). It would be good practice for an ISR to avoid realloc.
  Note, while doing this might initially sound scary, this appears to be very
  stable. It ran on my troublesome sketch for over 3 weeks until I got back from
  vacation and  flashed an update. Troublesome sketch - runs ESPAsyncTCP, with
  modified fauxmo emulation for 10 devices. It receives lost of Network traffic
  related to uPnP scans, which includes lots of TCP connects disconnects RSTs
  related to uPnP discovery.

  I have clocked umm_info critical lock time taking as much as 180us. A common
  use for the umm_info call is to get the free heap result. It is common
  to try and closely monitor free heap as a method to detect memory leaks.
  This may result in frequent calls to umm_info. There has not been a clear
  test case that shows an issue yet; however, I and others think they are or
  have had crashes related to this.

  I have added code that adjusts the running free heap number from _umm_malloc,
  _umm_realloc, and _umm_free. Removing the need to do a long interrupts
  disabled calculation via _umm_info.

  Build optional, min/max time measurements for locks held while in info,
  malloc, realloc, and free. Also, maintain a count of how many times each is
  called with INTLEVEL set.

* Fixed. travis build complaint.

* Changes for https://github.com/esp8266/Arduino/pull/6274#pullrequestreview-259579883

* Added requested comment and missing comment for UMM_CRITICAL_PERIOD_ANALYZE.

* Updated comments and update xt_rsil()

* Moved xt_rsil&co (pulled in __STRINGIFY) definitions out of
Arduino.h, to cores/esp8266/core_esp8266_features.h
Added esp_get_cycle_count() to core_esp8266_features.h.
Updated umm_malloc and Esp.h to use new defines and location.

* Added "#ifndef CORE_MOCK" around conflicted area.

* Moved performance measurment and ESP specific definitions to
umm_performance.h/cpp. Removed testing asserts.

* Commented out umm analyze. Delay CRITICAL_SECTION_EXIT() in
umm_realloc() to avoid exposing a transient OOM condition to ISR.

* Missed file change. This commit has: Delay CRITICAL_SECTION_EXIT() in
umm_realloc() to avoid exposing a transient OOM condition to ISR.

* 2nd Path. Removed early release of critical section around memmove
to avoid a possible OOM for an ISR.

* improved variable name

* Resolved ISR OOM concern with `_umm_realloc()`

Updated realloc() to do a preliminary free() of unused space,
before performing a critical section exit and memmove.
This change was applied to the current _umm_realloc().
This change should reduce the risk of an ISR getting an
OOM, during a realloc memmove operation.
Added additional stats for verifying correct operation.

* Resolved ISR OOM concern in _umm_realloc()

Updated realloc() to do a preliminary free() of unused space,
before performing a critical section exit and memmove.
This change was applied to the current _umm_realloc().
This change should reduce the risk of an ISR getting an
OOM when interrupting an active realloc memmove operation.
Added additional stats for verifying correct operation.
Updated: for clarity and Travis-CI fail.

* Update to keep access to alternate printf in one file.

* Updated to use ISR safe versions of memmove, memcpy, and memset.

The library versions of memmove, memcpy, and memset were in flash.
Updated to use ROM functions ets_memmove, ets_memcpy, and ets_memset.
Additional note, the library version of memmove does not appear to
have been optimized. It took almost 10x longer than the ROM version.
Renamed printf macro to DBGLOG_FUNCTION and moved to umm_malloc_cfg.h.
Changed printf macro usage to use DBGLOG_FUNCTION.

* Update umm_malloc.cpp

Fix comment
2019-08-18 20:48:23 -04:00
thangktran
6dd8474014 libraries: wrong value for setFrequency() (#6409)
Thanks to fix suggestion from @UlliBien.

Fixes: https://github.com/esp8266/Arduino/issues/6380
2019-08-17 12:27:45 -07:00
Zakary Kamal Ismail
0dbb04e881 Add HTTP_HEAD to HTTPMethod and parse it (#6413)
* Add HTTP_HEAD to HTTPMethod

* Parse the HTTP_HEAD variant of HTTPMethod from a method string

* Add HTTP_HEAD to the ESP8266WebServer constants

* Skip sending the content of the response if the HTTP method is HEAD method

* Convert the HTTP status code 418  to string
This status code is an easter egg from the IETF and is described in 
[RFC2324](https://tools.ietf.org/html/rfc2324#section-2.3.2)
2019-08-17 11:58:40 -07:00
Ilya
8f45a0fb91 Set method _connectSSL as protected (#6424) 2019-08-16 13:23:05 +02:00
방성범 (Bang Seongbeom)
e77f96c3e1 Fix the number of examples (#6407) 2019-08-12 14:50:40 -07:00
Dirk O. Kaar
f2bac1cae9 Prevent rewriting core_version.h if content unchanged (#6414) 2019-08-12 13:28:19 -07:00
Earle F. Philhower, III
adfc28d7d8
Fix basic SSL server definitions (#6402)
A typo was present in several ifdefs which would allow a server to negotiate
an EC connection even when in basic SSL mode.  When this happened, a crash
would occur (since there were no EC or advanced AES modes installed).

Fix the typo, fixes #6397
2019-08-08 21:54:59 -07:00
dickorydock
ea17a06bc8 Grammar edits in documentation (#6401)
* Grammar changes

* Update readme.rst

* Update README.md
2019-08-08 20:26:19 -04:00
david gauchard
021a81fc46
esptool: 3M-baud serial upload speed (#6399) 2019-08-08 12:28:07 +02:00
teo1978
a8873c2364 fix documented parameter (#6392) 2019-08-07 14:16:07 +02:00
david gauchard
88f0410c4b
ensure consistency for gdb hooks signatures (#6391) 2019-08-07 11:18:45 +02:00
Majenko Technologies
2a7a3f5683 Uncouple uart from GDBStub library (#6390) 2019-08-07 09:51:37 +02:00
david gauchard
4e9358445a wstring: fix concatenation from flash (#6368)
fixes #6367
2019-08-05 08:16:49 -07:00
thangktran
f78ab66f89 libraries: fixed no "OK" ACK for Signed Update (#6351) 2019-08-01 14:00:49 +02:00
david gauchard
d6973cd63d enable puya support by default (can be disabled with -DPUYA_SUPPORT=0) (#6362) 2019-07-31 01:04:01 -04:00
Earle F. Philhower, III
19d09eae2b
Preserve prior bitrate for I2S begin (#6349)
Fixes #6066

Preserve any existing sample rate for the I2S unit when performing an
`i2s_begin`.  If nothing has ever been set, default to 44.1KHz as
before.
2019-07-28 12:16:31 -07:00