Hi Guys
I am really new to embedded software programming and as part of a project I am required to write a HAL for the Flash for erase and write operations. The write operations to be supported are 8-bit unsigned bytes at any address, 16-bit unsigned words at an even address, and 32-bit unsigned long words on an address evenly divisible by 4. The HAL should support the allocation of Flash memory at the user’s request.
Also to do this I am restricted to the first 8-byte phrase of Sector 0 of Flash Block 2. I am including the work I have done so far using KDS 3.0 and would really appreciate if someone could help me out with programming the Flash HAL.
Thanks
Original Attachment has been moved to: Flash-Project.zip
Hello Musfiqur Sakib:
I sincerely apologize that you did not receive an answer before.
Just in case your project is still pending or for anyone else looking for information, the driver approach you are looking for is not feasible with the K70. This MCU has the FTFE flash memory module, whose smallest programming size is 8-bytes (phrase) and the programming address needs to be aligned to 8-bytes as well, not any random address. Also before programming any byte of the same phrase you have to erase the complete phrase. See the next discussions about this topic:
What are the rules for random writes to Flash? (K64)
FTFL FTFE Flash controller behaviour
Kinetis K10FX512 read flash hard fault
If you are interested in a Ready-to-use Flash driver for K70 instead of developing your own, then you can go with the C90TFS flash driver, downloadable from the next link:
http://cache.freescale.com/files/32bit/software/C90TFS_FLASH_DRIVER.exe
The driver provides APIs to erase and write the Flash memory, as well as the manual and some example projects.
Regards!
Jorge Gonzalez