Carl Norman

String alignment issue

Discussion created by Carl Norman on Mar 25, 2010
Latest reply on Mar 26, 2010 by CompilerGuru

Hi,

 

(CW7.1.2 patch build 11)

 

How do I get my string alignment to stop adding extra bytes in the following example?

 

Example:

 

nvm.c

 

volatile uchar ID1[12] = "123456789";

volatile uchar ID2[12] = "987654321";

 

linker:

 

 .NVM_Page:
 {
  nvm.c (.data)
  nvm.c (.rodata)
  nvm.c (.text)
 } > my_NVM

 

map file:

10060026 0000000C .data   ID1(nvm.c)
10060034 0000000C .data   ID2(nvm.c)

 

The map file shows ID2 at 0x10060034 instead of 0x10060032. If I change ID1 array to ID1[14], ID2 array is still at 10060034. Single byte varibles, 2 byte varibles are fine, its just arrays as far as i can tell.

 

What do I need to do to fix this issue?

Outcomes