<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Application struct alignment not working correctly in CodeWarrior for MCU</title>
    <link>https://community.nxp.com/t5/CodeWarrior-for-MCU/Application-struct-alignment-not-working-correctly/m-p/243857#M9470</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;can you please upload your demo code in zip thus we can check it directly here?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Fri, 28 Jun 2013 01:58:56 GMT</pubDate>
    <dc:creator>ZhangJennie</dc:creator>
    <dc:date>2013-06-28T01:58:56Z</dc:date>
    <item>
      <title>Application struct alignment not working correctly</title>
      <link>https://community.nxp.com/t5/CodeWarrior-for-MCU/Application-struct-alignment-not-working-correctly/m-p/243856#M9469</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P style="min-height: 8pt; padding: 0px;"&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have an application I'm building that includes libraries from several other projects.&lt;/P&gt;&lt;P style="min-height: 8pt; padding: 0px;"&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have all the projects set to use coldfire struct alignment, but it only seems to work for the library projects and not the main project.&lt;/P&gt;&lt;P style="min-height: 8pt; padding: 0px;"&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;For example, in my main() function I create a new class object and the sizeof() will return 2256 bytes. Then I create an instance of the exact same type from code that is linked from another project and it returns 2286.&lt;/P&gt;&lt;P style="min-height: 8pt; padding: 0px;"&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;If I look at the memory layout of the two structures, it is very easy to see that one shows up as byte aligned while the other is not. If I set all the projects to use single byte alignment then everything matches, but I don't want to use single byte alignment. I want to use word aligntment.&lt;/P&gt;&lt;P style="min-height: 8pt; padding: 0px;"&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Any suggestions on how I can force word alignment on my project?&lt;/P&gt;&lt;P style="min-height: 8pt; padding: 0px;"&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Edit: I look at the disassembler and the sizeof() operator compiles to two different numbers for the same depending on which project it's compiled from.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 28 Jun 2013 00:33:18 GMT</pubDate>
      <guid>https://community.nxp.com/t5/CodeWarrior-for-MCU/Application-struct-alignment-not-working-correctly/m-p/243856#M9469</guid>
      <dc:creator>dan_quist</dc:creator>
      <dc:date>2013-06-28T00:33:18Z</dc:date>
    </item>
    <item>
      <title>Re: Application struct alignment not working correctly</title>
      <link>https://community.nxp.com/t5/CodeWarrior-for-MCU/Application-struct-alignment-not-working-correctly/m-p/243857#M9470</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;can you please upload your demo code in zip thus we can check it directly here?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 28 Jun 2013 01:58:56 GMT</pubDate>
      <guid>https://community.nxp.com/t5/CodeWarrior-for-MCU/Application-struct-alignment-not-working-correctly/m-p/243857#M9470</guid>
      <dc:creator>ZhangJennie</dc:creator>
      <dc:date>2013-06-28T01:58:56Z</dc:date>
    </item>
  </channel>
</rss>

