libgit2's repository_init -> config-write -> FATFS -> wear-leveling chain nests ~10 GIT_PATH_MAX (4 KB) stack buffers deep; a trivial config write measured ~67 KB on hardware and overflowed the previous 48 KB, corrupting a newlib lock handle (LoadProhibited in xQueueGenericSend). Shared with the editor build, so this is temporary -- git should move to a dedicated large-stack task and this can drop back to ~16 KB.
58 lines
3.4 KiB
Plaintext
58 lines
3.4 KiB
Plaintext
# Rust often needs a bit of an extra main task stack size compared to C (the default is 3K)
|
||
# You might have to increase this further if you allocate large stack variables in the main task.
|
||
# Bumped for the TLS handshake (Spike 6): mbedtls runs on the calling task and
|
||
# wants several KB of stack on top of the app's own usage.
|
||
# Bumped hard for Spike 7: libgit2's call chain is stack-hungry. Nearly every
|
||
# function puts a `char path[GIT_PATH_MAX]` (4 KB) buffer on the stack, and the
|
||
# repository_init → config-write → FATFS → wear-leveling chain nests ~10 of them
|
||
# deep — a trivial config write measured ~67 KB of stack on hardware, overflowing
|
||
# the previous 48 KB and smashing an adjacent newlib lock handle (LoadProhibited
|
||
# in xQueueGenericSend). The push (smart-HTTP + pack + mbedTLS) is deeper still.
|
||
# NOTE: this earlier looked like "time() only works on the main task" — but that
|
||
# iteration ran git on a std::thread with the default 4 KB stack; the same chain
|
||
# just overflowed sooner. It's stack depth, not thread-vs-main.
|
||
# CAVEAT: this sdkconfig is shared with the editor build, so the editor also
|
||
# reserves this stack for nothing. Once the push is proven, git should move to a
|
||
# dedicated large-stack task and this can drop back to ~16 KB.
|
||
CONFIG_ESP_MAIN_TASK_STACK_SIZE=98304
|
||
|
||
# Increase a bit these stack sizes as they are also a bit too small by default
|
||
CONFIG_ESP_SYSTEM_EVENT_TASK_STACK_SIZE=4096
|
||
CONFIG_FREERTOS_IDLE_TASK_STACKSIZE=4096
|
||
|
||
# You might have to increase this further if you spawn your own Rust threads
|
||
# that allocate large stack variables; or better yet - use
|
||
# `std::thread::Builder::new().stack_size(XXX)` for spawning
|
||
CONFIG_PTHREAD_TASK_STACK_SIZE_DEFAULT=4096
|
||
|
||
# Raise the compile-time log ceiling so the sdmmc/sdspi drivers' per-command
|
||
# DEBUG logs (the raw R1 response bytes) are built in. Runtime level stays INFO
|
||
# by default; the SD spike bumps just the sdmmc/sdspi tags to DEBUG so we can see
|
||
# exactly what each init command returns. (Diagnostic for Spike 3 init failures.)
|
||
CONFIG_LOG_MAXIMUM_LEVEL_DEBUG=y
|
||
|
||
# FatFS long filenames (Spike 3 — SD). Default is 8.3-only, which rejects the
|
||
# persistence module's atomic-save temp name (`notes.md.tmp` has two dots).
|
||
# LFN on the heap keeps the working buffer off the (small) task stack.
|
||
CONFIG_FATFS_LFN_HEAP=y
|
||
|
||
# PSRAM (Spike 7 — the git working set needs it; the docs memory plan budgets
|
||
# ~1.5 MB PSRAM for pack/delta work, and the rope buffer lives there too). This
|
||
# board is an ESP32-S3-WROOM-1-N16R8 → 8 MB *octal* PSRAM, so OCT mode is
|
||
# required (quad would fail to init). USE_MALLOC adds PSRAM to the heap
|
||
# allocator, so large allocations (Box, Rope, libgit2 buffers) land there
|
||
# instead of the ~339 KB internal DRAM Spike 6 measured. Octal PSRAM occupies
|
||
# GPIO 33–37; the EPD/SD pins (4–13) deliberately avoid that range, so no wiring
|
||
# conflict. Speed left at the 40 MHz default (safe first-enable; 80 MHz needs
|
||
# matching flash-freq config and is a later tuning step).
|
||
CONFIG_SPIRAM=y
|
||
CONFIG_SPIRAM_MODE_OCT=y
|
||
CONFIG_SPIRAM_USE_MALLOC=y
|
||
|
||
# TLS trust store (Spike 6 — Wi-Fi + TLS, the gate for Spike 7 git push).
|
||
# The certificate bundle backs esp_crt_bundle_attach so an HTTPS GET to
|
||
# api.github.com validates against real roots. FULL rather than the common
|
||
# subset so a less common CA in the chain can't surprise us on the bench.
|
||
CONFIG_MBEDTLS_CERTIFICATE_BUNDLE=y
|
||
CONFIG_MBEDTLS_CERTIFICATE_BUNDLE_DEFAULT_FULL=y
|