<?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: HC(S)12 Compiler alignment in CodeWarrior for MCU</title>
    <link>https://community.nxp.com/t5/CodeWarrior-for-MCU/HC-S-12-Compiler-alignment/m-p/303232#M10801</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello Carlos,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If your strSType struct located in flash is initialized by the code in your project e.g.:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;const strSType&amp;nbsp; struct_in_Flash = { "hello", {0,1},'1',0x1234....}&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;then you don't have to consider any padding bytes/alignments within the structure.&lt;/P&gt;&lt;P&gt;But you should&amp;nbsp; possibly consider alignment of byte array by[512]&amp;nbsp; if you require better speed performance.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;What kind of problem do you observe? Can you please describe it more in the detail?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Stan&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Tue, 07 Apr 2015 14:14:39 GMT</pubDate>
    <dc:creator>stanish</dc:creator>
    <dc:date>2015-04-07T14:14:39Z</dc:date>
    <item>
      <title>HC(S)12 Compiler alignment</title>
      <link>https://community.nxp.com/t5/CodeWarrior-for-MCU/HC-S-12-Compiler-alignment/m-p/303228#M10797</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;I'm developing on the S912ZVML12 using codewarrior. Is there any possibility to force alignment for a variable.&lt;/P&gt;&lt;P&gt;Something linke this:&lt;/P&gt;&lt;P&gt;volatile uint8 SomeArray[6][4] __attribute__((aligned (4)));&lt;/P&gt;&lt;P&gt;With this line of code the Compiler writes:&lt;/P&gt;&lt;P&gt;"volatile uint8 SomeArray[6][4] __attribute__((aligned (4))) =&amp;gt; illegal or unsupported __attribute__"&lt;/P&gt;&lt;P&gt;How can the 32bit alignment forced for this Array?&lt;/P&gt;&lt;P style="min-height: 8pt; padding: 0px;"&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 22 May 2014 09:20:57 GMT</pubDate>
      <guid>https://community.nxp.com/t5/CodeWarrior-for-MCU/HC-S-12-Compiler-alignment/m-p/303228#M10797</guid>
      <dc:creator>markuskandler</dc:creator>
      <dc:date>2014-05-22T09:20:57Z</dc:date>
    </item>
    <item>
      <title>Re: HC(S)12 Compiler alignment</title>
      <link>https://community.nxp.com/t5/CodeWarrior-for-MCU/HC-S-12-Compiler-alignment/m-p/303229#M10798</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thank you for your post, however please consider moving it to the right community place (e.g. &lt;A _jive_internal="true" class="jivecontainerTT-hover-container jive-link-community-small" data-containerid="1" data-containertype="14" data-objectid="2020" data-objecttype="14" href="https://community.nxp.com/community/codewarrior"&gt;CodeWarrior Development Tools&lt;/A&gt; or &lt;A _jive_internal="true" class="jivecontainerTT-hover-container jive-link-community-small" data-containerid="1" data-containertype="14" data-objectid="2017" data-objecttype="14" href="https://community.nxp.com/community/16bit"&gt;16-bit Microcontrollers&lt;/A&gt; ) to get it visible for active members.&lt;/P&gt;&lt;P&gt;For details please see general advice &lt;A _jive_internal="true" data-containerid="2001" data-containertype="14" data-objectid="99909" data-objecttype="102" href="https://community.nxp.com/docs/DOC-99909"&gt;Where to post a Discussion?&lt;/A&gt; (&lt;A _jive_internal="true" data-containerid="2001" data-containertype="14" data-objectid="99909" data-objecttype="102" href="https://community.nxp.com/docs/DOC-99909"&gt;https://community.freescale.com/docs/DOC-99909&lt;/A&gt; )&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thank you for using Freescale Community. &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 26 May 2014 08:20:24 GMT</pubDate>
      <guid>https://community.nxp.com/t5/CodeWarrior-for-MCU/HC-S-12-Compiler-alignment/m-p/303229#M10798</guid>
      <dc:creator>Wlodek_D_</dc:creator>
      <dc:date>2014-05-26T08:20:24Z</dc:date>
    </item>
    <item>
      <title>Re: HC(S)12 Compiler alignment</title>
      <link>https://community.nxp.com/t5/CodeWarrior-for-MCU/HC-S-12-Compiler-alignment/m-p/303230#M10799</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello Markus,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;This feature has been added into the latest relase CodeWarrior for MCU v10.6.&lt;/P&gt;&lt;P&gt;You can download it here:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;A href="http://www.freescale.com/webapp/sps/site/prod_summary.jsp?code=CW-MCU10&amp;amp;fpsp=1&amp;amp;tab=Design_Tools_Tab" title="http://www.freescale.com/webapp/sps/site/prod_summary.jsp?code=CW-MCU10&amp;amp;fpsp=1&amp;amp;tab=Design_Tools_Tab"&gt;CW-MCU10: CodeWarrior for MCUs (Eclipse IDE) - ColdFire, 56800/E DSC, Kinetis, Qorivva 56xx, RS08/S08, S12Z&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Stan&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 28 May 2014 14:49:03 GMT</pubDate>
      <guid>https://community.nxp.com/t5/CodeWarrior-for-MCU/HC-S-12-Compiler-alignment/m-p/303230#M10799</guid>
      <dc:creator>stanish</dc:creator>
      <dc:date>2014-05-28T14:49:03Z</dc:date>
    </item>
    <item>
      <title>Re: HC(S)12 Compiler alignment</title>
      <link>https://community.nxp.com/t5/CodeWarrior-for-MCU/HC-S-12-Compiler-alignment/m-p/303231#M10800</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello Stanislav,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I´m having alignment problems too and I wonder how can I apply the&amp;nbsp; __attribute__((aligned())) in my case:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;- I have a struct (let´s call it strSType) with several fields with varying sizes (char F1[11], word F2[2], char F3, dword F4...)&lt;/P&gt;&lt;P&gt;- I read a byte array from memory (let´s say flash) and I want to cast this array so that I can access it by field: &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;byte by[512];&lt;/P&gt;&lt;P&gt;strSType *pstr;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;ReadFromFlash(by,512);&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;pstr=(strSType *)by;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;.... And the use &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;pstr-&amp;gt;F1[]...&lt;/P&gt;&lt;P&gt;pstr-&amp;gt;F4...&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Any suggestion?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks in advance&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 07 Apr 2015 07:20:08 GMT</pubDate>
      <guid>https://community.nxp.com/t5/CodeWarrior-for-MCU/HC-S-12-Compiler-alignment/m-p/303231#M10800</guid>
      <dc:creator>cabl</dc:creator>
      <dc:date>2015-04-07T07:20:08Z</dc:date>
    </item>
    <item>
      <title>Re: HC(S)12 Compiler alignment</title>
      <link>https://community.nxp.com/t5/CodeWarrior-for-MCU/HC-S-12-Compiler-alignment/m-p/303232#M10801</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello Carlos,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If your strSType struct located in flash is initialized by the code in your project e.g.:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;const strSType&amp;nbsp; struct_in_Flash = { "hello", {0,1},'1',0x1234....}&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;then you don't have to consider any padding bytes/alignments within the structure.&lt;/P&gt;&lt;P&gt;But you should&amp;nbsp; possibly consider alignment of byte array by[512]&amp;nbsp; if you require better speed performance.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;What kind of problem do you observe? Can you please describe it more in the detail?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Stan&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 07 Apr 2015 14:14:39 GMT</pubDate>
      <guid>https://community.nxp.com/t5/CodeWarrior-for-MCU/HC-S-12-Compiler-alignment/m-p/303232#M10801</guid>
      <dc:creator>stanish</dc:creator>
      <dc:date>2015-04-07T14:14:39Z</dc:date>
    </item>
    <item>
      <title>Re: HC(S)12 Compiler alignment</title>
      <link>https://community.nxp.com/t5/CodeWarrior-for-MCU/HC-S-12-Compiler-alignment/m-p/303233#M10802</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello Stan,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;thanks for the answer.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I´m trying to read data from an external flash memory and process it (for example, reading the master boot record of a FAT filesystem). As I read an array of bytes (let´s call it byArr[512]) without padding bytes but my structure has padding bytes I cannot simply cast the byte array to my struct and expect that each field is located where it should.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;For example, I read the 512 bytes of the master boot record of the FAT, and try to cast this byte array to the structure:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;typedef struct _MasterBoot_Entries&lt;/P&gt;&lt;P&gt;{&lt;/P&gt;&lt;P&gt;&amp;nbsp; UINT8&amp;nbsp;&amp;nbsp; ExcecutableCode[446];&lt;/P&gt;&lt;P&gt;&amp;nbsp; Partition_Entries Partitions[4];&lt;/P&gt;&lt;P&gt;&amp;nbsp; UINT16&amp;nbsp; MBRSignature;&lt;/P&gt;&lt;P&gt;}MasterBoot_Entries;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;It happens that ((&lt;SPAN style="font-size: 13.3333330154419px;"&gt;MasterBoot_Entries *&lt;/SPAN&gt;)&lt;SPAN style="font-size: 13.3333330154419px;"&gt;byArr)-&amp;gt;&lt;SPAN style="font-size: 13.3333330154419px;"&gt;MBRSignature does not match the real value, which is *((UINT16 *)&amp;amp;&lt;SPAN style="font-size: 13.3333330154419px;"&gt;byArr[510]&lt;/SPAN&gt;).&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;It happens the same with all the fields in each &lt;SPAN style="font-size: 13.3333330154419px;"&gt;((&lt;/SPAN&gt;&lt;SPAN style="font-size: 13.3333330154419px;"&gt;MasterBoot_Entries *&lt;/SPAN&gt;&lt;SPAN style="font-size: 13.3333330154419px;"&gt;)&lt;/SPAN&gt;&lt;SPAN style="font-size: 13.3333330154419px;"&gt;byArr)-&amp;gt;&lt;SPAN style="font-size: 13.3333330154419px;"&gt;Partitions[x], as &lt;SPAN style="font-size: 13.3333330154419px;"&gt;((&lt;/SPAN&gt;&lt;SPAN style="font-size: 13.3333330154419px;"&gt;MasterBoot_Entries *&lt;/SPAN&gt;&lt;SPAN style="font-size: 13.3333330154419px;"&gt;)&lt;/SPAN&gt;&lt;SPAN style="font-size: 13.3333330154419px;"&gt;byArr)-&amp;gt;&lt;/SPAN&gt;&lt;SPAN style="font-size: 13.3333330154419px;"&gt;Partitions is dword aligned, with padding byte before it&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Am I missing something?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 09 Apr 2015 11:01:32 GMT</pubDate>
      <guid>https://community.nxp.com/t5/CodeWarrior-for-MCU/HC-S-12-Compiler-alignment/m-p/303233#M10802</guid>
      <dc:creator>cabl</dc:creator>
      <dc:date>2015-04-09T11:01:32Z</dc:date>
    </item>
  </channel>
</rss>

