how much code may be sent to BBC micro:bit?

Posted on
  • Hi folks,

    given the low amount of free memory in a BBC micro:bit

    >process.memory()
    ={ free: 280, usage: 20, total: 300, history: 0,
      gc: 0, gctime: 2.83813476562, blocksize: 12, "stackEndAddress": 536884560, flash_start: 0,
      "flash_binary_end": 258580, "flash_code_start": 260096, flash_length: 262144 }
    

    is there an estimate of how much code may be sent to that device without causing a LOW_MEMORY error?

    That code should also be able to be saved, of course.

    Or, is there way to build larger code from smaller pieces (e.g. by saving individual functions rather than a whole bunch of them)?

    Thanks in advance for any help!

    With greetings from Germany,

    Andreas Rozek

  • Hi - sorry for the delay, just saw this.

    In terms of RAM it's blocksize*free - so 3360 bytes. The reality is it's slightly less than that due to various overheads.

    However there is 2k of flash available, and if you save code to flash it'll be executed from there and won't use RAM, so I'd suggest doing that - so you get 2k of code space plus 3k of RAM.

  • Post a reply
    • Bold
    • Italics
    • Link
    • Image
    • List
    • Quote
    • code
    • Preview
About

how much code may be sent to BBC micro:bit?

Posted by Avatar for Andreas_Rozek @Andreas_Rozek

Actions