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

3349 Commits

Author SHA1 Message Date
Earle F. Philhower, III
418b00f7c0 Re-add deprecated _SPIFFS_xxx linker symbols (#6543)
In order to give user libs a change to update to the new symbols, re-add
the _SPIFFS_XX symbols to the linker file with a comment that they are
deprecated.

Also add back spiffs_hal_xxx functions, also marked as deprecated.

Fixes #6542
2019-09-26 21:28:07 +02:00
Earle F. Philhower, III
2b9fcdb568 Add EEPROM debug printouts, error check to example (#6556)
* Add EEPROM debug printouts, error check to example

Add debug printouts when EEPROM calls fail, even if the API doesn't
allow returning a success/failure code.

Adds error checking to the example to make it explicit that when you
call EEPROM::commit(), you need to look at the result code in your code.

Fixes #6551 , or would fix it if there was error checking in the MCVE.

* Clarify example error message
2019-09-26 14:48:04 -03:00
Mike Nix
244dbd7713 Add 20/26MHz Flash frequencies for slow/cheap flash chips on the Generic ESP board (#6552)
A number of non-genuine boards exist mainly from flea-bay sellers that
use under-sized and/or low quality flash chips which can not handle
a 40MHz FlashFreq properly.

This patch adds slower flash frequencies to the menu for generic ESP boards
so that these cheap knock-offs can be run in a stable manner, hopefully saving
some people a few headaches and keeping these boards out of landfill.
2019-09-24 10:32:11 -03:00
M Hightower
f3ca09006d Update UART selection for Boot ROM ets_putc, when debug port is selected. (#6489)
* Add code to select the UART for Boot ROM ets_putc which is used by
::printf, ets_printf_P in core_esp_postmortem.cpp and others.

ets_putc is a wrapper for uart_tx_one_char. uart_tx_one_char uses
the element buff_uart_no in UartDev (A structure in data area of the
Boot ROM) to select UART0 or UART1. uart_buff_switch is used to set
that entry.

The structure for UartDev can be found in uart.h from the
ESP8266_NONOS_SDK. As best I can tell the Boot ROM always
defaults to UART0.

* Fixes debug UART selection for ets_putc

This addresses an issue of UART selection for ROM function ets_putc,
which is used by ::printf, ets_printf_P in core_esp_postmortem.cpp
and others. Currently ets_putc stays on UART0 after
Serial1.setDebugOutput(true) is called.

ets_putc() is not affected by calls to ets_install_putc1.
Its UART selection is controlled by the ROM function uart_buff_switch.

Updated uart_set_debug() to call uart_buff_switch whenever debug is
enabled on an UART. For the case of disabling, a call to select UART0
is made, because there is no disable option for this print method.

* Removed fp_putc_t typedef, save for a later PR
2019-09-23 14:05:27 -07:00
Max Prokhorov
308e131dee Update EEPROM library documentation (#6548)
Update EEPROM description with mention of current implementation limitations
Move ESP_EEPROM to Other Libraries, update description from upstream README
Add https://github.com/xoseperez/eeprom_rotate to Other Libraries as an alternative
2019-09-23 07:30:02 -07:00
Earle F. Philhower, III
69f3e81fb9
Restore EEPROM address to prior released location (#6537)
When the FS_END was adjusted to end on a full block (i.e. rounded down)
to avoid filesystem issues, but _FS_end was changed.  The EEPROM library
used _FS_end to implicitly calculate the start of the EEPROM data, so
this means after the _FS_end fix, EEPROM data written with prior
releases would "disappear."

Avoid the issue by explicitly calculating the EEPROM start location in
the linker, using the same formula as prior release.

Fixes #6531
2019-09-20 08:24:10 -07:00
Carlos Alberto Nunes
3733ece7e8 Allow Filesystem update via ESP8266HTTPUpdateServer (#3732)
* Allow SPIFFS update via ESP8266HTTPUpdateServer

This adds capability to update the SPIFFS image via
the same mechansism as firmware in the 
ESP8266HTTPUpdateServer.

It does not provide any dependency or linkage between
firmware and spiffs image updating; they are each taken
on their own, each followed by a reboot.

(I wrote this before seeing the other PR for similar
functionality; I like this a bit better, becaue it uses
the available SPIFFS size, and does not hide magic numbers
(U_SPIFFS) in the html...)

(It also cleans up a stray \n from commit ace0622)

* A simple filter

* Review https://github.com/esp8266/Arduino/pull/3234#pullrequestreview-37773153

* Including suggestions for mobile first #3961

* SPIFFS rennamed to FS

* including comments from @earlephihower

* button renaming

* missing #include for LittleFS

* generic names as suggested by @d-a-v
2019-09-20 09:44:48 +02:00
david gauchard
a10e02e998
segment size printout cosmetics (#6534)
* segment size printout cosmetics

* improve readability
2019-09-20 00:04:28 +02:00
johnm545
5d609fd294 Fix WiFiClientSecure::available() blocking on dropped connections (#6449)
* Fix WiFiClientSecure::available blocking

Added a check of WiFiClient::availableForWrite to prevent blocking writes when the _run_until blocking flag is false

* change availForWrite from int to size_t

* add timeout to _run_until loop

fixes #6464

* use polledTimeout with _timeout millis
2019-09-17 01:03:34 -03:00
Earle F. Philhower, III
f2de9e130c
Add segment size printout to standard build process (#6525)
Since IRAM is such a precious resource on the ESP8266, dump out its size
(and all other segments) at the end of the build process.

Ex:
Executable segment sizes:
IROM   : 338932
IRAM   : 27263
DATA   : 1476
RODATA : 2896
BSS    : 30304
Sketch uses 370567 bytes (35%) of program storage space. Maximum is 1044464 bytes.
Global variables use 34676 bytes (42%) of dynamic memory, leaving 47244 bytes for local variables. Maximum is 81920 bytes.
2019-09-16 16:29:53 -07:00
Jeroen88
f5a7318f2f Add ::updateBaudRate(unsigned long baud) to change the baudrate after begin was called (#6494) 2019-09-16 07:43:27 -07:00
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