1

I am building zephyr on Raspberry Pi 3b to use nRF52840 dongle. Follow the tutorial Getting started with Zephyr

Everything includes:

  • download
  • install
  • cmake -DBOARD=nrf52840_pca10059 ..

was ok until I "make" in build/, issue occurred:

/home/pi/zephyr/ext/hal/cmsis/Include/core_cm4.h:105:8: error: #error "Compiler generates FPU instructions for a device without an FPU (check __FPU_PRESENT)" #error "Compiler generates FPU instructions for a device without an FPU (check __FPU_PRESENT)"

Has anyone:

  • used Zephyr with RasPi 3b?
  • used RasPi 3b with nRF52840 dongle?
  • can solve this problem?

1 Answers1

3

The GCC that you were using gcc-arm-linux-gnueabihf is the incorrect gcc to use. You should be using arm-none-eabi-gcc which the PI uses specifically.

Along with that, you can disable the generation of FPU instructions and SIMD (Single Instruction Multiple Data) by using -mcpu=name+attribs where it might be -mcpu=cortex-a53+nofp+nosimd.

See http://gcc.gnu.org for documentation on -mcpu.

Capybara
  • 1,313
  • 8
  • 12
user2262111
  • 563
  • 1
  • 6
  • 16
  • 1
    Disabling the FP with '-mcpu' or any other compiler option won't work for 99% of programmers. The 'glibc' will be with *hard float* and you can't use `malloc`, `strlen`, etc. You have to also use `-nostdlib` and maybe `-freestanding`. See: [Compile without libc](https://stackoverflow.com/questions/2548486/compiling-without-libc), [blog hello world without libc](https://blogs.oracle.com/linux/hello-from-a-libc-free-world-part-1-v2), etc. Getting the proper gcc is the answer for people. You might do `-freestanding` for a boot loader before the FPU is enabled, etc, but not the OP. – artless noise Dec 11 '18 at 17:49
  • Ahh I see, unless glibc is compiled with the right options. However, I think it worked for them because glibc already doesn't use hard floats due to the board not having a FPU. – user2262111 Dec 12 '18 at 07:41
  • *glibc* is part of the compiler; it is a library provided with the host `gcc` executables. The *glibc* will have FPU instructions and expect float arguments in a VFP registers. Using it may seem to work but will result in unexpected crashes. For instance `memset` and `memcpy` may decide to use NEON registers as this can be faster. It is very irresponsible to use the *glibc* that is compiled with hard float. – artless noise Dec 12 '18 at 16:39
  • There are other 'multi-lib' gcc with both hard and softfloat. Getting the right compiler is the right thing to do. You should compile with `-freestanding` if you intend to use the hf tools on a non-FPU system. This has many issue to resolve depending on the 'C' features you use. – artless noise Dec 12 '18 at 16:40