SmartTech wrote: ↑Thu Sep 24, 2020 11:45 am
Is there any way to increase pyboard PBV11 flash drive?
The chip has a fixed amount of flash that needs to be used for firmware and filesystem. You can't increase this internal storage, however you could add an external spiflash chip and put the filesystem on there instead.
However, the MicroPython firmware assumes that it should reserve 112kiB for the filesystem, allowing 896kiB for the MicroPython firmware (including any frozen modules).
The PYBV11 firmware only needs about ~400k, so **in theory** there's a fair bit that can be reallocated to the filesystem. However, it's more complicated than that...
On the F405 you have the following sectors
0: 16kiB
1: 16kiB
2: 16kiB
3: 16kiB
4: 64kiB
5: 128kiB
6: 128kiB
7: 128kiB
8: 128kiB
9: 128kiB
10: 128kiB
11: 128kiB
The default layout is to put the bootloader in sector 0, the filesystem in sectors 1,2,3,4 (112kiB), and the firmware in the remaining sectors (5,6,7,8,9,10,11).
But the issue is that (on STM32F4) you can only erase on a whole-sector boundary, but our filesystems (FAT, LFS) work on much smaller block sizes. So that means you need a in-RAM cache that is as big as the largest sector so that you can do read-update-write to the whole sector. Unfortunately, we only have 64kiB of RAM available for a cache (in CCMRAM) so that means we're limited to just using the sectors that are 64kiB or smaller (i.e. 0-4) for the filesystem.
If you need more space for Python code, I suggest freezing the Python code instead (which will make it part of the firmware). For other resources (such as images or data files), then you can also freeze them into the firmware too -- see
https://github.com/micropython/micropyt ... -562918657