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

32 Commits

Author SHA1 Message Date
Maxim Prokhorov
19b7a29720 Migrate from astyle to clang-format (#8464) 2022-03-04 02:28:47 +03:00
david gauchard
15e7d35d6e
emulation on host: minor updates (#8454)
* emulation on host: minor fixes
merge MockDigital.cpp and HostWiring.cpp

* emulation: share mockverbose between CI-on-host and emulation

* mock: add missing recently overridden method

* remove extern variable, use weak function
2022-02-20 16:27:52 +03:00
david gauchard
f60defc3d3
flash-size agnostic builds (#6690)
* flash: mapping definition by sketch at runtime depending on flash chip size and user configuration
2022-02-10 18:25:18 +01:00
Dirk O. Kaar
c312a2eaf1
Implement esp_yield() as a replacement for delay(0)
esp_yield() now also calls esp_schedule(), original esp_yield() function renamed to esp_suspend().

Don't use delay(0) in the Core internals, libraries and examples. Use yield() when the code is
supposed to be called from CONT, use esp_yield() when the code can be called from either CONT or SYS.
Clean-up esp_yield() and esp_schedule() declarations across the code and use coredecls.h instead.

Implement helper functions for libraries that were previously using esp_yield(), esp_schedule() and
esp_delay() directly to wait for certain SYS context tasks to complete. Correctly use esp_delay()
for timeouts, make sure scheduled functions have a chance to run (e.g. LwIP_Ethernet uses recurrent)

Related issues:
- #6107 - discussion about the esp_yield() and esp_delay() usage in ClientContext
- #6212 - discussion about replacing delay() with a blocking loop
- #6680 - pull request introducing LwIP-based Ethernet
- #7146 - discussion that originated UART code changes
- #7969 - proposal to remove delay(0) from the example code
- #8291 - discussion related to the run_scheduled_recurrent_functions() usage in LwIP Ethernet
- #8317 - yieldUntil() implementation, similar to the esp_delay() overload with a timeout and a 0 interval
2021-10-17 00:19:01 +03:00
Earle F. Philhower, III
60fe7b4ca8
Add code-spell spelling checks to CI (#8067)
Help find and fix silly spelling errors as they are added to the repo.
2021-05-23 08:53:04 -07:00
Earle F. Philhower, III
70e4457041
Remove axTLS from code and documentation (#7437) 2020-07-09 09:21:38 -07:00
david gauchard
0989932669
allow ".bin.gz" filter in updater file selector (#7026) 2020-01-26 00:56:46 +01:00
Dirk Mueller
698ffc3498 Various String handling cleanups (#6945)
Use the proper api (::clear(), isEmpty()) instead of doing
comparisons/assignments of empty strings. Also fix mixture
of tabs and spaces in the source code.
2019-12-26 17:03:18 -03:00
david gauchard
6f7eb2828a Make SPIFFS and LittleFS stay out of link when not needed (#6699)
* define two weak functions defaulting to no-op
redefine them to do something useful when either spiffs or littlefs are used

* noop

* single entry point for closing FSes

* rename functions, override when instanciated, add link to explanation

* spiffs: call end on destructor
2019-11-06 21:37:52 -03:00
Jason2866
dd73a1885e Remove non-ASCII or non-UTF8 character (#6687)
Newer version of Platformio generates a warning
2019-10-29 13:45:41 +01: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
Earle F. Philhower, III
d2fde8dee0
Fix trivial extra "\n" on web update success (#6350)
Fixes #3290
2019-07-26 16:34:22 -07:00
Earle F. Philhower, III
7036297920 Convert ESP8266WebServer* into templatized model (#5982)
* Convert ESP8266WebServer* into templatized model

Supercedes #4912

Refactor the three versions of ESP8266WebServer and *WebServerSecure to a
single templated class. Use "using" to enable old, non-templated names to b
used (so no user changes required to compile or run).

Fixes #4908 and clean up the code base a lot.

Basic tests run (the ones in the example code).

No code changes are required in userland except for setting the SSL
certificates which now use a cleaner "getServer()" accessor and lets the
app use the native BearSSL calls on the WiFiClientSecure object.

@devyte should be proud, it removes virtuals and even has template specialization...

* Fix HTTPUpdate templates and examples

* Fix HTTPUpdateServer library build

Need to remove dot-a linkage since there are no .cpp files in the
directory anymore due to templates.

* Provide backward-compat names for updt template

Allow existing code to use the same well known names for
HTTPUpdateSecure.

* Remove ClientType from all templates, auto-infer

Remove the ClientType template parameter from all objects.  Simplifies
the code and makes it more foolproof.

Add a "using" in each server to define the type of connection returned
by all servers, which is then used in the above templates automatically.

* Can safely include FS.h now that SD/SPIFFS unified

* Move the templates/objects to their own namespaces

* Fix merge issues with untemplated methods

* Address review comments

* Fix mock test, remove warnings inside test dir

Make the simple mock test CI job pass and clean up
any spurious warnings in the test directory.

There still are warnings in the libraries and core, but they
should be addressed in a separate PR.
2019-07-04 10:58:22 +02:00
Allman-astyler
eea9999dc5 Revert "Allman now (#6080)" (#6090)
This reverts commit 98125f88605cd7e46e9be4e1b3ad0600dd5d2b51.
2019-05-14 00:09:54 +02:00
Allman-astyler
98125f8860 Allman now (#6080)
* switch restyle script for CI

* remove confirmation

* restyle with allman
2019-05-13 16:41:34 +02:00
Develo
e9d052c621
WIP - Update ArduinoOTA and examples with MDNS.update() calls (#5494)
* ArduinoOTA: allow use without MDNS, add MDNS.update() in handle()

* Update examples with MDNS.update() in loop

* Update CaptivePortalAdvanced.ino

Fix typo

* Update CaptivePortalAdvanced.ino

astyle

* Update Arduino_Wifi_AVRISP.ino

astyle
2018-12-14 03:29:32 -03:00
david gauchard
92373a9837 Deprecate axTLS, update examples (#5366)
* update examples

* fix serial<->tcp example, use STASSID instead of SSID (name collision)

* fix HTTPSRequest.ino

* update AxTLS HTTPS examples, update AxTLS API to deprecated

* fixes

* fixes + fix astyle (no preproc directives) + restyling script

* fix HTTPClient library

* fixes

* common.sh: do not reload arduino when already present (for locally CI testing)

* common.sh: do not reload ArduinoJson when already present (for locally CI testing)

* fix

* fix

* fix deprecated example

* fix WiFiHTTPSServer.ino

* reduce footprint

* wipfix

* fix led builtin

* fix example

* finished updating APSSID on all examples

* style

* restyle examples

* helper to run CI test locally

* local CI runner more verbose

* +const

* deprecation deprecation

* deprecation

* Update NTPClient.ino

const char[] => const char *

* Update interactive.ino

const char[] => const char *
2018-11-29 20:49:27 -08:00
dav1901
41de43a263 Update ESP8266HTTPUpdateServer library (#5297)
* Converted C type strings to String object

* Converted C type strings to String object
2018-11-13 00:43:21 -03:00
Earle F. Philhower, III
233d3e3b5e
Move BearSSLHelpers into BearSSL namespace (#5315)
BearSSLX509List, BearSSLSession, BearSSLPublicKey, and BearSSLPrivateKey
were all in the global namespace and not in the BearSSL:: one, due to an
oversight when they were originally created.  Move them to the proper
namespace with the following mapping:
    BearSSLX509List => BearSSL::X509List
    BearSSLSession => BearSSL::Session
    BearSSLPublicKey => BearSSL::PublicKey
    BearSSLPrivateKey => BearSSL::PrivateKey
2018-11-06 19:27:40 -08:00
david gauchard
85e68093e9
Automatic stack location selection (SYS or HEAP), enable per library AR-chive in arduino build system (#5018)
Automatic stack location selection (SYS or HEAP), enable per library AR-chive in arduino build system 

* enable dot_a_linkage on internal libraries
* add device tests
* boards generator: deprecate --noextra4k/--allowWPS and fix documentation
2018-08-20 14:35:52 +02:00
Balázs Kelemen
8cda9655e3 Allow to update credentials after setup performed. (#4789) 2018-06-07 13:13:45 +02:00
Earle F. Philhower, III
e3c970210f
Add BearSSL client and server, support true bidir, lower memory, modern SSL (#4273)
BearSSL (https://www.bearssl.org) is a TLS(SSL) library written by
Thomas Pornin that is optimized for lower-memory embedded systems
like the ESP8266. It supports a wide variety of modern ciphers and
is unique in that it doesn't perform any memory allocations during
operation (which is the unfortunate bane of the current axTLS).

BearSSL is also absolutely focused on security and by default performs
all its security checks on x.509 certificates during the connection
phase (but if you want to be insecure and dangerous, that's possible
too).

While it does support unidirectional SSL buffers, like axTLS,
as implemented the ESP8266 wrappers only support bidirectional
buffers. These bidirectional buffers avoid deadlocks in protocols
which don't have well separated receive and transmit periods.

This patch adds several classes which allow connecting to TLS servers
using this library in almost the same way as axTLS:
BearSSL::WiFiClientSecure - WiFiClient that supports TLS
BearSSL::WiFiServerSecure - WiFiServer supporting TLS and client certs

It also introduces objects for PEM/DER encoded keys and certificates:
BearSSLX509List - x.509 Certificate (list) for general use
BearSSLPrivateKey - RSA or EC private key
BearSSLPublicKey - RSA or EC public key (i.e. from a public website)

Finally, it adds a Certificate Authority store object which lets
BearSSL access a set of trusted CA certificates on SPIFFS to allow it
to verify the identity of any remote site on the Internet, without
requiring RAM except for the single matching certificate.
CertStoreSPIFFSBearSSL - Certificate store utility

Client certificates are supported for the BearSSL::WiFiClientSecure, and
what's more the BearSSL::WiFiServerSecure can also *require* remote clients
to have a trusted certificate signed by a specific CA (or yourself with
self-signing CAs).

Maximum Fragment Length Negotiation probing and usage are supported, but
be aware that most sites on the Internet don't support it yet.  When
available, you can reduce the memory footprint of the SSL client or server
dramatically (i.e. down to 2-8KB vs. the ~22KB required for a full 16K
receive fragment and 512b send fragment).  You can also manually set a
smaller fragment size and guarantee at your protocol level all data will
fit within it.

Examples are included to show the usage of these new features.

axTLS has been moved to its own namespace, "axtls".  A default "using"
clause allows existing apps to run using axTLS without any changes.

The BearSSL::WiFi{client,server}Secure implements the axTLS
client/server API which lets many end user applications take advantage
of BearSSL with few or no changes.

The BearSSL static library used presently is stored at
https://github.com/earlephilhower/bearssl-esp8266 and can be built
using the standard ESP8266 toolchain.
2018-05-14 20:46:47 -07:00
Ivan Grokhotkov
61cd8d8385 examples: format all .ino files
This formats all the example source files using Arduino style rules.
2018-03-08 14:32:06 +08:00
Earle F. Philhower, III
bd1c7ce1dc Add SSL enabled WiFiServer, Updater, WebServer
Adds SSL server mode for WiFiServerSecure, for plain SSL connections,
ESP8266WebServerSecure, for HTTPS web serving, and SecureHTTPSUpdater for
encrypted OTA updates.

Example code is provided for all new options, as well as a BASH script for
generating their own, self-signed certificates.

Both ESP8266WebServerSecure and SecureHTTPSUpdater are important for secure
password-based authentication.  HTTP Basic Authentication, the only supported
model presently, sends the username and password in *cleartext* and therefore
should *never* be used in any un-SSL encrypted channel unless you don't mind
sharing your login and password with anyone else on the internet.  Even if the
ESP8266 is not safety critical, this cleartext broadcast could expose you should
you reuse this password elsewhere on your network or the internet.
2018-01-10 11:56:32 +08:00
E. van Harten
b81ef01ef7 Fix for redirect of HTTP Update, so that it always returns to the root / instead of /update (#3420) 2017-10-15 02:03:28 -05:00
hchahine
1bd1de0286 Removed literal '\n' in ESP8266HTTPUpdateServer response (#3421) 2017-08-07 15:46:47 +03:00
Ivan Grokhotkov
ace0622e46 ESP8266HTTPUpdateServer: fix responses after uploading
- fix response not being delivered to the browser after upload is done
  (https://github.com/esp8266/Arduino/issues/2221)

- if Update.begin fails, don’t attempt to write data

- if update is not successful, send error message from Update to the
  client

- move strings into PROGMEM
2017-05-10 09:49:47 -05:00
Adam Bogdał
b4368ba870 Update curl command 2017-01-05 11:43:26 -06:00
Me No Dev
a7ced9cabb make HTTP Update Server more secure (#2104)
* make HTTP Update Server more secure

* added option for authentication
* added option to change the url for upload

* move to overloaded setup

* remove delay in both examples

* Get better result responses

* fix strings

interesting, the meta did not refresh if the successResponse is put in
"R"
2016-06-07 10:09:05 +08:00
Jacques
b7049ed8ee Update ESP8266HTTPUpdateServer.cpp
Redirect browser back to the update page after 15 seconds.
2016-03-02 21:24:42 +00:00
Me No Dev
0063d80c74 "Fix" sketches and libs to use the new upload api 2015-11-19 23:20:03 +02:00
Miguel Angel Ajo
065e1ccb8c Extracted the WebUpdate example into a library.
This ESP8266HTTPUpdateServer can be instantiated and used
more cleanly, it's also able to take or create an ESP8266WebServer
to configure the events and /update handler.

It's been made more robust by handling upload abort, which
depends on fix provided for issue #833
2015-10-01 15:19:02 +02:00