LwipIntfDev<RawDev> calls RawDev::end() from LwipIntfDev::end() and from the two
error paths of LwipIntfDev::begin(). Wiznet5500 provides end(), ENC28J60 does
not, so LwipIntfDev<ENC28J60> - i.e. ENC28J60lwIP - no longer compiles:
LwipIntfDev.h:280:20: error: 'end' is not a member of 'ENC28J60'
LwipIntfDev.h:294:24: error: 'end' is not a member of 'ENC28J60'
The calls came in with #9023, which only touched cores/esp8266/LwipIntfDev.h.
Wiznet5500::end() closes socket 0 and leaves the chip powered and configured,
since a following begin() resets and reopens it anyway. The ENC28J60 equivalent
of closing the socket is clearing ECON1.RXEN, the bit that reset() sets last to
enable reception. ECON1 is mapped into every bank, so no bank switch is needed,
and no frame can be in flight because sendFrame() polls ECON1.TXRTS until the
frame has left.
* Fix possible crash in UdpContext host mocking.
I saw this crash in UdpContext.h happen after some hours of regular NTP requests....
```
[17:38:51] ADE: voltage spike: phase A, factor=0.81, cycles=1
(mock) ClientContext::connect: ::connect(): Connection refused
(mock) ClientContext::connect: ::connect(): Connection refused
(mock) ClientContext::connect: ::connect(): Connection refused
(mock) ClientContext::connect: ::connect(): Connection refused
[17:41:14] ADE: voltage spike: phase A, factor=0.86, cycles=2
(mock) ClientContext::connect: ::connect(): Connection refused
(mock) ClientContext::connect: ::connect(): Connection refused
(mock) ClientContext::connect: ::connect(): Connection refused
(mock) ClientContext::connect: ::connect(): Connection refused
[17:43:49] ADE: voltage spike: phase B, factor=1.12, cycles=3
(mock) ClientContext::connect: ::connect(): Connection refused
(mock) =====> UdpServer port: 2390 <=====
[17:44:31] NTP: waiting for response from '81.169.233.252' timed out
Program received signal SIGSEGV, Segmentation fault.
0x000055555556848c in std::_Function_base::_M_empty() const ()
(gdb) where
#0 0x000055555556848c in std::_Function_base::_M_empty() const ()
#1 0x00005555555685be in std::function<void ()>::operator bool() const ()
#2 0x00005555555684b8 in UdpContext::mock_cb() ()
#3 0x00005555555683af in check_incoming_udp() ()
#4 0x0000555555567fa6 in main ()
```
I tracked it down to UdpContext::mock_cb() which is calling a std::function callback that's been destroyed thus used-after-free. I believe what happens is:
1. UdpContext::unref() calls delete this when refcount hits 0 (line 56)
2. The destructor (~UdpContext(), line 47) is empty — it never calls register_udp(_sock, nullptr) to remove itself from the global udps map
3. check_incoming_udp() iterates udps, finds the dangling pointer, calls mock_cb() on freed memory
4. _on_rx (a destroyed std::function) → segfault in _M_empty()
The disconnect() method already does the right thing (lines 78-84: closes socket + unregisters), but it's never called before the object is destroyed via unref().
The fix is to make the destructor clean up properly.
I tested intensely, no crashes since.
* Format destructor for UdpContext for clarity
Fixes code-style CI.
Replace .o -> .c.o or .cpp.o, .ld pattern expects source-named objects to place them into ROM instead of IRAM (which would blow up otherwise)
Check another known issue w/ newlib-4.0.0 libm which was missing remainder{,f} using existing device test code
Actually use the funcs in the resulting .elf via app_entry
Check GCC building C++ in addition to C code
Check that compiler can build and link .elf using default build flags & defines
Check for known issue w/ newlib-4.5.0 when expecting wide characters support by attempting to link with libstdc++ while using <iostream> and <regex>
* SpiUtils - explicit asm instead of volatile
getting rid of volatile arg(s) is must-have for -std=c++20 and later
provide helper macros to init & load vars at specific points in code
modify existing macros to use c++-style casts & less volatile
change locals to plain non-volatile variables, avoid extra memw
also fixes unintentional const mask load in (pre_cmd) branch
* words
* 'a' constraint for output
as noted in implementation, all but sp
- don't check exc_info() in `finally`, it only works without `except` with just `try` and `finally`
see https://docs.python.org/3/reference/compound_stmts.html#try
after `except Exception as e:` block, `e` is already deleted
- handle a rare case when esptool code does not close 'erase_file'.
printing paths may cause encoding issues, so just fall through silently
- simplify ordering of write_flash & erase_region arguments
since we always end up in write_flash, prefer to think of it as argument pairs 'addr' + 'path'. actual binaries go first, erase
temporaries go last. construct write args beforehand and apply when finishing with the command line.
both commands can appear multiple times, for manual or scripting cases, where multiple regions should be erased / written to
post #9224, allow to call 'stack_thunk_yield()' outside of bssl context
Reset 'stack_thunk_save' before returning from 'thunk_...'ed function
Skip invalid a1 load and yield with the current value
update packaging script w/ new arguments
rewrite ci build pattern to only rewrite core_version.h once per job
restore behaviour from #6414 for other cases
* Tools - makecorever.py explicit output argument
Don't hide where the file is actually placed
Using pathlib instead of raw strings to simplify path ops
Plus, add stdout preview when output is missing
Clean-up git-describe <-> version availility checks
* typo
* fix unhandled exc in git cmd
* unused escape
* RELEASE using same values
* Tools - get.py updates
Using pathlib for paths, assume relative paths from __file__.parent as PWD
Using argparse for arguments, expose previously uncustomizable bits.
Reading tarfile with transparent compression.
Drop previously untested .t{...} and .tar.{...}, just use "r:*"
Remove hard-coded dependency on 'platform' and allow to specify sys_name, sys_platform and bits.
Stub for DarwinARM, allow to fetch x86_64 packages in the meantime.
* missing mkdir_p
Stop pyexpect from closing serial port when running with WSL2
Remove makefile flags & opts making it too silent. At some point it makes a lot of useful info just disappear. There are external means of silencing make, so probably best to leave useful data always available
Replace SPIFFS with LittleFS in FS test
Re-use certs-from-mozilla.py in FS test
Fix libc tests w/o -fno-builtin not actually testing anything, also add the flag via .globals.h in case it breaks
Fix libc tests generating warnings when using invalid (but safe) size arguments
* Tools - none-cxxflags generator script
GCC10 -> GCC (as in general, not specific to 10)
cpp -> cxx to be consistent with gcc terminology
grep exclude patterns in a separate file
exclude 'deprecated' warnings by default
* actually set warnings when compiling
--warnings=none is arduino-cli implicit default
* ESP8266WebServer - unused templated code throws out unused statics
currently, only w/ mock build because it is using gcc>=12
> ../../libraries/ESP8266WebServer/src/detail/RequestHandlersImpl.h:14:15: warning: ‘String esp8266webserver::calcETag(fs::FS&, const String&)’ defined but not used [-Wunused-function]
> 14 | static String calcETag(FS &fs, const String &path) {
> | ^~~~~~~~
* ESP8266WiFiMesh - fix classes used as aggregates
> error: designated initializers cannot be used with a non-aggregate type '...'
gcc10.3 allowed this construct for some reason
* LEAmDNS - consistent const <-> non-const accessors
> error: infinite recursion detected [-Werror=infinite-recursion]
py3.13 - https://docs.python.org/3/library/re.html#re.sub
> Deprecated since version 3.13: Passing count and flags as positional arguments is deprecated. In future Python versions they will be keyword-only parameters.
py3.12 - https://docs.python.org/3/library/tarfile.html#tarfile.TarFile.extraction_filter
> If extraction_filter is None (the default), calling an extraction method without a filter argument will raise a DeprecationWarning, and fall back to the fully_trusted filter, whose dangerous behavior matches previous versions of Python.
* Update bearssl builder
* Keep bssl stack pointer from confusing yield
implement stack_thunk_yield() which is called within bssl
stack overflow checks for cont would always fail otherwise
* add new example for enhanced file listing
* adapt Pin
* adapt due to clanf format check in line 14
* Adapt further clang findings
* additional intention corrections
* last clang format issues corrected
* case-sensitive, eof line break
get rid of warnings when converting python -> rst, force quit when they happen
fix code-blocks, always need extra line
fix invalid headers refs so they actually work
* Resolves exceptions occuring when using SPI0Command for flash write operations
such as: Write Status Register-1, Sector Eraser, etc.
Moved PRECACHE_END to ensure `Wait_SPI_Idlep` and `xt_wsr_ps` are included in the iCache.
Added SPIUCSSETUP to give more settling time for #CS.
* There was a risk of flash reads inserted between an "enable opcode"
and the "target opcode". They are now tightly coupled.
Update flash quirks.
* When sending instruction Write Enable 0x06, use BootROM API
SPI_write_enable for the special handling of the WEL bit.
Corrected zero mask for fractional byte returns where the partial
byte bits are positioned at the most significant bit position in the byte.
I was recently trying to compile this project with a more recent version of GCC and hit an issue with this file. With older versions the std::set_terminate definition was being included via a transitive include of <exception> from the C++ standard library implementation. This is no longer the case with newer versions of libstdc++. This fixes the issue by using a direct include instead of relying on an implementation specific transitive include.
* Update to SDFat upstream 2.2.2
Pull in reformatted/slightly refactored SDFat 2.2.2 upstream.
Very minor changes, simple testing on other architectures passed w/o
incident.
* Fix SdFat to build for ESP8266
2.2.2 removed a define from the configuration header which is needed to
compile on the ESP8266. Restore the default values there previously.
* SDFat Debug tests not compatible, skip
---------
Co-authored-by: Max Prokhorov <prokhorov.max@outlook.com>
* Add creation timestamp to LittleFS directories
Partial fix#9120. This is simple enough to include and does not increase
the amount of flash writes on file updates significantly (which a
modified-time 't' attribute would).
* Fix typo in debug message on error