Skip to content

microcontroller.nvm reports a hardcoded 1024 bytes on every chip; storage and os have no filesystem to stand on #16

Description

@begeistert

microcontroller.py:162 returns 1024 from __len__: false on the ATtiny85 (512 B) and the ATmega2560 (4096 B). CHANGELOG.md:6-9 promises nvm[0:4] works while microcontroller.py:152-154 says slice access is not available.

What to do

Expose the EEPROM size in pymcu.chips and read it: about 10 lines plus one entry per chip. storage and os are not addressable, there is no filesystem; document that rather than leave them silently absent.

From the read-only audit of the layer against CircuitPython (2026-09-14), Uno-class boards first.


Fixed (nvm size); storage and os are not done

nvm

len(nvm) was a 1024 literal in the layer, reported on every chip. It asks the HAL now,
which knows the part: PyMCU dbe25747 adds EEPROM.size() as a compile-time constant.

part before after
ATmega328P 1024 1024
ATtiny85 1024 512
ATtiny13 1024 64
ATmega2560 1024 4096

A program that trusted the old number wrote past the end of an ATtiny85's EEPROM and used a
quarter of an ATmega2560's. Measured on an Arduino Uno in pymcu-avr e923c80; the other
sizes are the parts' datasheets.

pymcu-circuitpython c45b70e, with a test that patches the HAL's answer and checks the layer
reports it rather than its own number.

Still open

storage and os have no filesystem to stand on, which is the other half of this issue and
is untouched. A filesystem needs a block device and a directory structure, and there is
neither; the honest shapes are either a refusal that names nvm and the EEPROM, or a real
read-only image in flash. That is a design decision, not a fix.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions