<div dir="ltr">i mean I use VisualGDB, I also use WinDBG, but that is a debugger. :) </div><div class="gmail_extra"><br><div class="gmail_quote">On Thu, Dec 22, 2016 at 7:45 PM, Steve Edwards <span dir="ltr"><<a href="mailto:steve.edwards214@gmail.com" target="_blank">steve.edwards214@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">I am not a compiler expert nor have I ever used <span style="font-size:12.8px"><b>arm-none-eabi-gcc cross compiler under linux</b> but i have WinDBG under Windows that cross compiles with  \sysgcc\arm-eabi 6.2.0.</span><div><span style="font-size:12.8px"><br></span></div><div><span style="font-size:12.8px">This may help.  i created two projects, both target same board STM32F401RE, one enables HW FPU support and one uses Software FPU. you can compare the makefiles to see several differences.  perhaps it will give you the info you need.<br></span><div><span style="font-size:12.8px"><br></span></div><div><span style="font-size:12.8px">-hth Steve</span></div></div></div><div class="HOEnZb"><div class="h5"><div class="gmail_extra"><br><div class="gmail_quote">On Thu, Dec 22, 2016 at 5:16 PM, David Anderson <span dir="ltr"><<a href="mailto:davida@smu.edu" target="_blank">davida@smu.edu</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">For any who have worked with the STMicros STM32401RE board using the arm-none-eabi-gcc cross compiler under linux.  The LMX RTOS code is now running on the board and I can flash leds and write output to a UART.<br>
<br>
But there is a problem with the math generated by the compiler. Basically the math function "divide"  (/)  for single precision integers works, but crashes for double precision and for floats, doubles etc.<br>
<br>
Suspicious that it was something I'm doing, I stripped out everything, told the loader to give it a lot of stack space,  wrote this simple test, and turned off the -O2 optimizer:<br>
<br>
#include "main.h"<br>
#include "leds.h"<br>
<br>
/* ------------------------------<wbr>------------------------------<wbr>----------------*/<br>
/* main */<br>
/* ------------------------------<wbr>------------------------------<wbr>----------------*/<br>
<br>
int a,b,c;<br>
// long a,b,c;<br>
// long long a,b,c;<br>
// float  a,b,c;<br>
// double a,b,c;<br>
<br>
int main(void)<br>
{<br>
        /* initialize */<br>
        leds_init();<br>
        LED2_ON;<br>
<br>
        a = 65535;<br>
        b = 10;<br>
        c = a / b;<br>
<br>
        LED3_ON;<br>
        while (1) {};<br>
<br>
        /* should never get here */<br>
        return 0;<br>
}<br>
<br>
/* ------------------------------<wbr>------------------------------ */<br>
<br>
The code turns on one LED, runs the math test, and turns on the second LED.   This works with ints and longs, but fails (2nd LED never lights) with long longs and floats and doubles.  I added casts for the appropriate constants but it didn't make any difference.<br>
<br>
I dumped the assembly code to see what was generated, and it appears that the ints and longs are divided by the machine instruction "sdiv" while the long longs call the function "__aeabi_ldivmod" and the floats call the function "__aeabi_fdiv".  But neither one of those calls appear to work.<br>
<br>
And why is it calling a function?  I thought this ARM Cortex-M4 processor included a hardware single precision FPU (FPv4-SP)?   Did I leave out some flag when building the compiler, newlib, or the application?  I think they were all built with "-mcpu=cortex-m4". Is something else required?  I tried "-mfpu=fpv4-sp" but the compiler said "no such thing" and offered fpv4-sp-d16 as the closest option.  It did not help.<br>
<br>
So... help!  Anyone seem this before?  Any of you compiler guru's have any suggestions?<br>
<br>
much thanks,<br>
dpa<br>
<br>
<br>
<br>
<br>
<br>
______________________________<wbr>_________________<br>
DPRGlist mailing list<br>
<a href="mailto:DPRGlist@lists.dprg.org" target="_blank">DPRGlist@lists.dprg.org</a><br>
<a href="http://lists.dprg.org/listinfo.cgi/dprglist-dprg.org" rel="noreferrer" target="_blank">http://lists.dprg.org/listinfo<wbr>.cgi/dprglist-dprg.org</a><br>
</blockquote></div><br></div>
</div></div></blockquote></div><br></div>