Microcontroller Memory Constraints
Discussions center on the limited RAM and flash memory of embedded microcontrollers like PIC, AVR, STM32, and ESP32, evaluating if programs, interpreters like MicroPython, or other software can run on such resource-constrained hardware.
Activity Over Time
Top Contributors
Keywords
Sample Comments
Not the OP, but check out devices like Microchip's PIC (8 bits) or AVR (8 bits), or ARM Cortex M0 or Cortex M3/4 devices. On cheaper devices you can get down to a few kB of RAM and Flash memory, so you need to be mindful of what you use!When working with embedded devices like that, the main thing is you can't just easily import libraries or use many layers of abstraction (limited stack depth too). So generally everything is done at a low level.
That's a huge amount of RAM for most microcontrollers.
It'd fit in an STM32 microcontroller's 64K RAM comfortably, with room to spare for some actual programs. That's actually a pretty useful application. Except I think it targets x86 rather than ARM.
A program for a micro controller with only a few KB of RAM
Small micro controllers don't have the resources you're used to. The smallest thing I ever wrote code for was in the PIC family and had 176 bytes of RAM and like 4 or 8K of flash (EEPROM?). Even on more common parts you may find only a few K of RAM and 10's or 100's of K flash. In that space we don't do any dynamic memory allocation, never mind garbage collection. If you did it's entirely possible you'd run out of heap space and the program would crash. It'
Think it's portable enough to use in embedded microcontroller environments?
That sounds positively luxurious... I recently worked on a project where the microcontroller had 768 bytes of RAM and around 32k flash. The hardware team were really pushing for a slightly cheaper version of the microcontroller with only 512 bytes RAM but as we software folks were feeling pinched even at 768, they got overruled.
That's roughly true: 32KB RAM and 256KB Flash will provide a decent MicroPython environment. I'm afraid if you have fewer resources than that you should probably look at other alternatives.
Have you considered embedded programming? Less bloat...
Micropython runs in 16k RAM.https://micropython.org/