pybflash size

The official pyboard running MicroPython.
This is the reference design and main target board for MicroPython.
You can buy one at the store.
Target audience: Users with a pyboard.
Post Reply
JimTal001
Posts: 176
Joined: Thu Jul 30, 2015 4:59 pm

pybflash size

Post by JimTal001 » Fri Aug 21, 2015 6:07 pm

Just received my pyboard today and have a general question.

Windows 7 reports that the flash (pybflash) size is roughly 100 kb while the specs state:

1024KiB flash ROM and 192KiB RAM

Can anyone explain?

Thanks

blmorris
Posts: 348
Joined: Fri May 02, 2014 3:43 pm
Location: Massachusetts, USA

Re: pybflash size

Post by blmorris » Fri Aug 21, 2015 6:53 pm

The size of the PYBFLASH volume is 112 kBytes, which is the sum of the four flash sectors that are used by the volume (16 + 16 + 16 + 64 kB).
The Flash on the STM32F405 is broken into 13 sectors: the first four are 16kB, the next is 64kB, and the last 7 are 128kB. The first sector is where the code starts to execute on startup, so it isn't usable for the PYBFLASH volume. Unfortunately, the 128kB sectors are too large to be used for the PYBFLASH; they do not fit into the 64kB section of RAM which is used for the read-modify-write operation required to write to the Flash. (They could conceivably provide a read-only volume, but as far as I know nobody has tried to implement that yet.)

-Bryan

User avatar
dhylands
Posts: 3384
Joined: Mon Jan 06, 2014 6:08 pm
Location: Peachland, BC, Canada
Contact:

Re: pybflash size

Post by dhylands » Fri Aug 21, 2015 7:49 pm

Everything bryan said is correct.

When the board is in DFU mode, you can see that the flash is laid out as follows (from dfu-util -l)

Found DFU: [0483:df11] ver=2200, devnum=12, cfg=1, intf=0, alt=0, name="@Internal Flash /0x08000000/04*016Kg,01*064Kg,07*128Kg", serial="355B36523033"
d which is the 1024K of flash.

The first 16K hold the reset vector/interrupt vectors. As Bryan mentioned, the remaining 3 16K + 64K = 112K is used for the filesystem that you're seeing in windows. The remainder is used to hold code. The micropython firmware is about 270K. So that means that there is currently about 400K of flash which isn't being used.

The firmware image is larger when networking is added into the mix.

Post Reply