<?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: BSS fill with data_alignment in Kinetis Design Studio</title>
    <link>https://community.nxp.com/t5/Kinetis-Design-Studio/BSS-fill-with-data-alignment/m-p/559807#M7186</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks Erich &lt;/P&gt;&lt;P&gt;Already done that from my same question on yr blog.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;BTW, I was using the CW tool-chain on the CW project, not the GNU.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Tue, 12 Jul 2016 14:00:45 GMT</pubDate>
    <dc:creator>leccy</dc:creator>
    <dc:date>2016-07-12T14:00:45Z</dc:date>
    <item>
      <title>BSS fill with data_alignment</title>
      <link>https://community.nxp.com/t5/Kinetis-Design-Studio/BSS-fill-with-data-alignment/m-p/559805#M7184</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;&lt;BR /&gt;&lt;SPAN style="font-size: 10pt;"&gt;I have recently ported USB MSD boot-loader AN4379 from CW 10.4 to KDS.&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="min-height: 8pt; padding: 0px;"&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt;"&gt;With some adaptations, we have been running the boot-loader on several products for a couple of years.&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="min-height: 8pt; padding: 0px;"&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt;"&gt;On KDS, however, I cannot get the project to compile without a linker error.&amp;nbsp; It shows an over-spill of 840 bytes in RAM.&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="min-height: 8pt; padding: 0px;"&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt;"&gt;Looking at the .map file, I see there is a *fill* section in BSS of 0x1e4 bytes (484):&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 8pt;"&gt;.bss&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 0x1fff0400&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 0x1b40 load address 0x00008600&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 8pt;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 0x1fff0400&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; __START_BSS = .&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 8pt;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 0x1fff0400&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; PROVIDE (__bss_start__, __START_BSS)&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 8pt;"&gt; *(.bss)&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 8pt;"&gt; .bss&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 0x1fff0400&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 0x1c c:/freescale/kds_3.0.0/toolchain/bin/../lib/gcc/arm-none-eabi/5.4.1/armv7e-m/crtbegin.o&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 8pt;"&gt; *(.bss*)&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 8pt;"&gt; *fill*&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 0x1fff041c&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 0x1e4 &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 8pt;"&gt; .bss.g_Mem&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 0x1fff0600&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 0x400 ./Sources/USB/driver/usb_dci_kinetis.o&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 8pt;"&gt; .bss.g_bdtmap&amp;nbsp; 0x1fff0a00&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 0x4 ./Sources/USB/driver/usb_dci_kinetis.o&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 8pt;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 0x1fff0a00&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; g_bdtmap&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="min-height: 8pt; padding: 0px;"&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt;"&gt;The global g_Mem must be aligned to a 512 byte boundary since it is filled by the DMA:&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 8pt;"&gt;#if defined(__GNUC__)&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 8pt;"&gt;__attribute__((__aligned__(512)))&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 8pt;"&gt;#elif defined(__IAR_SYSTEMS_ICC__)&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 8pt;"&gt;#pragma data_alignment = 512&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 8pt;"&gt;#endif&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 8pt;"&gt;static uint_8 g_Mem[BYTES_1024];&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="min-height: 8pt; padding: 0px;"&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 12pt;"&gt;Any ideas why the linker does not place any other variables in the BSS region up to g_Mem?&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 12pt;"&gt;The CW10.4 compilation does this.&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 12 Jul 2016 08:56:34 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Kinetis-Design-Studio/BSS-fill-with-data-alignment/m-p/559805#M7184</guid>
      <dc:creator>leccy</dc:creator>
      <dc:date>2016-07-12T08:56:34Z</dc:date>
    </item>
    <item>
      <title>Re: BSS fill with data_alignment</title>
      <link>https://community.nxp.com/t5/Kinetis-Design-Studio/BSS-fill-with-data-alignment/m-p/559806#M7185</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Alex,&lt;/P&gt;&lt;P&gt;I don't think the GNU linker in CodeWarrior handles this differently. The GNU linker is going through the linker script file in a linear way, and does not try to fill up things or distribute variables into different memory areas (I whish the GNU ld could do this, this is a long time wish from many users).&lt;/P&gt;&lt;P&gt;Anyway, the thing is that you should allocate the USB buffer at the beginning of a section (which is already aligned to the 512 byte boundary. That way the linker has not to add *fill* bytes. See &lt;A href="https://mcuoneclipse.com/2014/07/11/switching-arm-gnu-tool-chain-and-libraries-in-kinetis-design-studio/comment-page-1/#comment-84288" title="https://mcuoneclipse.com/2014/07/11/switching-arm-gnu-tool-chain-and-libraries-in-kinetis-design-studio/comment-page-1/#comment-84288"&gt;https://mcuoneclipse.com/2014/07/11/switching-arm-gnu-tool-chain-and-libraries-in-kinetis-design-studio/comment-page-1/#…&lt;/A&gt; &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I hope this helps,&lt;/P&gt;&lt;P&gt;Erich&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 12 Jul 2016 11:35:37 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Kinetis-Design-Studio/BSS-fill-with-data-alignment/m-p/559806#M7185</guid>
      <dc:creator>BlackNight</dc:creator>
      <dc:date>2016-07-12T11:35:37Z</dc:date>
    </item>
    <item>
      <title>Re: BSS fill with data_alignment</title>
      <link>https://community.nxp.com/t5/Kinetis-Design-Studio/BSS-fill-with-data-alignment/m-p/559807#M7186</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks Erich &lt;/P&gt;&lt;P&gt;Already done that from my same question on yr blog.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;BTW, I was using the CW tool-chain on the CW project, not the GNU.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 12 Jul 2016 14:00:45 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Kinetis-Design-Studio/BSS-fill-with-data-alignment/m-p/559807#M7186</guid>
      <dc:creator>leccy</dc:creator>
      <dc:date>2016-07-12T14:00:45Z</dc:date>
    </item>
    <item>
      <title>Re: BSS fill with data_alignment</title>
      <link>https://community.nxp.com/t5/Kinetis-Design-Studio/BSS-fill-with-data-alignment/m-p/559808#M7187</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Alex,&lt;/P&gt;&lt;P&gt;ok, then it makes sense: the non-GNU ARM toolchain used a custom linker implementation, and that linker was able to fill gaps in the memory map.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Erich&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 12 Jul 2016 15:30:00 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Kinetis-Design-Studio/BSS-fill-with-data-alignment/m-p/559808#M7187</guid>
      <dc:creator>BlackNight</dc:creator>
      <dc:date>2016-07-12T15:30:00Z</dc:date>
    </item>
  </channel>
</rss>

