We are running a survey to help us improve the experience for all of our members. If you see the survey appear, please take the time to tell us about your experience if you can.
Hello,
I would like to disable the FPU on my ARM Cortex A9 CPU during the boot software execution.
But I need to employ RSA authentication to guarantee the integrity of my image partitions.
As I am trying to compile my boot software using arm-none-eabi-gcc with no FPU support, I noticed that the Xilinx xilrsa.a library may access VFP registers (FPU or NEON). See the exact errors at the bottom of my post.
However as I looked at the disassembly code, no vector instruction appears (e.g. vadd, vstr...) , and all accessed registers are with the general purpose range (0~15).
What would trigger this error then? Is it because the library has been compiled with arguments -mfpu=vfpv3 and -mfloat-abi=hard ??
Thank you
Florian
/usr/lib/gcc/arm-none-eabi/5.4.1/../../../arm-none-eabi/bin/ld: error: ../../ssbl_bsp//ps7_cortexa9_0/lib/librsa.a(SoftRSA.o) uses VFP register arguments, ssbl.elf does not /usr/lib/gcc/arm-none-eabi/5.4.1/../../../arm-none-eabi/bin/ld: failed to merge target specific data of file ../../ssbl_bsp//ps7_cortexa9_0/lib/librsa.a(SoftRSA.o) /usr/lib/gcc/arm-none-eabi/5.4.1/../../../arm-none-eabi/bin/ld: error: ../../ssbl_bsp//ps7_cortexa9_0/lib/librsa.a(SoftSHA256.o) uses VFP register arguments, ssbl.elf does not /usr/lib/gcc/arm-none-eabi/5.4.1/../../../arm-none-eabi/bin/ld: failed to merge target specific data of file ../../ssbl_bsp//ps7_cortexa9_0/lib/librsa.a(SoftSHA256.o)
The output from readelf -A librsa.a shows that mfpu has been set as vfpv3 (Tag_FP_arch = VFPv3) and that mfloat-abi was set as hard (Tag_ABI_VFP_args = VFP registers).
The full output is shown below. Does that mean I must compile the rest of the code with FPU enabled?
My problem is that I try to compile my software with a custom makefile, and I still have inconsistency with the float abi.
If I use the Xilinx SDK automatically generated Makefile it seems to apply the hard float ABI everywhere and does not have this issue. But originally I wanted to disable FPU... so I decided to write the custom Makefile.
Also the arm-none-eabi-gcc compiler/linker does not interpret the -nofp argument as could be expected from the GNU Toolchain.
Makefile:
CC := arm-none-eabi-gcc CC_FLAGS := CFLAGS := ECFLAGS := LDFLAGS := c_SOURCES := $(wildcard *.c) S_SOURCES := $(wildcard *.S) s_SOURCES := $(wildcard *.s) INCLUDES := $(wildcard *.h) OBJS := $(patsubst %.c, %.o, $(c_SOURCES)) OBJS += $(patsubst %.S, %.o, $(S_SOURCES)) OBJS += $(patsubst %.s, %.o, $(s_SOURCES)) BSP_DIR := ../../ssbl_bsp/ LIBS := libxil.a EXEC := ssbl.elf INCLUDEPATH := -I$(BSP_DIR)/ps7_cortexa9_0/include INCLUDEPATH += -Igpio INCLUDEPATH += -Iboard_gpiops INCLUDEPATH += -Iboard_interrupt INCLUDEPATH += -Iboard_mio INCLUDEPATH += -Iboard_uartps LIBPATH := $(BSP_DIR)/ps7_cortexa9_0/lib BOARD := zc702 DEPS := depends AS=arm-none-eabi-gcc CFLAGS = -Wall -O0 -g3 -c -fmessage-length=0 CFLAGS += -DSSBL_DEBUG -DRSA-SUPPORT -DSSBL_DEBUG_INFO -DSSBL_DEBUG_GENERAL -DDEBUG -DSSBL_DEBUG_RSA CFLAGS += -DXUARTPS_USED -DCFG_UARTPS -DSRU_USED -DSRU_MODULE -DNANDPS_USED -DQSPIPS_USED -DXGPIOPS_USED -DSCU_TIMER_USER -DHYPERION LINKER=arm-none-eabi-gcc LDFLAGS = -Wl,--start-group,-lxil,-lgcc,-lc,--end-group -Wl,--start-group,-lxilffs,-lxil,-lgcc,-lc,--end-group -Wl,--start-group,-lrsa,-lxil,-lgcc,-lc,--end-group LD1FLAGS = -mcpu=cortex-a9 -mfpu=vfpv3 -mfloat-abi=hard -Wl,-build-id=none -Wl,-T -Wl,../src/lscript.ld -L$(LIBPATH) -specs=Xilinx.spec ECFLAGS = -mcpu=cortex-a9 -mfpu=vfpv3 -mfloat-abi=hard all: $(EXEC) ssbl.elf.size $(EXEC): $(LIBS) $(OBJS) $(INCLUDES) $(LINKER) $(LD1FLAGS) -o $@ $(OBJS) $(LDFLAGS) rm -rf $(OBJS) $(LIBS): echo "Compiling bsp" make -C $(BSP_DIR) -k all "CC=arm-none-eabi-gcc" "AR=arm-none-eabi-ar" "C_FLAGS=-O2 -c" "EC_FLAGS=-g" %.o:%.c $(CC) $(CC_FLAGS) $(CFLAGS) $(ECFLAGS) $(INCLUDEPATH) $< -o $@ %.o:%.S $(AS) $(CC_FLAGS) $(CFLAGS) $(ECFLAGS) $(INCLUDEPATH) $< -o $@ %.o:%.s $(AS) $(CC_FLAGS) $(CFLAGS) $(ECFLAGS) $(INCLUDEPATH) $< -o $@ clean: rm -rf $(OBJS) $(BSP_DIR)/ps7_cortexa9_0/lib/* $(EXEC) ssbl.elf.size: ssbl.elf @echo 'Invoking: ARM v7 Print Size' arm-none-eabi-size ssbl.elf |tee "ssbl.elf.size" @echo 'Finished building: $@' @echo ' '
error log:
/usr/lib/gcc/arm-none-eabi/5.4.1/../../../arm-none-eabi/bin/ld: error: pcap.o uses VFP register arguments, ssbl.elf does not /usr/lib/gcc/arm-none-eabi/5.4.1/../../../arm-none-eabi/bin/ld: failed to merge target specific data of file pcap.o /usr/lib/gcc/arm-none-eabi/5.4.1/../../../arm-none-eabi/bin/ld: error: nand.o uses VFP register arguments, ssbl.elf does not /usr/lib/gcc/arm-none-eabi/5.4.1/../../../arm-none-eabi/bin/ld: failed to merge target specific data of file nand.o /usr/lib/gcc/arm-none-eabi/5.4.1/../../../arm-none-eabi/bin/ld: error: main.o uses VFP register arguments, ssbl.elf does not /usr/lib/gcc/arm-none-eabi/5.4.1/../../../arm-none-eabi/bin/ld: failed to merge target specific data of file main.o /usr/lib/gcc/arm-none-eabi/5.4.1/../../../arm-none-eabi/bin/ld: error: ssbl_hooks.o uses VFP register arguments, ssbl.elf does not /usr/lib/gcc/arm-none-eabi/5.4.1/../../../arm-none-eabi/bin/ld: failed to merge target specific data of file ssbl_hooks.o /usr/lib/gcc/arm-none-eabi/5.4.1/../../../arm-none-eabi/bin/ld: error: boot_utils.o uses VFP register arguments, ssbl.elf does not /usr/lib/gcc/arm-none-eabi/5.4.1/../../../arm-none-eabi/bin/ld: failed to merge target specific data of file boot_utils.o /usr/lib/gcc/arm-none-eabi/5.4.1/../../../arm-none-eabi/bin/ld: error: qspi.o uses VFP register arguments, ssbl.elf does not /usr/lib/gcc/arm-none-eabi/5.4.1/../../../arm-none-eabi/bin/ld: failed to merge target specific data of file qspi.o /usr/lib/gcc/arm-none-eabi/5.4.1/../../../arm-none-eabi/bin/ld: error: performance.o uses VFP register arguments, ssbl.elf does not /usr/lib/gcc/arm-none-eabi/5.4.1/../../../arm-none-eabi/bin/ld: failed to merge target specific data of file performance.o /usr/lib/gcc/arm-none-eabi/5.4.1/../../../arm-none-eabi/bin/ld: error: rsa.o uses VFP register arguments, ssbl.elf does not /usr/lib/gcc/arm-none-eabi/5.4.1/../../../arm-none-eabi/bin/ld: failed to merge target specific data of file rsa.o /usr/lib/gcc/arm-none-eabi/5.4.1/../../../arm-none-eabi/bin/ld: error: md5.o uses VFP register arguments, ssbl.elf does not /usr/lib/gcc/arm-none-eabi/5.4.1/../../../arm-none-eabi/bin/ld: failed to merge target specific data of file md5.o /usr/lib/gcc/arm-none-eabi/5.4.1/../../../arm-none-eabi/bin/ld: error: image_mover.o uses VFP register arguments, ssbl.elf does not /usr/lib/gcc/arm-none-eabi/5.4.1/../../../arm-none-eabi/bin/ld: failed to merge target specific data of file image_mover.o /usr/lib/gcc/arm-none-eabi/5.4.1/../../../arm-none-eabi/bin/ld: error: nor.o uses VFP register arguments, ssbl.elf does not /usr/lib/gcc/arm-none-eabi/5.4.1/../../../arm-none-eabi/bin/ld: failed to merge target specific data of file nor.o /usr/lib/gcc/arm-none-eabi/5.4.1/../../../arm-none-eabi/bin/ld: error: sd.o uses VFP register arguments, ssbl.elf does not /usr/lib/gcc/arm-none-eabi/5.4.1/../../../arm-none-eabi/bin/ld: failed to merge target specific data of file sd.o /usr/lib/gcc/arm-none-eabi/5.4.1/../../../arm-none-eabi/bin/ld: error: ../../ssbl_bsp//ps7_cortexa9_0/lib/libxil.a(xqspips.o) uses VFP register arguments, ssbl.elf does not /usr/lib/gcc/arm-none-eabi/5.4.1/../../../arm-none-eabi/bin/ld: failed to merge target specific data of file ../../ssbl_bsp//ps7_cortexa9_0/lib/libxil.a(xqspips.o) /usr/lib/gcc/arm-none-eabi/5.4.1/../../../arm-none-eabi/bin/ld: error: ../../ssbl_bsp//ps7_cortexa9_0/lib/libxil.a(xqspips_sinit.o) uses VFP register arguments, ssbl.elf does not /usr/lib/gcc/arm-none-eabi/5.4.1/../../../arm-none-eabi/bin/ld: failed to merge target specific data of file ../../ssbl_bsp//ps7_cortexa9_0/lib/libxil.a(xqspips_sinit.o) /usr/lib/gcc/arm-none-eabi/5.4.1/../../../arm-none-eabi/bin/ld: error: ../../ssbl_bsp//ps7_cortexa9_0/lib/libxil.a(xqspips_options.o) uses VFP register arguments, ssbl.elf does not /usr/lib/gcc/arm-none-eabi/5.4.1/../../../arm-none-eabi/bin/ld: failed to merge target specific data of file ../../ssbl_bsp//ps7_cortexa9_0/lib/libxil.a(xqspips_options.o) /usr/lib/gcc/arm-none-eabi/5.4.1/../../../arm-none-eabi/bin/ld: error: ../../ssbl_bsp//ps7_cortexa9_0/lib/libxil.a(vectors.o) uses VFP register arguments, ssbl.elf does not /usr/lib/gcc/arm-none-eabi/5.4.1/../../../arm-none-eabi/bin/ld: failed to merge target specific data of file ../../ssbl_bsp//ps7_cortexa9_0/lib/libxil.a(vectors.o) /usr/lib/gcc/arm-none-eabi/5.4.1/../../../arm-none-eabi/bin/ld: error: ../../ssbl_bsp//ps7_cortexa9_0/lib/libxil.a(xil_assert.o) uses VFP register arguments, ssbl.elf does not /usr/lib/gcc/arm-none-eabi/5.4.1/../../../arm-none-eabi/bin/ld: failed to merge target specific data of file ../../ssbl_bsp//ps7_cortexa9_0/lib/libxil.a(xil_assert.o) /usr/lib/gcc/arm-none-eabi/5.4.1/../../../arm-none-eabi/bin/ld: error: ../../ssbl_bsp//ps7_cortexa9_0/lib/libxil.a(xil_cache.o) uses VFP register arguments, ssbl.elf does not /usr/lib/gcc/arm-none-eabi/5.4.1/../../../arm-none-eabi/bin/ld: failed to merge target specific data of file ../../ssbl_bsp//ps7_cortexa9_0/lib/libxil.a(xil_cache.o) /usr/lib/gcc/arm-none-eabi/5.4.1/../../../arm-none-eabi/bin/ld: error: ../../ssbl_bsp//ps7_cortexa9_0/lib/libxil.a(xil_exception.o) uses VFP register arguments, ssbl.elf does not /usr/lib/gcc/arm-none-eabi/5.4.1/../../../arm-none-eabi/bin/ld: failed to merge target specific data of file ../../ssbl_bsp//ps7_cortexa9_0/lib/libxil.a(xil_exception.o) /usr/lib/gcc/arm-none-eabi/5.4.1/../../../arm-none-eabi/bin/ld: error: ../../ssbl_bsp//ps7_cortexa9_0/lib/libxil.a(xil_printf.o) uses VFP register arguments, ssbl.elf does not /usr/lib/gcc/arm-none-eabi/5.4.1/../../../arm-none-eabi/bin/ld: failed to merge target specific data of file ../../ssbl_bsp//ps7_cortexa9_0/lib/libxil.a(xil_printf.o) /usr/lib/gcc/arm-none-eabi/5.4.1/../../../arm-none-eabi/bin/ld: error: ../../ssbl_bsp//ps7_cortexa9_0/lib/libxil.a(xil_sleepcommon.o) uses VFP register arguments, ssbl.elf does not /usr/lib/gcc/arm-none-eabi/5.4.1/../../../arm-none-eabi/bin/ld: failed to merge target specific data of file ../../ssbl_bsp//ps7_cortexa9_0/lib/libxil.a(xil_sleepcommon.o) /usr/lib/gcc/arm-none-eabi/5.4.1/../../../arm-none-eabi/bin/ld: error: ../../ssbl_bsp//ps7_cortexa9_0/lib/libxil.a(xtime_l.o) uses VFP register arguments, ssbl.elf does not /usr/lib/gcc/arm-none-eabi/5.4.1/../../../arm-none-eabi/bin/ld: failed to merge target specific data of file ../../ssbl_bsp//ps7_cortexa9_0/lib/libxil.a(xtime_l.o) /usr/lib/gcc/arm-none-eabi/5.4.1/../../../arm-none-eabi/bin/ld: error: ../../ssbl_bsp//ps7_cortexa9_0/lib/libxil.a(xdevcfg_intr.o) uses VFP register arguments, ssbl.elf does not /usr/lib/gcc/arm-none-eabi/5.4.1/../../../arm-none-eabi/bin/ld: failed to merge target specific data of file ../../ssbl_bsp//ps7_cortexa9_0/lib/libxil.a(xdevcfg_intr.o) /usr/lib/gcc/arm-none-eabi/5.4.1/../../../arm-none-eabi/bin/ld: error: ../../ssbl_bsp//ps7_cortexa9_0/lib/libxil.a(xdevcfg_sinit.o) uses VFP register arguments, ssbl.elf does not /usr/lib/gcc/arm-none-eabi/5.4.1/../../../arm-none-eabi/bin/ld: failed to merge target specific data of file ../../ssbl_bsp//ps7_cortexa9_0/lib/libxil.a(xdevcfg_sinit.o) /usr/lib/gcc/arm-none-eabi/5.4.1/../../../arm-none-eabi/bin/ld: error: ../../ssbl_bsp//ps7_cortexa9_0/lib/libxil.a(xdevcfg.o) uses VFP register arguments, ssbl.elf does not /usr/lib/gcc/arm-none-eabi/5.4.1/../../../arm-none-eabi/bin/ld: failed to merge target specific data of file ../../ssbl_bsp//ps7_cortexa9_0/lib/libxil.a(xdevcfg.o) /usr/lib/gcc/arm-none-eabi/5.4.1/../../../arm-none-eabi/bin/ld: error: ../../ssbl_bsp//ps7_cortexa9_0/lib/libxil.a(xnandps_sinit.o) uses VFP register arguments, ssbl.elf does not /usr/lib/gcc/arm-none-eabi/5.4.1/../../../arm-none-eabi/bin/ld: failed to merge target specific data of file ../../ssbl_bsp//ps7_cortexa9_0/lib/libxil.a(xnandps_sinit.o) /usr/lib/gcc/arm-none-eabi/5.4.1/../../../arm-none-eabi/bin/ld: error: ../../ssbl_bsp//ps7_cortexa9_0/lib/libxil.a(xnandps_bbm.o) uses VFP register arguments, ssbl.elf does not /usr/lib/gcc/arm-none-eabi/5.4.1/../../../arm-none-eabi/bin/ld: failed to merge target specific data of file ../../ssbl_bsp//ps7_cortexa9_0/lib/libxil.a(xnandps_bbm.o) /usr/lib/gcc/arm-none-eabi/5.4.1/../../../arm-none-eabi/bin/ld: error: ../../ssbl_bsp//ps7_cortexa9_0/lib/libxil.a(xnandps.o) uses VFP register arguments, ssbl.elf does not /usr/lib/gcc/arm-none-eabi/5.4.1/../../../arm-none-eabi/bin/ld: failed to merge target specific data of file ../../ssbl_bsp//ps7_cortexa9_0/lib/libxil.a(xnandps.o) /usr/lib/gcc/arm-none-eabi/5.4.1/../../../arm-none-eabi/bin/ld: error: ../../ssbl_bsp//ps7_cortexa9_0/lib/libxil.a(xnandps_g.o) uses VFP register arguments, ssbl.elf does not /usr/lib/gcc/arm-none-eabi/5.4.1/../../../arm-none-eabi/bin/ld: failed to merge target specific data of file ../../ssbl_bsp//ps7_cortexa9_0/lib/libxil.a(xnandps_g.o) /usr/lib/gcc/arm-none-eabi/5.4.1/../../../arm-none-eabi/bin/ld: error: ../../ssbl_bsp//ps7_cortexa9_0/lib/libxil.a(xqspips_g.o) uses VFP register arguments, ssbl.elf does not /usr/lib/gcc/arm-none-eabi/5.4.1/../../../arm-none-eabi/bin/ld: failed to merge target specific data of file ../../ssbl_bsp//ps7_cortexa9_0/lib/libxil.a(xqspips_g.o) /usr/lib/gcc/arm-none-eabi/5.4.1/../../../arm-none-eabi/bin/ld: error: ../../ssbl_bsp//ps7_cortexa9_0/lib/libxil.a(outbyte.o) uses VFP register arguments, ssbl.elf does not /usr/lib/gcc/arm-none-eabi/5.4.1/../../../arm-none-eabi/bin/ld: failed to merge target specific data of file ../../ssbl_bsp//ps7_cortexa9_0/lib/libxil.a(outbyte.o) /usr/lib/gcc/arm-none-eabi/5.4.1/../../../arm-none-eabi/bin/ld: error: ../../ssbl_bsp//ps7_cortexa9_0/lib/libxil.a(sleep.o) uses VFP register arguments, ssbl.elf does not /usr/lib/gcc/arm-none-eabi/5.4.1/../../../arm-none-eabi/bin/ld: failed to merge target specific data of file ../../ssbl_bsp//ps7_cortexa9_0/lib/libxil.a(sleep.o) /usr/lib/gcc/arm-none-eabi/5.4.1/../../../arm-none-eabi/bin/ld: error: ../../ssbl_bsp//ps7_cortexa9_0/lib/libxil.a(usleep.o) uses VFP register arguments, ssbl.elf does not /usr/lib/gcc/arm-none-eabi/5.4.1/../../../arm-none-eabi/bin/ld: failed to merge target specific data of file ../../ssbl_bsp//ps7_cortexa9_0/lib/libxil.a(usleep.o) /usr/lib/gcc/arm-none-eabi/5.4.1/../../../arm-none-eabi/bin/ld: error: ../../ssbl_bsp//ps7_cortexa9_0/lib/libxil.a(xdevcfg_g.o) uses VFP register arguments, ssbl.elf does not /usr/lib/gcc/arm-none-eabi/5.4.1/../../../arm-none-eabi/bin/ld: failed to merge target specific data of file ../../ssbl_bsp//ps7_cortexa9_0/lib/libxil.a(xdevcfg_g.o) /usr/lib/gcc/arm-none-eabi/5.4.1/../../../arm-none-eabi/bin/ld: error: ../../ssbl_bsp//ps7_cortexa9_0/lib/libxil.a(xuartps_hw.o) uses VFP register arguments, ssbl.elf does not /usr/lib/gcc/arm-none-eabi/5.4.1/../../../arm-none-eabi/bin/ld: failed to merge target specific data of file ../../ssbl_bsp//ps7_cortexa9_0/lib/libxil.a(xuartps_hw.o) /usr/lib/gcc/arm-none-eabi/5.4.1/../../../arm-none-eabi/bin/ld: error: ../../ssbl_bsp//ps7_cortexa9_0/lib/libxil.a(xnandps_onfi.o) uses VFP register arguments, ssbl.elf does not /usr/lib/gcc/arm-none-eabi/5.4.1/../../../arm-none-eabi/bin/ld: failed to merge target specific data of file ../../ssbl_bsp//ps7_cortexa9_0/lib/libxil.a(xnandps_onfi.o) /usr/lib/gcc/arm-none-eabi/5.4.1/../../../arm-none-eabi/bin/ld: error: ../../ssbl_bsp//ps7_cortexa9_0/lib/libxil.a(_exit.o) uses VFP register arguments, ssbl.elf does not /usr/lib/gcc/arm-none-eabi/5.4.1/../../../arm-none-eabi/bin/ld: failed to merge target specific data of file ../../ssbl_bsp//ps7_cortexa9_0/lib/libxil.a(_exit.o) /usr/lib/gcc/arm-none-eabi/5.4.1/../../../arm-none-eabi/bin/ld: error: ../../ssbl_bsp//ps7_cortexa9_0/lib/librsa.a(SoftRSA.o) uses VFP register arguments, ssbl.elf does not /usr/lib/gcc/arm-none-eabi/5.4.1/../../../arm-none-eabi/bin/ld: failed to merge target specific data of file ../../ssbl_bsp//ps7_cortexa9_0/lib/librsa.a(SoftRSA.o) /usr/lib/gcc/arm-none-eabi/5.4.1/../../../arm-none-eabi/bin/ld: error: ../../ssbl_bsp//ps7_cortexa9_0/lib/librsa.a(SoftSHA256.o) uses VFP register arguments, ssbl.elf does not /usr/lib/gcc/arm-none-eabi/5.4.1/../../../arm-none-eabi/bin/ld: failed to merge target specific data of file ../../ssbl_bsp//ps7_cortexa9_0/lib/librsa.a(SoftSHA256.o)
Alright, my solution is that:
- the RSA library has been compiled with -mfpu=vpfv3 and -mfloat-abi=hard
- But the disassembly code does not use any VPF instruction or register
==> I must compile all the code with -mfpu=vpfv3 and -mfloat-abi=hard, but the boot assembly code does not need to enable FPU (FPEXC register).