<?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: HEX file larger than memory in Kinetis Design Studio</title>
    <link>https://community.nxp.com/t5/Kinetis-Design-Studio/HEX-file-larger-than-memory/m-p/976416#M10015</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I rewrote linker script, data section to:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;.data :&lt;BR /&gt; {&lt;BR /&gt; . = ALIGN(4);&lt;BR /&gt; __DATA_RAM = .;&lt;BR /&gt; __data_start__ = .;&lt;BR /&gt; *(.data) &lt;BR /&gt; *(.data*) &lt;BR /&gt; KEEP(*(.jcr*))&lt;BR /&gt; . = ALIGN(4);&lt;BR /&gt; __data_end__ = .; &lt;BR /&gt; } &amp;gt; m_data AT &amp;gt; m_text&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;It seems it works as expected - initilization data now goes to m_text (to flash memory), so flash memory overflow is now detected.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I noticed, that NXP uses these bad linker scripts everywhere. I have even several apps based on them. Fortunately, my program code has never been so large that initialization data wouldn't fit rest of the flash memory.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;But if program code size is large enough, initialization data are silently truncated with these linker scripts. Can anyone explain how it is possible that these dangerous linker scripts are used??? Maybe I just don't understand something...&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Tue, 21 Jan 2020 19:45:08 GMT</pubDate>
    <dc:creator>dusek_martin</dc:creator>
    <dc:date>2020-01-21T19:45:08Z</dc:date>
    <item>
      <title>HEX file larger than memory</title>
      <link>https://community.nxp.com/t5/Kinetis-Design-Studio/HEX-file-larger-than-memory/m-p/976412#M10011</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;I&amp;nbsp;built release configuration of MKL25Z4 freedom_bootloader in&amp;nbsp;NXP_Kinetis_Bootloader_2_0_0. The only change I did was modification of linker script:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;MEMORY&lt;BR /&gt;{&lt;BR /&gt; m_interrupts (RX) : ORIGIN = 0x00000000, LENGTH = 0x00000100&lt;BR /&gt; m_bootloader_config (RX) : ORIGIN = 0x000003C0, LENGTH = 0x00000040 &lt;BR /&gt; m_flash_config (RX) : ORIGIN = 0x00000400, LENGTH = 0x00000010&lt;BR /&gt; m_text (RX) : ORIGIN = 0x00000410, LENGTH = 0x00007BF0&lt;BR /&gt; m_data (RW) : ORIGIN = 0x1FFFF000, LENGTH = 0x00004000&lt;BR /&gt;}&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I enabled hex file creation and print of program size after build.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I got:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;text data bss dec hex filename&lt;BR /&gt; 30788 2288 6336 39412 99f4 freedom_bootloader.elf&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The hex file ends with:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;:108ED0000000000000000000000000000000000092&lt;BR /&gt;:108EE0000000000000000000000000000000000082&lt;BR /&gt;:108EF0000000000000000000000000000000000072&lt;BR /&gt;:108F00000000000000000000000000000000000061&lt;BR /&gt;:108F10000000000000000000000000000000000051&lt;BR /&gt;:0400000300000541B3&lt;BR /&gt;:00000001FF&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;You can see that there is 0x8000 (0x8ED0 etc) region occupied with some data in the hex file even though the program should end on 0x7FFF address as defined in linker script.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Can you please advise how to fix this? I don't want KDS to generate larger images that what fits regions defined in my .ld file.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 20 Jan 2020 13:43:16 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Kinetis-Design-Studio/HEX-file-larger-than-memory/m-p/976412#M10011</guid>
      <dc:creator>dusek_martin</dc:creator>
      <dc:date>2020-01-20T13:43:16Z</dc:date>
    </item>
    <item>
      <title>Re: HEX file larger than memory</title>
      <link>https://community.nxp.com/t5/Kinetis-Design-Studio/HEX-file-larger-than-memory/m-p/976413#M10012</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;That's strange. Did you add some kind of address offset?&lt;/P&gt;&lt;P&gt;I would consult the linker map file how things are allocated, or what gets placed beyond 0x8000.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 20 Jan 2020 14:29:29 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Kinetis-Design-Studio/HEX-file-larger-than-memory/m-p/976413#M10012</guid>
      <dc:creator>ErichStyger</dc:creator>
      <dc:date>2020-01-20T14:29:29Z</dc:date>
    </item>
    <item>
      <title>Re: HEX file larger than memory</title>
      <link>https://community.nxp.com/t5/Kinetis-Design-Studio/HEX-file-larger-than-memory/m-p/976414#M10013</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Erich, thank you for your suggestion.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I can see this in .map file:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;.debug_str 0x0000869e 0x2a6 C:\Users\Martin\AppData\Local\Temp\ccDVk63k.ltrans10.ltrans.o&lt;BR /&gt; 0x19f8 (size before relaxing)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;But I'm not sure what is its purpose.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Can you please advise, what can be wrong? Here are hex, map. ld and elf files of my project:&amp;nbsp;&lt;A class="link-titled" href="https://drive.google.com/open?id=1bQKXg78OsG1jh0pkCeEM4b1XRxvj1IL0" title="https://drive.google.com/open?id=1bQKXg78OsG1jh0pkCeEM4b1XRxvj1IL0"&gt;https://drive.google.com/open?id=1bQKXg78OsG1jh0pkCeEM4b1XRxvj1IL0&lt;/A&gt;&amp;nbsp;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 20 Jan 2020 15:00:20 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Kinetis-Design-Studio/HEX-file-larger-than-memory/m-p/976414#M10013</guid>
      <dc:creator>dusek_martin</dc:creator>
      <dc:date>2020-01-20T15:00:20Z</dc:date>
    </item>
    <item>
      <title>Re: HEX file larger than memory</title>
      <link>https://community.nxp.com/t5/Kinetis-Design-Studio/HEX-file-larger-than-memory/m-p/976415#M10014</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I think, there is something bad with:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp; __DATA_ROM = .; /* Symbol is used by startup for data initialization */&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;and&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;.data : AT(__DATA_ROM)&lt;BR /&gt; {&lt;BR /&gt; . = ALIGN(4);&lt;BR /&gt; __DATA_RAM = .;&lt;BR /&gt; __data_start__ = .; &lt;BR /&gt; *(.data) &lt;BR /&gt; *(.data*) &lt;BR /&gt; KEEP(*(.jcr*))&lt;BR /&gt; . = ALIGN(4);&lt;BR /&gt; __data_end__ = .; &lt;BR /&gt; } &amp;gt; m_data&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;sections in linker file.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I think this section is "floating" outside memory definitions. And if it is true, this is really badly designed linker file. Please help me fix that, I can't edit linker file.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 21 Jan 2020 10:25:49 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Kinetis-Design-Studio/HEX-file-larger-than-memory/m-p/976415#M10014</guid>
      <dc:creator>dusek_martin</dc:creator>
      <dc:date>2020-01-21T10:25:49Z</dc:date>
    </item>
    <item>
      <title>Re: HEX file larger than memory</title>
      <link>https://community.nxp.com/t5/Kinetis-Design-Studio/HEX-file-larger-than-memory/m-p/976416#M10015</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I rewrote linker script, data section to:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;.data :&lt;BR /&gt; {&lt;BR /&gt; . = ALIGN(4);&lt;BR /&gt; __DATA_RAM = .;&lt;BR /&gt; __data_start__ = .;&lt;BR /&gt; *(.data) &lt;BR /&gt; *(.data*) &lt;BR /&gt; KEEP(*(.jcr*))&lt;BR /&gt; . = ALIGN(4);&lt;BR /&gt; __data_end__ = .; &lt;BR /&gt; } &amp;gt; m_data AT &amp;gt; m_text&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;It seems it works as expected - initilization data now goes to m_text (to flash memory), so flash memory overflow is now detected.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I noticed, that NXP uses these bad linker scripts everywhere. I have even several apps based on them. Fortunately, my program code has never been so large that initialization data wouldn't fit rest of the flash memory.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;But if program code size is large enough, initialization data are silently truncated with these linker scripts. Can anyone explain how it is possible that these dangerous linker scripts are used??? Maybe I just don't understand something...&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 21 Jan 2020 19:45:08 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Kinetis-Design-Studio/HEX-file-larger-than-memory/m-p/976416#M10015</guid>
      <dc:creator>dusek_martin</dc:creator>
      <dc:date>2020-01-21T19:45:08Z</dc:date>
    </item>
  </channel>
</rss>

