I was reading up on the flash eeprom and best I can tell for the stm32f chips this is needed. micromouseusa.com/
Has Keil mdk5 not provided a simple function?
To post source use PRE tags
1MB Flash on Die (all parts) Sec# 0 16K 0x08000000 1 16K 0x08004000 2 16K 0x08008000 3 16K 0x0800C000 4 64K 0x08010000 5 128K 0x08020000 6 128K 0x08040000 7 128K 0x08060000 8 128K 0x08080000 9 128K 0x080A0000 10 128K 0x080C0000 11 128K 0x080E0000
See Data Sheet and Reference Manual
The value of using the small sectors is that they don't eat into the code space budget as much, and erase faster. Think the erase time is mentioned in DS, but depends on age and voltage.
The use of journalling is strongly recommended to reduce wear. Erase only needs to occur after sector completely consumed, many examples will ping-pong between two sectors to reduce window for data loss.