The MCF52258/9 Coldfire processor has 512 kBytes of internal 32 bit flash. In our design we have divided the 512 kBytes into blocks for specific purposes. We have allocated 64 kBytes for a boot-loader, two blocks of 32 kBytes for non-volatile persist memory, and two blocks for two copies of the firmware. One copy of firmware runs while newer code can be downloaded to the other block.
So the requirement is to be able to erase a section of flash memory and be able to write new data or code to the section that was erased. I would think this would be common firmware design.
I've read the MCF52259 Coldfire reference manual on this topic. The logical page erase procedure in the manual is understandable, although it would be nice to provide examples. However, the flash program example and information is not straigthforward. I'm confused by the mention of a backdoor flash address with little information on it. Plus there is no direct #define definition for this important address in any of the ".h" files.
I would really appreciate any help with clues and examples in this effort.
Best Regards
Kent
Hi Kent
The backdoor access means that you need to add the following to the address in flash that you want to work with:
(IPSBAR + 0x4000000)
You can get all code and (personal) support for this in the uTasker project, including being able to simulate the flash operation (with assertions on bad use of flash which could fail due to not fully respecting rules, etc.); it includes all modules you need to do such work fast and efficiently (including boot loaders, M522xx simulator, file system designed especially for M522xx internal flash use (plus FAT32 in case needed) and a parameter system designed to safely work with parameters (based on swap blocks to allow old parameter retrieval in case of emergencies, fail save updates etc.).
Regards
Mark