title: Force compiler/linker to group variables (physically in consecutive RAM locations) as defined
body: <p>How can I force the complier (with option switches I assume) to group variables together in physical, consecutive RAM locations in the order defined ? I don't really care where it starts (that is - where it puts <code>MinWaitTime</code>. However, <code>FaultCode</code> must be located immediately after <code>MinWaitTime</code> in RAM. It cannot put it somewhere else.</p>
  
  <p>I thought of creating a section, but this will only guarantee that they are placed together, and not necessarily in the order they were defined.</p>
  
  <p>I know that I could create and array to force the issue, but I would like to avoid it.</p>
  
  <p>Any suggestions ?</p>
  
  <p>For instance if <code>MinWaitTime</code> was at address 0x20000000, I want <code>FaultCode</code> defined at 0x20000002, and every other variable in that order.</p>
  
  <pre><code>unsigned short  MinWaitTime;        // reg 450
  
  unsigned short  FaultCode;          // reg 451
  
  unsigned short  FaultReg1;          // reg 452
  
  unsigned short  FaultReg2;          // reg 453
  
  unsigned short  Reserved2;          // reg 454
  
  unsigned short  Reserved3;          // reg 455
  
  unsigned short  SystemStatusReg1;   // reg 456
  
  unsigned short  SystemStatusReg2;   // reg 457
  </code></pre>
  
  <p>The complier is GCC.</p>