Converting floats to doubles is very expensive on esp8266, so prefer
calculations or comparisons as float. This saves 10% (20 bytes) of the
String::parseFloat() code size and probably quite a bit of runtime
overhead.
Check that building the eboot.c block generates the same binary as
the verison checked into the repo. Catches the case where a library
or eboot.c file is changed, but an updated eboot.elf isn't included
in a PR.
Can't do simple binary diff of the ELFs because paths and compile
times will change, so dump the two sections we care about.
There is a window where the eboot sector is erased and
unwritten/partially written. If there's a power cycle at this time, the
chip will brick due to eboot being corrupted.
Avoid this by checking if the new eboot 4K sector is identical to the
one already in flash, and if so don't rewrite it.
The ROM routine __divsi3 is called by code whenever a division is needed,
because there is no divide unit on the ESP8266 core. When the divide
routine in ROM hits a div-by-zero case, it jumpt to an ILL(egal instruction)
at a fixed address which causes a HW exception 0 (IllegalInsnException).
In the postmortem dump, when an ILL exception is detected at this address
in ROM, convert it to a DivByZeroException for printout (6).
Divde by zero errors now print as follows:
````
--------------- CUT HERE FOR EXCEPTION DECODER ---------------
Exception (6):
epc1=0x4000dce5 epc2=0x00000000 epc3=0x00000000 excvaddr=0x00000000 depc=0x00000000
>>>stack>>>
...
<<<stack<<<
--------------- CUT HERE FOR EXCEPTION DECODER ---------------
````
And will decode as follows:
````
Exception 6: IntegerDivideByZero: QUOS, QUOU, REMS, or REMU divisor operand is zero
PC: 0x4000dce5
EXCVADDR: 0x00000000
Decoding stack results
...
````
Remove get.py percent dump to shorten PIO output 99%.
Use latest release version of PIO, not bleeding edge, to fix
failures introduced in devel (non-release) PIO versions.
Thanks, @mcspr, for noticing this!
This patch fixes some spelling typos in following files
bearssl-client-secure-class.rst
client-class.rst
scan-class.rst
scan-examples.rst
server-examples.rst
* Add SerialEvent() callback to loop processing
Match the AVR SerialEvent implicit callback. Callback is executed
in normal user mode, not IRQ, so standard processing can be uses.
Fixes#752 after 5 years. :)
* Fix style
* Clean up minor warnings from LGTM.com
LGTM (Semmie) is a tool, bought by GitHub last year, that conducts basic
linting tasks on code and HTML.
Clean up the warnings identified in the latest report:
https://lgtm.com/projects/g/esp8266/Arduino/?mode=list
No functionality should change, however this may fix some issues with
the perl utilities not exiting properly on a Ctrl-C from the command
line.
* Back out HTML changes and rerun boards.txt.py
Run valgrind on host mock example runs to catch more bugs in CI. These
tests would have caught the problem in #7464 before users did.
Add a list of some randomly picked examples to run, and add an option to
run the loop exactly once in the host mock routine, so the test will
actually exit under valgrind.
Parameters that are only used in an assert() statement are unused when
the NoAssert-NDEBUG option is used. This causes the following unused
parameter warnings while building:
````
/home/earle/Arduino/hardware/esp8266com/esp8266/cores/esp8266/Crypto.cpp: In function 'String {anonymous}::createBearsslHmac(const br_hash_class*, uint8_t, const String&, const void*, size_t, size_t)':
/home/earle/Arduino/hardware/esp8266com/esp8266/cores/esp8266/Crypto.cpp:101:71: warning: unused parameter 'hashTypeNaturalLength' [-Wunused-parameter]
101 | String createBearsslHmac(const br_hash_class *hashType, const uint8_t hashTypeNaturalLength, const String &message, const void *hashKey, const size_t hashKeyLength, const size_t hmacLength)
| ~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~
/home/earle/Arduino/hardware/esp8266com/esp8266/cores/esp8266/Crypto.cpp: In function 'String {anonymous}::createBearsslHmacCT(const br_hash_class*, uint8_t, const String&, const void*, size_t, size_t)':
/home/earle/Arduino/hardware/esp8266com/esp8266/cores/esp8266/Crypto.cpp:153:73: warning: unused parameter 'hashTypeNaturalLength' [-Wunused-parameter]
153 | String createBearsslHmacCT(const br_hash_class *hashType, const uint8_t hashTypeNaturalLength, const String &message, const void *hashKey, const size_t hashKeyLength, const size_t hmacLength)
| ~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~
````
Mark them unused in the code to avoid the error. The assert() still
works.
Add mention that OTA Update class will block changes to flash mode bits if the image is uncompressed, and link to the recent discussion on this.
Co-authored-by: Earle F. Philhower, III <earlephilhower@yahoo.com>
Matching standard Arduino cores, make the default analogWrite() take
values from 0...255. Users can always use the analogWriteRange() call
to change to a different setup.
Add a `analogWriteResolution` which takes a number of bits and sets
the range from 0...(1<<bits)-1, part of the standard Arduino API.
Remove the PWMRANGE define. It's non-standard and not generally valid
(i.e. it's fixed at 1024 of 256, but the real range varies depending on
what you last set).
Also add note about the change and how to fix pre 3.0 applications.
Fixes#2895
* webhook api
* simplify webserver debug printouts, move text to flash
* Hook examples in HelloServer example
* print executable code address in example
* simplify example per @mcspr suggestion
In the HTTPS example we were using a fingerprint which changes almost
daily as the github.com certificates are regenerated. Replace this with
a trust anchor based on the ultimate root CA that github.com uses to
sign their certificates. Assuming they don't change CAs, this
certificate should be good until 2030+
Fixes#7489
* CVE-2020-12638 workaround for WPA downgrade attack
When connected to an encrypted (WEP/WPA) router, a rogue packet can
cause the ESP8266 WiFi stack to drop to an unecrypted rogue network of
the same SSID.
Handle this by dropping the WiFi connection immediately and reconnecting
to the stored WPA/WEP network requested by the application, whenever the
AUTHMODE changes to OPEN from a secured mode.
https://lbsfilm.at/blog/wpa2-authenticationmode-downgrade-in-espressif-microprocessors
for more details.
* Initialize _ledPin
_ledPin should be initialized to -1 in the constructor to avoid setting a random pin when calling Updater::end without having called Updater::begin before. This happens, for example, in the Homie software
* Fix field sequence
PR #7464 removed the reset of client authentication settings when server
authentication settings were changed, however it never did initialize
the client authentication information to nullptr in the constructor.
This can result in crashes during connections when client certs are not
applied.
Fix by resetting the client authenticaion variables on object
construction.
* Comment out verify step in eboot.c
Meant for #7458 , but still requires a recompiled eboot.elf.
* Rebuild eboot.elf from changed source
Co-authored-by: Earle F. Philhower, III <earlephilhower@yahoo.com>