<?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: structure data alignment rules (56F8013) in Other NXP Products</title>
    <link>https://community.nxp.com/t5/Other-NXP-Products/structure-data-alignment-rules-56F8013/m-p/133109#M141</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;Thanks for the quick answer,&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;I understand the need for word alignment even for simple byte(s) structure (whatever I use bitfields or not) for performance reasons when creating these structures.&lt;BR /&gt;&lt;BR /&gt;I'm receive a stream of packed byte structure and I just wished that I could control the way the code was generated in the cases where I'm using byte pointers to access my structure. Ha well, I'm back with macros.&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Fri, 21 Apr 2006 19:17:37 GMT</pubDate>
    <dc:creator>BeerBomber</dc:creator>
    <dc:date>2006-04-21T19:17:37Z</dc:date>
    <item>
      <title>structure data alignment rules (56F8013)</title>
      <link>https://community.nxp.com/t5/Other-NXP-Products/structure-data-alignment-rules-56F8013/m-p/133107#M139</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I'm using a 56F8013 and I would like to control the compiler's boundary rule for structure. In "Targeting_56800E.pdf" at section "Targeting MC56F83xx/DSP5685x Controllers" page 133, it says that "A structure containing only bytes still is word aligned.".&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The problem is that I'm trying to read an array of single-byte structure and I would really like to use the structure layout in my C code.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If I have an array of these then&lt;BR /&gt;typedef struct{&lt;BR /&gt;unsigned char _someValueA:3;&lt;BR /&gt;unsigned char _someValueB:2;&lt;BR /&gt;unsigned char _someValueC:1;&lt;BR /&gt;unsigned char _someValueD:1;&lt;BR /&gt;unsigned char _someValueE:1;&lt;BR /&gt;}myStruct;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I can't use things like ptr-&amp;gt;_someValueC because of code generated forces the boundary of the structure to be word aligned. I need it to be byte aligned. Is there any ways (pragmas, attribute or compiler flags) that I can use my structure in C?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Otherwise I have to read them as byte and use explicit shifter which reduce the clarity of the source.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I'm using :&lt;BR /&gt;Metrowerks C/C++ for DSP M56800E.&lt;BR /&gt;Copyright (c)1998-2005, Metrowerks&lt;BR /&gt;All rights reserved.&lt;BR /&gt;Version 7.2 build 1003&lt;BR /&gt;Runtime Built: Apr 15 2005 19:46:26&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 21 Apr 2006 03:33:31 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Other-NXP-Products/structure-data-alignment-rules-56F8013/m-p/133107#M139</guid>
      <dc:creator>BeerBomber</dc:creator>
      <dc:date>2006-04-21T03:33:31Z</dc:date>
    </item>
    <item>
      <title>Re: structure data alignment rules (56F8013)</title>
      <link>https://community.nxp.com/t5/Other-NXP-Products/structure-data-alignment-rules-56F8013/m-p/133108#M140</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&amp;gt;&amp;gt; Otherwise I have to read them as byte and use explicit shifter which&lt;BR /&gt;&amp;gt;&amp;gt; reduce the clarity of the source.&lt;BR /&gt;&lt;BR /&gt;Hello BeerBomber,&lt;BR /&gt;Using structs and bitfields to interchange data between two different systems often causes weird problems. Compilers are free to align structures as they like and put dummy data between members. Better store all that stuff into byte arrays and use shift/logical operators to access them. You can write some macros or inline functions for that which keeps your code pretty...&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 21 Apr 2006 17:47:44 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Other-NXP-Products/structure-data-alignment-rules-56F8013/m-p/133108#M140</guid>
      <dc:creator>pittbull</dc:creator>
      <dc:date>2006-04-21T17:47:44Z</dc:date>
    </item>
    <item>
      <title>Re: structure data alignment rules (56F8013)</title>
      <link>https://community.nxp.com/t5/Other-NXP-Products/structure-data-alignment-rules-56F8013/m-p/133109#M141</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;Thanks for the quick answer,&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;I understand the need for word alignment even for simple byte(s) structure (whatever I use bitfields or not) for performance reasons when creating these structures.&lt;BR /&gt;&lt;BR /&gt;I'm receive a stream of packed byte structure and I just wished that I could control the way the code was generated in the cases where I'm using byte pointers to access my structure. Ha well, I'm back with macros.&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 21 Apr 2006 19:17:37 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Other-NXP-Products/structure-data-alignment-rules-56F8013/m-p/133109#M141</guid>
      <dc:creator>BeerBomber</dc:creator>
      <dc:date>2006-04-21T19:17:37Z</dc:date>
    </item>
  </channel>
</rss>

