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
@@ -374,7 +374,7 @@ static void qrImage(lv_image_dsc_t& dsc, uint8_t* data, size_t size, int n, int
// The Solo site's QR code (ui-core/SiteQr.h), built once at 5 px a module.
static lv_obj_t* siteQr(lv_obj_t* parent) {
static const int S = 5, PX = (siteqr::N + 2 * siteqr::QUIET) * S;
static uint8_t data[8 + (PX + 7) / 8 * PX];
static PSRAM_BSS uint8_t data[8 + (PX + 7) / 8 * PX];
static lv_image_dsc_t dsc;
if (!dsc.data) qrImage(dsc, data, sizeof(data), siteqr::N, S, siteqr::dark);
lv_obj_t* img = lv_image_create(parent);
@@ -386,9 +386,9 @@ static lv_obj_t* siteQr(lv_obj_t* parent) {
// shown (the name can change), 3 px a module; null when it doesn't fit.
static lv_obj_t* contactQr(lv_obj_t* parent) {
static const int S = 3, PX = (contactqr::MAX_VERSION * 4 + 17 + 2 * siteqr::QUIET) * S;
static uint8_t data[8 + (PX + 7) / 8 * PX];
static PSRAM_BSS uint8_t data[8 + (PX + 7) / 8 * PX];
static lv_image_dsc_t dsc;
static contactqr::Code code;
static PSRAM_BSS contactqr::Code code;
if (!contactqr::make(code)) return nullptr;
qrImage(dsc, data, sizeof(data), code.n, S, [](int x, int y) { return code.dark(x, y); });
lv_obj_t* img = lv_image_create(parent);