2022-03-30 07:29 AM
Hi,
I am trying to use a flash write and read module written for the STM32F103 on an STM32F405.
However the F103 deals with pages and subpages. Some algorithms depend on subpage size. The F405 has sectors, which I guess are the equivalent to pages, but nothing for subpages. How can I have the same functionality with as little change to the code as possible? How do the two flash concepts relate to each other?
2022-03-30 07:51 AM
> How do the two flash concepts relate to each other?
Sectors on the F4 are analogous to pages on the F1. Sectors are not constant size, which is presumably (?) why they chose a different name.
I don't see any mention of "subpage" in the F1 datasheet or reference manual. Perhaps this is terminology created by your code.
2022-03-30 08:12 AM
Right, the subpages were a custom definition, I hadn't noticed that.
Regarding the sectors and pages, the sector size will come into play when erasing sectors, correct? Since blanking a page will require the full page to be erased, I expect erasing to take a lot longer than on the F103, or is there something I am missing?
2022-03-30 08:26 AM
2022-03-30 01:11 PM
You'll likely have to adapt, the F2/F4 have some very large sectors, with long erase times.
If you need smaller ones, you'll need to carve out some space after the first sector (16KB) which is needed, to free up the other 16KB and 64KB ones for usage.
I'd typically commit the first 16KB sector for a boot-loader, which can validate application placed at the 64KB+ or 128KB+ boundaries.
There isn't the opportunity to use 256, 512 byte, and 1K blocks like there were in the older F1 parts.
2022-03-30 11:41 PM
That's some good info, thanks. However wouldn't it be easier to put the entire application in a higher part of the flash, instead of having a bootloader in the lower parts?
If I define a section in the memory part of the linker file such as:
FLASHUPPER (rx) : ORIGIN = 0x08020000, LENGTH = 384K
and place everything that was supposed to be in FLASH at FLASHUPPER, would this cause problems? What about the .ARM parts etc. mentioned in the generated linker file?
2022-03-31 04:20 AM
The execution starts by fetching the first two words of memory, so there must be at least 8 bytes used at 0x08000000.