microsoft / pxt-microbit

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

MakeCode 2022 leaves less RAM than V4 for user code #4808

Open martinwork opened 2 years ago

martinwork commented 2 years ago

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).

Desktop (please complete the following information):

Smartphone (please complete the following information):

Additional context Add any other context about the problem here.

microbit-carlos commented 2 years ago

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.

martinwork commented 2 years ago

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.

itibanbosi commented 2 years ago

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!

eanders-ms commented 1 year ago

@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.

martinwork commented 1 year ago

@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 commented 1 year ago

@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.