tock / tock/libtock-c

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

Open
#97 8 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
C
Stars
90
Forks
109
Avg merge
22h 46m
Merged PRs (30d)
3

Description

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
https://github.com/tock/libtock-c/blob/3d96d35efab0f48c6f491951be62d69a67a394c8/Configuration.mk#L138
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 👍 👍

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with Configuration.mk at the cited flag definition and reproduce the build from examples/n-body using the reported command and NucleoF429ZI target. Compare the configured ABI and instruction-set options with the compiler error, then establish whether a supported build configuration or a documented limitation is needed.

Written by the indexing model from the issue text.

Assessment

Tech stack
c
Domain
build-system, embedded-iot
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
30/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.