Commit Graph
24458 Commits
Author SHA1 Message Date
J. Nick Koston 63ceb61dec Merge remote-tracking branch 'upstream/rp2040-accept-no-irq-malloc' into integration 2026-03-10 15:10:50 -10:00
J. Nick Koston a0681bce6b [socket] Combine shift and tcp_arg update into single loop in accept() 2026-03-10 15:09:41 -10:00
J. Nick Koston 9c28195130 [socket] Combine shift and tcp_arg update into single loop in accept() 2026-03-10 15:09:29 -10:00
J. Nick Koston 9238e7d55d Merge branch 'rp2040-accept-no-irq-malloc' into integration 2026-03-10 14:57:39 -10:00
J. Nick Koston 7cb32321b1 cleanup 2026-03-10 14:57:30 -10:00
J. Nick Koston b8e9ad931b Merge remote-tracking branch 'upstream/dev' into rp2040-accept-no-irq-malloc 2026-03-10 14:55:56 -10:00
J. Nick Koston fddd76a446 Merge branch 'rp2040-accept-no-irq-malloc' into integration 2026-03-10 14:54:34 -10:00
J. Nick Koston a9e921e053 [socket] Refactor accept() to skip null entries without duplicate code
Consolidate the dequeue + shift + tcp_arg update into a single while
loop that skips null entries (freed by lwip while queued) and returns
the first valid PCB. Eliminates the duplicated shift/update logic.
2026-03-10 14:52:38 -10:00
J. Nick Koston fab32d9e7b [socket] Refactor accept() to skip null entries without duplicate code
Consolidate the dequeue + shift + tcp_arg update into a single while
loop that skips null entries (freed by lwip while queued) and returns
the first valid PCB. Eliminates the duplicated shift/update logic.
2026-03-10 14:51:09 -10:00
J. Nick Koston acbfe9838d Merge remote-tracking branch 'upstream/rp2040-accept-no-irq-malloc' into integration 2026-03-10 14:47:01 -10:00
J. Nick Koston 6751fcf0b8 clear error first 2026-03-10 14:46:44 -10:00
J. Nick Koston b1e41be02f clear error first 2026-03-10 14:46:02 -10:00
J. Nick Koston 9265d9e0f8 [socket] Buffer early data on queued PCBs to prevent data loss
When LWIPRawImpl creation was deferred to the main-loop accept(),
the queued PCB had no recv callback registered. lwip's default
tcp_recv_null handler ACKs incoming data but drops it silently.

On ESP8266, lwip processes TCP segments in batches — if the SYN
completion and first data packet arrive in the same batch, the
API handshake data is lost, causing SocketClosedAPIError (EOF).

Fix: register temporary recv/err callbacks on queued PCBs that
buffer any data received before accept() creates the LWIPRawImpl.
The buffered data is transferred to the new socket via init().
2026-03-10 14:45:45 -10:00
CFlix b84d773bec [bme280] Change communication error message to include "no response" hint. (#14686) 2026-03-10 20:24:46 -04:00
J. Nick Koston 2359a6c7e7 Merge branch 'rp2040-accept-no-irq-malloc' into integration 2026-03-10 14:12:27 -10:00
J. Nick Koston 756b00b59d Reduce MAX_ACCEPTED_SOCKETS from 3 to 2 2026-03-10 14:10:38 -10:00
J. Nick Koston 6ad5f107d9 Unify accept queue to use raw PCBs on all platforms
The LWIPRawImpl object is only 20 bytes — no reason to heap-allocate it
in the callback on ESP8266 either. Store raw tcp_pcb pointers on both
platforms, removing the #ifdef branches and simplifying the code.
2026-03-10 14:07:12 -10:00
J. Nick Koston 5cf07071dd Unify accept queue to use raw PCBs on all platforms
The LWIPRawImpl object is only 20 bytes — no reason to heap-allocate it
in the callback on ESP8266 either. Store raw tcp_pcb pointers on both
platforms, removing the #ifdef branches and simplifying the code.
2026-03-10 14:07:06 -10:00
J. Nick Koston 459f08181e Merge remote-tracking branch 'upstream/rp2040-crash-handler' into integration 2026-03-10 14:04:53 -10:00
J. Nick Koston d6efde5a5d Merge remote-tracking branch 'upstream/rp2040-accept-no-irq-malloc' into integration 2026-03-10 14:04:45 -10:00
J. Nick Koston 6718cd6df2 Account for xPSR alignment padding, use reinterpret_cast, and use idedata ELF path
- Check xPSR bit 9 to detect hardware alignment padding word in the
  exception frame, fixing pre-fault SP and stack scan start offset
- Replace C-style pointer casts with reinterpret_cast<uintptr_t>
- Use idedata.firmware_elf_path instead of hardcoded path in decoder
2026-03-10 14:04:06 -10:00
J. Nick Koston 49024c240b Register temporary err callback on queued PCBs to prevent use-after-free
Between accept_fn_ storing a raw PCB and accept() picking it up, the
connection could error (RST, timeout). Without an error callback, lwip
frees the PCB silently, leaving a dangling pointer. When accept() later
creates LWIPRawImpl with it, the use-after-free corrupts the heap.

Fix: register a lightweight error callback (no allocation) in accept_fn_
that nulls the array slot when the PCB is freed. accept() checks for
null and skips freed PCBs. After shifting the array, tcp_arg pointers
are updated for remaining entries.
2026-03-10 14:02:56 -10:00
J. Nick Koston 352150c7f1 Register temporary err callback on queued PCBs to prevent use-after-free
Between accept_fn_ storing a raw PCB and accept() picking it up, the
connection could error (RST, timeout). Without an error callback, lwip
frees the PCB silently, leaving a dangling pointer. When accept() later
creates LWIPRawImpl with it, the use-after-free corrupts the heap.

Fix: register a lightweight error callback (no allocation) in accept_fn_
that nulls the array slot when the PCB is freed. accept() checks for
null and skips freed PCBs. After shifting the array, tcp_arg pointers
are updated for remaining entries.
2026-03-10 14:02:43 -10:00
J. Nick Koston ee2425878d Merge branch 'rp2040-accept-no-irq-malloc' into integration 2026-03-10 13:57:03 -10:00
J. Nick Koston 9b15f623b1 Merge remote-tracking branch 'upstream/rp2040-crash-handler' into integration 2026-03-10 13:55:57 -10:00
J. Nick Koston e5c879290e [socket] Fix RP2040 heap corruption from malloc in lwip accept IRQ callback 2026-03-10 13:54:50 -10:00
J. Nick Koston c2f7fa4009 cleanup 2026-03-10 13:54:10 -10:00
J. Nick Koston bbca87a375 Merge branch 'rp2040-crash-handler' into integration 2026-03-10 13:47:15 -10:00
J. Nick Koston ee12cba23c Use SDK defines SRAM_END and XIP_BASE instead of magic numbers 2026-03-10 13:47:09 -10:00
J. Nick Koston f92f957af0 Narrow broad except to OSError and CalledProcessError 2026-03-10 13:44:43 -10:00
J. Nick Koston e20e8b9761 Merge branch 'rp2040-crash-handler' into integration 2026-03-10 13:40:01 -10:00
J. Nick Koston 7113e41550 Address review feedback: RP2350 compat, noreturn, addr2line hint
- Add #if defined(PICO_RP2350) for SRAM end (520KB vs 264KB) so
  stack scanning works on both RP2040 and RP2350
- Widen flash range check to 4MB for RP2350
- Add __attribute__((noreturn)) to hard_fault_handler_c
- Mark exc_return parameter as unused via /*exc_return*/
- Build addr2line hint line with all addresses (PC, LR, and BT*)
  so users can copy-paste a single command for full decode
2026-03-10 13:38:42 -10:00
J. Nick Koston c017bfc35b Add comment explaining ESP_LOGE over ESP_LOGCONFIG 2026-03-10 13:34:37 -10:00
J. Nick Koston 045bef53fe Merge branch 'rp2040-crash-handler' into integration 2026-03-10 13:32:07 -10:00
J. Nick Koston 3359f541b1 Widen flash range to 2MB for stack scan 2026-03-10 13:31:48 -10:00
J. Nick Koston 20d884a2de Replace #define with static constexpr for clang-tidy 2026-03-10 13:31:24 -10:00
J. Nick Koston fcbbfd8dd9 Merge branch 'rp2040-crash-handler' into integration 2026-03-10 13:29:55 -10:00
J. Nick Koston 192080f6d3 Add references for HardFault handler asm pattern 2026-03-10 13:29:24 -10:00
J. Nick Koston a3aff62e4c Use combined namespace esphome::rp2040 2026-03-10 13:28:58 -10:00
J. Nick Koston 5f56f266b5 [rp2040] Add HardFault crash handler with backtrace
Add a crash handler for RP2040 that captures register state and stack
backtrace when a HardFault occurs, stores it in watchdog scratch
registers (which survive reboot), and logs it on the next boot.

- Override weak isr_hardfault with Cortex-M0+ compatible handler
- Save PC, LR, SP to watchdog scratch registers
- Scan stack for return addresses to provide deeper backtrace
- Log crash data immediately after logger initialization
- Add addr2line auto-decoding in CLI serial log viewer
2026-03-10 13:26:27 -10:00
J. Nick Koston 829448a5c6 Merge remote-tracking branch 'upstream/dev' into integration 2026-03-10 12:33:56 -10:00
Thomas Rupprecht dcbf3c8728 [esp32] gpio type improvements (#14517) 2026-03-10 18:18:35 -04:00
J. Nick Koston 30c8c68703 [socket] Fix RP2040 TCP race condition between lwip callbacks and main loop (#14679) 2026-03-10 11:22:23 -10:00
9513edc468 [dew_point] Add dew_point sensor component (#14441)
Co-authored-by: pre-commit-ci-lite[bot] <117423508+pre-commit-ci-lite[bot]@users.noreply.github.com>
Co-authored-by: Jonathan Swoboda <154711427+swoboda1337@users.noreply.github.com>
2026-03-10 17:17:13 -04:00
J. Nick KostonandClaude Opus 4.6 6356e3def9 [core] Warn on crystal frequency mismatch during serial upload (#14582)
Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-10 20:42:38 +00:00
J. Nick Koston 58e65f9355 Merge remote-tracking branch 'upstream/dev' into integration 2026-03-10 10:39:58 -10:00
Jonathan SwobodaandClaude Opus 4.6 8d988723cd [config] Allow !extend/!remove on components without id in schema (#14682)
Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-10 16:38:50 -04:00
J. Nick Koston 043290c204 Merge remote-tracking branch 'upstream/dev' into integration
# Conflicts:
#	esphome/__main__.py
#	esphome/core/log.cpp
#	esphome/core/log.h
#	esphome/util.py
#	tests/component_tests/logger/test_logger.py
#	tests/component_tests/logger/test_logger.yaml
#	tests/unit_tests/test_util.py
2026-03-10 10:34:19 -10:00
Kevin AhrendtandJ. Nick Koston 8ca6ee4349 [speaker_source] Add new media player (#14649)
Co-authored-by: J. Nick Koston <nick@home-assistant.io>
2026-03-10 20:25:26 +00:00
mahumpulaandJonathan Swoboda 780e009bf4 [runtime_image] Add support for 8bit BMPs and fix existing issues (#10733)
Co-authored-by: Jonathan Swoboda <154711427+swoboda1337@users.noreply.github.com>
2026-03-10 16:23:49 -04:00