<?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>CodeWarrior for MCU中的主题 aligned attribute maximum value</title>
    <link>https://community.nxp.com/t5/CodeWarrior-for-MCU/aligned-attribute-maximum-value/m-p/247651#M9546</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;"Use &lt;SAMP class="codeph"&gt;__attribute__ ((aligned(...))) &lt;/SAMP&gt;directive to specify to the compiler on what memory boundary to store data objects. This directive specifies which multiple of bytes to store an object.&lt;/P&gt;&lt;P&gt;The format of this directive is&lt;/P&gt;&lt;PRE class="codeblock"&gt;__attribute__ ((aligned( &lt;EM&gt;x&lt;/EM&gt; )) &lt;/PRE&gt;&lt;P&gt;where &lt;EM&gt;x&lt;/EM&gt; is a decimal number of a power of 2 from 1 to 4096."&lt;/P&gt;&lt;P style="min-height: 8pt; padding: 0px;"&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;That is a quote from CW 10.4 Documentation for PPC Arch.&lt;/P&gt;&lt;P&gt;First of all the CW will complain only if x is greater than 8192. And seems that it works with 8192. So the documentation seems to be wrong on this. &lt;/P&gt;&lt;P&gt;Second why is there such a limit? Why not 16384 or 32768? And how can I trick it to align to a larger value?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 30 Oct 2013 12:28:24 GMT</pubDate>
    <dc:creator>bogdanlaiu</dc:creator>
    <dc:date>2013-10-30T12:28:24Z</dc:date>
    <item>
      <title>aligned attribute maximum value</title>
      <link>https://community.nxp.com/t5/CodeWarrior-for-MCU/aligned-attribute-maximum-value/m-p/247651#M9546</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;"Use &lt;SAMP class="codeph"&gt;__attribute__ ((aligned(...))) &lt;/SAMP&gt;directive to specify to the compiler on what memory boundary to store data objects. This directive specifies which multiple of bytes to store an object.&lt;/P&gt;&lt;P&gt;The format of this directive is&lt;/P&gt;&lt;PRE class="codeblock"&gt;__attribute__ ((aligned( &lt;EM&gt;x&lt;/EM&gt; )) &lt;/PRE&gt;&lt;P&gt;where &lt;EM&gt;x&lt;/EM&gt; is a decimal number of a power of 2 from 1 to 4096."&lt;/P&gt;&lt;P style="min-height: 8pt; padding: 0px;"&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;That is a quote from CW 10.4 Documentation for PPC Arch.&lt;/P&gt;&lt;P&gt;First of all the CW will complain only if x is greater than 8192. And seems that it works with 8192. So the documentation seems to be wrong on this. &lt;/P&gt;&lt;P&gt;Second why is there such a limit? Why not 16384 or 32768? And how can I trick it to align to a larger value?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 30 Oct 2013 12:28:24 GMT</pubDate>
      <guid>https://community.nxp.com/t5/CodeWarrior-for-MCU/aligned-attribute-maximum-value/m-p/247651#M9546</guid>
      <dc:creator>bogdanlaiu</dc:creator>
      <dc:date>2013-10-30T12:28:24Z</dc:date>
    </item>
    <item>
      <title>Re: aligned attribute maximum value</title>
      <link>https://community.nxp.com/t5/CodeWarrior-for-MCU/aligned-attribute-maximum-value/m-p/247652#M9547</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Bogdan,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Sorry for the delay.&lt;/P&gt;&lt;P&gt;I've performed some tests on my side with MCU V10.4.&lt;/P&gt;&lt;P&gt;Extract of documentation:&lt;/P&gt;&lt;P&gt;The format of this directive is&lt;/P&gt;&lt;P&gt;__attribute__ ((aligned( x ))&lt;/P&gt;&lt;P&gt;where x is a decimal number of a power of 2 from 1 to 4096.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I can write __attribute__ ((aligned (4096))); and __attribute__ ((aligned (8192)));&lt;/P&gt;&lt;P&gt;according to the doc the value of x should be between 1 to 4096.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I will check with compiler team to have more info.&lt;/P&gt;&lt;P&gt;Keep you informed.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Pascal&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 06 Nov 2013 09:51:24 GMT</pubDate>
      <guid>https://community.nxp.com/t5/CodeWarrior-for-MCU/aligned-attribute-maximum-value/m-p/247652#M9547</guid>
      <dc:creator>trytohelp</dc:creator>
      <dc:date>2013-11-06T09:51:24Z</dc:date>
    </item>
    <item>
      <title>Re: aligned attribute maximum value</title>
      <link>https://community.nxp.com/t5/CodeWarrior-for-MCU/aligned-attribute-maximum-value/m-p/247653#M9548</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi&amp;nbsp; Bogdan,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I got feedback from compiler team.&lt;/P&gt;&lt;P&gt;In fat there is a problem with the documentation - this will be fixed in a next version.&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #1f497d;"&gt;Compiler is designed to allow up to 8192 (2^13) and throws error for anything more.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;For higher alignment value, this can be done via the LCF.&lt;/P&gt;&lt;P&gt;I've created an example on my side.&lt;/P&gt;&lt;P&gt;to resume ...&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #1f497d;"&gt;For my example if I want to write:&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #1f497d;"&gt; int V1[4] __attribute__ ((aligned (16384)));&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #1f497d;"&gt;the compiler generates an error.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #1f497d;"&gt; The V1[] is allocated in the .bss section.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #1f497d;"&gt;To do that I can:&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #1f497d;"&gt;In the main.c&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="color: #7f0055; font-size: 10.0pt; font-family: Consolas;"&gt;#pragma&lt;/STRONG&gt;&lt;SPAN style="font-size: 10.0pt; font-family: Consolas; color: black;"&gt; push &lt;/SPAN&gt;&lt;SPAN style="font-size: 10.0pt; font-family: Consolas; color: #3f7f5f;"&gt;//Save the original &lt;SPAN style="text-decoration: underline;"&gt;pragma&lt;/SPAN&gt; context&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="color: #7f0055; font-size: 10.0pt; font-family: Consolas;"&gt;#pragma&lt;/STRONG&gt;&lt;SPAN style="font-size: 10.0pt; font-family: Consolas; color: black;"&gt; section data_type &lt;/SPAN&gt;&lt;SPAN style="font-size: 10.0pt; font-family: Consolas; color: #2a00ff;"&gt;".__my_data"&lt;/SPAN&gt; &lt;SPAN style="font-size: 10.0pt; font-family: Consolas; color: #2a00ff;"&gt;".__my_data"&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="color: #7f0055; font-size: 10.0pt; font-family: Consolas;"&gt;int&lt;/STRONG&gt;&lt;SPAN style="font-size: 10.0pt; font-family: Consolas; color: black;"&gt; V1[4];&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="color: #7f0055; font-size: 10.0pt; font-family: Consolas;"&gt;#pragma&lt;/STRONG&gt;&lt;SPAN style="font-size: 10.0pt; font-family: Consolas; color: black;"&gt; pop&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #1f497d;"&gt;In the lcf file&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10.0pt; font-family: Consolas; color: black;"&gt; .bss&amp;nbsp;&amp;nbsp;&amp;nbsp; : {}&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10.0pt; font-family: Consolas; color: black;"&gt; .__my_data &lt;/SPAN&gt;&lt;STRONG style="color: #0099ff; font-size: 10.0pt; font-family: Consolas;"&gt;ALIGN&lt;/STRONG&gt;&lt;SPAN style="font-size: 10.0pt; font-family: Consolas; color: black;"&gt;(0x4000) :{}&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10.0pt; font-family: Consolas; color: black;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; } &amp;gt; internal_ram_p0&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #1f497d;"&gt;Extract of map file:&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10.0pt; font-family: Consolas;"&gt;.__my_data section layout&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10.0pt; font-family: Consolas;"&gt;&amp;nbsp; Starting Virtual&amp;nbsp; File&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10.0pt; font-family: Consolas;"&gt;&amp;nbsp; address&amp;nbsp; Size&amp;nbsp; address offset&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10.0pt; font-family: Consolas;"&gt;&amp;nbsp; ---------------------------------&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10.0pt; font-family: Consolas;"&gt;&amp;nbsp; 00000000 000010 40004000 00004000&amp;nbsp; 1 .__my_data&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; main_c.obj &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10.0pt; font-family: Consolas;"&gt;&amp;nbsp; 00000000 000010 40004000 00004000&amp;nbsp; 8 V1 main_c.obj &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards&lt;/P&gt;&lt;P&gt;Pascal&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 07 Nov 2013 10:31:10 GMT</pubDate>
      <guid>https://community.nxp.com/t5/CodeWarrior-for-MCU/aligned-attribute-maximum-value/m-p/247653#M9548</guid>
      <dc:creator>trytohelp</dc:creator>
      <dc:date>2013-11-07T10:31:10Z</dc:date>
    </item>
  </channel>
</rss>

