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?
Ok I have it working now, much clearer picture. I see now I'll need some type of shadow array to hold the writes as I progress thru the code as I can only write a page at a time. Using my last sector would be far to wasteful and using the first has that bootloader issue that can be addressed but is a pain to deal with at first.
I just want to rule out the hole in the middle possibility?
code fake eeprom or nvram code code code...
Is there anyway possibly of using IROM so that the code can be split up to have a hole in the middle for this fake nvram.
Use a scatter file that puts the vector/reset stuff low in flash, leaves space for your configuration flash area and add a section for everything else past the configuration flash area you want to use.
Along these lines?
LR_IROM1 0x08000000 0x00804000 { ; vector/reset ER_IROM1 0x08000000 0x08004000 { ; *.o (RESET, +First) *(InRoot$Sections) .ANY (+RO) } RW_IRAM1 0x08004000 0x08008000 { ; eeprom area .ANY (+RW +ZI) } }
LR_IROM2 0x08008000 0x08100000 { ER_IROM2 0x08008000 0x08100000 { ; remaining of code.. .ANY (+RO) } }
Hope this is more readable.
LR_IROM1 0x08000000 0x00804000 { ; vector/reset
ER_IROM1 0x08000000 0x08004000 { ;
*.o (RESET, +First)
*(InRoot$Sections)
.ANY (+RO)
}
RW_IRAM1 0x08004000 0x08004000 { ; eeprom area
.ANY (+RW +ZI)
LR_IROM2 0x08004000 0x08100000 {
ER_IROM2 0x08004000 0x08100000 { ; remaing of code..
"You can write you firmware to do anything you want. The High order 128KB sectors are certainly usable, the erase time is significant."
The stm32f207 has a flash size of 128k. From what I know this is sectors 0-4 for firmware. Can I access and use the upper memory sector 5 for my NVRAM area? My thinking is if I use that, there is no way the firmware will ever grow past the fake eeprom area.
This is something that you will understand best if you do it yourself. You should try to build with that scatter file and see what fails. You have a general idea of how to use the scatter file to do what you want to do, but have a few errors that you will go "why was I thinking that would work" once you figure them out.
One hint: +RW variables cannot go into flash. // this is actually more than 1 hint
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.