Brennan Dayberry

Simple FLASH storage of C array (MC9S08DZ60)

Discussion created by Brennan Dayberry on Feb 20, 2008
Latest reply on Feb 25, 2008 by Jim Donelson
I have been lookign around on the forums trying to find a simple way of using the flash memory to store a C array in my main code. I simply need to store a long array of integers into flash, from a function in my main.c file. I need this C array to be stored in flash because it will need to access the same data after device shutdowns and reboots. Ideally, I'd like to just access it as an array like:

AverageMPGdata[index]=data;

So I want the array stored in an unused block/segment of the flash, or multiple segments if the size requires it, and be able to just treat it as an array from my C code. Is this possible? Everything I have found on using the flash is either about setting up the flash memory for the program storage or involves complex assembly code to access the flash. Could anyone help me with this? I know C well and am high on the learning curve for my device, the MC9S08DZ60 on the DEMO9S08DZ60 board from axiom. I am developing in the codewarrior IDE and using the device initialization tool to create an MCU_Init(); for all the device initialization. Any help that any one can offer is very appriciated.

Outcomes