I have been experimenting with MicroPython and CircuitPython on rpi Pico. The Adafruit Pico Feather and QTPY 2040 have 8MB flash storage . In CircuitPython shows up as 7MB, but Micropython shows up as 3 MB. The Pico board has 4MB, but in Micropython storage shows up as 1.3MB.
Is this an error?
File size differences
Re: File size differences
For the Adafruit boards the board definition seems wrong. The are all listed wih 8 MByte flash. Maybe Adafruit changed the board specs. The Raspberry Pi Pico has 2 MB flash, at least the devices I have here. So 1.3MB is fine.
Re: File size differences
Circuitpython reports 7mb storage while micropython reports 3mb for the same board.
Re: File size differences
Seems to be. Sparkfun's ThingPlus and ProMicro have a 16MB Flash chip fitted and those expose 15MB for the file system.
I don't like that one has to specify a board when building firmware; it would be much nicer if MicroPython could figure out how much Flash there was at power-up and configure itself appropriately. That would also avoid having to jump through hoops when the firmware is extended and the supposed file system size won't fit.
Re: File size differences
I think the flash definition in the pico-sdk is wrong for some of the Adafruit boards. I think we've fixed it upstream. We don't use those specs in CircuitPython (we dynamically detect it, which messes up the arduino...). We were originally going to ship with 4MB flash but 8MB was in stock so we switched it at the last minute.
Re: File size differences
I noticed that an update was made to the github file for Adafruit's QTYPY_RP2040 where the size of the flash was increased. When I ran it, however I got this error:
[ 70%] Building C object CMakeFiles/firmware.dir/rp2_flash.c.obj
In file included from /home/chris/micropython/py/obj.h:29,
from /home/chris/micropython/py/mpstate.h:35,
from /home/chris/micropython/py/runtime.h:29,
from /home/chris/micropython/ports/rp2/rp2_flash.c:29:
/home/chris/micropython/ports/rp2/rp2_flash.c:45:1: error: static assertion failed: "MICROPY_HW_FLASH_STORAGE_BYTES too big"
45 | static_assert(MICROPY_HW_FLASH_STORAGE_BYTES <= PICO_FLASH_SIZE_BYTES, "MICROPY_HW_FLASH_STORAGE_BYTES too big");
| ^~~~~~~~~~~~~
make[3]: *** [CMakeFiles/firmware.dir/build.make:2900: CMakeFiles/firmware.dir/rp2_flash.c.obj] Error 1
make[2]: *** [CMakeFiles/Makefile2:1498: CMakeFiles/firmware.dir/all] Error 2
make[1]: *** [Makefile:84: all] Error 2
make: *** [Makefile:19: all] Error 2
Now it's too big?
[ 70%] Building C object CMakeFiles/firmware.dir/rp2_flash.c.obj
In file included from /home/chris/micropython/py/obj.h:29,
from /home/chris/micropython/py/mpstate.h:35,
from /home/chris/micropython/py/runtime.h:29,
from /home/chris/micropython/ports/rp2/rp2_flash.c:29:
/home/chris/micropython/ports/rp2/rp2_flash.c:45:1: error: static assertion failed: "MICROPY_HW_FLASH_STORAGE_BYTES too big"
45 | static_assert(MICROPY_HW_FLASH_STORAGE_BYTES <= PICO_FLASH_SIZE_BYTES, "MICROPY_HW_FLASH_STORAGE_BYTES too big");
| ^~~~~~~~~~~~~
make[3]: *** [CMakeFiles/firmware.dir/build.make:2900: CMakeFiles/firmware.dir/rp2_flash.c.obj] Error 1
make[2]: *** [CMakeFiles/Makefile2:1498: CMakeFiles/firmware.dir/all] Error 2
make[1]: *** [Makefile:84: all] Error 2
make: *** [Makefile:19: all] Error 2
Now it's too big?
Re: File size differences
Not surprising because I would expect PICO_FLASH_SIZE_BYTES to be set at 2MB, because that's what the Raspberry Pi PIco actually has. However, who knows.mwalimu wrote: ↑Tue Aug 03, 2021 3:43 pm/home/chris/micropython/ports/rp2/rp2_flash.c:45:1: error: static assertion failed: "MICROPY_HW_FLASH_STORAGE_BYTES too big"
45 | static_assert(MICROPY_HW_FLASH_STORAGE_BYTES <= PICO_FLASH_SIZE_BYTES, "MICROPY_HW_FLASH_STORAGE_BYTES too big");
| ^~~~~~~~~~~~~
Now it's too big?
~/pico/micropython/lib/pico-sdk/src/boards/include/boards/adafruit_qtpy_rp2040.h
Code: Select all
#ifndef PICO_FLASH_SIZE_BYTES
#define PICO_FLASH_SIZE_BYTES (8 * 1024 * 1024)
#endif
The practice of naming things "Pico" when that should be a generic "RP2" with "Pico" being a sub-set of that was a nightmare waiting to happen in my view.
It's even worse when something called "Pico" means some other board entirely.
IMO that should be BOARD_FLASH_SIZE_BYTES or similar and be set in the MicroPython board definition file - Though I still favour having no board definitions at all with MicroPython figuring it out at runtime.
Re: File size differences
Yeah even rp2 is problematic because the "2" here refers to the number of cores. I don't think there's a generic name for the family of chips?