AnsweredAssumed Answered

how to use the internal extended flash eeprom of the chip of mc68hc912dg128ccpv?

Question asked by meng zhang on Jun 16, 2015
Latest reply on Jun 19, 2015 by ZhangJennie

Several days before,i have contacted the freescale fae to seek for some methods to manipulate the external dual-port ram.

We have accomplished this goal by receiving a demo code.

Our's chip of mc68hc912dg128ccpv has a 128K bytes of flash eeprom,we are not sure of whether this 128K bytes flash eeprom is read-only or read-write?

because we may have a code of 100K bytes,maybe 50K bytes of them need to operate to  read and write,i think ram(0x2000-0x3FFF) is not adequate.

So i program a code below,in this code, i want to set page3,page4,page5 to be internal expended ram space to make the data can be read and write,just leave page0,page1,page2 to be internal rom to. be read only.

 

some code below in project.prm:

SEGMENTS

    RAM            = READ_WRITE 0x2000 TO 0x3FFF;

    /* unbanked FLASH ROM */

    FLASH_PAGEC000 = READ_ONLY  0xC000 TO 0xFEFF; 

    /* banked EXTERNAL FLASH RAM */

    FLASH_PAGE4000 = READ_WRITE  0x4000 TO 0x7FFF;        //set 4000-7FFF to be external ram

    /* banked FLASH RAM */

    FLASH_PPAGE3   = READ_WRITE 0x38000 TO 0x3BFFF;       //set page3,4,5 to be internal ram    

    FLASH_PPAGE4   = READ_WRITE 0x48000 TO 0x4BFFF;            

    FLASH_PPAGE5   = READ_WRITE 0x58000 TO 0x5BFFF;

    /* banked FLASH ROM */

    FLASH_PPAGE0   = READ_ONLY 0x08000 TO 0x0BFFF;        //set page0,1,2 to be internal rom

    FLASH_PPAGE1   = READ_ONLY 0x18000 TO 0x1BFFF;

    FLASH_PPAGE2   = READ_ONLY 0x28000 TO 0x2BFFF;

    EEPROM         = READ_WRITE 0x0800 TO 0x0FFF;

END

PLACEMENT

    _PRESTART,                 

    STARTUP,                   

    ROM_VAR,                

    STRINGS,                   

    VIRTUAL_TABLE_SEGMENT,     

    NON_BANKED,               

    COPY                         INTO FLASH_PAGEC000/*, FLASH_PAGE4000*/;      //original ram

    DEFAULT_ROM                  INTO FLASH_PPAGE0, FLASH_PPAGE1, FLASH_PPAGE2;

    SSTACK,             

    DEFAULT_RAM                  INTO RAM;

    /* set banked EXTERNAL FLASH RAM */

    MY_EX_RAM_PG               INTO  FLASH_PAGE4000;       //external ram

.........................................

 

a part of the code in main.c:

#pragma DATA_SEG   MY_EX_RAM_PG                            //set dataRAM array in external ram

uchar dataRAM[0x4000];

#pragma DATA_SEG __PPAGE_SEG  FLASH_PPAGE3                 //set ram01 array in  page3

uchar  RAM01[0x4000];

#pragma DATA_SEG __PPAGE_SEG  FLASH_PPAGE4                 //set ram02 array in  page4

uchar  RAM02[0x4000];

#pragma DATA_SEG __PPAGE_SEG  FLASH_PPAGE5                 //set ram03 array in  page5

uchar  RAM03[0x4000];

#pragma DATA_SEG  DEFAULT

    some code has been omit.......

    RAM01[0] = 0x0A;                                       //i want to use this array RAM01[0]

...............................

 

compiler tell me the mistakes as follows:

Link Error   : L1102: Out of allocation space in segment RAM at address 0x2101

Link Error   : Link failed

 

i have set the option :PPAGE is used for banking.

so i do not know how to set the internal expended ram,and rom. how to use anything in page3 or page2?how to use RAM02[ xx] array?

we can see the code in demo code:

pragma CONST_SEG __PPAGE_SEG MY_EX_RAM_PG0A

UBYTE dataROM_02[0x4000];

how to visit datarom_02[0]? read-only?

Outcomes