External SRAM problem in CodeWarrior V4.5 for hCS12

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

External SRAM problem in CodeWarrior V4.5 for hCS12

1,654 Views
eddie
Contributor I
Hi
using  Axiom EVB9S12NE64.
trying to use external SRAM in banked memory model
 can't bank SRAM in banked memory model.OK
I can live with 24K
issue is PRM file
here's segments & placement:
SEGMENTS
RAM=READ_WRITE 0x400 TO 7FFF; //internal SRAM
ERAM=READ_WRITE 0x200 to 0x7FFF; //24K of external SRAM
ROM_C000=READ_ONLY 0xC000 to 0x777F; //unbanked flash
PAGE_3C=READ_ONLY 0x3C8000 to 0x3CBFFF; //banked flash
END
PLACEMENT
_PRESTART,STARTUP,ROM_VAR,STRINGS,VIRTUAL_TABLE_SEGMENT,NON_BANKED,
COPY INTO ROM_C000;
DEFAULT_ROM INTO PAGE_3C;
DEFAULT_RAM INTO RAM,ERAM;
END
I try to write/verify to 24K in SRAM(big array) in main()
Code compiles okay but write/verify doesn't work
If I modify placement like so,it works if I use a DATA_SEG pragma to reference EXTRAM
my 24K array is placed inside the DATA_SEG pargma and an END
 
PLACEMENT
_PRESTART,STARTUP,ROM_VAR,STRINGS,VIRTUAL_TABLE_SEGMENT,NON_BANKED,
COPY INTO ROM_C000;
DEFAULT_ROM INTO PAGE_3C;
DEFAULT_RAM INTO RAM;
EXTRAM INTO ERAM;
END
I'm sure I'm setting up PEAR,MODE,EBICTL,MISC correctly or the second method
wouldn't work
My second solution isn't workable for me.I need the compiler to be able to use internal RAM
and external SRAM contiguously for variables,arrays etc.
Help!I am going mad.
 
 
 
 
Labels (1)
Tags (1)
0 Kudos
Reply
2 Replies

716 Views
slyfox
NXP Employee
NXP Employee
Hi eddie,
 
Is that still a problem?
I'm assuming you have no overlaps in your SEGMENT definitions (might be typos).
 
Then try the following:
In the first option (PLACEMENT with DEFAULT_RAM INTO RAM,ERAM:smileywink: the linker fills RAM first then ERAM;
To place a variable/constant explicitely in the ERAM space define the variable with the @<address> modifier, e.g. unsigend int myvariable @0x2000 =10;
 
If you use DATA_SEG pragma with extra segment for ERAM, then you have to switch the memory segment back to default before defining a variable for the RAM area (#pragma DATA_SEG DEFAULT).
Alternatively, you define the extra segment for ERAM and immediately switch back to default, then you can use the @"<segment>" modifier to define a var for ERAM like this:
unsigend int myvariable @"EXTRAM" =10;
 

716 Views
eddie
Contributor I
Mr SlyFox
I appreciate your reply.
I had a couple of typo's on posting my PRM stuff here.
RAM is actually at 0x400 to 0x1fff.ERAM is actually at
0x2000 to 0x7fff.
Bummer that method 1 doesn't work.The only way that
I can get my external SRAM to work is by using method 2
which really limits my application a lot.I wish freescale
provided a few more code examples of various apps(maybe
they could check the Zilog website and study it).I would
definitely like to see a code example where external SRAM is utilized in the banked memory model.On the other
hand,maybe there are lots of code examples that I haven't
found.
Signing off...
0 Kudos
Reply