-
Notifications
You must be signed in to change notification settings - Fork 642
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
compile-time allocation of flash #5548
Comments
The basic idea here is quite simple, we will make a pass over the packages to collect the amount of flash (default 0) that each needs. This list will be used to allocate addresses (from top of available flash down) and make a call to a known function in the package to inform it of the starting (bottom) address for its flash range.
|
@tballmsft what are the cases for an extension needing dedicated flash, compared to, say, needing a reliable config store, or filesystem? Back in V1 we had the MicroBitStorage which was quite generally useful, but underused because it wasn't persistent. I worry we'll consume flash quite quickly with an approach like this, as unless extensions co-operate, the minimum allocation granule will be one flash page and the size of that can be platform dependent, so could see a fallback to reserving large chunk. On micro:bit, some considerations for this:
@finneyj any other considerations here? |
Thanks. @jaustin. Yes, a reliable configuration store (which is implemented in settings, used in Arcade, and also by pxt-jacdac) would be very useful. Of course, size might matter. For certain apps, we may need to allocate more flash. For many applications, persistence is only required for that app, so drag and drop of a new app isn't a huge concern. For Jacdac, we persist the mapping between role names and device identifiers. For more ambitious programs, like MicroCode (now ported to makecode.microbit.org), we persist user programs in flash. My understanding, correct me if I am wrong, is that we have several new features that require some flash:
In the future, will there be need for
My major point is that a particular micro:bit app might used just a subset of the above features, so it seems problematic to statically allocate regions for features that might not be used by an app. Different features might have different needs/APIs for flash, so not accommodated by a generic key-value store (though maybe it is enough?) https://github.com/lancaster-university/codal-microbit-v2/blob/master/docs/MemoryMap.md |
per @jaustin - we probably need to discuss this in larger context of partial flashing - anything that relies on the layout of code/data in flash. |
In general, an extension might have a need for extra flash. If a MakeCode app includes several extensions, each of them with some need for a declared constant amount of flash, it would be great for the MakeCode compiler to statically allocate and assign available flash, and then determine how much space is left for the code. This flexibility will allow us to:
The important point here is that an extension (or feature) should just say how much flash it needs and be parameterized by an address that will be set from outside at compile time. We want to stay away from a feature hardcoding a particular address range, especially if that feature may not be used all the time.
In general, we might have C++ code that wants some flash as well (and is optionally compiled), so would be good to think about this as well. As you know, each time we change set of extensions for an app, we recompile the whole world (with caching), so we can definitely accommodate needs of C++ that is included for a compilation.
The text was updated successfully, but these errors were encountered: