Byte align base address of class - CW6.4 on 5282

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

Byte align base address of class - CW6.4 on 5282

2,079 Views
odnt
Contributor I
CW6.4 on 5282

I have byte - aligned a class and placed it (nearly) at my desired memory location; however, I need it to start at a byte address, and it always increments to the next 2-byte address. How do I get "Instance" the be a 0x7000000f ?  My .lcf, .cpp, and .xMAP file entries are below. Thank you.

MEMORY {
    TEXT (RX) : ORIGIN = 0x00000500, LENGTH = 0    # using External DRAM
    DATA   (RW) : ORIGIN = AFTER(TEXT), LENGTH = 0
    myIOSpace (RW) : ORIGIN = 0x7000000f
}
SECTIONS {
...
    .mySection :
    {
      *(.Space1)
    } > myIOSpace
...

---------------------------------------------------------
class myClass
{
public:
  unsigned char yyy;
  unsigned char zzz;
  myClass(void)
  {
    yyy = 3;
    zzz = 4;
  }
};
---------------------------------------------------------
#pragma define_section mySpace ".Space1" far_absolute
__declspec(mySpace) myClass Instance;

int main()
{
  while(1);
}
---------------------------------------------------------
# .mySection
  70000010 00000002 .Space1 Instance    (main.c)

Labels (1)
0 Kudos
Reply
2 Replies

513 Views
Black
Contributor I

This can be done via the lcf file with the ALIGNALL(1); directive which overrides the more "natural" alignment. The ALIGNALL directive forces minimum alignment for all objects in the current segment to the specified value.

Please consult the CodeWarrior for ColdFire V6.4 install folder\Help\PDF\ColdFire_Build_Tools_Reference.pdf manuals for more details.

0 Kudos
Reply

513 Views
Arev
Contributor III
Hello,

Use the following pragma:
 
 #pragma options align=packed
 
I Hope this helps..

Bye
0 Kudos
Reply