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

4289 Commits

Author SHA1 Message Date
M Hightower
fe451a814f
Fix typo in section list (#8726)
For GCC LD scripts, using commas in a section expression
sometimes cause problems.
2022-11-23 12:33:56 -08:00
seism0saurus
80bf716625
Only check the actual used lenght of the hash. (#8709) 2022-11-06 00:20:23 +03:00
M Hightower
3a2fe9ff0f
Correction on Heap API available from ISR (#8708)
* Correction on Heap API available from ISR

* Expand reason for avoid realloc/free
2022-11-04 16:07:31 +03:00
M Hightower
3d9aeeff2d
Fix pre-SDK Cache_Read_Enable for PUYA flash (#8658)
* Enable SPI_CS_SETUP for early ICACHE use

The SPI_CS_SETUP parameter has been observed set by RTOS SDK and NONOS SDK
as part of flash init/configuration. It may be necessary for some flash
chips to perform correctly with ICACHE hardware access. Turning on and
leaving it on should be okay.

* Cleanup comment

* Change umm_init to default to IRAM

Some flash chips (PUYA) have some unknown requirements for running with
early `Cache_Read_Enable`. They work fine after the SDK is started.
For now, change umm_init to default to IRAM.
Define UMM_INIT_USE_ICACHE to move to ICACHE and free up IRAM.

Added some experimental code that may indirectly support PUYA.

Note, until this issue is resolved, that HWDT Stack Dump is not
going to work with PUYA flash.

* typo

* Finalize fix for PUYA flash and preSDK use of Cache_Read_Enable.

This resolves the exception 0 issue with PUYA flash when using
flash/ICACHE for umm_init and/or using HWDT Stack Dump.
2022-11-04 13:51:53 +03:00
Max Prokhorov
e1081e30f5
Update README.md (#8706)
Remove unused Travis URL, update documentation links and add PlatformIO platform instructions
2022-11-03 18:38:01 +03:00
Max Prokhorov
fff12e3068
Updater lifetime callbacks (#8653)
follow-up of #8598 
similar to ArduinoOTA API, execute certain callback in the Updater context.
2022-11-03 08:58:53 +03:00
Max Prokhorov
27c0591756
Longer delays for Ticker and some internal updates (#8625)
Adds max duration check. In case it is over SDK limit, enable 'repeat'ing timer with a duration proportional to the original one and count until it executes N times, only then run the callback.
Code with durations less than that executes as usual. Original proposal was to not create anything or create some kind of error state... which seems counter-productive to not help out with this pretty solvable use-case.

Additional updates, while refactoring the class
- Stronger types for internal time management using `std::chrono::duration`. Works the same, `std::chrono::duration` handles seconds <-> milliseconds conversion, and we don't have to remember the time type in each method. (...and even allow `once()` and `attach` as overloads instead of the current `_ms`-suffix, in a future update)
- `::detach()` when timer finishes. Fixes (unintentional?) side-effect that we remain `::active()`. Plus, this destroys any lambda-bound variables that will persist with the Ticker object. And, since we can't re-arm with the existing function (`Ticker::attach_ms(uint32_t just_the_time)` and etc.)
- `std::variant` aka union for internal callback storage (kind-of similar to #6918). Instead of having two separate code paths, **always** attach our static function and dispatch using type info. Also helps with the issue described above, since it will call `std::function` dtor when ptr + arg is attached instead of doing nothing.
- smarter copy and move, detaching existing timer on assignment and detaching the moved-in timer object in both ctor and assignment. Copying or moving a running timer no longer blindly copies `_timer` pointer, allowing to disarm the original one. Since we are a simple wrapper around `os_timer_t`, just do the simpler thing (and not re-schedule the callback, try to store original times, etc. polledTimeout already does it and is copyable)
2022-11-01 20:15:14 +03:00
Max Prokhorov
04494f0729
Generic netif status callback and mDNS (#8705)
* sprinkle IPAddress(...).isSet() across our loops to avoid polling on a
  stopped interface. status callback and netif_is_up **does not
  guarantee and we could use the interface**!
* register *one* status callback per instance, e.g. when begin() is called
  multiple times (also notice a subtle issue with schedule function when
  instance is delete'ed)
* consistent LwipIntf callback signature. no need for rvalue, just pass
  stdfunc as-is and let the compiler figure it out
2022-11-01 03:01:40 +03:00
rotulet
78444a5037
Add Wemos ESP-WROOM-02 board (#8664)
* add fixes from https://github.com/esp8266/Arduino/issues/6551#issuecomment-534737671
* add flashfreq_26 to the macro list
2022-11-01 01:38:35 +03:00
Max Prokhorov
d36b21db38
Remove paths / paths-ignore condition from CI (#8704)
Does not work very well with branch protection rules.
Pending some other solution, re-enable our ability to merge stuff.
2022-11-01 01:23:24 +03:00
Max Prokhorov
0aab6ecee2
Rework CI workflows (#8688)
- split workflows into separate files to trigger by path
  this should help out documentation and boards / eboot / pkg files
  updates, since those *wont* trigger usual build stuff anymore
- build*.sh whatever merged into just common.sh and build.sh
  trigger different parity builds, mod % rem and allow to set .ino list
  through the environment variable
- removes unnecessary temporary files, try to use more pipes
  move remaining ones into cache dir instead of PWD
- remove legacy TRAVIS env vars, use ESP8266_ARDUINO prefix for config
- remove Windows path workarounds
- hardware/ and ide/ directories are set through envionment
  do not force specific paths, simplify builds on local machine
- sketch list is set through environment. expicit paths for Windows and
  macOS builders. platformio also gets a real shuffled list instead of
  mod and rem magic numbers
- detect root of the repo through git cli, not base{name,dir} or relative paths
2022-10-31 11:13:40 -07:00
david gauchard
2360d1cff1
Consistent netif->status_callback (#8676)
https://github.com/d-a-v/esp82xx-nonos-linklayer/pull/62
2022-10-31 07:33:16 +03:00
Max Prokhorov
bde8ef7af7
Nice stack smashing postmortem message (#8670)
Wire everything that relies on stack smashing detection to call
`__stack_chk_fail()` (aka what libssp / ssp / stack-protector uses)
Expose it in our debugging header

Rename overflow -> smashing, as these are different things we are trying
to detect (meaning, that we check for things writing there, not some
kind of `alloca` issue or the way `-fstack-check` would have worked)
ref. #8666

`-fstack-protector` continues to work as it always did
CONT replaces `abort()`, also moves its check to the loop wrapper to
avoid dumping otherwise useless SYS context memory
StackThunk replaces a similar `abort()` call
2022-10-31 07:15:42 +03:00
Jiri Bilek
5f94a60d78
Changed / added virtual functions for returning connection information (#8693)
Fixes the incorrect behavior of WiFiClientSecure.remoteIP(), .remotePort(), .localIP(), .localPort().
2022-10-31 06:25:04 +03:00
M Hightower
d3eddeb501
Ensure xPortGetFreeHeapSize reports DRAM (#8680)
Create dedicated function for xPortGetFreeHeapSize() that only reports on DRAM.
NONOS SDK API system_get_free_heap_size() relies on xPortGetFreeHeapSize() for the free Heap size.

Possible breaking change for multiple Heap Sketches calling system_get_free_heap_size(); it will now always report free DRAM Heap size.

Update and export umm_free_heap_size_lw() to report the free Heap size of the current Heap.
Updated ESP.getFreeHeap() to use umm_free_heap_size_lw().

Updated build options to supply exported umm_free_heap_size_lw() via either UMM_STATS or UMM_INFO.

Improved build option support via the SketchName.ino.globals.h method for Heap options: UMM_INFO, UMM_INLINE_METRICS, UMM_STATS, UMM_STATS_FULL, UMM_BEST_FIT, and UMM_FIRST_FIT. While uncommon to change from the defaults, you can review umm_malloc_cfgport.h for more details, which may help reduce your Sketch's size in dire situations. Assuming you are willing to give up some functionality.
For debugging UMM_STATS_FULL can offer additional stats, like Heap low water mark (umm_free_heap_size_min()).
2022-10-11 14:52:39 +03:00
Max Prokhorov
7b2c627ed4
Update WiFi scan docs (#8685) 2022-10-10 18:08:06 +03:00
Max Prokhorov
5c22dbc163
Fix Sphinx build warnings (#8686)
* `doc/faq/a06-global-build-options.rst: WARNING: document isn't included in any toctree`
ref. https://www.sphinx-doc.org/en/master/usage/restructuredtext/field-lists.html#special-metadata-fields
same as other a#-... .rst pages
* `doc/faq/readme.rst:190: WARNING: Inline literal start-string without end-string.`
 just a typo
2022-10-10 17:36:47 +03:00
M Hightower
3df5693697
Expand access to SDK's struct bss_info (#8683)
The NONOS SDK's `struct bss_info` in `user_interface.h` has grown since the
beginning of this project. The additional elements are not accessible.
Add a method for R/O access to full `struct bss_info`.

See #7965 (comment)
2022-10-10 15:56:44 +03:00
Max Prokhorov
a0c7a85649
Fix Updater non-zero _verify->length() once again (#8545)
Amends #8507
I took the liberty to also do some refactoring; specifically, fixing signed vs. unsigned mismatch in len, using pointer object vs. the original manual malloc & free, try to have named constants for certain addresses and lengths, plus localize printing of u8 arrays.

The suggested test to have a 'dummy' verifier works just fine. (...how it actually works and gets the hash to compare with is a whole other question, though)

Another issue noticed while testing, in the underlying bearssl api there's an actual limit for hash length.
6105635531/inc/bearssl_rsa.h (L257)
2022-09-13 15:57:42 +03:00
M Hightower
313b3c07ec
Add debug support for build.opt (#8637)
Add support to have different build option comment blocks
for debug and production builds.

Updated example esp8266/HwdtStackDump to use build.opt
2022-08-04 21:33:24 +03:00
david gauchard
ee7ac2f79d
make WiFi/Ethernet interface compatible with Arduino Ethernet API (#8645)
* make WiFi/Ethernet interface compatible with Arduino Ethernet API
provide some minimaly adapted examples from legacy

* move ethernet compat globals to EthernetCompat.h

* LegacyEthernet: add UDP example

* adjust comments

Co-authored-by: Max Prokhorov <prokhorov.max@outlook.com>
2022-07-28 00:00:56 +02:00
david gauchard
646bdfc060
SSL examples: updates (#8643)
Simplify SSL+ethernet example, reuse/include WiFi example
2022-07-28 00:47:10 +03:00
hreintke
e2a36ed6c2
MDNS : Also increase # of sends when a send fails (#8641)
This solves the root cause of the infinite sending of host probes when STA is not connected.
2022-07-28 00:33:18 +03:00
Max Prokhorov
d44c3f42a3
SPI: writePattern() should not call setDataBits(0) (#8636)
resolves #8635
2022-07-27 23:03:01 +02:00
Max Prokhorov
06f34ed566
Board ID as build flag (#8634)
* Board ID as build flag

When using IDE or `arduino-cli board list`, show full board name and FQBN
```
$ arduino-cli.exe board list
Port          Protocol Type              Board Name                FQBN                       Core
xxx.xxx.x.xxx network  Network Port      LOLIN(WEMOS) D1 R2 & mini esp8266com:esp8266:d1_mini esp8266com:esp8266
```
Also add `description` field to the mDNS response containing the
original `{build.board}` string value.

resolve #7759

* does not work with recent ide (?)

* fixup! does not work with recent ide (?)
2022-07-27 22:52:20 +02:00
david gauchard
e149829802
update example certs (#8642)
* update certs
2022-07-19 12:21:35 +02:00
david gauchard
a2982f96a4
Add missing license headers (#8630) 2022-07-09 10:02:58 -07:00
david gauchard
00f5f2acc4
emulation on host: fix incorrect lwIP DNS implementation (#8627)
* emulation on host: fix incorrect lwIP DNS implementation
+initialize netif0, make ipv6 example unfail
2022-07-09 12:36:35 +02:00
david gauchard
a8e3786d38
Fix hostname management (#8626)
* manage hostname with sdk string
2022-07-06 22:57:58 +02:00
Max Prokhorov
65d30437f0
Correctly handle unaligned address in EspClass::flashWrite u8 overload (#8605)
Separate page handling logic and the actual writing. Make sure we place both unaligned src and dest into a buffer.
Fixes edge-case introduced for SPIFFS that exclusively works through unaligned flash write function.

This copies the behaviour of official RTOS port, but does not change the original spi_flash_write.
2022-07-03 22:47:16 +03:00
Max Prokhorov
c12a6b48a2
Github Actions updates and setup dependabot (#8624)
* github: actions/checkout v2 -> v3

* github: actions/cache v2 -> v3

* github: actions/setup-python v2 -> v4

* github: dependabot for actions

* github: 'restricted' mode for token permissions

noticed at https://github.com/ossf/scorecard/blob/main/docs/checks.md#token-permissions

whenever external action uses our token, overall workflow 'permissions:' apply
https://docs.github.com/en/actions/security-guides/automatic-token-authentication
https://docs.github.com/en/actions/security-guides/automatic-token-authentication#permissions-for-the-github_token

ref. apps documentation to understand which permissions API endpoints need
https://docs.github.com/en/rest/overview/permissions-required-for-github-apps

* missed tag-to-draft action
2022-07-01 22:24:13 +03:00
Max Prokhorov
601da8e933
Fix python warnings and update device tests runner (#8623)
Update soon-to-be deprecated code in the runner.py
https://docs.python.org/3/library/imp.html is deprecated since 3.4, will be removed in 3.12
https://docs.python.org/3/library/configparser.html readfp() is replaced with read_file() since 3.2, will be removed in 3.12

Use venv instead of virtualenv. We don't really use any of the extended features, and might as well simplify installation requirements.
virtualenv/bin/python can execute runner.py inside of venv, no need to activate beforehand.
2022-06-29 14:27:42 +03:00
Max Prokhorov
a2c8a63360
Use current netif address in NetBIOS response (#8622)
* fix 8139 netbios in AP mode

* take the current if addr

* handle enabled ipv6

Co-authored-by: pablo <pablomartikian@hotmail.com>
2022-06-29 14:05:19 +03:00
Joseph Francis
678a477559
HTTPUpdateServer Allow external POSTS (CORS) (#6824)
* HTTPUpdateServer Allow external POSTS (CORS)

* Format Updates - POST HTTPUpdateServer

Co-authored-by: Joseph Francis <joefran@us.ibm.com>
2022-06-27 23:06:10 +02:00
BlazerYoo
9668f77070
Update documentation (#8619) 2022-06-27 16:02:28 +03:00
Max Prokhorov
7e5520c23e
Fix DHCP server pbuf handling and allow to change netif address (#8602)
* Fix sending NACK, use helper function to fill pbuf

As noticed in https://github.com/esp8266/Arduino/pull/8582#issuecomment-1153331408
Plus, handle the case when `pbuf->len` is less than struct size

* Make sure to call SDK functions to start and stop DHCP server

As noticed in https://github.com/esp8266/Arduino/pull/8582#issuecomment-1153331408
Can't really use `server.begin()` and `server.end()` directly, only
default static IP is applied to the interface since DHCP server is
deemed 'running' (see `wifi_softap_dhcps_status()` return value)

* s

Co-authored-by: david gauchard <gauchard@laas.fr>
2022-06-27 03:26:05 +03:00
Max Prokhorov
0bff52fe55
Without autoreconnect, forcibly stop station connection manager (#8607) 2022-06-27 02:21:40 +03:00
sticilface
f0d8f33d83
Add FSTools with examples of how to convert between SPIFFS and LITTLEFS. (#7696)
* Add FSTools with examples of how to convert between SPIFFS and LITTLEFS.

* Oops.  Need to pass layout by reference in order to capture the correct address.  Took a while to find that.  There maybe a better way to store all these configs

* Update FSTools.cpp

fix ESP.h to Esp.h

* Fix unused variable i

* Parsed with restyle.sh.  Compile with all errors.

* remove unused variable

* fix different sign complication error

* Fix indentation to spaces
Run test/restyle.sh
Remove commented code
Use #ifdef blocks for debugging.  `DEBUG_ESP_CORE` and `DEBUG_ESP_PORT`
use `static constexpr  layout` which saves ROM ~500B for unused vars

* Update FSTools.cpp

Add yield in between file copy
2022-06-26 20:22:31 +02:00
david gauchard
5656035bed
document side-effects for wifi-off-at-boot (#8614)
* adding wifi-off-at-boot side-effects mention in documentation
2022-06-25 23:18:54 +02:00
Max Prokhorov
5d4ae86565
Check ESP8285 at runtime (#8604)
* esp_is_8285() at runtime
* less code with less statics, just read again
2022-06-25 22:23:45 +02:00
Max Prokhorov
8decdc380a
Allow to use temporary strings in configTime (#8606) 2022-06-24 23:46:03 +02:00
Max Prokhorov
7935bed18f
Provide wl_tcp_state as tcp_state alias (#8609) 2022-06-24 15:41:51 +02:00
Earle F. Philhower, III
8048ea52ca
Rebuilt HAL w/latest toolchain and fixed configure (#8615)
Returns the library contents to the expected functions.
2022-06-24 15:24:56 +02:00
david gauchard
7d9abbb605
do not call tcp/udp ::stopAll() when it is not required to do so (#8598)
* do not call tcp/udp ::stopAll() when it is not required to to so
* remove stopAll also from ArduinoOTA
2022-06-23 22:14:19 +02:00
M Hightower
d5d6a3b023
Correct "list" formatting (#8610)
Correct "list" formating in a06-global-build-options.rst.
A formatting error was introduced in .md to .rst conversion.
2022-06-23 14:14:13 +02:00
Earle F. Philhower, III
dc6b15e38a
Update to toolchain 3.1.0-gcc10.3 (#8613)
* Update to toolchain 3.1.0-gcc10.3

* Update BearSSL with L32R minimized

See https://github.com/earlephilhower/esp-quick-toolchain/issues/36#issuecomment-1162363757
2022-06-22 07:52:15 +02:00
Max Prokhorov
047f14b9db
upload.py should not always fail (#8608)
07789808b9 (r76344981)
thx @jjsuwa-sys3175
2022-06-19 01:22:33 +03:00
Max Prokhorov
07789808b9
Do not show python traceback when esptool fails (#8603)
Path separator already handled by python
Empty strings are false, implicitly checking for length
2022-06-15 02:39:16 +03:00
david gauchard
8bfc2e9eab
Fix lwip2 ping (#8596)
fixes https://github.com/esp8266/Arduino/issues/8555
related to https://github.com/dancol90/ESP8266Ping/pull/42
2022-06-14 20:24:04 +03:00
Earle F. Philhower, III
760a6bc6c7
Update to latest BearSSL (#8600)
Minor SSL bug fix included.
2022-06-14 09:49:22 -07:00