bbcmicrobit / micropython

Port of MicroPython for the BBC micro:bit
https://microbit-micropython.readthedocs.io
Other
603 stars 284 forks source link

uflash a script produces different results to putting main.py #620

Closed rhubarbdog closed 5 years ago

rhubarbdog commented 5 years ago

if i flash my script typing uflash test_fs.py it crashes OSError: 28 on line 14. But if i flash my script with command uflash then add my program with ufs put test_fs.py main.py it runs ok

here's a copy of the offending program test_fs.py.txt

dpgeorge commented 5 years ago

If you flash a script using uflash test_fs.py then this script is put at location 0x3e000 which takes away 8k of flash from the filesystem.

If you don't append a script and just flash the firmware on its own, then the filesystem can use as much room as possible all the way up to 0x40000 (256k, but minus 1k for the compass calibration data). So that's why you are able to write a large file in this case.

It's recommended to use ufs put to copy across main.py if you need lots of free space on the filesytem.