ram to flash function

キャンセル
次の結果を表示 
表示  限定  | 次の代わりに検索 
もしかして: 

ram to flash function

ソリューションへジャンプ
1,551件の閲覧回数
Stevanatto
Contributor II

Hi,

I wanto to store the value of a variable before disconnect my Qorivva Microcontrller.

If it was possible:

 

int my_var1 = 7; // RAM variable

const int my_var2; // FLASH variable

void ram2flash(void)

{

     my_var2 = my_var1;

}   

and once I run ram2flash  than I have 7 stored in my_var2 even if I restart.

ラベル(1)
0 件の賞賛
返信
1 解決策
1,178件の閲覧回数
stanish
NXP Employee
NXP Employee

Carlos,

You cannot assign a variable value to a constant. It does not work this way.

in order to modify Flash memory you need to use special routines to erase/program flash memory.

Also Flash memory can be erased/programmed in blocks in contrast to EEPROM.

Please refer to the reference manual of your MCU, section "C90LC Flash memory" for more details about Flash memory programming.

You can possibly re-use some existing C90LC Flash memory drivers available on Freescale web.

e.g.:

Freescale Search

BR

Stanislav

元の投稿で解決策を見る

0 件の賞賛
返信
3 返答(返信)
1,178件の閲覧回数
Stevanatto
Contributor II
0 件の賞賛
返信
1,179件の閲覧回数
stanish
NXP Employee
NXP Employee

Carlos,

You cannot assign a variable value to a constant. It does not work this way.

in order to modify Flash memory you need to use special routines to erase/program flash memory.

Also Flash memory can be erased/programmed in blocks in contrast to EEPROM.

Please refer to the reference manual of your MCU, section "C90LC Flash memory" for more details about Flash memory programming.

You can possibly re-use some existing C90LC Flash memory drivers available on Freescale web.

e.g.:

Freescale Search

BR

Stanislav

0 件の賞賛
返信
1,178件の閲覧回数
TICS_Fiona
NXP Employee
NXP Employee

If you use the default New Project wizard settings, the Internal ROM target links all constants into the .rodata, the .rdata and the .sdata2 sections for you. The following code snippets show how this is done.

Snippet of .lcf file :

----------------------


MEMORY

{

    boot_flash:           org = 0x00000000,   len = 0x00010000

    interrupts_flash:     org = 0x00010000,   len = 0x00010000

    internal_flash:       org = 0x00020000,   len = 0x00060000

    internal_ram:         org = 0x40000000,   len = 0x00007C00

    stack_ram:            org = 0x40007C00,   len = 0x0400

}

...

 
   GROUP : {
     .intc_sw_isr_vector_table ALIGN (2048) : {} /* For INTC in SW Vector Mode */

       .text_vle (VLECODE) ALIGN(0x1000): {
             *(.text)
             *(.text_vle)
             *(.fini)
             *(.eini)
         }
       .init  : {}
       .init_vle (VLECODE) : {
             *(.init)
             *(.init_vle)
          }
        .ctors : {}
        .dtors : {}
        .rodata (CONST) : {
            *(.rdata)
            *(.rodata)
         }
     .sdata2       : {}
     extab      : {}
     extabindex : {}
  }  > internal_flash

0 件の賞賛
返信