AnsweredAssumed Answered

Store a variable inside a Flash

Question asked by Utsavi Kalpesh Bharuchwala on Aug 4, 2015
Latest reply on Aug 7, 2015 by Jorge_Gonzalez




I am working with TWR-K60D100M a CodeWarrior v10.6 and of MQXv4.0.


I am working on FNET Demo of Ethernet Bootloader. Demo works perfectly.


I am trying to shape FNET demo as per my requirements.


What problem I am facing is, I am using a variable that I need to store inside Flash (Read and write from Flash).


When I tried to assign a static Flash address say 0x00008000 compiler will not show me error but when I am debugging code, The code is stuck at the point.


Say int *p;

p = 0x00008000;


//my stuff..



*p = 4;  <-- Debugging Stuck at this point.


So What I tried is to put the Variable inside fapp_params_flash



struct fapp_params_flash


    char signature[FAPP_PARAMS_SIGNATURE_SIZE]; /**< @brief Signature string.@n

                                                 * It's used for simple check if configuration

                                                 * structure is present in a persistent storage.*/

     int My_Bit;                              //Variable that Need to store in Flash.


    struct fapp_params_fnet fnet_params;        /**< @brief FNET TCP/IP stack specific

                                                 * configuration parameters.*/

    struct fapp_params_boot boot_params;        /**< @brief Bootloader specific

                                                 * configuration parameters*/

    struct fapp_params_tftp tftp_params;        /**< @brief TFTP loader specific

                                                 * configuration parameters.*/



(which is storing a data into flash from address 0x7F800) what that doesn't work (I removed all error and download code).


Can anybody tell me exactly procedure that how to store a variable inside a flash? if any further information then please let me inform.



Utsavi Bharuchwala