Skip to content

nordic, stm, mimxrt10xx, analog: shrink property objects - #11371

Open
lynt-smitka wants to merge 1 commit into
adafruit:mainfrom
MakerClassCZ:property-flash-size
Open

nordic, stm, mimxrt10xx, analog: shrink property objects#11371
lynt-smitka wants to merge 1 commit into
adafruit:mainfrom
MakerClassCZ:property-flash-size

Conversation

@lynt-smitka

Copy link
Copy Markdown

A read-only property carries two slots it never uses, and a getter/setter pair one. atmel-samd and raspberrypi already put these objects in their own linker sections and drop the unused slots: 8 bytes instead of 16, or 12 for a pair.
The other ARM ports never turned it on.
This adds the sections to their linker scripts and enables the option for nordic, stm, mimxrt10xx and analog.

board before after saved
feather_nrf52840_express 662152 660824 1328
feather_stm32f405_express 662112 660728 1384

The section bounds tell the runtime how many slots an object has, so a section with anything else between the bounds would read an 8-byte object as a full property. The linker now asserts that each section holds whole objects.
I have no board for these ports. Verified: the sizes above, the assert, the section geometry in the map, and the property paths on a raspberrypi board, where this is already on.

This was found and fixed by AI.

These ports never opted into CIRCUITPY_OPTIMIZE_PROPERTY_FLASH_SIZE, so every
read-only property carries two unused slots and every getter/setter pair one.
Give the two sections a home in the linker script, the way atmel-samd and
raspberrypi do, and turn the option on.

The section bounds decide how many slots an object has, so a misplaced section
would be read as a full property. The linker now asserts that each section is a
whole number of objects.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant