<?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>LPC MicrocontrollersのトピックRe: printf and floats</title>
    <link>https://community.nxp.com/t5/LPC-Microcontrollers/printf-and-floats/m-p/545794#M13130</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;STRONG&gt;Content originally posted in LPCWare by g_mocken on Wed Jul 01 03:06:39 MST 2015&lt;/STRONG&gt;&lt;BR /&gt;&lt;HR /&gt;&lt;SPAN style="color: #0000ff;"&gt;&lt;STRONG&gt;Quote: TheFallGuy&lt;/STRONG&gt;&lt;BR /&gt;Looks like you have configured FreeRTOS for hardware float. Look at the FreeRTOS configuration header.&lt;/SPAN&gt;&lt;HR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;There is no such thing to configure in there. However I have now switched to the CM3 port (instead of CM4F) which can (only) be compiled without FPU support and apparently also runs on the CM4. It works!&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 15 Jun 2016 18:29:24 GMT</pubDate>
    <dc:creator>lpcware</dc:creator>
    <dc:date>2016-06-15T18:29:24Z</dc:date>
    <item>
      <title>printf and floats</title>
      <link>https://community.nxp.com/t5/LPC-Microcontrollers/printf-and-floats/m-p/545790#M13126</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;STRONG&gt;Content originally posted in LPCWare by g_mocken on Fri Jun 26 02:56:38 MST 2015&lt;/STRONG&gt;&lt;BR /&gt;&lt;SPAN&gt;Hi,&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;generally I am aware of stack size&amp;nbsp; and library selection issues when using printf with floats. Using lplink2 with 4370, I have no problems to print floats to either UART or to the console via semihosting.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;But when I use the same code (or a minimal test project) on a custom board with 4074, it always runs into a HardFault. The stack trace is:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Thread [1] &amp;lt;main&amp;gt; (Suspended : Signal : SIGSTOP:Stopped (signal))&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;HardFault_Handler() at cr_startup_lpc407x_8x.c:371 0x228&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;lt;signal handler called&amp;gt;() at 0xfffffff9&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;fp_display() at 0x1488&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;__vfprintf() at 0x24c2&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;printf_char() at 0x1146&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;main() at Test_4074_board.c:41 0x326&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;In this case, I was linking with RedLib(semihost) and trying in main() to perform:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; DEBUGOUT("float: %f\r\n", 123.456f);&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I also tried more complex variants (e.g putting this line into a FreeRTOS task that was created with a large stack size), but with no success on 4074. &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Any help would be appreciated.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 15 Jun 2016 18:29:21 GMT</pubDate>
      <guid>https://community.nxp.com/t5/LPC-Microcontrollers/printf-and-floats/m-p/545790#M13126</guid>
      <dc:creator>lpcware</dc:creator>
      <dc:date>2016-06-15T18:29:21Z</dc:date>
    </item>
    <item>
      <title>Re: printf and floats</title>
      <link>https://community.nxp.com/t5/LPC-Microcontrollers/printf-and-floats/m-p/545791#M13127</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;STRONG&gt;Content originally posted in LPCWare by lpcxpresso-support on Fri Jun 26 08:28:09 MST 2015&lt;/STRONG&gt;&lt;BR /&gt;&lt;SPAN&gt;Its always possible that you have run out of stack/heap.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;&lt;A class="jive-link-external-small" href="https://community.nxp.com/external-link.jspa?url=http%3A%2F%2Fwww.lpcware.com%2Fcontent%2Ffaq%2Flpcxpresso%2Fheap-checking-redlib" rel="nofollow" target="_blank"&gt;http://www.lpcware.com/content/faq/lpcxpresso/heap-checking-redlib&lt;/A&gt;&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;But another possibility is that your project is configured to use hardware floating point - but the LPC4074 (unlike most LPC40xx parts) doesn't actually implement hardware FP. &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;&lt;SPAN&gt;Thus check your project settings - for more details see: &lt;/SPAN&gt;&lt;A class="jive-link-external-small" href="https://community.nxp.com/external-link.jspa?url=http%3A%2F%2Fwww.lpcware.com%2Fcontent%2Ffaq%2Flpcxpresso%2Fcm4-floating-point" rel="nofollow" target="_blank"&gt;http://www.lpcware.com/content/faq/lpcxpresso/cm4-floating-point&lt;/A&gt;&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;If that doesn't fix it, then it would be useful to see what exactly is triggering the hard fault - use the following FAQ as a guide on how to do this:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;&lt;A class="jive-link-external-small" href="https://community.nxp.com/external-link.jspa?url=http%3A%2F%2Fwww.lpcware.com%2Fcontent%2Ffaq%2Flpcxpresso%2Fdebugging-hard-fault" rel="nofollow" target="_blank"&gt;http://www.lpcware.com/content/faq/lpcxpresso/debugging-hard-fault&lt;/A&gt;&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Regards,&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;LPCXpresso Support&lt;/SPAN&gt;&lt;BR /&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 15 Jun 2016 18:29:21 GMT</pubDate>
      <guid>https://community.nxp.com/t5/LPC-Microcontrollers/printf-and-floats/m-p/545791#M13127</guid>
      <dc:creator>lpcware</dc:creator>
      <dc:date>2016-06-15T18:29:21Z</dc:date>
    </item>
    <item>
      <title>Re: printf and floats</title>
      <link>https://community.nxp.com/t5/LPC-Microcontrollers/printf-and-floats/m-p/545792#M13128</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;STRONG&gt;Content originally posted in LPCWare by g_mocken on Fri Jun 26 11:06:59 MST 2015&lt;/STRONG&gt;&lt;BR /&gt;&lt;HR /&gt;&lt;SPAN style="color: #0000ff;"&gt;&lt;STRONG&gt;Quote: lpcxpresso-support&lt;/STRONG&gt;&lt;BR /&gt;&lt;BR /&gt;But another possibility is that your project is configured to use hardware floating point - but the LPC4074 (unlike most LPC40xx parts) doesn't actually implement hardware FP. &lt;BR /&gt;Thus check your project settings&lt;/SPAN&gt;&lt;HR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I am using "SoftABI". What should I use instead? "HardABI" crashes in the same way. "None" does not compile with FreeRTOS.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;"None" does however solve the problem for a minimal test project without FreeRTOS!&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Assuming that "None" is the way to go, do you have any additional hint on how to deal with FreeRTOS' compilation errors:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;arm-none-eabi-gcc -std=c99 -D__MULTICORE_NONE -DDEBUG -D__CODE_RED -DCORE_M4 -D__USE_LPCOPEN -D__REDLIB__ -DCR_PRINTF_CHAR -I"/home/guido/lpc_workspace/lpc_chip_40xx/inc" [various other source files] -Og -g3 -Wall -c -fmessage-length=0 -fno-builtin -ffunction-sections -fdata-sections -fsingle-precision-constant -mcpu=cortex-m4 -mthumb -D__REDLIB__ -specs=redlib.specs -MMD -MP -MF"freertos/src/port.d" -MT"freertos/src/port.o" -MT"freertos/src/port.d" -o "freertos/src/port.o" "../freertos/src/port.c"&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;/tmp/ccQgaxFT.s: Assembler messages:&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;/tmp/ccQgaxFT.s:306: Error: selected processor does not support Thumb mode `vstmdbeq r0!,{s16-s31}'&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;/tmp/ccQgaxFT.s:308: Error: instruction not allowed in IT block -- `stmdb r0!,{r4-r11,r14}'&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;/tmp/ccQgaxFT.s:329: Error: selected processor does not support Thumb mode `vldmiaeq r0!,{s16-s31}'&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;/tmp/ccQgaxFT.s:331: Error: instruction not allowed in IT block -- `msr psp,r0'&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;make: *** [freertos/src/port.o] Fehler 1 &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;?&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;On closer inspection , I noticed this line in port.c (the #error did not trigger, though):&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;#ifndef __VFP_FP__&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;#error This port can only be used when the project options are configured to enable hardware floating point support.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;#endif&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;So is there any FreeRTOS port that can be used on lpc4074?&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 15 Jun 2016 18:29:22 GMT</pubDate>
      <guid>https://community.nxp.com/t5/LPC-Microcontrollers/printf-and-floats/m-p/545792#M13128</guid>
      <dc:creator>lpcware</dc:creator>
      <dc:date>2016-06-15T18:29:22Z</dc:date>
    </item>
    <item>
      <title>Re: printf and floats</title>
      <link>https://community.nxp.com/t5/LPC-Microcontrollers/printf-and-floats/m-p/545793#M13129</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;STRONG&gt;Content originally posted in LPCWare by TheFallGuy on Fri Jun 26 23:42:14 MST 2015&lt;/STRONG&gt;&lt;BR /&gt;&lt;SPAN&gt;Looks like you have configured FreeRTOS for hardware float. Look at the FreeRTOS configuration header.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 15 Jun 2016 18:29:23 GMT</pubDate>
      <guid>https://community.nxp.com/t5/LPC-Microcontrollers/printf-and-floats/m-p/545793#M13129</guid>
      <dc:creator>lpcware</dc:creator>
      <dc:date>2016-06-15T18:29:23Z</dc:date>
    </item>
    <item>
      <title>Re: printf and floats</title>
      <link>https://community.nxp.com/t5/LPC-Microcontrollers/printf-and-floats/m-p/545794#M13130</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;STRONG&gt;Content originally posted in LPCWare by g_mocken on Wed Jul 01 03:06:39 MST 2015&lt;/STRONG&gt;&lt;BR /&gt;&lt;HR /&gt;&lt;SPAN style="color: #0000ff;"&gt;&lt;STRONG&gt;Quote: TheFallGuy&lt;/STRONG&gt;&lt;BR /&gt;Looks like you have configured FreeRTOS for hardware float. Look at the FreeRTOS configuration header.&lt;/SPAN&gt;&lt;HR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;There is no such thing to configure in there. However I have now switched to the CM3 port (instead of CM4F) which can (only) be compiled without FPU support and apparently also runs on the CM4. It works!&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 15 Jun 2016 18:29:24 GMT</pubDate>
      <guid>https://community.nxp.com/t5/LPC-Microcontrollers/printf-and-floats/m-p/545794#M13130</guid>
      <dc:creator>lpcware</dc:creator>
      <dc:date>2016-06-15T18:29:24Z</dc:date>
    </item>
    <item>
      <title>Re: printf and floats</title>
      <link>https://community.nxp.com/t5/LPC-Microcontrollers/printf-and-floats/m-p/545795#M13131</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;STRONG&gt;Content originally posted in LPCWare by &lt;A href="https://community.nxp.com/www.FreeRTOS.org" target="test_blank"&gt;www.FreeRTOS.org&lt;/A&gt; on Wed Jul 01 03:20:34 MST 2015&lt;/STRONG&gt;&lt;BR /&gt;&lt;SPAN&gt;To use FreeRTOS on a Cortex-M3 part or a Cortex-M4 part that does not have an FPU (or if the FPU is turned off) then use the port files from FreeRTOS/source/portable/GCC/ARM_CM3.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;To use FreeRTOS on a Cortex-M4F part (with hardware FPU) use the port files from FreeRTOS/source/portable/GCC/ARM_CM4F.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Hope this helps.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 15 Jun 2016 18:29:24 GMT</pubDate>
      <guid>https://community.nxp.com/t5/LPC-Microcontrollers/printf-and-floats/m-p/545795#M13131</guid>
      <dc:creator>lpcware</dc:creator>
      <dc:date>2016-06-15T18:29:24Z</dc:date>
    </item>
  </channel>
</rss>

