cancel
Showing results for 
Search instead for 
Did you mean: 

Using flash algorithm from F103 for F405

JReed.1856
Associate II

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?

6 REPLIES 6
TDK
Guru

> 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.

If you feel a post has answered your question, please click "Accept as Solution".
JReed.1856
Associate II

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?

Correct in that you can’t erase only part of a sector. I imagine erase times will be longer as well. They are listed in the datasheet and will vary based on the sector.
If you feel a post has answered your question, please click "Accept as Solution".

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.

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..
JReed.1856
Associate II

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?

gbm
Lead III

The execution starts by fetching the first two words of memory, so there must be at least 8 bytes used at 0x08000000.