HCS12XDP512 LARGE ARRAY USING GLOBAL ADDRESSING

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

HCS12XDP512 LARGE ARRAY USING GLOBAL ADDRESSING

1,131 Views
PCC
Contributor I
Hi, we use the 16 bit 9S12xDP512 µc.
 
We want to use a 8K array (struct) in the paged RAM. We use this declaration
 
#pragma DATA_SEG __GPAGE_SEG GLOBAL_RAM
struct T__LICODE __far Licode;
GLOBAL_RAM is placed in    RAM_OF_GLOBAL =  READ_WRITE  0xF81000'G TO 0xFB1FFF'G;
We use codewarrior V4.6 developpment tools and Isystem Ione emulator.
 
This declarations are correct? if no,  can we give us the good declarations?
 
Thanks in advance.
 
 
 
Labels (1)
0 Kudos
Reply
1 Reply

403 Views
CompilerGuru
NXP Employee
NXP Employee
 
>#pragma DATA_SEG __GPAGE_SEG GLOBAL_RAM
>struct T__LICODE __far Licode;

The __far is not wrong, but not actually necessary as the __GPAGE_SEG implies far access. I would suggest to drop the __far, and only write it if you want a __far/global access to something not allocated __far/global.

>GLOBAL_RAM is placed in    RAM_OF_GLOBAL =  READ_WRITE  0xF81000'G TO 0xFB1FFF'G;

That looks very suspicious, is probably wrong.
0xF81000 for RAM is a logical address (0xF81000'L), not a global one. The corresponding global address is 0xF8000'G. Likewise use 0xFBFFF'G instead of 0xFB1FFF.
Note that 0xF8000'G..0xFBFFF'G is a 16k area, so if you only need 8k, use just the half of it.
(0xF8000'G ..0xF9FFF'G).

Mapping in between global and logical addresses is actually not that hard, there is also a simplistic executable at
"C:\Program Files\Freescale\CodeWarrior for HCS12 V4.7\Prog\hcs12xadrmap.exe"
which provides the basic translation via UI.


Daniel


0 Kudos
Reply