In some cases, `initCertStore` may need to be called multiple times
(i.e. to update certs w/oa reboot). In that case, the saved file names
leaked when the new ones were `malloc()`'d.
Fix by freeing the old strings, if present.
To mimic SPIFFs behavior, we automatically create subdirectories when a
file is opened in a subdir.
The check mixed up a bitmask check with a boolean AND. Fix it.
* Remove trailing whitespace
* Improve "is file" check for LittleFS support
The previous implementation was based on a quirk of SPIFFS (that exists
returns false for directories) so it wouldn't work with LittleFS. This
implementation works with both.
Co-authored-by: Develo <deveyes@gmail.com>
Forgot to add a Dir->fileTime override, resulting in it always returning
(time_t)0, or Jan 1, 1970.
Add the override, returning the proper lastWriteTime.
Fixes#6981
Fixes#6955
LittleFS was updating the timestamp on any close, not only for files
when they were opened for writing. This could lead to excessive writes
to the flash.
Preserve the LFS flags, and only update the timestamp if the file was
opened for writing.
* Reduce temporary string creation/reallocation in HTTPClient
This improves both performance due to fewer memory allocations/copies
as well as reduces code size by ~ 25% (150 bytes)
* Add more correct reservation calculation
Co-authored-by: Develo <deveyes@gmail.com>
* Bug fixes to EspSoftwareSerial, release 6.6.0
Various improvements to the Delegate class template.
Memory footprint reduction of SoftwareSerial instances based on 3rd party contribution by @dirkmueller
* Bug fix EspSoftwareSerial, delegate template programming for > 3 platforms is interesting.
Co-authored-by: Earle F. Philhower, III <earlephilhower@yahoo.com>
Co-authored-by: Develo <deveyes@gmail.com>
* PROGMEM footprint cleanup for responseCodeToString
Doing returns with String/FlashStringHelper conversion for every
case means that the code for doing that is duplicated, which
is wasteful. doing it only once saves about 250 bytes (50%) of
code size.
* Remove "I'm a teapot" error code
* Add inline code comment to explain rationale
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.
* Add a CRC32 over progmem and ESP.checkFlashCRC
Automatically embed a CRC32 of the program memory (including bootloader
but excluding any filesystems) in all images in unused space in the
bootloader block.
Add a call, ESP.checkFlashCRC() which returns false if the calculated
CRC doesn't match the one stored in the image (i.e. flash corruption).
Fixes#4165
* Add example that corrupts itself, comments
Show CRC checking catch a 1-bit error in program code by corrupting a
large array, and then return it to clean and verify the CRC matches once
again.
Add comments to the CRC check routine
Clean up pylint complaints on crc32bin.py
* Check linker script for CRC space in bootsector
Add an assertion in the eboot linker file to guarantee that we have at
least 8 bytes of unused space at the end of the boot sector to patch in
the CRC. If not, the eboot link will fail.
* Add note about what to do if CRC check fails
Per discussion with @d-a-v.
When the CRC check fails, you could *try* to do certain things (but may
not succeed since there is known flash corruption at that point). List
a few ideas for application authors.
* Only single, flash/ram friendly crc32() function
* Combine the CRC calc and bin generation in 1 step
Per discussion w/@mcspr, combine the CRC calculation with the binary
generation, removing the additional build step.
* EspSoftwareSerial 6.5.0 public release.
* EspSoftwareSerial bug fix public release 6.5.1
* Release 6.5.2, examples changed only, simplified adding WiFi setup etc. by moving logger setup up to the front.
* Parity bug fix: Overflow condition caused data and parity to get out of sync permanently.
* Allow GZIP compressed flash updates
Modified the bootloader to be able to take stored updates in compressed
GZIP format (i.e. the output of "gzip -9 xxx.bin") and decompress them
on-the-fly to their final destination. This can work for apps and for
filesystems (when used with the 2-step update option).
Allow eboot to be built using -Os/2 optimizations by fixing some portions
which failed when any optimizations were used. Add -Wall and use data
and function sections to reduce size. Use -Os to minimize size.
Remove obsolete esptool-ck calls to build a .ROM image, we don't use it.
Move all uninitted variables to RAM from IRAM, allowing 8-bit access.
Hook in @d-a-v and @pfalcon's uzlib port to actually do the
decompression. Do not use any CRC checking which saves space. Since we
have overwritten all of flash by the time we know id the CRC matches,
there's nothing we could have done anyway.
Adjust the Updater class to support GZIP files and not attempt to patch
them.
Bootloader builds to 0xd90 out of 0xfff bytes.
* Add @d-a-v's patch for httpupdate
https://github.com/esp8266/Arduino/pull/6820#pullrequestreview-326541014
* Update uzlib to point to pfalcon++
For now, because there are some self-test failures with @d-a-v's esp8266
branch (whose cool new features we don't actually use in eboot now)
start with pfalcon's 2.9 release and add the 2 patches (clcidx to code
from IRAM/RODATA, and the Windows test file renaming) needed to build
and run successfully.
* Add (c) notice for uzlib to README
This commit avoids OOMs on an udp corner case where a delay() in the main
loop would allow memory filling.
A memory leak has been observed with such semantically forbidden delay,
unsolved yet, and preventing to use a simple counter instead of walking
through a linked list. The count limit is however small.
The method #send(int, char*, char*[, size_t])) is a virtual method which
calculates the size of the content then calls #send_P(int, PGM_P, PGM_P,
size_t). This particular implementation of #send_P differs from the other
implementations of #send and #send_P in that it uses #sendContent for
headers and always calls #sendContent_P for contents even when the
contents is not specified.
The method #sendContent is intended for body and prepends the chunksize
in chunk mode but this breaks the HTTP protocol which does not expect a
chunksize prior to the headers.
Fix is simply to do the same thing as all the other methods - call
_currentClient.write and only call #sendContent_P if there is content to
send.
* Remove user_interface.h from gdbstub includes
Avoid a warning by not including the unneeded "user_interface.h" from
gdbstub.c. Leftover from original stub code from the SDK, this include
is unnecessary in the Arduino core.
* Add example to ensure gdbstub compiles in CI
Ensure the same user_interface warning doesn't occur in the future by
adding the example shown in the GDB docs to the CI build process.
This is all @dirkx , whose PR unfortunately got borked when we were
trying to update it to the new format. As @dirkx said:
When sending POST responses of well over a K - _write() may not sent it
all. Make sure we do -- but cap the individual writes - as somehow large
2-3k blobs seem to cause instability (on my 12F units).
Supercedes #2528
* EspSoftwareSerial: ctor/begin() compatibility to AVR/ESP8266/ESP32 HW release 6.2.0
* Release 6.2.1: In loopback example, explicit pin settings and for ESP32, realistic max. bps for single stop bit config.
* Loopback example can exploit new invert API in HardwareSerial
* EspSoftwareSerial 6.3.0
Fixes#6811 which found an issue where connecting to scripts.google.com
would *occasionally* cause a crash. On inspection, it was found that up
to 5828 bytes of stack were used once in a while, so expand the stack to
5900 bytes to cover this case plus a little extra.
Replaces abandoned #1817 and #2694
Add optional std::function callback (so it supports lambdas and normal
functions) via ::onStart, ::onEnd, ::onProgress, and ::onError methods.
Update example with their use.
From @baruch's original pull request:
The callback is called when the upgrade actually starts rather than just
the initial query so that the user can know that it will not take longer
and can also prepare for the upgrade by shutting down other works.
From @karlp's original pull request:
Incomplete: I've not updated any documentation yet. If this style looks
good, I'll happily go and update the documentation (likewise for the
examples)
* Add const char* content to ESP8266WebSerer::send()
Supercedes #3492
Allow sending raw binary data or strings directly without conversion to
a String to reduce memory overhead when possible.
From original @timw1971 PR #3492
Added public functions to allow content to be uploaded using const
char*. For some cases, this can remove the need for content to be copied
into a String, and thus can be considerably more space-efficient.
* Fix example formatting
* Make GIF example use static const array
* Make the example really need to use const char*
Make the generated GIF dynamic in the example and move the original to
PROGMEM (since that's where const arrays like this belong).
Fixes#6792
Only append the "l" to ".htm" when there actually is a ".html" file
present. If not, fall-thru like before and try .gz through the normal
paths.
* [SSDP] add `schema(Print &) const`
Supercedes #2806
Make SSDP::schema(WiFiClient&) use a by-ref (reduce stack use)
Add a SSDP::schema(Print&)
From @Palatis' original PR:
useful when using AsyncWebServer.
* Use ip.toString, only export Print& schema interface
Because WiFiClient inherits a Print interface, replace the
::schema(WiFiClient&) with ::schema(Print&) which is source compatible
with existing code and allows the functionality requested in the initial
PR.
Use ip.toString() in the templates instead of breaking up the octets of
the address.
* Fix compile errors and backwards compatibility
Fixes#6767 . Remove the `undef F` from SysCall.h as it is not needed
nor used in the SD or SDFS libraries. This puts F() strings back in
flash when using the SD/SDFS libs.
* Backport from ESP32
* Use new library layout (.../src)
* Cleanup test case.
* C++ style cast required.
* Whitespace
* Inlining via header has better baseline ROM footprint.
* Reordered functions for better code-compare to master
* Reduces ROM footprint some more.
* Avoid unnecessary parameter passing - refactoring, same generated footprint.
* Reformat example sources
* EspSoftwareSerial release 5.3.5 with performance/error rate improvement in TX
* EspSoftwareSerial 5.3.6 with CI fix and, tadaaa, reliable tx and rx at 115200bps and beyond.
* Version 5.4.0 stabilized work of past 24h.
* 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