<?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: ffunction-sections is not working? in MCUXpresso IDE</title>
    <link>https://community.nxp.com/t5/MCUXpresso-IDE/ffunction-sections-is-not-working/m-p/680348#M640</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I think I found the issue: it's not related to the sections options, but with the system library. &lt;STRONG&gt;The NewLibNano(nohost) gives the best results&lt;/STRONG&gt; (smaller size code)!&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Fri, 04 Aug 2017 23:37:52 GMT</pubDate>
    <dc:creator>fjrg76</dc:creator>
    <dc:date>2017-08-04T23:37:52Z</dc:date>
    <item>
      <title>ffunction-sections is not working?</title>
      <link>https://community.nxp.com/t5/MCUXpresso-IDE/ffunction-sections-is-not-working/m-p/680344#M636</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;In order to decrease the program's &amp;nbsp;I want to use the linker flag -ffunction-sections, besides -gc-sections. Without&amp;nbsp;&lt;SPAN&gt;-ffunction-sections flag the size of a binary output for freertos_blinky demo for the lpc11u68 is 18KB! It seems all functions are been included from the chip library even when they are not used. However I cannot use&amp;nbsp;&lt;SPAN&gt;-ffunction-sections flag because a linker error:&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&lt;SPAN&gt;&lt;SPAN style="font-family: 'courier new', courier, monospace;"&gt;&lt;EM&gt;/usr/local/mcuxpressoide-10.0.0_344/ide/tools/bin/../lib/gcc/arm-none-eabi/5.4.1/../../../../arm-none-eabi/bin/ld: &lt;STRONG&gt;-f may not be used without -shared&lt;/STRONG&gt;&lt;/EM&gt;&lt;/SPAN&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&lt;SPAN&gt;From the command line the linker instruction seems to be:&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;EM style="font-family: 'courier new', courier, monospace;"&gt;make -r -j2 all &lt;BR /&gt;Building target: freertos_blinky.axf&lt;BR /&gt;Invoking: MCU Linker&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM style="font-family: 'courier new', courier, monospace;"&gt;arm-none-eabi-gcc -nostdlib -L"/home/fjrg76/Documents/MCUXpresso_10.0.0_344/workspace3/lpc_chip_11u6x/Debug" -L"/home/fjrg76/Documents/MCUXpresso_10.0.0_344/workspace3/lpc_board_nxp_lpcxpresso_11u68/Debug" -Xlinker -Map="freertos_blinky.map" -Xlinker --gc-sections -Xlinker --allow-multiple-definition -flto -Os -mcpu=cortex-m0plus.small-multiply -mthumb -T "freertos_blinky_Debug.ld" -o "freertos_blinky.axf" ./freertos/src/FreeRTOSCommonHooks.o ./freertos/src/heap_3.o ./freertos/src/list.o ./freertos/src/port.o ./freertos/src/queue.o ./freertos/src/tasks.o ./example/src/aeabi_romdiv_patch.o ./example/src/cr_startup_lpc11u6x.o ./example/src/crp.o ./example/src/freertos_blinky.o ./example/src/mtb.o ./example/src/sysinit.o &lt;STRONG&gt;-llpc_board_nxp_lpcxpresso_11u68 -llpc_chip_11u6x&lt;/STRONG&gt;&lt;BR /&gt;&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&lt;SPAN&gt;&lt;EM style="font-family: 'courier new', courier, monospace;"&gt;Finished building target: freertos_blinky.axf&lt;/EM&gt;&lt;BR /&gt; &lt;BR /&gt;&lt;EM style="font-family: 'courier new', courier, monospace;"&gt;make --no-print-directory post-build&lt;/EM&gt;&lt;BR /&gt;&lt;EM style="font-family: 'courier new', courier, monospace;"&gt;Performing post-build steps&lt;/EM&gt;&lt;BR /&gt;&lt;EM style="font-family: 'courier new', courier, monospace;"&gt;arm-none-eabi-size "freertos_blinky.axf"; # arm-none-eabi-objcopy -O binary "freertos_blinky.axf" "freertos_blinky.bin" ; checksum -p LPC11U68 -d "freertos_blinky.bin";&lt;/EM&gt;&lt;BR /&gt;&lt;EM style="font-family: 'courier new', courier, monospace;"&gt; text data bss dec hex filename&lt;/EM&gt;&lt;BR /&gt;&lt;EM style="font-family: 'courier new', courier, monospace;"&gt;&lt;STRONG&gt; 18060&lt;/STRONG&gt; 8 1072 19140 4ac4 freertos_blinky.axf&lt;/EM&gt;&lt;BR /&gt; &lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&lt;SPAN&gt;If I turn on the shared flags other problems shows up.&amp;nbsp;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;SPAN&gt;&lt;SPAN&gt;And optimizing for size only saves 3KB, from 18KB to 15KB. Any ideas?&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&lt;SPAN&gt;Thank you!&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 01 Jul 2017 20:24:14 GMT</pubDate>
      <guid>https://community.nxp.com/t5/MCUXpresso-IDE/ffunction-sections-is-not-working/m-p/680344#M636</guid>
      <dc:creator>fjrg76</dc:creator>
      <dc:date>2017-07-01T20:24:14Z</dc:date>
    </item>
    <item>
      <title>Re: ffunction-sections is not working?</title>
      <link>https://community.nxp.com/t5/MCUXpresso-IDE/ffunction-sections-is-not-working/m-p/680345#M637</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Javier,&lt;/P&gt;&lt;P&gt;Can you provide the compiler options you use to compile your source files. To have the linker removing code and data sections, the files need to be compiled&amp;nbsp; with the 'sections' option. I use it for both functions and data, so make sure your source files are compiled with&lt;/P&gt;&lt;P&gt;-ffunction-sections -fdata-sections&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/24506i9A5A0B5A91E14AA9/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;Example command line on my side:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;arm-none-eabi-gcc -DDEBUG -D__CODE_RED -DCORE_M0PLUS -D__MTB_BUFFER_SIZE=256 -D__USE_ROMDIVIDE -D__USE_LPCOPEN -DNO_BOARD_LIB -D__LPC82X__ -D__REDLIB__ -I"C:\Users\Erich Styger\Data\GitRepos\McuOnEclipse\Examples\MCUXpresso\LPC800-DIP\lpc_chip_82x\inc" -O3 -fno-common -g3 -Wall -c -fmessage-length=0 -fno-builtin &lt;SPAN style="color: #ff0000;"&gt;-ffunction-sections -fdata-sections&lt;/SPAN&gt; -mcpu=cortex-m0 -mthumb -D__REDLIB__ -specs=redlib.specs -MMD -MP -MF"src/sysinit.d" -MT"src/sysinit.o" -MT"src/sysinit.d" -o "src/sysinit.o" "../src/sysinit.c"&lt;/EM&gt;&lt;BR /&gt;&lt;EM&gt;Finished building: ../src/aeabi_romdiv_patch.s&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;Invoking: MCU Linker&lt;/EM&gt;&lt;BR /&gt;&lt;EM&gt;arm-none-eabi-gcc -nostdlib -L"C:\Users\Erich Styger\Data\GitRepos\McuOnEclipse\Examples\MCUXpresso\LPC800-DIP\lpc_chip_82x\Debug" -Xlinker -Map="LPC800-DIP_Blinky.map" -Xlinker &lt;SPAN style="color: #ff0000;"&gt;--gc-sections&lt;/SPAN&gt; -Xlinker -print-memory-usage -mcpu=cortex-m0 -mthumb -T "LPC800-DIP_Blinky_Debug.ld" -o "LPC800-DIP_Blinky.axf"&amp;nbsp; ./src/LPC800-DIP_Blinky.o ./src/aeabi_romdiv_patch.o ./src/cr_startup_lpc82x.o ./src/crp.o ./src/mtb.o ./src/sysinit.o&amp;nbsp;&amp;nbsp; -llpc_chip_82x&lt;/EM&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>Sun, 02 Jul 2017 05:59:46 GMT</pubDate>
      <guid>https://community.nxp.com/t5/MCUXpresso-IDE/ffunction-sections-is-not-working/m-p/680345#M637</guid>
      <dc:creator>BlackNight</dc:creator>
      <dc:date>2017-07-02T05:59:46Z</dc:date>
    </item>
    <item>
      <title>Re: ffunction-sections is not working?</title>
      <link>https://community.nxp.com/t5/MCUXpresso-IDE/ffunction-sections-is-not-working/m-p/680346#M638</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Erich,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks for your promp reply. The options you've recommended are already set, as&amp;nbsp;shown:&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper" image-alt="Captura de pantalla de 2017-07-02 15-55-37.png"&gt;&lt;img src="https://community.nxp.com/t5/image/serverpage/image-id/24478i50A8725B8A9BBCC7/image-size/large?v=v2&amp;amp;px=999" role="button" title="Captura de pantalla de 2017-07-02 15-55-37.png" alt="Captura de pantalla de 2017-07-02 15-55-37.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;It seems I've been making things in the correct way, and probably those 15KB are the correct size for such a project. Turning on size optimizations I'm getting 9KB. The compiler instruction is:&lt;/P&gt;&lt;P&gt;&lt;EM style="font-size: 11px; font-family: 'courier new', courier, monospace;"&gt;Building file: ../example/src/freertos_blinky.c&lt;/EM&gt;&lt;BR /&gt;&lt;EM style="font-size: 11px; font-family: 'courier new', courier, monospace;"&gt;Invoking: MCU C Compiler&lt;/EM&gt;&lt;BR /&gt;&lt;EM style="font-size: 11px; font-family: 'courier new', courier, monospace;"&gt;arm-none-eabi-gcc &lt;STRONG&gt;-std=c99&lt;/STRONG&gt; -DDEBUG -D__CODE_RED -D__USE_LPCOPEN -D__MTB_BUFFER_SIZE=256 -DCORE_M0PLUS -D__USE_ROMDIVIDE -D__NEWLIB__ -I"/home/fjrg76/Documents/MCUXpresso_10.0.0_344/workspace3/lpc_chip_11u6x/inc" -I"/home/fjrg76/Documents/MCUXpresso_10.0.0_344/workspace3/lpc_board_nxp_lpcxpresso_11u68/inc" -I"/home/fjrg76/Documents/MCUXpresso_10.0.0_344/workspace3/freertos_blinky/example/inc" -I"/home/fjrg76/Documents/MCUXpresso_10.0.0_344/workspace3/freertos_blinky/freertos/inc" -O0 -g3 -Wall -c -fmessage-length=0 -fno-builtin &lt;SPAN style="color: #ff0000;"&gt;&lt;STRONG&gt;-ffunction-sections -fdata-sections&lt;/STRONG&gt;&lt;/SPAN&gt; -v -flto -ffat-lto-objects -mcpu=cortex-m0 -mthumb -D__NEWLIB__ -MMD -MP -MF"example/src/freertos_blinky.d" -MT"example/src/freertos_blinky.d" -o "example/src/freertos_blinky.o" "../example/src/freertos_blinky.c"&lt;/EM&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;In other post &lt;A _jive_internal="true" href="https://community.nxp.com/thread/454682?sr=stream"&gt;I stablished that a bundle is broken&lt;/A&gt;, so I've updated it including the latest FreeRTOS release. With a minimal configuration and size optimizations for the libraries used I got 7KB, which I consider is a reasonable size for a project that includes 3 libraries: for the chip, for the board, and for the RTOS. You can find it &lt;A _jive_internal="true" href="https://community.nxp.com/message/919800"&gt;here&lt;/A&gt;.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Anyway, now I know that code that is not used is really discarded, which was my concern in first place.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Kind regards!&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 02 Jul 2017 21:29:47 GMT</pubDate>
      <guid>https://community.nxp.com/t5/MCUXpresso-IDE/ffunction-sections-is-not-working/m-p/680346#M638</guid>
      <dc:creator>fjrg76</dc:creator>
      <dc:date>2017-07-02T21:29:47Z</dc:date>
    </item>
    <item>
      <title>Re: ffunction-sections is not working?</title>
      <link>https://community.nxp.com/t5/MCUXpresso-IDE/ffunction-sections-is-not-working/m-p/680347#M639</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;FYI : The sections being removed from your image by the combined use of the compiler -ffunction-sections / -fdata-sections and linker --gc-sections options can be seen from the map file generated by the link step.&amp;nbsp;Look for the section of the map file starting : "Discarded input sections".&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;For more details, see section 12.5.3, "Linker Map files" of the MCUXpresso IDE v10.0.0 User Guide.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;MCUXpresso IDE Support&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 03 Jul 2017 12:49:00 GMT</pubDate>
      <guid>https://community.nxp.com/t5/MCUXpresso-IDE/ffunction-sections-is-not-working/m-p/680347#M639</guid>
      <dc:creator>lpcxpresso_supp</dc:creator>
      <dc:date>2017-07-03T12:49:00Z</dc:date>
    </item>
    <item>
      <title>Re: ffunction-sections is not working?</title>
      <link>https://community.nxp.com/t5/MCUXpresso-IDE/ffunction-sections-is-not-working/m-p/680348#M640</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I think I found the issue: it's not related to the sections options, but with the system library. &lt;STRONG&gt;The NewLibNano(nohost) gives the best results&lt;/STRONG&gt; (smaller size code)!&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 04 Aug 2017 23:37:52 GMT</pubDate>
      <guid>https://community.nxp.com/t5/MCUXpresso-IDE/ffunction-sections-is-not-working/m-p/680348#M640</guid>
      <dc:creator>fjrg76</dc:creator>
      <dc:date>2017-08-04T23:37:52Z</dc:date>
    </item>
  </channel>
</rss>

