microsoft / pxt-microbit

A Blocks / JavaScript code editor for the micro:bit built on Microsoft MakeCode
https://makecode.microbit.org
Other
710 stars 588 forks source link

this program never works on V2 #5396

Open tballmsft opened 10 months ago

tballmsft commented 10 months ago

The following program never works as expected when loaded successfully (no error messages) over WebUSB or file download to micro:bit V2. I suspect it is too large for the V2 as well as V1:

https://makecode.microbit.org/_9KKHE4WyyUM3

I reduced the program size to this:

https://makecode.microbit.org/_Chq7538rzeDL

This program works as expected when successfully loaded.

abchatra commented 10 months ago

I can reproduce the issue. We should throw error in v2 if the size is too long for v2

microbit-carlos commented 10 months ago

We have some documented memory map info in: https://github.com/lancaster-university/codal-microbit-v2/blob/master/docs/MemoryMap.md

Essentially the user programme needs to stop at address 0x73000, as anything after that is either used by CODAL or the bootloader. In this case, looking at the hex file, the largeSwitch programme is writing up to address 0x752B0, so it's about 8 KBs larger than would fit in V2.

The extra 8 KBs overlap the "CODAL scratch page", "MicroBitStorage", and "Flash Data Storage", which probably don't trigger any issues on programmes not using these features, but as soon as any programme uses BLE or the CODAL MicroBitFlash, MicroBitFileSystem and MicroBitStorage, it will cause problems.


Edit: This is actually a different issue than originally reported here, as this is about what errors are shown in the editor, so I've opened: