← board

What does a static Python program on a microcontroller need to write to?

Filed as a decide rather than a bug because every option works and they differ in what we want to be, which is the Track U test.

The measurement

PXXDBG=a.datamap on examples/esp32/nilpy-c3/main/main.npy, riscv32, --platform=esp --dce, compiler c6c5f5f1b:

bss 89,352B = 23,115B named globals + 66,237B unattributed

  bss 4128B  Input
  bss 4128B  Output
  bss 4128B  ErrOutput
  bss 4128B  StdOut
  bss 4128B  StdErr
  bss 1536B  TokCache
  bss  512B  FreeBins

20,640 B — 89% of all named globals, 23% of .bss, 16% of our 125,832 B of SRAM. The program is a class, a list, a loop and print. It opens no file and reads no input.

4,128 is a 4 KiB buffer plus a 32-byte header — a size chosen for a filesystem. The ESP console is a line-buffered UART.

The question, in goal terms

Should a Python program compiled for a microcontroller have the same five standard streams as one compiled for Linux, at 4 KiB of SRAM each — or should an embedded target give it what the chip can afford?

Answerable without knowing what a text record is, which is the test for whether this belongs here at all.

Options

Recommendation: (c) + (d). No program stops working, the divergence is a buffer size rather than a missing stream, and it is the only pair that costs nothing in behaviour.

What is NOT being asked

Not whether writeln works on ESP-IDF — it does, and the IDF stdio path is already wired. This is only about what the streams RESERVE.

Before implementing

Re-measure. 4,128 is one target's number on one program; check a Pascal ESP image and the other chip before sizing anything, and state the saving as a ceiling — dropping a record also frees the alignment after it, and keeping a header keeps some of it.