Crash under sparc/rtems-4.11 when compiling with FPU

Athanasios.Tsiodras at esa.int Athanasios.Tsiodras at esa.int
Tue Feb 9 16:50:26 UTC 2016


I added a section to the FPU page (
https://devel.rtems.org/wiki/TBR/UserManual/Floating_Point_Support) - hope 
it helps the next person dealing with this.
I hope Daniel Hellström  replies with the code that used to trigger the 
compiler bug - we will then be able to make sure the bug is gone now, and 
finally put this to rest.

HE Space for ESA - European Space Agency
Thanassis Tsiodras
Real-time Embedded Software Engineer 
System, Software and Technology Department

ESTEC
Keplerlaan 1, PO Box 299
NL-2200 AG Noordwijk, The Netherlands
Athanasios.Tsiodras at esa.int | www.esa.int
T +31 71 565 5332



From:   "Gedare Bloom" <gedare at rtems.org>
To:     "Hugues Jérôme" <hugues.jerome at gmail.com>
Cc:     Athanasios.Tsiodras at esa.int, "RTEMS List" <users at rtems.org>
Date:   08/02/2016 17:41
Subject:        Re: Crash under sparc/rtems-4.11 when compiling with FPU
Sent by:        gedare at gwmail.gwu.edu



Please disregard the TBR notice, and feel free to modify/update the
page. This "TBR" is a misnomer of sorts. Many of these pages are
slated to be copied to a website other than the wiki. Or in this case,
into some sort of user manual that is pending. It was a mistake to use
this TBR lingo.

On Mon, Feb 8, 2016 at 6:14 AM, Hugues Jérôme <hugues.jerome at gmail.com> 
wrote:
> Hi,
>
> The root of the wiki you point to is:
>
> To Be Removed
>
> All pages under /TBR/* are slated to be removed.
>
>
> If memory serves me, these were created when ritems.org has been
> reorganized.
> Note sure it is a good idea to change this
>
>
>
> Le 8 févr. 2016 à 10:57, Athanasios.Tsiodras at esa.int a écrit :
>
> (slight correction - I pasted the wrong output, the binary works fine 
:-)
>
> *** BEGIN OF TEST HELLO WORLD ***
> Hello World, 93647.304688
> *** END OF TEST HELLO WORLD ***
>
> I am unaware of the proper etiquette for this, so I better check - am I
> allowed to edit the wiki page at
> https://devel.rtems.org/wiki/TBR/UserManual/Floating_Point_Support to 
add a
> section about Leon3 native FPU usage and the need for the patch I did in
> leon3.cfg?
>
> Apologies if I am overstepping - I just don't want others to go through 
the
> same efforts that I did.
>
> Kind regards,
> Thanassis.
>
> European Space Agency (via HE Space)
> Thanassis Tsiodras
> Real-time Embedded Software Engineer
> System, Software and Technology Department
>
> ESTEC
> Keplerlaan 1, PO Box 299
> NL-2200 AG Noordwijk, The Netherlands
> Athanasios.Tsiodras at esa.int | www.esa.int
> T +31 71 565 5332
>
>
>
> From:        Athanasios.Tsiodras at esa.int
> To:        "RTEMS List" <users at rtems.org>
> Date:        08/02/2016 10:50
> Subject:        Re: Crash under sparc/rtems-4.11 when compiling with FPU
> Sent by:        "users" <users-bounces at rtems.org>
> ________________________________
>
>
>
> I verified Sebastian's suggestion - by modifying the leon3.cfg file...
>
>    diff --git a/c/src/lib/libbsp/sparc/leon3/make/custom/leon3.cfg
> b/c/src/lib/libbsp/sparc/leon3/make/custom/leon3.cfg
>    index 58f2f07..30fc3a4 100644
>    --- a/c/src/lib/libbsp/sparc/leon3/make/custom/leon3.cfg
>    +++ b/c/src/lib/libbsp/sparc/leon3/make/custom/leon3.cfg
>    @@ -9,7 +9,8 @@ RTEMS_CPU_MODEL=leon3
>
>     #  This contains the compiler options necessary to select the CPU 
model
>     #  and (hopefully) optimize for it.
>    -CPU_CFLAGS = -mcpu=cypress -msoft-float
>    +CPU_CFLAGS = -mcpu=cypress -mhard-float
>
> ...the generated binary of hello.exe works fine - I went a step further 
and
> did a test calculation, too:
>
>    diff --git a/testsuites/samples/hello/init.c
> b/testsuites/samples/hello/init.c
>    index d8fe450..6ee33f6 100644
>    --- a/testsuites/samples/hello/init.c
>    +++ b/testsuites/samples/hello/init.c
>    @@ -27,8 +27,13 @@ rtems_task Init(
>       rtems_task_argument ignored
>     )
>     {
>    +  int i = 0;
>    +  float a=3.14159f, b=1.0f;
>    +
>       rtems_test_begin();
>    -  printf( "Hello World\n" );
>    +  for (i=0; i<10; i++)
>    +      b*=a;
>    +  printf( "Hello World, %f\n", b );
>       rtems_test_end();
>       exit( 0 );
>     }
>
> ...which worked fine:
>
>    (gdb) tar extended-remote ... ( to grmon)
>    (gdb) c
>    Continuing.
>
>    *** BEGIN OF TEST HELLO WORLD ***
>    Hello World, 1.000000
>    *** END OF TEST HELLO WORLD ***
>
> ...and I made sure that FPU instructions are inside:
>
>      for (i=0; i<10; i++)
>      28:   82 80 7f ff     addcc  %g1, -1, %g1
>      2c:   12 bf ff ff     bne  28 <Init+0x28>
>      30:   91 a2 09 29     fmuls  %f8, %f9, %f8
>          b*=a;
>      printf( "Hello World, %f\n", b );
>      34:   91 a0 19 28     fstod  %f8, %f8
>
> So, executive summary....  It seems that the default compilation 
settings of
> the Leon3 BSP forbid "real FPU" work.
> If one needs to work in native (non-emulated) FPU mode, then the 
leon3.cfg
> must be patched as I showed above.
>
> In the long run, as Sebastian indicated, a leon3fp (and a corresponding
> leon2fp, I imagine)
> should ideally be added as new BSP targets - and the FPU page
> (https://devel.rtems.org/wiki/TBR/UserManual/Floating_Point_Support) 
should
> probably
> be updated to indicate this.
>
> Thanks to everyone for their help,
> Thanassis.
>
>
> European Space Agency (via HE Space)
> Thanassis Tsiodras
> Real-time Embedded Software Engineer
> System, Software and Technology Department
>
> ESTEC
> Keplerlaan 1, PO Box 299
> NL-2200 AG Noordwijk, The Netherlands
> Athanasios.Tsiodras at esa.int | www.esa.int
> T +31 71 565 5332
>
>
>
> From:        "Sebastian Huber" <sebastian.huber at embedded-brains.de>
> To:        "RTEMS List" <users at rtems.org>
> Cc:        software at gaisler.com
> Date:        07/02/2016 07:40
> Subject:        Re: Crash under sparc/rtems-4.11 when compiling with FPU
> Sent by:        "users" <users-bounces at rtems.org>
> ________________________________
>
>
>
> Hello Athanasios,
>
> it was always a miracle to me how you are supposed to use the 
leon2/leon3
> BSPs with a FPU. If you want to use the FPU, then the BSP must be built 
with
> the -mhard-float option, otherwise the FPU support is not enabled in the
> operating system support. In addition the application configuration must 
be
> compiled with exactly the same compiler flags as the BSP, otherwise it 
will
> generate a corrupt configuration.
>
> I think we need leon2fp and leon3fp BSPs, which use -mhard-float.
>
> --
> Sebastian Huber, embedded brains GmbH
>
> Address : Dornierstr. 4, D-82178 Puchheim, Germany
> Phone   : +49 89 189 47 41-16
> Fax     : +49 89 189 47 41-09
> E-Mail  : sebastian.huber at embedded-brains.de
> PGP     : Public key available on request.
>
> Diese Nachricht ist keine geschäftliche Mitteilung im Sinne des EHUG.
> _______________________________________________
> users mailing list
> users at rtems.org
> http://lists.rtems.org/mailman/listinfo/users
> This message and any attachments are intended for the use of the 
addressee
> or addressees only.
> The unauthorised disclosure, use, dissemination or copying (either in 
whole
> or in part) of its
> content is not permitted.
> If you received this message in error, please notify the sender and 
delete
> it from your system.
> Emails can be altered and their integrity cannot be guaranteed by the
> sender.
>
> Please consider the environment before printing this email.
> _______________________________________________
> users mailing list
> users at rtems.org
> http://lists.rtems.org/mailman/listinfo/users
>
> This message and any attachments are intended for the use of the 
addressee
> or addressees only.
> The unauthorised disclosure, use, dissemination or copying (either in 
whole
> or in part) of its
> content is not permitted.
> If you received this message in error, please notify the sender and 
delete
> it from your system.
> Emails can be altered and their integrity cannot be guaranteed by the
> sender.
>
> Please consider the environment before printing this email.
>
> _______________________________________________
> users mailing list
> users at rtems.org
> http://lists.rtems.org/mailman/listinfo/users
>
>
>
> _______________________________________________
> users mailing list
> users at rtems.org
> http://lists.rtems.org/mailman/listinfo/users


This message and any attachments are intended for the use of the addressee or addressees only.
The unauthorised disclosure, use, dissemination or copying (either in whole or in part) of its
content is not permitted.
If you received this message in error, please notify the sender and delete it from your system.
Emails can be altered and their integrity cannot be guaranteed by the sender.

Please consider the environment before printing this email.

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.rtems.org/pipermail/users/attachments/20160209/ab8d55ba/attachment-0002.html>


More information about the users mailing list