<?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 Newlib-Nano Support in LPCXpresso IDE FAQs</title>
    <link>https://community.nxp.com/t5/LPCXpresso-IDE-FAQs/Newlib-Nano-Support/m-p/472759#M97</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;LPCXpresso v7 introduced a new C library to complement the existing 'Redlib' and 'Newlib' libraries - Newlib-Nano (sometimes written as NewlibNano).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Newlib-Nano was produced as part of &lt;A _jive_internal="true" href="https://community.nxp.com/external-link.jspa?url=https%3A%2F%2Flaunchpad.net%2Fgcc-arm-embedded"&gt;ARM's "GNU Tools for ARM Embedded Processors" initiative&lt;/A&gt; in order to provide a version of Newlib focused on code size. Using Newlib-Nano can help to dramatically reduce the size of your application compared to using the standard version of Newlib - for both C and C++ projects.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;HR style="color: #646464; font-family: Arial, sans-serif; font-size: 12px;" /&gt;&lt;P&gt;&lt;/P&gt;&lt;H2&gt;&lt;SPAN style="color: #eb7a3d;"&gt;Enabling the use of Newlib-Nano&lt;/SPAN&gt;&lt;/H2&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;To use Newlib-Nano, you will need to change the selected library being used by your project, the easiest way to do this being to use:&lt;/P&gt;&lt;P style="color: #646464; font-family: Arial, sans-serif; font-size: 12px; padding: 5px 10px; background: #eeeeee;"&gt;&lt;SPAN style="font-family: courier new,courier;"&gt;&lt;TT&gt;Quickstart -&amp;gt; Quick Settings -&amp;gt; Set library type&lt;/TT&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;and then select the required Newlib-Nano variant.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;By default, Newlib-Nano uses non-floating point variants of the &lt;SPAN style="font-family: courier new,courier;"&gt;&lt;TT&gt;printf&lt;/TT&gt;&lt;/SPAN&gt; and &lt;SPAN style="font-family: courier new,courier;"&gt;&lt;TT&gt;scanf&lt;/TT&gt;&lt;/SPAN&gt; family of functions, which can help to dramatically reduce the size of your image if only integer values are used by such functions.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If your codebase does require floating point variants of &lt;TT&gt;printf&lt;/TT&gt;/&lt;TT&gt;scanf&lt;/TT&gt;, then these can be enabled by going to&lt;/P&gt;&lt;P style="color: #646464; font-family: Arial, sans-serif; font-size: 12px; padding: 5px 10px; background: #eeeeee;"&gt;&lt;SPAN style="font-family: courier new,courier;"&gt;&lt;TT&gt;Project -&amp;gt; Properties -&amp;gt; C/C++ Build -&amp;gt; Settings -&amp;gt; MCU Linker -&amp;gt; Managed Linker Script&lt;/TT&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;and selecting the "&lt;TT&gt;Enable printf/scanf float&lt;/TT&gt;" tick box.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;H3&gt;Enabling Newlib-Nano when not using managed linker scripts&lt;/H3&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If you are not using the managed linker script mechanism, then to enable the use of Newlib-Nano, you will need to define which library files to use in your linker script, as described in the FAQ "&lt;A _jive_internal="true" data-containerid="11529" data-containertype="14" data-objectid="389125" data-objecttype="1" href="https://community.nxp.com/thread/389125"&gt;Using your own linker scripts&lt;/A&gt;".&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;In addition, the tick box method of enabling printf/scanf floating point support described above will also not be available. In such cases, you can enabling floating point support manually by going to&lt;/P&gt;&lt;P style="color: #646464; font-family: Arial, sans-serif; font-size: 12px; padding: 5px 10px; background: #eeeeee;"&gt;&lt;SPAN style="font-family: courier new,courier;"&gt;&lt;TT&gt;Project -&amp;gt; Properties -&amp;gt; C/C++ Build -&amp;gt; Settings -&amp;gt; MCU Linker -&amp;gt; Miscellaneous&lt;/TT&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;and entering&amp;nbsp; &lt;SPAN style="font-family: courier new,courier;"&gt;&lt;TT&gt;-u _printf_float&lt;/TT&gt;&lt;/SPAN&gt; and/or&amp;nbsp; &lt;SPAN style="font-family: courier new,courier;"&gt;&lt;TT&gt;-u _scanf_float&lt;/TT&gt;&lt;/SPAN&gt; into the "&lt;SPAN style="font-family: courier new,courier;"&gt;&lt;TT&gt;Linker flags&lt;/TT&gt;&lt;/SPAN&gt;" box.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;A further alternative is to put an explicit reference to the required support function into your project codebase itself.&amp;nbsp; One way to do this is to add a statement such as:&lt;/P&gt;&lt;P style="color: #646464; font-family: Arial, sans-serif; font-size: 12px; padding: 5px 10px; background: #eeeeee;"&gt;&lt;SPAN style="font-family: courier new,courier;"&gt;&lt;TT&gt;asm (".global _printf_float");&lt;/TT&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;to one (or more) of the C source files in your project.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;HR style="color: #646464; font-family: Arial, sans-serif; font-size: 12px;" /&gt;&lt;P&gt;&lt;/P&gt;&lt;H2&gt;&lt;SPAN style="color: #eb7a3d;"&gt;Newlib vs Newlib-Nano&lt;/SPAN&gt;&lt;/H2&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Differences between Newlib and Newlib-Nano include:&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;&lt;P&gt;Newlib-Nano is optimized for size.&lt;/P&gt;&lt;/LI&gt;&lt;LI&gt;&lt;P&gt;The printf and scanf family of routines have been re-implemented in Newlib-Nano to remove a direct dependency on the floating-point input/output handling code. Projects that need to handle floating-point values using these functions must now explicitly request the feature during linking, as described above.&lt;/P&gt;&lt;/LI&gt;&lt;LI&gt;&lt;P&gt;The printf and scanf family of routines in Newlib-Nano support only conversion specifiers defined in C89 standard. This provides a good balance between small memory footprint and full feature formatted input/output.&lt;/P&gt;&lt;/LI&gt;&lt;LI&gt;&lt;P&gt;Newlib-Nano removes the now redundant integer-only implementations of the printf/scanf family of routines (iprintf/iscanf, etc).&amp;nbsp; These functions now alias the standard routines.&lt;/P&gt;&lt;/LI&gt;&lt;LI&gt;&lt;P&gt;In Newlib-Nano, only unwritten buffered data is flushed on exit.&amp;nbsp; Open streams are not closed.&lt;/P&gt;&lt;/LI&gt;&lt;LI&gt;&lt;P&gt;In Newlib-Nano, the dynamic memory allocator has been re-implemented&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;&lt;/P&gt;&lt;H2&gt;Related FAQs&lt;/H2&gt;&lt;UL&gt;&lt;LI&gt;&lt;A _jive_internal="true" data-containerid="11529" data-containertype="14" data-objectid="389153" data-objecttype="1" href="https://community.nxp.com/thread/389153"&gt;What are none, nohost and semihost libraries?&lt;/A&gt;&lt;/LI&gt;&lt;LI&gt;&lt;A _jive_internal="true" data-containerid="11529" data-containertype="14" data-objectid="389152" data-objecttype="1" href="https://community.nxp.com/thread/389152"&gt;What are Redlib and Newlib?&lt;/A&gt;&lt;/LI&gt;&lt;LI&gt;&lt;A _jive_internal="true" data-containerid="11529" data-containertype="14" data-objectid="389104" data-objecttype="1" href="https://community.nxp.com/thread/389104"&gt;Switching the selected C library&lt;/A&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Thu, 31 Mar 2016 22:25:30 GMT</pubDate>
    <dc:creator>lpcware-support</dc:creator>
    <dc:date>2016-03-31T22:25:30Z</dc:date>
    <item>
      <title>Newlib-Nano Support</title>
      <link>https://community.nxp.com/t5/LPCXpresso-IDE-FAQs/Newlib-Nano-Support/m-p/472759#M97</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;LPCXpresso v7 introduced a new C library to complement the existing 'Redlib' and 'Newlib' libraries - Newlib-Nano (sometimes written as NewlibNano).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Newlib-Nano was produced as part of &lt;A _jive_internal="true" href="https://community.nxp.com/external-link.jspa?url=https%3A%2F%2Flaunchpad.net%2Fgcc-arm-embedded"&gt;ARM's "GNU Tools for ARM Embedded Processors" initiative&lt;/A&gt; in order to provide a version of Newlib focused on code size. Using Newlib-Nano can help to dramatically reduce the size of your application compared to using the standard version of Newlib - for both C and C++ projects.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;HR style="color: #646464; font-family: Arial, sans-serif; font-size: 12px;" /&gt;&lt;P&gt;&lt;/P&gt;&lt;H2&gt;&lt;SPAN style="color: #eb7a3d;"&gt;Enabling the use of Newlib-Nano&lt;/SPAN&gt;&lt;/H2&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;To use Newlib-Nano, you will need to change the selected library being used by your project, the easiest way to do this being to use:&lt;/P&gt;&lt;P style="color: #646464; font-family: Arial, sans-serif; font-size: 12px; padding: 5px 10px; background: #eeeeee;"&gt;&lt;SPAN style="font-family: courier new,courier;"&gt;&lt;TT&gt;Quickstart -&amp;gt; Quick Settings -&amp;gt; Set library type&lt;/TT&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;and then select the required Newlib-Nano variant.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;By default, Newlib-Nano uses non-floating point variants of the &lt;SPAN style="font-family: courier new,courier;"&gt;&lt;TT&gt;printf&lt;/TT&gt;&lt;/SPAN&gt; and &lt;SPAN style="font-family: courier new,courier;"&gt;&lt;TT&gt;scanf&lt;/TT&gt;&lt;/SPAN&gt; family of functions, which can help to dramatically reduce the size of your image if only integer values are used by such functions.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If your codebase does require floating point variants of &lt;TT&gt;printf&lt;/TT&gt;/&lt;TT&gt;scanf&lt;/TT&gt;, then these can be enabled by going to&lt;/P&gt;&lt;P style="color: #646464; font-family: Arial, sans-serif; font-size: 12px; padding: 5px 10px; background: #eeeeee;"&gt;&lt;SPAN style="font-family: courier new,courier;"&gt;&lt;TT&gt;Project -&amp;gt; Properties -&amp;gt; C/C++ Build -&amp;gt; Settings -&amp;gt; MCU Linker -&amp;gt; Managed Linker Script&lt;/TT&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;and selecting the "&lt;TT&gt;Enable printf/scanf float&lt;/TT&gt;" tick box.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;H3&gt;Enabling Newlib-Nano when not using managed linker scripts&lt;/H3&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If you are not using the managed linker script mechanism, then to enable the use of Newlib-Nano, you will need to define which library files to use in your linker script, as described in the FAQ "&lt;A _jive_internal="true" data-containerid="11529" data-containertype="14" data-objectid="389125" data-objecttype="1" href="https://community.nxp.com/thread/389125"&gt;Using your own linker scripts&lt;/A&gt;".&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;In addition, the tick box method of enabling printf/scanf floating point support described above will also not be available. In such cases, you can enabling floating point support manually by going to&lt;/P&gt;&lt;P style="color: #646464; font-family: Arial, sans-serif; font-size: 12px; padding: 5px 10px; background: #eeeeee;"&gt;&lt;SPAN style="font-family: courier new,courier;"&gt;&lt;TT&gt;Project -&amp;gt; Properties -&amp;gt; C/C++ Build -&amp;gt; Settings -&amp;gt; MCU Linker -&amp;gt; Miscellaneous&lt;/TT&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;and entering&amp;nbsp; &lt;SPAN style="font-family: courier new,courier;"&gt;&lt;TT&gt;-u _printf_float&lt;/TT&gt;&lt;/SPAN&gt; and/or&amp;nbsp; &lt;SPAN style="font-family: courier new,courier;"&gt;&lt;TT&gt;-u _scanf_float&lt;/TT&gt;&lt;/SPAN&gt; into the "&lt;SPAN style="font-family: courier new,courier;"&gt;&lt;TT&gt;Linker flags&lt;/TT&gt;&lt;/SPAN&gt;" box.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;A further alternative is to put an explicit reference to the required support function into your project codebase itself.&amp;nbsp; One way to do this is to add a statement such as:&lt;/P&gt;&lt;P style="color: #646464; font-family: Arial, sans-serif; font-size: 12px; padding: 5px 10px; background: #eeeeee;"&gt;&lt;SPAN style="font-family: courier new,courier;"&gt;&lt;TT&gt;asm (".global _printf_float");&lt;/TT&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;to one (or more) of the C source files in your project.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;HR style="color: #646464; font-family: Arial, sans-serif; font-size: 12px;" /&gt;&lt;P&gt;&lt;/P&gt;&lt;H2&gt;&lt;SPAN style="color: #eb7a3d;"&gt;Newlib vs Newlib-Nano&lt;/SPAN&gt;&lt;/H2&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Differences between Newlib and Newlib-Nano include:&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;&lt;P&gt;Newlib-Nano is optimized for size.&lt;/P&gt;&lt;/LI&gt;&lt;LI&gt;&lt;P&gt;The printf and scanf family of routines have been re-implemented in Newlib-Nano to remove a direct dependency on the floating-point input/output handling code. Projects that need to handle floating-point values using these functions must now explicitly request the feature during linking, as described above.&lt;/P&gt;&lt;/LI&gt;&lt;LI&gt;&lt;P&gt;The printf and scanf family of routines in Newlib-Nano support only conversion specifiers defined in C89 standard. This provides a good balance between small memory footprint and full feature formatted input/output.&lt;/P&gt;&lt;/LI&gt;&lt;LI&gt;&lt;P&gt;Newlib-Nano removes the now redundant integer-only implementations of the printf/scanf family of routines (iprintf/iscanf, etc).&amp;nbsp; These functions now alias the standard routines.&lt;/P&gt;&lt;/LI&gt;&lt;LI&gt;&lt;P&gt;In Newlib-Nano, only unwritten buffered data is flushed on exit.&amp;nbsp; Open streams are not closed.&lt;/P&gt;&lt;/LI&gt;&lt;LI&gt;&lt;P&gt;In Newlib-Nano, the dynamic memory allocator has been re-implemented&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;&lt;/P&gt;&lt;H2&gt;Related FAQs&lt;/H2&gt;&lt;UL&gt;&lt;LI&gt;&lt;A _jive_internal="true" data-containerid="11529" data-containertype="14" data-objectid="389153" data-objecttype="1" href="https://community.nxp.com/thread/389153"&gt;What are none, nohost and semihost libraries?&lt;/A&gt;&lt;/LI&gt;&lt;LI&gt;&lt;A _jive_internal="true" data-containerid="11529" data-containertype="14" data-objectid="389152" data-objecttype="1" href="https://community.nxp.com/thread/389152"&gt;What are Redlib and Newlib?&lt;/A&gt;&lt;/LI&gt;&lt;LI&gt;&lt;A _jive_internal="true" data-containerid="11529" data-containertype="14" data-objectid="389104" data-objecttype="1" href="https://community.nxp.com/thread/389104"&gt;Switching the selected C library&lt;/A&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 31 Mar 2016 22:25:30 GMT</pubDate>
      <guid>https://community.nxp.com/t5/LPCXpresso-IDE-FAQs/Newlib-Nano-Support/m-p/472759#M97</guid>
      <dc:creator>lpcware-support</dc:creator>
      <dc:date>2016-03-31T22:25:30Z</dc:date>
    </item>
  </channel>
</rss>

