Post Go back to editing

Store a variable in Flash

Hello

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
  • Hi,

    Apologies for delay in response.

    We are attached a simple C bare metal code for SPI Flash read and write in Quad mode. Please refer this code.

    Regards,
    Anand Selvaraj.

  • Hello 

    I tried this example given in the forum for SC584 EZ kit.

     (Missing Wiki Page) 

    The program runs fine and it displays on console the flash basic information. I ran this project in debug mode when my Switch SW1 is in position 1 which is actually Boot from Flash Mode. After running this project and again powering off and then on the board the system fault red LED is glowing continuously. And when I try to flash the chip in no boot mode and again resetting the board after changing the SW1 position to 1 then also led still continuously glows and my project didn't boot from the flash. This same behavior happen on two of my evaluation kit and in both now I am not able to boot my project from flash. What might be the issue can you guide me? It will be of great help.  

Reply
  • Hello 

    I tried this example given in the forum for SC584 EZ kit.

     (Missing Wiki Page) 

    The program runs fine and it displays on console the flash basic information. I ran this project in debug mode when my Switch SW1 is in position 1 which is actually Boot from Flash Mode. After running this project and again powering off and then on the board the system fault red LED is glowing continuously. And when I try to flash the chip in no boot mode and again resetting the board after changing the SW1 position to 1 then also led still continuously glows and my project didn't boot from the flash. This same behavior happen on two of my evaluation kit and in both now I am not able to boot my project from flash. What might be the issue can you guide me? It will be of great help.  

Children
No Data