AnsweredAssumed Answered

How to use >32k of flash?

Question asked by ANDERS FAGERSTROM on Apr 14, 2008
Latest reply on Aug 6, 2008 by ANDERS FAGERSTROM
Hi there,
I'm using the MC9S12GC64. Just recently the code size has grown above 32k, and therefor I have upgraded to Code Warrior V4.6 with a license to link 64k of code.
This is how my .prm file has looked up until now. I have only used the non banked ROM. (The RAM setup in Start12.c is according to the serial monitor example.)
...SEGMENTS    RAM = READ_WRITE 0x3000 TO 0x3FFF;                /* unbanked FLASH ROM */    ROM_4000 = READ_ONLY  0x4000 TO 0x7FFF;       ROM_C000 = READ_ONLY  0xC000 TO 0xFEFF;              /* banked FLASH ROM */    PAGE_3C = READ_ONLY  0x3C8000 TO 0x3CBFFF;                              PAGE_3D = READ_ONLY  0x3D8000 TO 0x3DBFFF;ENDPLACEMENT    _PRESTART, STARTUP,    ROM_VAR, STRINGS,    VIRTUAL_TABLE_SEGMENT,    DEFAULT_ROM, NON_BANKED,    COPY                                             INTO  ROM_4000, ROM_C000;     OTHER_ROM                    INTO  PAGE_3D, PAGE_3C;                   DEFAULT_RAM                  INTO  RAM;ENDSTACKSIZE 0x100

Now I obviously need to do something to be able to go above 32k. One way would be to use the banked ROM. I suppose I then would need to use pragma directives to move e.g. constants to page 3c and 3d, right? I have fiddled a lot with this but have not been able to get it to work. What do I need to do with registers like PPAGE etc. in the Start12.c file?? How do I use the pragma directives? Can I just define any code like this:
#pragma CODE_SEG OTHER_ROM // Banked
static const signed int myVar[400]=....
#pragma CODE_SEG DEFAULT // back to non banked
Or have I completely misunderstood??
Also, I searched the forums here and found another idea: a linear mapping model that would allow for 48k of non banked memory. This would definately cover my needs and sounds very attractive and simple. However, I tried to add this to the .prm file:
ROM_8000 = READ_ONLY  0x8000 TO 0xBFFF;  
I did manage to compile and link but have not got the code to run. Again, I read that it might be that this area are is not flashed??
If I could keep everything within non banked 48k of ROM, I think I would prefer that, but any help would be appreciated. There has been many postings about memory mapping but I fear that I might lack the basic understanding to use the information I have found so far.