bkshepherd / DaisySeedProjects

A collection of hardware and software projects based around the Electro-Smith Daisy Seed
MIT License
231 stars 35 forks source link

Flash utilization #4

Closed KnightHill closed 9 months ago

KnightHill commented 12 months ago

Flash utilization is 97.16% after the latest changes. It is unlikely more than one or two new effects can be added. I am wondering if there is a cheap way to decrease that.

bkshepherd commented 12 months ago

This forum thread covers the options pretty well: https://forum.electro-smith.com/t/out-of-flash-memory-walkthrough-with-samples/4370/10

The lowest hanging fruit is to simply turn on compiler binary size optimization by adding OPT = -Os to the make file. I did a quick test, that gets it down to 93.16%.

I'm not sure offloading anything to SDRAM would help at the moment as I'm not sure I'm allocating any huge buffers.

Honestly, I haven't really done any profiling, so I'm not really sure what's using all the memory. I will say that just an empty sample project that takes input and routes it directly to output with no other code uses 48.69% of memory on its own.

Switching to the boot loader and running things out of SRAM however would help a lot. It would give us 4x the space going from 128KB -> 512KB.

KnightHill commented 11 months ago

I am wondering if libDaisy can be slimmed down, while offering the same functionality, more or less. Similar to the way busybox replaces traditional Linux tools on smaller systems.

bkshepherd commented 9 months ago

The project now default to using the Daisy custom boot loader to run the programs out of SRAM. This increases the amount of space available for program code from 128kb to 512kb. I also updated the read me to describe how to use the boot loader.