Banked memory with a 9S12DP256

Started by ssinfod December 5, 2005
Hi,

I am using CodeWarrior 3.1 and also use the banked memory model on a
9S12DP256.

I would like to know if it is mandatory to allocate at least one
segment in a NON-Banked location.

Right now, my prm looks like this :

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NAMES END

SEGMENTS

EEPROM = NO_INIT 0x0400 TO 0x0FFF;
RAM = READ_WRITE 0x1000 TO 0x3F50;

PAGE_30 = READ_ONLY 0x308000 TO 0x30BFFF;
PAGE_31 = READ_ONLY 0x318000 TO 0x31BFFF;
PAGE_32 = READ_ONLY 0x328000 TO 0x32BFFF;
PAGE_33 = READ_ONLY 0x338000 TO 0x33BFFF;
PAGE_34 = READ_ONLY 0x348000 TO 0x34BFFF;
PAGE_35 = READ_ONLY 0x358000 TO 0x35BFFF;
PAGE_36 = READ_ONLY 0x368000 TO 0x36BFFF;
PAGE_37 = READ_ONLY 0x378000 TO 0x37BFFF;
PAGE_38 = READ_ONLY 0x388000 TO 0x38BFFF;
PAGE_39 = READ_ONLY 0x398000 TO 0x39BFFF;
PAGE_3A = READ_ONLY 0x3A8000 TO 0x3ABFFF;
PAGE_3B = READ_ONLY 0x3B8000 TO 0x3BBFFF;
PAGE_3C = READ_ONLY 0x3C8000 TO 0x3CBFFF;
//PAGE_3D = READ_ONLY 0x3D8000 TO 0x3DBFFF;
//not used : equivalent to ROM_8000
//PAGE_3E = READ_ONLY 0x3E8000 TO 0x3EBFFF;
//not used : equivalent to ROM_4000
//PAGE_3F = READ_ONLY 0x3F8000 TO 0x3FBFFF;
//not used : equivalent to ROM_C000

ROM_4000 = READ_ONLY 0x3E8000 TO 0x3EBFFF;
ROM_8000 = READ_ONLY 0x3D8000 TO 0x3DBFFF;
ROM_C000 = READ_ONLY 0x3F8000 TO 0x3FB7FF;

END
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

With this PRM file I have the following linker warning :
L1128: Cutting value pZeroOut startup data member from 0x3F805D to
0x805D
L1128: Cutting value toCopyDownBeg startup data member from 0x3F80C7
to 0x80C7
L1128: Cutting value libInits startup data member from 0x3F8062 to
0x8062
L1128: Cutting value initBodies startup data member from 0x3F8064 to
0x8064
L1128: Cutting value finiBodies startup data member from 0x3F8064 to
0x8064

But the warning dissapears if I set ROM in the NON-Banked area like
this in the PRM.
ROM_4000 = READ_ONLY 0x4000 TO 0x7FFF;
ROM_8000 = READ_ONLY 0x8000 TO 0xBFFF;
ROM_C000 = READ_ONLY 0xC000 TO 0xF7FF;

Is it mandatory to set the ROM_C000 at 0xC000 and not at 0x3F8000 ?

I would like to define the ROM at 3F8000 because it this case my .s28
would contains only s2 records..

Any idea ?

Thanks


All those warnings are not the real problem you are facing with this prm
file.
The real problem is that the linker will use 0x8000..0xBFFF addresses
for all your objects, including the ones which have to be non banked,
like the address of all interrupt handlers or the address of the
_Startup function.
So to answer your question: You have to list the non banked areas with
their non banked address. If you list them with the banked alias areas,
the linker will use the banked alias addresses, and those do not work
for non banked accesses.

If you want to have a SRecord with just paged addresses, use a batch
burner file *.bbl to map all the non banked addresses to banked address.

PS: As ROM_8000 is in a area controlled by PPAGE I would define it with
the "ROM_8000 = READ_ONLY 0x3D8000 TO 0x3DBFFF;" area anyway.
But define the ROM_4000 and ROM_C000 areas with their non banked addresses.

Daniel

>Hi,
>
>I am using CodeWarrior 3.1 and also use the banked memory model on a
>9S12DP256.
>
>I would like to know if it is mandatory to allocate at least one
>segment in a NON-Banked location.
>
>Right now, my prm looks like this :
>
>- - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
>NAMES END
>
>SEGMENTS
>
> EEPROM = NO_INIT 0x0400 TO 0x0FFF;
> RAM = READ_WRITE 0x1000 TO 0x3F50;
>
> PAGE_30 = READ_ONLY 0x308000 TO 0x30BFFF;
> PAGE_31 = READ_ONLY 0x318000 TO 0x31BFFF;
> PAGE_32 = READ_ONLY 0x328000 TO 0x32BFFF;
> PAGE_33 = READ_ONLY 0x338000 TO 0x33BFFF;
> PAGE_34 = READ_ONLY 0x348000 TO 0x34BFFF;
> PAGE_35 = READ_ONLY 0x358000 TO 0x35BFFF;
> PAGE_36 = READ_ONLY 0x368000 TO 0x36BFFF;
> PAGE_37 = READ_ONLY 0x378000 TO 0x37BFFF;
> PAGE_38 = READ_ONLY 0x388000 TO 0x38BFFF;
> PAGE_39 = READ_ONLY 0x398000 TO 0x39BFFF;
> PAGE_3A = READ_ONLY 0x3A8000 TO 0x3ABFFF;
> PAGE_3B = READ_ONLY 0x3B8000 TO 0x3BBFFF;
> PAGE_3C = READ_ONLY 0x3C8000 TO 0x3CBFFF;
> //PAGE_3D = READ_ONLY 0x3D8000 TO 0x3DBFFF;
> //not used : equivalent to ROM_8000
> //PAGE_3E = READ_ONLY 0x3E8000 TO 0x3EBFFF;
> //not used : equivalent to ROM_4000
> //PAGE_3F = READ_ONLY 0x3F8000 TO 0x3FBFFF;
> //not used : equivalent to ROM_C000
>
> ROM_4000 = READ_ONLY 0x3E8000 TO 0x3EBFFF;
> ROM_8000 = READ_ONLY 0x3D8000 TO 0x3DBFFF;
> ROM_C000 = READ_ONLY 0x3F8000 TO 0x3FB7FF;
>
>END
>- - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
>
>With this PRM file I have the following linker warning :
>L1128: Cutting value pZeroOut startup data member from 0x3F805D to
>0x805D
>L1128: Cutting value toCopyDownBeg startup data member from 0x3F80C7
>to 0x80C7
>L1128: Cutting value libInits startup data member from 0x3F8062 to
>0x8062
>L1128: Cutting value initBodies startup data member from 0x3F8064 to
>0x8064
>L1128: Cutting value finiBodies startup data member from 0x3F8064 to
>0x8064
>
>But the warning dissapears if I set ROM in the NON-Banked area like
>this in the PRM.
> ROM_4000 = READ_ONLY 0x4000 TO 0x7FFF;
> ROM_8000 = READ_ONLY 0x8000 TO 0xBFFF;
> ROM_C000 = READ_ONLY 0xC000 TO 0xF7FF;
>
>Is it mandatory to set the ROM_C000 at 0xC000 and not at 0x3F8000 ?
>
>I would like to define the ROM at 3F8000 because it this case my .s28
>would contains only s2 records..
>
>Any idea ?
>
>Thanks >Yahoo! Groups Links




> But the warning dissapears if I set ROM in the NON-Banked area
> like
> this in the PRM.
> ROM_4000 = READ_ONLY 0x4000 TO 0x7FFF;
> ROM_8000 = READ_ONLY 0x8000 TO 0xBFFF;
> ROM_C000 = READ_ONLY 0xC000 TO 0xF7FF;

ROM_8000 is in the BANKED area... (ppage window)

bela


Hi,

Here are contents of a prm (just the for codespace) and a burn file.
They are used for a 9S12DP512. Hope this is helpful.

.prm:
// this read only ROM and is the CODESPACE
// unbanked sections of ROM span from 0x4000 to 0x7FFF
// and from 0xC000 to 0xFFFF
// these are mirrored with banked sections from
// 0x3E0000 to 0x3FFFFF

UNBANKED_ONE = READ_ONLY 0x4000 TO 0x7FFF;
UNBANKED_TWO = READ_ONLY 0xC000 TO 0xFEFF;

// banked ROM (shows up from 0x8000 to 0xBFFF)
// which bank shows at 0x8000 depends on the PPAGE register
// note how the banks grow 'downwards'
// chips with more flash ROM will have the
// extra ROM at 'lower' addresses
// note that 0x3E0000 to 0x3FFFFF is mirrored unbanked
// space - do not declare it here
BANK_1 = READ_ONLY 0x3D8000 SIZE 0x4000;
BANK_2 = READ_ONLY 0x3C8000 SIZE 0x4000;
BANK_3 = READ_ONLY 0x3B8000 SIZE 0x4000;
BANK_4 = READ_ONLY 0x3A8000 SIZE 0x4000;
BANK_5 = READ_ONLY 0x398000 SIZE 0x4000;
BANK_6 = READ_ONLY 0x388000 SIZE 0x4000;
// etc until the lowest bank (0x20) .inc:

#the intent of this procedure is to map the sx
#file into something that can be understood by our
#upgrade utility and accepted by the bootloader

#we are keeping the banks as they are mapped in flash
#check page 16 of FTS512K4 Block User Guide
# V01.06 for the S12 w/512K of ram to find the memory map

#if you examine the mapping below, you will find that
#the only changes made are on the very bottom of the list
#those are for the mirrored banks which appear
#regardless of what page is setup

burnsx:

$(BURN_) OPENFILE "$(BURN_DEST_FILE_)" format=motorola busWidth=1
SRECORD=Sx len=0x4000\
origin=0x208000 destination=0x208000
SENDBYTE 1 "$(BURN_SRC_FILE_)"
origin=0x218000 destination=0x218000
SENDBYTE 1 "$(BURN_SRC_FILE_)"

.. from 0x22 to 0x2C

origin=0x3D8000 destination=0x3D8000
SENDBYTE 1 "$(BURN_SRC_FILE_)"
origin=0x004000 destination=0x3E8000
SENDBYTE 1 "$(BURN_SRC_FILE_)"
origin=0x00C000 destination=0x3F8000
SENDBYTE 1 "$(BURN_SRC_FILE_)"
CLOSE