fix(l2): WiFi fails to start or join - big statics and task stacks to PSRAM

WiFi starts and joins on internal RAM: ~42 KB the first time, ~25 KB after,
more for WPA. Free internal RAM had shrunk to ~20 KB after opening the map
(the tile decoder's 12 KB stack, the 32 KB I-cache, the DMA draw buffers,
UI statics), so a scan failed at once (esp_wifi_init: no memory) and a join
during a tile download timed out (AUTH_EXPIRE).

- ESP-IDF: CONFIG_SPIRAM_ALLOW_BSS_SEG_EXTERNAL_MEMORY, and the esp_timer
  task stack 8 -> 4 KB (it uses ~0.4 KB). Rebuild the framework libs:
  pio run -e Wio_Tracker_L2_idf_libs.
- PSRAM_BSS (EXT_RAM_BSS_ATTR) on the UI's big statics: QR codes, map
  state, charts, lists. .dram0.bss 115 -> 66 KB.
- The tile decoder's and fetcher's task stacks in PSRAM.

Free internal RAM, idle: 48 -> 105 KB; WiFi up: 57 KB, 29 KB at the
lowest while downloading tiles.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Jakub
2026-10-14 17:23:29 +02:00
co-authored by Claude Opus 5.5
parent 3825dcc077
commit 2f2db6045c
17 changed files with 49 additions and 29 deletions
@@ -24,7 +24,7 @@ static LiveVal s_vals[diag::MAX_ROWS + EXTRA];
static int s_rows = 0;
// The history, a sample every 5 minutes from boot (UITask::sampleHistory()).
static uicore::StatusHistory<96, 300000UL> s_hist;
static PSRAM_BSS uicore::StatusHistory<96, 300000UL> s_hist;
static uint32_t s_hist_shown = 0; // the history's version the charts show
static lv_obj_t* s_ch_obj[4]; // History's charts and their values now
static lv_obj_t* s_ch_now[4];
@@ -38,7 +38,7 @@ static uint32_t totalRecv() {
// One chart's samples as drawn: a copy, so the draw callback needn't know
// which ring (of which size) they came from. What the axis and the pill
// say is set once (setupCharts()).
static chart::Chart s_charts[4];
static PSRAM_BSS chart::Chart s_charts[4];
template <int N>
static void chartOf(int k, const uicore::History<N>& h) {
chart::Chart& c = s_charts[k];
@@ -218,7 +218,7 @@ static void onNoiseRun(lv_event_t* e) { (void)e; s_ui->diagNoiseRun(); }
// A sweep as bars (Chart.h), the step nearest the mesh's frequency in the
// accent, then its quietest / loudest values.
static chart::Chart s_sweep_chart;
static PSRAM_BSS chart::Chart s_sweep_chart;
static char s_sweep_under[3][12];
static void plotSweep(lv_obj_t* list, const char* title, const Sweep& sw, float mesh_f) {
sectionTitle(list, title);