<?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: Generated Software size - .elf file size - MBD toolbox 3.0.0 - Devkit MPC5744P in Model-Based Design Toolbox (MBDT)</title>
    <link>https://community.nxp.com/t5/Model-Based-Design-Toolbox-MBDT/Generated-Software-size-elf-file-size-MBD-toolbox-3-0-0-Devkit/m-p/990543#M3897</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello &lt;A class="jx-jive-macro-user" href="https://community.nxp.com/people/dumitru-daniel.popa"&gt;dumitru-daniel.popa&lt;/A&gt;‌,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thank you very much for the complete response.&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;Kind Regards, Rafael&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Fri, 06 Mar 2020 12:53:52 GMT</pubDate>
    <dc:creator>rafael_barbosa</dc:creator>
    <dc:date>2020-03-06T12:53:52Z</dc:date>
    <item>
      <title>Generated Software size - .elf file size - MBD toolbox 3.0.0 - Devkit MPC5744P</title>
      <link>https://community.nxp.com/t5/Model-Based-Design-Toolbox-MBDT/Generated-Software-size-elf-file-size-MBD-toolbox-3-0-0-Devkit/m-p/990541#M3895</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;Can you help me on how to reduce the generated .elf file size without changing the model?&lt;/P&gt;&lt;P&gt;What is the content of the .elf file?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Also I am curious why the project built in S32 Design studio presents the software size metrics different from the generated .elf file as shown below:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;BaseMotorControl_DEV:&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&lt;span class="lia-inline-image-display-wrapper" image-alt="pastedImage_15.png"&gt;&lt;img src="https://community.nxp.com/t5/image/serverpage/image-id/103857i7AF80201948D5B37/image-size/large?v=v2&amp;amp;px=999" role="button" title="pastedImage_15.png" alt="pastedImage_15.png" /&gt;&lt;/span&gt;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;_____________________________________________________________________________________&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Copy_of_BaseMotorControl_DEV:&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&lt;span class="lia-inline-image-display-wrapper" image-alt="pastedImage_16.png"&gt;&lt;img src="https://community.nxp.com/t5/image/serverpage/image-id/103087i4B9BFA8494A600F0/image-size/large?v=v2&amp;amp;px=999" role="button" title="pastedImage_16.png" alt="pastedImage_16.png" /&gt;&lt;/span&gt;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;________________________________________________________________________________________&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Copy_2_of_BaseMotorControl_DEV:&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&lt;span class="lia-inline-image-display-wrapper" image-alt="pastedImage_17.png"&gt;&lt;img src="https://community.nxp.com/t5/image/serverpage/image-id/103981i60710C8C3C1D0DDC/image-size/large?v=v2&amp;amp;px=999" role="button" title="pastedImage_17.png" alt="pastedImage_17.png" /&gt;&lt;/span&gt;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&lt;EM&gt;Finally, which size shall be considered as the limitation when flashing the file into the microcontroller flash memory?&lt;/EM&gt;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper" image-alt="pastedImage_1.png"&gt;&lt;img src="https://community.nxp.com/t5/image/serverpage/image-id/104613i2A164AA745EA6EE6/image-size/large?v=v2&amp;amp;px=999" role="button" title="pastedImage_1.png" alt="pastedImage_1.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Kind Regards, Rafael&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 05 Mar 2020 12:21:08 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Model-Based-Design-Toolbox-MBDT/Generated-Software-size-elf-file-size-MBD-toolbox-3-0-0-Devkit/m-p/990541#M3895</guid>
      <dc:creator>rafael_barbosa</dc:creator>
      <dc:date>2020-03-05T12:21:08Z</dc:date>
    </item>
    <item>
      <title>Re: Generated Software size - .elf file size - MBD toolbox 3.0.0 - Devkit MPC5744P</title>
      <link>https://community.nxp.com/t5/Model-Based-Design-Toolbox-MBDT/Generated-Software-size-elf-file-size-MBD-toolbox-3-0-0-Devkit/m-p/990542#M3896</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Rafael,&amp;nbsp;&lt;/P&gt;&lt;BLOCKQUOTE class="jive_macro_quote jive-quote jive_text_macro"&gt;&lt;P&gt;&lt;SPAN style="color: #0000ff; background-color: #ffffff;"&gt;Can you help me on how to reduce the generated .elf file size without changing the model?&lt;/SPAN&gt;&lt;/P&gt;&lt;/BLOCKQUOTE&gt;&lt;P&gt;&lt;SPAN style="color: #51626f; background-color: #ffffff;"&gt;You can reduce the elf size in 2 different modes:&lt;/SPAN&gt;&lt;/P&gt;&lt;OL&gt;&lt;LI&gt;&lt;SPAN style="color: #51626f; background-color: #ffffff;"&gt;remove the debug information from the elf.&amp;nbsp;&lt;/SPAN&gt;&lt;UL&gt;&lt;LI&gt;See more about the debug information here:&amp;nbsp;&lt;A class="link-titled" href="https://gcc.gnu.org/onlinedocs/gcc/Debugging-Options.html#Debugging-Options" rel="nofollow noopener noreferrer noopener noreferrer" target="_blank" title="https://gcc.gnu.org/onlinedocs/gcc/Debugging-Options.html#Debugging-Options"&gt;Using the GNU Compiler Collection (GCC): Debugging Options&lt;/A&gt;&amp;nbsp;&lt;/LI&gt;&lt;LI&gt;&lt;SPAN style="color: #51626f; background-color: #ffffff;"&gt;&lt;SPAN class="lia-inline-image-display-wrapper" image-alt="pastedImage_9.png"&gt;&lt;IMG alt="pastedImage_9.png" src="https://community.nxp.com/t5/image/serverpage/image-id/35187i57E1CCB902FCF1AB/image-size/large?v=v2&amp;amp;px=999" title="pastedImage_9.png" /&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;/LI&gt;&lt;LI&gt;&lt;SPAN style="background-color: #ffffff; color: #51626f; "&gt;enable optimizations related with code size (if the .text is larger) or data size (if .data is larger). This can be done from 2 stages:&lt;/SPAN&gt;&lt;UL&gt;&lt;LI&gt;&lt;STRONG&gt;Stage Code-Generation&lt;/STRONG&gt; in MATLAB settings to control how the generated code will look like.&lt;SPAN style="background-color: #ffffff; color: #51626f; "&gt;&lt;SPAN class="lia-inline-image-display-wrapper" image-alt="pastedImage_3.png"&gt;&lt;IMG alt="pastedImage_3.png" src="https://community.nxp.com/t5/image/serverpage/image-id/34713i2C06D3A3B2140221/image-size/large?v=v2&amp;amp;px=999" title="pastedImage_3.png" /&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/LI&gt;&lt;LI&gt;&lt;SPAN style="background-color: #ffffff; color: #51626f; "&gt;&lt;STRONG&gt;Stage Cross Compiler arguments&lt;/STRONG&gt; that controls how the compiler generates the final application code. Here you can change the optimization level or add the -Os. More on the compile optimizations here:&amp;nbsp;&lt;A class="link-titled" href="https://gcc.gnu.org/onlinedocs/gcc/Optimize-Options.html" rel="nofollow noopener noreferrer noopener noreferrer" target="_blank" title="https://gcc.gnu.org/onlinedocs/gcc/Optimize-Options.html"&gt;Using the GNU Compiler Collection (GCC): Optimize Options&lt;/A&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN style="background-color: #ffffff; color: #51626f; "&gt;&lt;SPAN class="lia-inline-image-display-wrapper" image-alt="pastedImage_4.png"&gt;&lt;IMG alt="pastedImage_4.png" src="https://community.nxp.com/t5/image/serverpage/image-id/35241i69CBED697200888C/image-size/large?v=v2&amp;amp;px=999" title="pastedImage_4.png" /&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;/LI&gt;&lt;/OL&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;BLOCKQUOTE class="jive_macro_quote jive-quote jive_text_macro"&gt;&lt;SPAN style="color: #0000ff;"&gt;What is the content of the .elf file?&lt;/SPAN&gt;&lt;/BLOCKQUOTE&gt;&lt;P&gt;ELF is just a container. The Bootloader do not use all the information from this file. For the application to work on the MCU all you need are specific sections of .text, .data, .bss&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;A very good explanation of the elf file can be found here:&amp;nbsp;&lt;A class="link-titled" href="https://en.wikipedia.org/wiki/Executable_and_Linkable_Format" rel="nofollow noopener noreferrer noopener noreferrer" target="_blank" title="https://en.wikipedia.org/wiki/Executable_and_Linkable_Format"&gt;Executable and Linkable Format - Wikipedia&lt;/A&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;NXP is offering elf dump tools that allows you to parse the elf and see exactly what is inside. You can find this tools inside the ..\\tools\S32DS\build_tools\powerpc-eabivle-4_9\bin\ of your MBDT installation.&lt;/P&gt;&lt;P&gt;&lt;SPAN class="lia-inline-image-display-wrapper" image-alt="pastedImage_14.png"&gt;&lt;IMG alt="pastedImage_14.png" src="https://community.nxp.com/t5/image/serverpage/image-id/30478i1A05FBA25903AD82/image-size/large?v=v2&amp;amp;px=999" title="pastedImage_14.png" /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;As you can see, almost half of the sections are related with debug information. These sections are NOT flashed into the MCU memory. They exist only in the elf and ONLY an IDE/Debugger running on the host PC can access such information.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE __default_attr="info" __jive_macro_name="alert" alert="info" class="jive_text_macro jive_macro_alert" modifiedtitle="true"&gt;&lt;P&gt;Look for A flag. Only the sections that have A-allocation flag will be written to the target.&lt;/P&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;BLOCKQUOTE class="jive_macro_quote jive-quote jive_text_macro"&gt;&lt;SPAN style="color: #0000ff; background-color: #ffffff;"&gt;Also I am curious why the project built in S32 Design studio presents the software size metrics different from the generated .elf file as shown below:&lt;/SPAN&gt;&lt;/BLOCKQUOTE&gt;&lt;P&gt;The number reported by the ELF&amp;nbsp;powerpc-eabivle-size resports only for .text, .data and .bss sections. The number returned is expressed in number of bytes/octets.&lt;/P&gt;&lt;P&gt;The number reported by the S32DS is for the entire file (will all the sections)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;In Windows OS, the size = size on disk which is different than the file actual size.&lt;/P&gt;&lt;P&gt;&lt;SPAN class="lia-inline-image-display-wrapper" image-alt="pastedImage_5.png"&gt;&lt;IMG alt="pastedImage_5.png" src="https://community.nxp.com/t5/image/serverpage/image-id/35530iC38623C825F3AA47/image-size/large?v=v2&amp;amp;px=999" title="pastedImage_5.png" /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;BLOCKQUOTE class="jive_macro_quote jive-quote jive_text_macro"&gt;&lt;SPAN style="color: #0000ff;"&gt;&lt;EM style="border: 0px; font-weight: inherit; font-size: 14px;"&gt;Finally, which size shall be considered as the limitation when flashing the file into the microcontroller flash memory?&lt;/EM&gt;&lt;/SPAN&gt;&lt;/BLOCKQUOTE&gt;&lt;P&gt;Assuming you want to flash the application permanently into the MCU, then you need to consider the .text and .data size.&lt;/P&gt;&lt;P&gt;BUT, it also depends on other key sections that might be added in the linker by the user. Anyone can define an allocate sections in the ELF. Hence is hard to pinpoint which section is limiting factor. I would say: compute the size of all sections that have the A flag and make sure the total size is smaller than the flash memory.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Hope this helps!&lt;/P&gt;&lt;P&gt;Daniel&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 02 Nov 2020 14:31:34 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Model-Based-Design-Toolbox-MBDT/Generated-Software-size-elf-file-size-MBD-toolbox-3-0-0-Devkit/m-p/990542#M3896</guid>
      <dc:creator>Daniel_Popa</dc:creator>
      <dc:date>2020-11-02T14:31:34Z</dc:date>
    </item>
    <item>
      <title>Re: Generated Software size - .elf file size - MBD toolbox 3.0.0 - Devkit MPC5744P</title>
      <link>https://community.nxp.com/t5/Model-Based-Design-Toolbox-MBDT/Generated-Software-size-elf-file-size-MBD-toolbox-3-0-0-Devkit/m-p/990543#M3897</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello &lt;A class="jx-jive-macro-user" href="https://community.nxp.com/people/dumitru-daniel.popa"&gt;dumitru-daniel.popa&lt;/A&gt;‌,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thank you very much for the complete response.&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;Kind Regards, Rafael&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 06 Mar 2020 12:53:52 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Model-Based-Design-Toolbox-MBDT/Generated-Software-size-elf-file-size-MBD-toolbox-3-0-0-Devkit/m-p/990543#M3897</guid>
      <dc:creator>rafael_barbosa</dc:creator>
      <dc:date>2020-03-06T12:53:52Z</dc:date>
    </item>
  </channel>
</rss>

