Tim Maloy

MCF52235, CW 7.1  Same types using different amounts of memory

Discussion created by Tim Maloy on Nov 26, 2008
Latest reply on Nov 27, 2008 by Rich Testardi
In MCF52235_INTERNAL_FLASH.elf.xMAP all variables of the same type are listed as the same size, but they do not always use the same number of bytes.
Why is this?
 
snippet from xMAP
#>20000610          __START_BSS (linker command file)
  20000610 00000001 .bss    ticks (main.c)
  20000611 00000001 .bss    mS_250 (main.c)
  20000612 00000001 .bss    error (main.c)
  20000614 00000002 .bss    txfint (main.c)
  20000616 00000002 .bss    rxfint (main.c)
  20000618 00000002 .bss    myrdar (main.c)
  2000061A 00000002 .bss    mytdar (main.c)
  2000061C 00000002 .bss    txfcount (main.c)
  2000061E 00000002 .bss    rxfcount (main.c)
  20000620 00000004 .bss    udp_pcbs (udp.c)
  20000624 00000001 .bss    mem_sem (mem.c)
  20000628 00000004 .bss    lfree (mem.c)
 
You can see that
"ticks" begins at 610 and uses 1 byte
"mS_250" begins at 611 and uses 1 byte
"error" begins at 612 but uses 2 bytes
All three of these variables are declared as type "uint8" and all are initialized to zero,
so why are they using different amounts of memory.
At 624 you can see "mem_sem" is 1 byte but uses 4 bytes
 
Size must have preference over speed in this project.
Any help is greatly appreciated
 
C_F_S

Outcomes