pxt-microbit icon indicating copy to clipboard operation
pxt-microbit copied to clipboard

use of settings consumes more flash (V2) - need to reflect this in available flash for app

Open tballmsft opened this issue 11 months ago • 5 comments

  • Context: the use of the settings feature (from pxt-common-packages) in pxt-jacdac reduces the amount of flash for the user code
  • Problem: the web app and compiler are likely unaware of this, so may produce a binary (that uses settings) and overwrites the setting area in flash.
  • Solution: need a way to adjust the amount of available flash in compile check for "user code too large", when settings is included in binary

tballmsft avatar Mar 12 '24 21:03 tballmsft

There are target-specific settings for end of flash

            "compile": {
                "flashCodeAlign": 4096,
                "flashUsableEnd": 487424,
                "flashEnd": 524288
            },

There is no way to override on a package basis, so we would need some special case coding somewhere for this... or we just hard code the limit, assuming settings is used.

tballmsft avatar Mar 12 '24 22:03 tballmsft

Note that the above flashUsableEnd already is incorrect, as it doesn't reflect the memory map: https://github.com/lancaster-university/codal-microbit-v2/blob/master/docs/MemoryMap.md.

From the memory map for the V2, the flashUsableEnd is now 0x73000, which is 471,040.

Subtracting 32k for settings get us down to 0x6b000 = 438,272

tballmsft avatar Mar 12 '24 22:03 tballmsft

On further reflection, it seems rather severe to take away 32k for settings. On the other hand, most micro:bit programs are tiny! Thoughts?

tballmsft avatar Mar 12 '24 22:03 tballmsft

@abchatra - Do we have a set of test programs we can benchmark on?

tballmsft avatar Mar 12 '24 22:03 tballmsft

@carlosperate - can you please give me a set of the largest MakeCode programs for the micro:bit.

tballmsft avatar Mar 13 '24 17:03 tballmsft

See https://github.com/microsoft/pxt-microbit/issues/5548

tballmsft avatar Mar 14 '24 20:03 tballmsft

  • the use of the settings feature (from pxt-common-packages) in pxt-jacdac reduces the amount of flash for the user code

Is that the CODAL MicroBitStorage (or similar) settings.

If not, this could be also related:

  • https://github.com/microsoft/pxt-microbit/issues/5403

@carlosperate - can you please give me a set of the largest MakeCode programs for the micro:bit.

I don't have anything specifically created for this purpose, mostly just encountered some examples (also from your own testing) like these:

  • https://github.com/microsoft/pxt-microbit/issues/5396
  • https://github.com/microsoft/pxt-microbit/issues/4788

microbit-carlos avatar Mar 20 '24 18:03 microbit-carlos

I am assuming this doesn't need to be tracked as an issue. Closing. If not let me know.

abchatra avatar Jul 18 '24 17:07 abchatra