Skip to content

Building apps with gcc flag '-mhard-float' ? #97

@JOE1994

Description

@JOE1994

Hello 🦀,

I measured the execution time of the same C nbody benchmark program on top of FreeRTOS & Tock.
(I only modified variable n in the main function to be const volatile int n = 50000;)
(Both cases were tested on NucleoF429ZI board)

  • nbody on FreeRTOS : 13.037325 seconds
  • nbody on Tock : 360.536 seconds

I found that Tock apps are currently built with gcc flag -mfloat-abi=soft

-mfloat-abi=soft\

I tried replacing the flag with -mfloat-abi=hard,
but I received the following error.

lonelyjoe@lonelyjoe-desktop:~/workspace/libtock-c/examples/n-body$ make
  CC        main.c
In file included from ./../../support/warning_header.h:6:0,
                 from <command-line>:0:
/usr/include/newlib/stdio.h: In function '__sputc_r':
/usr/include/newlib/stdio.h:671:39: sorry, unimplemented: Thumb-1 hard-float VFP ABI
 _ELIDABLE_INLINE int __sputc_r(struct _reent *_ptr, int _c, FILE *_p) {
                                       ^~~~~~

On Stm32CubeIDE which provides newlib-nano as the default runtime library,
I had no errors while building the same C program on top of FreeRTOS with the -mfloat-abi=hard configuration.
One thing I see is that the instruction set I used in stm32cubeide was Thumb-2,
while the error from building Tock tells me Thumb-1 hard-float VFP ABI is not implemented.

(below is an image of the build configuration I used for building nbody on FreeRTOS)
image

Is there a way to work around this error to build apps with flag -mfloat-abi=soft?
Or is it currently possible to use Thumb-2 instruction set instead of Thumb-1?

Thank you for checking out this issue 👍 👍

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions