<?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: How to use Math functions with MCUXpresso? in MCUXpresso General</title>
    <link>https://community.nxp.com/t5/MCUXpresso-General/How-to-use-Math-functions-with-MCUXpresso/m-p/804059#M765</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Mark,&lt;/P&gt;&lt;P&gt;you don't need to add the libraries manually, as the compiler/linker driver will pick the ones matching to your application/linker settings. So I think you might have missed options like specifying your FPU?&lt;/P&gt;&lt;P&gt;I recommend you create a project in the IDE and check what it sets up for you?&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>Mon, 20 Aug 2018 18:36:05 GMT</pubDate>
    <dc:creator>BlackNight</dc:creator>
    <dc:date>2018-08-20T18:36:05Z</dc:date>
    <item>
      <title>How to use Math functions with MCUXpresso?</title>
      <link>https://community.nxp.com/t5/MCUXpresso-General/How-to-use-Math-functions-with-MCUXpresso/m-p/804056#M762</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi All&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Any ideas as to how to use math functions in MCUXpresso?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The project in hand can't link due to missing math library, eg&lt;BR /&gt;&lt;SPAN style="font-family: courier new, courier, monospace;"&gt;FLASH_target/../Applications/Project/time.c:213: undefined reference to `sin'&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-family: courier new, courier, monospace;"&gt;FLASH_target/../Applications/Project/calculations.c:219: undefined reference to `tan'&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-family: courier new, courier, monospace;"&gt;FLASH_target/../Applications/Project/calculations.c:220: undefined reference to `atan'&lt;/SPAN&gt;&lt;BR /&gt;... etc.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Normally I add &lt;STRONG&gt;-lm&lt;/STRONG&gt; to link in the GCC math libraries but this has no effect here.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;In the project properties there is a tab to add libraries but which one is needed, or which path?&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper"&gt;&lt;img src="https://community.nxp.com/t5/image/serverpage/image-id/63272i1A71655A2E593C19/image-size/large?v=v2&amp;amp;px=999" title="pastedImage_1.png" alt="pastedImage_1.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;Searing in the IDE user's guide the only reference too math is with respect to Redlib extension:&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper"&gt;&lt;img src="https://community.nxp.com/t5/image/serverpage/image-id/63314i1580731E588D83D4/image-size/large?v=v2&amp;amp;px=999" title="pastedImage_4.png" alt="pastedImage_4.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;Thanks in advance for any help.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;regrds&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Mark&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;P.S Also the same problem when trying with KDS....&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 20 Aug 2018 16:24:46 GMT</pubDate>
      <guid>https://community.nxp.com/t5/MCUXpresso-General/How-to-use-Math-functions-with-MCUXpresso/m-p/804056#M762</guid>
      <dc:creator>mjbcswitzerland</dc:creator>
      <dc:date>2018-08-20T16:24:46Z</dc:date>
    </item>
    <item>
      <title>Re: How to use Math functions with MCUXpresso?</title>
      <link>https://community.nxp.com/t5/MCUXpresso-General/How-to-use-Math-functions-with-MCUXpresso/m-p/804057#M763</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi All&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;As follow-up:&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;I note that Redlib, Newlib or NewlibNano can be used when the setting is to use managed linker script mechanism, which look to include libm.a.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Since managed linker script is &lt;SPAN style="text-decoration: underline;"&gt;not&lt;/SPAN&gt; being used the advice is to modify the linker script to add entries before the SECTION line, whereby if I have understood correctly it needs&lt;BR /&gt;"GROUP (libgcc.a libc.a libm.a libcr_newlib_none.a)"&lt;BR /&gt;to be added.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;This hasn't been tried (yet) because the linker script file is shared with other GCC projects and the preferred method would be to add the appropriate library in an IDE setting as shown in the first image. Since there are 21 occurrences of libm.a in the MCUXpresso directories the question is how to chose the correct one for a particular processor and keep it compatible when changing between M0+ and M4 cores with and without FPU (which seems the big advantage of the -lm option that is not working)?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards&lt;BR /&gt;&lt;BR /&gt;Mark&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 20 Aug 2018 18:30:29 GMT</pubDate>
      <guid>https://community.nxp.com/t5/MCUXpresso-General/How-to-use-Math-functions-with-MCUXpresso/m-p/804057#M763</guid>
      <dc:creator>mjbcswitzerland</dc:creator>
      <dc:date>2018-08-20T18:30:29Z</dc:date>
    </item>
    <item>
      <title>Re: How to use Math functions with MCUXpresso?</title>
      <link>https://community.nxp.com/t5/MCUXpresso-General/How-to-use-Math-functions-with-MCUXpresso/m-p/804058#M764</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Mark,&lt;/P&gt;&lt;P&gt;it works for me out of the box, both for MCUXpresso IDE (RedLib) and KDS (newlib-nano). I think you have your compiler and/or linker switches wrong. Here is what I have as reference (I cut down the list of includes and object files as this is not of interest here):&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;KDS:&lt;/P&gt;&lt;P&gt;Building file: ../Sources/Application.c&lt;BR /&gt;Invoking: Cross ARM GNU C Compiler&lt;BR /&gt;arm-none-eabi-gcc -mcpu=cortex-m4 -mthumb -mfloat-abi=hard -mfpu=fpv4-sp-d16 -O3 -fmessage-length=0 -fsigned-char -ffunction-sections -fdata-sections&amp;nbsp; -g3 -I"........" -std=c99 -MMD -MP -MF"Sources/Application.d" -MT"Sources/Application.o" -c -o "Sources/Application.o" "../Sources/Application.c"&lt;BR /&gt;Finished building: ../Sources/Application.c&lt;BR /&gt;&amp;nbsp;&lt;BR /&gt;Building target: FRDM-K64F_Adafruit_SSD1351.elf&lt;BR /&gt;Invoking: Cross ARM GNU C++ Linker&lt;BR /&gt;arm-none-eabi-g++ -mcpu=cortex-m4 -mthumb -mfloat-abi=hard -mfpu=fpv4-sp-d16 -O3 -fmessage-length=0 -fsigned-char -ffunction-sections -fdata-sections&amp;nbsp; -g3 -T "C:/Users/Erich Styger/Data/GitRepos/McuOnEclipse/Examples/KDS/FRDM-K64F120M/FRDM-K64F_Adafruit_SSD1351/Project_Settings/Linker_Files/ProcessorExpert.ld" -Xlinker --gc-sections -L"C:/Users/Erich Styger/Data/GitRepos/McuOnEclipse/Examples/KDS/FRDM-K64F120M/FRDM-K64F_Adafruit_SSD1351/Project_Settings/Linker_Files" -Wl,-Map,"FRDM-K64F_Adafruit_SSD1351.map" -specs=nano.specs -specs=nosys.specs -o "FRDM-K64F_Adafruit_SSD1351.elf"&amp;nbsp; ./Static_Code/System/CPU_Init.o ....... &amp;nbsp; &lt;BR /&gt;Finished building target: FRDM-K64F_Adafruit_SSD1351.elf&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;MCUXpresso IDE:&lt;/P&gt;&lt;P&gt;Building file: ../source/main.c&lt;BR /&gt;Invoking: MCU C Compiler&lt;BR /&gt;arm-none-eabi-gcc -D__REDLIB__ -DFSL_RTOS_BM -DSDK_OS_BAREMETAL -DSDK_DEBUGCONSOLE=0 -DCR_INTEGER_PRINTF -DPRINTF_FLOAT_ENABLE=0 -DCPU_MK64FN1M0VLL12 -DCPU_MK64FN1M0VLL12_cm4 -D__MCUXPRESSO -DDEBUG -I...... -O0 -fno-common -g3 -Wall -c -ffunction-sections -fdata-sections -ffreestanding -fno-builtin -mcpu=cortex-m4 -mfpu=fpv4-sp-d16 -mfloat-abi=hard -mthumb -D__REDLIB__ -specs=redlib.specs -MMD -MP -MF"source/main.d" -MT"source/main.o" -MT"source/main.d" -o "source/main.o" "../source/main.c"&lt;BR /&gt;Finished building: ../source/main.c&lt;BR /&gt;&amp;nbsp;&lt;BR /&gt;Building target: FRDM-K64F_Adafruit_SSD1351.axf&lt;BR /&gt;Invoking: MCU Linker&lt;BR /&gt;arm-none-eabi-gcc -nostdlib -Xlinker -Map="FRDM-K64F_Adafruit_SSD1351.map" -Xlinker --gc-sections -Xlinker -print-memory-usage -Xlinker --sort-section=alignment -mcpu=cortex-m4 -mfpu=fpv4-sp-d16 -mfloat-abi=hard -mthumb -T FRDM-K64F_Adafruit_SSD1351_Debug.ld -o "FRDM-K64F_Adafruit_SSD1351.axf"&amp;nbsp; ./startup/startup_mk64f12.o&amp;nbsp; ./source/Application.o .....&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>Mon, 20 Aug 2018 18:30:50 GMT</pubDate>
      <guid>https://community.nxp.com/t5/MCUXpresso-General/How-to-use-Math-functions-with-MCUXpresso/m-p/804058#M764</guid>
      <dc:creator>BlackNight</dc:creator>
      <dc:date>2018-08-20T18:30:50Z</dc:date>
    </item>
    <item>
      <title>Re: How to use Math functions with MCUXpresso?</title>
      <link>https://community.nxp.com/t5/MCUXpresso-General/How-to-use-Math-functions-with-MCUXpresso/m-p/804059#M765</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Mark,&lt;/P&gt;&lt;P&gt;you don't need to add the libraries manually, as the compiler/linker driver will pick the ones matching to your application/linker settings. So I think you might have missed options like specifying your FPU?&lt;/P&gt;&lt;P&gt;I recommend you create a project in the IDE and check what it sets up for you?&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>Mon, 20 Aug 2018 18:36:05 GMT</pubDate>
      <guid>https://community.nxp.com/t5/MCUXpresso-General/How-to-use-Math-functions-with-MCUXpresso/m-p/804059#M765</guid>
      <dc:creator>BlackNight</dc:creator>
      <dc:date>2018-08-20T18:36:05Z</dc:date>
    </item>
    <item>
      <title>Re: How to use Math functions with MCUXpresso?</title>
      <link>https://community.nxp.com/t5/MCUXpresso-General/How-to-use-Math-functions-with-MCUXpresso/m-p/804060#M766</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Eric&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I don't think there are any problems with linker switches and such.&lt;BR /&gt;What I find is that any project created in the IDEs (eg. MCUXpressor) adds an include linker script to the linker script with a group specifying the libraries to be used.&lt;/P&gt;&lt;P&gt;Eg.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: courier new, courier, monospace;"&gt;/*&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-family: courier new, courier, monospace;"&gt;&amp;nbsp;* GENERATED FILE - DO NOT EDIT&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-family: courier new, courier, monospace;"&gt;&amp;nbsp;* (c) Code Red Technologies Ltd, 2008-2013&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-family: courier new, courier, monospace;"&gt;&amp;nbsp;* (c) NXP Semiconductors 2013-2018&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-family: courier new, courier, monospace;"&gt;&amp;nbsp;* Generated linker script file for MK64FN1M0xxx12&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-family: courier new, courier, monospace;"&gt;&amp;nbsp;* Created from linkscript.ldt by FMCreateLinkLibraries&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-family: courier new, courier, monospace;"&gt;&amp;nbsp;* Using Freemarker v2.3.23&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-family: courier new, courier, monospace;"&gt;&amp;nbsp;* MCUXpresso IDE v10.0.0 [Build 344] [2017-03-21]&amp;nbsp; on 28-Aug-2018 03:26:43&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-family: courier new, courier, monospace;"&gt;&amp;nbsp;*/&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #0000ff;"&gt;&lt;STRONG style="font-family: courier new, courier, monospace;"&gt;INCLUDE "frdmk64f_driver_examples_rtc_Debug_library.ld"&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-family: courier new, courier, monospace;"&gt;INCLUDE "frdmk64f_driver_examples_rtc_Debug_memory.ld"&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: courier new, courier, monospace;"&gt;ENTRY(ResetISR)&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: courier new, courier, monospace;"&gt;SECTIONS&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-family: courier new, courier, monospace;"&gt;{&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-family: courier new, courier, monospace;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; /* MAIN TEXT SECTION */&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-family: courier new, courier, monospace;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; .text : ALIGN(4)&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-family: courier new, courier, monospace;"&gt;...&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;and then in one of the include files there is a list of libraries - eg.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: courier new, courier, monospace;"&gt;/*&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-family: courier new, courier, monospace;"&gt;&amp;nbsp;* GENERATED FILE - DO NOT EDIT&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-family: courier new, courier, monospace;"&gt;&amp;nbsp;* (c) Code Red Technologies Ltd, 2008-2013&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-family: courier new, courier, monospace;"&gt;&amp;nbsp;* (c) NXP Semiconductors 2013-2018&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-family: courier new, courier, monospace;"&gt;&amp;nbsp;* Generated linker script file for MK64FN1M0xxx12&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-family: courier new, courier, monospace;"&gt;&amp;nbsp;* Created from library.ldt by FMCreateLinkLibraries&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-family: courier new, courier, monospace;"&gt;&amp;nbsp;* Using Freemarker v2.3.23&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-family: courier new, courier, monospace;"&gt;&amp;nbsp;* MCUXpresso IDE v10.0.0 [Build 344] [2017-03-21]&amp;nbsp; on 28-Aug-2018 03:26:43&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-family: courier new, courier, monospace;"&gt;&amp;nbsp;*/&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: courier new, courier, monospace;"&gt;GROUP (&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-family: courier new, courier, monospace;"&gt;&amp;nbsp; libcr_nohost.a&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="color: #0000ff;"&gt;&lt;STRONG style="font-family: courier new, courier, monospace;"&gt;&amp;nbsp; libcr_c.a&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-family: courier new, courier, monospace;"&gt;&amp;nbsp; libcr_eabihelpers.a&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-family: courier new, courier, monospace;"&gt;)&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;It is the &lt;SPAN style="text-decoration: underline;"&gt;libcr_c.a&lt;/SPAN&gt; library that is needed (if you delete it from the included linker script file group you will find that projects will fail with non-found symbols).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;What I am look for is the method to add this library in a way that it doesn't need special linker scripts and also find the correct version of the library. At the moment I can get it to build by pointing it to the correct version (there are 21 available but I can only find it by trial and error since most directory names don't make much sense to me - however it breaks if the processor type is changed (core type and with/without FPU ).&lt;/P&gt;&lt;P&gt;Using the -l entry (also with -L to give it a path) it always fails because it can find the file (?) whereby I assume that it would then (somehow) take the correct one (?)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Mark&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 28 Aug 2018 02:19:11 GMT</pubDate>
      <guid>https://community.nxp.com/t5/MCUXpresso-General/How-to-use-Math-functions-with-MCUXpresso/m-p/804060#M766</guid>
      <dc:creator>mjbcswitzerland</dc:creator>
      <dc:date>2018-08-28T02:19:11Z</dc:date>
    </item>
    <item>
      <title>Re: How to use Math functions with MCUXpresso?</title>
      <link>https://community.nxp.com/t5/MCUXpresso-General/How-to-use-Math-functions-with-MCUXpresso/m-p/804061#M767</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;The "system" libraries are found in the appropriate directory based on the build options used (cpu/fpu/etc) using GCC's multilib support. You can generate a list of directories vs options by invoking :&lt;/P&gt;&lt;PRE style="padding-left: 30px;"&gt;arm-none-eabi-gcc -print-multi-lib&lt;/PRE&gt;&lt;P&gt;But this does raise the question of : what are you actually trying to do and why?&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>Fri, 21 Dec 2018 11:56:06 GMT</pubDate>
      <guid>https://community.nxp.com/t5/MCUXpresso-General/How-to-use-Math-functions-with-MCUXpresso/m-p/804061#M767</guid>
      <dc:creator>lpcxpresso_supp</dc:creator>
      <dc:date>2018-12-21T11:56:06Z</dc:date>
    </item>
  </channel>
</rss>

