Post Go back to editing

Store a variable in Flash


I am working on a project which requires some variables to be retained i.e. the value should not changed even after I switch off the system. I thought of storing such variable in a flash. But didn't know how to go ahead in the code to make that variable sit in flash. Also I want that project to be also loaded from flash. I am able to create the loader file and successfully able to boot from flash. But I need to retain some of the variable of the project. Is there any way to achieve this i.e simultaneously store the variable as well as the whole project in a flash and boot it from there. I am using SC584 Eval Kit for the project. Any guidance or sample code will be helpful.

Thanking You

Anukul Anand

Parents Reply Children
  • Hello

    I tried the above attachment and it worked fine. This is able to write and read whole flash in debug mode. My requirement is this:

    1. One Main application will be flashed.

    2. There will be some configuration information such 10KB of data.

    3. The main application will write these info in specified location (which doesn't hinder the already occupied location by main app) on the flash and retain it.

    4. The main application can also read the config info already written before.

    How to know when a loader file is loaded to flash how much space it will take and how much space is available for further writing. Is there any way to get this info. 

    Any idea regarding this will be helpful.

    Anukul Anand

  • Hi,

    The Loader file does indeed contain additional information. This is covered in the 'File Formats' topic within the Loader and Utilities Manual. The Loader file will be significantly larger that the actual space required due to the headers for each record. There is no automated way to get the sizing information, you would need to extract the size from each record's header within the Loader file.

    Please refer the below CCES help path for Loader and Utilities Manual :
    CrossCore® Embedded Studio (version) > SHARC® Development Tools Documentation > Loader and Utilities Manual or please refer the below link.

    We suggest you to write in the last block of the Flash memory, so that main application will not overwritten.

    Anand Selvaraj.

  • Thank You for the valuable guidance. I am now able to work with flash memory as per my requirement. 


    Anukul Anand