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

MakeCode 2022 leaves less RAM than V4 for user code

Open martinwork opened this issue 2 years ago • 3 comments

Describe the bug

Arising from support ticket https://support.microbit.org/helpdesk/tickets/55037 (private)

The customer's Bluetooth project runs out of memory (Error 020) in micro:bit V1.5.

microbit-JBN8C-Prj-BT-DPAD-XF-ObjectSensor.zip

I created a project in MakeCode V4 by copying the Javascript, and it works without running out of memory.

microbit-ble-v4.zip

To Reproduce Steps to reproduce the behavior:

  1. Flash hex to micro:bit
  2. Connect via Bluetooth from iOS app
  3. Use Monitor & Control, Gamepad panel buttons
  4. See error 020

Expected behavior Project that worked on V4 continues to work.

Screenshots Add screenshots to help explain your problem. You can copy paste the screenshot in the github report. The .gif screen recording is very useful as well.

micro:bit version (please complete the following information):

You can find this information in the lower right hand corner of the back of micro:bit (the side that says BBC micro:bit).

  • Which version of the micro:bit is this relevant to [ EG V1.3, V1.5, V2.0, or specify it's not hardware related ] V1.5

Desktop (please complete the following information):

  • OS: [e.g. iOS] Windows
  • Browser [e.g. chrome, safari] Chrome
  • Version [e.g. 22]

Smartphone (please complete the following information):

  • Device: [e.g. iPhone6] iPad Air 2
  • OS: [e.g. iOS8.1] iOS 15.5
  • Browser [e.g. stock browser, safari]
  • Version [e.g. 22]

Additional context Add any other context about the problem here.

martinwork avatar Jul 08 '22 11:07 martinwork

Thanks Martin! It's also worth mentioning that for V1 the DAL hasn't changed, so that points at the additional RAM being consumed by the MakeCode side.

Might be worth checking, if as indicated https://github.com/microsoft/pxt-microbit/issues/4788#issuecomment-1175348410, the additional memory usage was between 4.1.5 & 4.16.

microbit-carlos avatar Jul 08 '22 12:07 microbit-carlos

While I found it worked with my micro:bit V1.5 on MakeCode v4, I think the customer has a micro:bit v1.3, and their code was originally created on MakeCode v2. They have now tested their original hex in each MakeCode version and report that it starts to run out of memory for them on MakeCode v3.

martinwork avatar Jul 08 '22 13:07 martinwork

Memory over occurs in both V2 and V1.5 of micro: bit. It worked in V4 of MakeCode, but in V5 I get the following error. Program too ig by 3964bytes!

itibanbosi avatar Jul 13 '22 04:07 itibanbosi

@martinwork can you kindly test with this build? https://microbit.staging.pxt.io/app/90d23a3465264bc5f2cb314fce5d4be956dd7b12-3596625c81#

The hex it generates has a smaller footprint, but I'm having trouble pairing Bluetooth, unable to fully test with your sample.

eanders-ms avatar Jun 13 '23 22:06 eanders-ms

@eanders-ms I can pair with the original sample downloaded from that build. I reset to Bluetooth mode via A+B+RESET. because triple press didn't work. But I can't test the OOM error because there's an immediate error 071, because of https://github.com/lancaster-university/codal-microbit-v2/issues/331, which should be fixed in the next CODAL tag by https://github.com/lancaster-university/codal-microbit-v2/commit/2a1984e9cbe5d1874c4b68e3aa2ea1a2c57739e7.

martinwork avatar Jun 14 '23 10:06 martinwork

@eanders-ms Tested with the new live. It fails as with v5. After connecting in the iOS micro:bit app Monitor & Control, pressing gamepad button A triggers 020.

martinwork avatar Jun 17 '23 14:06 martinwork