CONFIG_IDF_TARGET="esp32p4" # Flash (Waveshare ESP32-P4-ETH-POE ships with 16 MB QSPI flash) CONFIG_ESPTOOLPY_FLASHSIZE_16MB=y CONFIG_ESPTOOLPY_FLASHSIZE="16MB" # Partition table CONFIG_PARTITION_TABLE_CUSTOM=y CONFIG_PARTITION_TABLE_CUSTOM_FILENAME="partitions.csv" # PSRAM (required for 800x480 framebuffer + JPEG decode + local screens). # 200 MHz speed is gated behind IDF_EXPERIMENTAL_FEATURES on ESP32-P4 — # at the default 20 MHz the DPI bridge underruns continuously trying to # feed the panel from PSRAM. 200 MHz gives ~10x more bandwidth and the # DPI runs clean. CONFIG_IDF_EXPERIMENTAL_FEATURES=y CONFIG_SPIRAM=y CONFIG_SPIRAM_MODE_HEX=y CONFIG_SPIRAM_SPEED_200M=y CONFIG_SPIRAM_USE_MALLOC=y CONFIG_SPIRAM_MALLOC_ALWAYSINTERNAL=16384 # Ethernet (Waveshare ESP32-P4-ETH-POE: internal EMAC + external PHY) CONFIG_ETH_ENABLED=y CONFIG_ETH_USE_ESP32_EMAC=y # EMAC RX DMA pool must exceed TCP_WND or a full-window burst overruns # the RX descriptors and the silent tail-drop puts the sender into a # ~200-400ms RTO stall (measured: WND=23040 with the default 20x512B # = 10KB pool made recv bimodal — wire_max 75Mbps on clean frames, # 200-450ms stalls on lossy ones, sender fps 20 -> 14). 1600B = one # full MSS frame per buffer (also 1 descriptor/packet instead of 3); # 24 x 1600 = 38.4KB >= 23040 + slack. ~44KB extra internal RAM. CONFIG_ETH_DMA_BUFFER_SIZE=1600 CONFIG_ETH_DMA_RX_BUFFER_NUM=24 # LWIP / mDNS CONFIG_LWIP_IPV4=y CONFIG_LWIP_IPV6=y CONFIG_MDNS_MAX_INTERFACES=1 # TCP receive window. History: at the IDF default (4 × MSS = 5760) # with the OLD single recv→decode→paint task, raising WND to 65535 # regressed g2g to 17s unbounded (kernel queue buildup, no skip- # oldest possible). The recv/decode task split + 1-deep latest-frame # slot removed that failure mode; the instrumented baseline at 5760 # then showed the window as the dominant throttle: wire=53Mbps # (= WND/RTT ceiling) vs ~94Mbps line rate, recv_chunk_max pinned at # exactly 5760, sender backpressured on 44-61% of frames. 23040 = # 16 × MSS. RECVMBOX must scale with the window (16 segments can be # in flight; a 6-deep mbox would silently become the new cap). # Regression tripwires when touching these: /state stream.pend_age_* # and recv_dropped_oldest must stay flat, sender g2g must not grow. CONFIG_LWIP_TCP_WND_DEFAULT=23040 CONFIG_LWIP_TCP_SND_BUF_DEFAULT=5760 CONFIG_LWIP_TCP_RECVMBOX_SIZE=32 CONFIG_LWIP_TCP_SACK_OUT=y # HTTP server CONFIG_HTTPD_MAX_REQ_HDR_LEN=1024 CONFIG_HTTPD_MAX_URI_LEN=512 # Main task stack — JPEG decode is hungry CONFIG_ESP_MAIN_TASK_STACK_SIZE=8192 # Log level CONFIG_LOG_DEFAULT_LEVEL_INFO=y # OTA: dual-partition layout in partitions.csv. Rollback marks new # images as PENDING_VERIFY at first boot; ota_arm_healthy_timer flips # them to VALID after 30 s of healthy uptime, otherwise the bootloader # reverts to the previous slot on the next reset. CONFIG_BOOTLOADER_APP_ROLLBACK_ENABLE=y