Take as an example the stm32f429. The flash memory is separated into 11 sectors:

sectors 0,1,2 and 3: 16KB each

sector 4: 64 KB

sectors 5-11: 128 KB each

What is the deal here?

  • 2
    \$\begingroup\$ You can run code out of one of them while erasing another, that way. Protection schemes can also play a role. I haven't looked at that device, so I can't say if that matters here, though. \$\endgroup\$ – jonk Feb 16 '18 at 18:41
  • \$\begingroup\$ Adding to the correct comment above. You could want to reserve some sectors for something else than code, and update just that, either by processor code or by external programmer. \$\endgroup\$ – linuxfan Feb 16 '18 at 18:59
  • \$\begingroup\$ @jonk But why so many sectors? What you are implying can be achieved with a lot less sectors. \$\endgroup\$ – hadez Feb 16 '18 at 19:03
  • \$\begingroup\$ @linuxfan : To reserve a sector for something other than code, I would need to provide the address for the specified sector to the linker. This could easily be achieved if all the flash memory was a single sector too and I would simply specify an address range for non-code purposes. I don't understand how creating all these sectors would help me in this case? \$\endgroup\$ – hadez Feb 16 '18 at 19:07
  • 1
    \$\begingroup\$ @hadez the Renesas r8c and m16c have multiple sectors exactly for that (virtual eeprom). You write data in one of them, appending instead of overwriting (so you don't erase). When the sector is full, you copy the valid data in another one, erase the original, and restart. More: these two sectors have longer life (number of erasures) in respect of the other (meant for code). \$\endgroup\$ – linuxfan Feb 16 '18 at 19:14

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.