S12XDT256 and CW4.5: How to include one of the RAM pages in link map

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

S12XDT256 and CW4.5: How to include one of the RAM pages in link map

3,382件の閲覧回数
Sten
Contributor IV
Could somebody give me a quick hint how to get more RAM than the non-paged 8k I by default have in the range 2000..3fff. I had thought that I could use one of the 4k pages at 1000..1fff (RPAGE = fd, XGATE uses page fc) and have one linear RAM area at 1000...3fff, but the program hangs in the Init()-routine in start12.c.
 
What am I doing wrong?
 
 
ラベル(1)
0 件の賞賛
返信
5 返答(返信)

874件の閲覧回数
CompilerGuru
NXP Employee
NXP Employee
Check the
(CodeWarrior_Examples)\HCS12X\BankedData
sample.
Also read the comments in "S12X Examples.pdf" in "(CodeWarrior_Examples)\HCS12X" for this sample.

I guess the solution to your current problem is mentioned in there:
>3) make sure to specify the option -D__FAR_DATA and
>–PsegObj on the compiler
>command line. This will enable the correct initialization
>in the startup code.

There are also two good technical notes about this topic, I forgot the numbers tough. I think the technical notes are a separate download, and they contain an overview pdf, so should be easy to find once you have them installed.

Daniel
0 件の賞賛
返信

874件の閲覧回数
Sten
Contributor IV
Thanks Daniel for your reply, but I have already done that. My compiler options are the following:
 
Code:
-CPUHCS12X -D_BootLoader -D__FAR_DATA -D__NO_FLOAT__ -Lasm=%n.lst -Mb -Ot -Onf -OiLib=a -OnB=abl -OnCstVar -OnPMNC -PSegObj -TuE

 
Here are som extracts from my PRM file:
Code:
/* non-paged RAM */      STK           = READ_WRITE    0x3D00 TO   0x3FFF;      RAM           = READ_WRITE    0x2000 TO   0x3CFF ALIGN 2[1:1]; /* word align for XGATE accesses */../* paged RAM:                       0x1000 TO   0x1FFF; addressed through RPAGE */      RAM_XGATE_STK = READ_WRITE  0xFC1000 TO 0xFC10FF; /* The stack is set by the XGATE compiler option -Cstv=C100 */      RAM_FC        = READ_WRITE  0xFC1100 TO 0xFC1FFF ALIGN 2[1:1]; /* is also mapped to XGATE:  0xC100..0xCFFF */  //  RAM_FD        = READ_WRITE  0xFD1000 TO 0xFD1FFF ALIGN 2[1:1]; /* is also mapped to XGATE:  0xD000..0xDFFF *//*    RAM_FE        = READ_WRITE  0xFE1000 TO 0xFE1FFF; intentionally not defined: equivalent to RAM: 0x2000..0x2FFF *//*    RAM_FF        = READ_WRITE  0xFF1000 TO 0xFF1FFF; intentionally not defined: equivalent to RAM: 0x3000..0x3FFF */..    //SSTACK,                 /* allocate stack first to avoid overwriting variables */      SHARED_DATA,            /* variables that are shared between CPU12 and XGATE */      DEFAULT_RAM             /* all variables, the default RAM location */                        INTO  RAM;      SSTACK            INTO  STK;      XGATE_VECTORS,          /* XGATE vector table has to be copied into RAM by HCS12X */      XGATE_STRING,           /* XGATE string literals have to be copied into RAM by HCS12X */      XGATE_CONST,            /* XGATE constants have to be copied into RAM by HCS12X */      XGATE_CODE,             /* XGATE functions have to be copied into RAM by HCS12X */      XGATE_STRING_RAM,       /* XGATE strings that should always go into RAM */      XGATE_CONST_RAM,        /* XGATE constants what should always go into RAM */      XGATE_CODE_RAM,          /* XGATE code that should always run out of RAM */      XGATE_DATA              /* data that are accessed by XGATE only */                        INTO  RAM_FC /*, RAM_FD */;      //PAGED_RAM               /* paged data accessed by CPU12 only */      //                  INTO  /* when using banked addressing for variable data, make sure to specify       //                           the option -D__FAR_DATA on the compiler command line */      //                        RAM_FD /*, RAM_FC */;

 
I had assumed that I just could change the start address of the RAM segment from 2000 to 1000 (and assure that the RPAGE is set to FD) without having to do anything else (as converting the whole program to paged data with three-byte pointers and such). When I look at the datasheet, I get the impression that one RAM-page always should be present between 1000...1fff, and so it lookes when I look at the area with the debugger, but when I try it the program crashes in the init()-routine.
 
thanks for any further info
 
Sten
 
 
 
0 件の賞賛
返信

874件の閲覧回数
CompilerGuru
NXP Employee
NXP Employee
Ah, ok.
The prm you showed is not actually using the FD RPAGE page, but I can guess what change you did.

Then I think the problem you have is because of the ambiguity of the address 0x1000.
You take it as 16 bit address, but it can also be interpreted as 24 bit address with the meaning of "RPAGE == 0", offset == 0x1000.
This interpretation actually accesses the register area, global address 0.

Anyway, try this:
     RAM0          = READ_WRITE  0xFD1000 TO 0xFD1FFF ALIGN 2[1:1];
     RAM1          = READ_WRITE    0x2000 TO   0x3CFF ALIGN 2[1:1];

...
DEFAULT_RAM             /* all variables, the default RAM location */
                        INTO  RAM1, RAM0;


Daniel
0 件の賞賛
返信

874件の閲覧回数
Sten
Contributor IV
Thanks Daniel,
 
that did work exactly as I wanted!
 
Sten
 
0 件の賞賛
返信

874件の閲覧回数
Sten
Contributor IV
Thanks again Daniel,
 
will try it immedetially monday morning, and post the result here.
 
Sten
 
0 件の賞賛
返信