Separate main.py vs embedding into hex

Questions and discussion about running MicroPython on a micro:bit board.
Target audience: MicroPython users with a micro:bit.
Post Reply
User avatar
aivarannamaa
Posts: 22
Joined: Fri Sep 22, 2017 3:19 pm
Location: Estonia
Contact:

Separate main.py vs embedding into hex

Post by aivarannamaa » Tue Jul 16, 2019 7:54 pm

Hi everybody!

Are there any benefits of embedding main code into hex file instead of uploading plain firmware and main.py separately?

Does one of these approaches allow longer programs?

Best regards,
Aivar

User avatar
jimmo
Posts: 791
Joined: Tue Aug 08, 2017 1:57 am
Location: Sydney, Australia

Re: Separate main.py vs embedding into hex

Post by jimmo » Tue Jul 16, 2019 10:32 pm

On the micro:bit, the difference is fairly small.

To allow for the largest possible program, put your main.py in the hex and put additional modules into the filesystem. (But be aware that flashing the hex file may erase the filesystem).

One advantage of putting code in the filesystem is that it's faster to upload, because you don't have to flash the entire device for every code change. Although if you install the latest daplink firmware and use recent versions of Mu, then flashing the hex file is a lot faster anyway. https://support.microbit.org/support/so ... -micro-bit

Post Reply