Memorry allication

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

Memorry allication

1,915 Views
NZ_Design
Contributor I
Is there a reason for not being able to declear my memory allocation like this

BATTERY_RAM       INTO  NO_INIT     0x200000'G TO 0x2FFFFF'G;   // CS1 BatteryRAM;

If I declear it as such GPage never changes an thus the 0xFFFF blocks of memory get corrupted as the data exceeds 0xFFFF.

But if I declear it like this.

BATTERY_RAM          INTO  NO_INIT     0x200000'G TO 0x20FFFF'G;   // CS1 BatteryRAM;
BED_RAM                   INTO  NO_INIT  0x210000'G TO 0x21FFFF'G;   // CS1 BatteryRAM;
EXTERNAL_RAM        INTO  NO_INIT  0x220000'G TO 0x22FFFF'G;   // CS1 BatteryRAM;

It is fine.

If the first one should work if I have an array the covers 2 GPages does code warrior cope I am I safer to declear it the secound way.

Using a HCS12XDP512MAG processor

Code worrior IDE 5.7 and HCS(X)12 v4.5

Thanks
Labels (1)
0 Kudos
1 Reply

258 Views
CompilerGuru
NXP Employee
NXP Employee
The S12X instruction set performs all address calculations on 16 bit only, it does not propagate overflows into the page.

LDX #FFFE
MOVB #0x0F, __GPAGE_ADR
GSTX 2,X

will write to 0xF0000'G, so the 2,X addition overflows and wraprs around.


Daniel
0 Kudos