Compiler generates FPU instructions for a device without an FPU - arm

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?

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.

Related

Adding FreeRTOS libraries to Energia IDE

Im trying to add FreeRTOS libraries to Energia IDE specifically for the Texas Instruments CS3220SF board. I already have integrated hardware using Energia libraries and want to use FreeRTOS functionality, I dont want to use TI-RTOS.
I setup the project in CCS IDE using this guide: https://www.freertos.org/TI_CC3220_SimpleLink_FreeRTOS_Demo.html
First I added all FreeRTOS source (timers.h,task.h,etc..) & required FreeRTOSConfig.h in same source folder as my project.
After compiling in Energia IDE i get this error:
C:\Users\Fsydn\AppData\Local\Temp\ccDJlHYY.s: Assembler messages:
C:\Users\Fsydn\AppData\Local\Temp\ccDJlHYY.s:468: Error: selected processor does not support `vstmdbeq r0!,{s16-s31}' in Thumb mode
C:\Users\Fsydn\AppData\Local\Temp\ccDJlHYY.s:470: Error: instruction not allowed in IT block -- `mrs r1,control'
C:\Users\Fsydn\AppData\Local\Temp\ccDJlHYY.s:495: Error: selected processor does not support `vldmiaeq r0!,{s16-s31}' in Thumb mode
C:\Users\Fsydn\AppData\Local\Temp\ccDJlHYY.s:497: Error: instruction not allowed in IT block -- `msr psp,r0'
exit status 1
Error compiling for board CC3220SF-LAUNCHXL (80MHz).
It is complaining that you are compiling floating point instructions but the command line options passed to the compiler have not stated that the target device has a floating point unit. Either you are building the wrong FreeRTOS source files (build FreeRTOS/Source/[compiler]/ARM_CM3 if Cortex-M3 or M4 without floating point, or FreeRTOS/Source/[compiler]/ARM_CM4F if Cortex-M4 with floating point), or your compiler command line is wrong.

gdb target architecture not listed yet seems supported ..?

I have a toolchain for my target which includes a gdb client in it:
GNU gdb (GNU Tools for ARM Embedded Processors 6-2017-q2-update) 7.12.1.20170417-git
(It's not the latest available from GNU ARM, but I have to use it for now, so let's assume there is no latest..)
The remote target (connecting through a gdbserver connected to JTAG) in is a Cortex-A7, which is armv7-a architecture.
What I don't understand why the gdb as is from this toolchain does not list armv7-a as one of the architectures that I can with "set architecture" command, yet, it appears to debug just fine.
I build binaries for armv7-a, and verify that they are built for this arch.
I can then start the gdb from the toolchain, and load and start debugging.
If I list available inside gdb, it shows this:
set architecture
arm arm_any armv2 armv2a armv3 armv3m armv4 armv4t armv5 armv5t armv5te auto ep9312 iwmmxt iwmmxt2 xscale
No armv7 anywhere. Yet gdb doesn't complain about anything, I can debug/single step instruction code, and, I see some v7 / new instructions which are new to the architecture.
These posts somewhat related but not answering it:
How does GDB determine ARM architecture
GDB remote debug: can't stop the thread
Attributes from my elf
Attribute Section: aeabi
File Attributes
Tag_CPU_name: "7-A"
Tag_CPU_arch: v7
Tag_CPU_arch_profile: Application
Tag_ARM_ISA_use: Yes
Tag_THUMB_ISA_use: Thumb-2
Tag_ABI_PCS_wchar_t: 4
Tag_ABI_FP_denormal: Needed
Tag_ABI_FP_exceptions: Needed
Tag_ABI_FP_number_model: IEEE 754
Tag_ABI_align_needed: 8-byte
Tag_ABI_enum_size: int
Tag_DIV_use: Allowed in v7-A with integer division extension
Tag_Virtualization_use: TrustZone and Virtualization Extensions
Gdb build was configured with:
configure --host=x86_64-linux-gnu --target=arm-none-eabi
What I expected is that "armv7-a" or "armv7-m" or any may be some "armv7" should be listed by gdb as supported, but it isn't .
Yet it seems to be able to work with armv7-a target code - can disassemble it and understand armv7 new instructions , such as movt/movw.
So how does it do it? Is it a special/patched gdb (client) which does not list the arch, or what am I missing?
(I've seen that later gdb versions do allow set architecture armv7-a, but that's not mine gdb, and I want to understand how mine works)

Linking a soft floating point compiled library on a hard float machine (avoid "uses VFP register arguments" linker issue)

I would like to link a cross-compiled library (library.a) compiled with soft floating point support (arm-none-eabi) on a system with support for hard floats (Raspberry Pi - armv7l-unknown-linux-gnueabihf) and run it with a test application.
Unfortunately I am getting a linker error:
/usr/bin/ld: error: application uses VFP register arguments library.a(library.c.obj) does not.
Any idea on how I could tell to gcc to build the executable with soft floats and the link to the rest of the system with VFP register arguments?
An alternative approach I have tried is to use the gcc-arm-none-eabi package available on raspian. I tried compiling my dependencies with
export CC="arm-none-eabi-gcc -I/usr/arm-linux-gnueabi/include/"
export LD="arm-none-eabi-ld -L/usr/arm-linux-gnueabi/lib/"
Unfortunately this compiler does not have Linux support integrated and I'm missing various references.
My current bet is now to build a cross-compiler toolchain with soft float for the raspian and the use this build to link and run my application.

Build Linux kernel from source for ARM

Where can I get from the Linux kernel 3.10 for arm7l?
I tried using the one for PC but when I compile it, it ask me the processor architecture and there is no ARM option.
Thank you!
In order to configure and build it for ARM architecture set environment variables or execute the following commands sequence.
ARCH=arm
CROSS_COMPILE=your path to arm cross compile tools/bin/arm-none-eabi-
make menuconfig
Instead of default x86 there will be ARM based architectures list in the menu.

ARM cross compiling introduction?

I'm trying to compile a program to run on a Linux powered board, which has an ARM926EJ-S processor. So I've installed Debian embedded cross-development toolchain, and tried compiling an Hello World with in gcc with -march=armv5te . When I tried running the binary on the board it crashed with file not found errors (due to library versions), after that I've tried compiling with -static flag and I got a seg fault (0x0000827c in __libc_start_main (), said mr gdb trough gdbserver).
Any idea on what to do here to get something running?
Apparently the solution is to try as many toolchains as you can find. Eventually you'll find the one that works, after spending a few too many hours compiling toolchains. uClibc buildroot in this case.
You can find toolchains which support ARM926EJ-S on Linaro Page. Use the most recent arm-linux-gnueabi from Linaro project. I am currently using a version with gcc 4.9.4 which you can find here
It is recommended to use -mcpu=arm926ej-s instead of -march and -mtune. See gcc documentation because it combines -march and -mtune for your specified processor. It was deprecated for x86, but not for arm.
Other possibility could be building your own toolchain via crosstools-ng. But the Linaro toolchains are working out of the box if you don't need some specific setting (for example only using static libraries).

Resources