sheroy
Posts: 33
Joined: Fri Jun 14, 2013 5:34 pm

When compiling for Pi3 in Arch32 enabling VFP

Fri Jul 13, 2018 10:36 pm

I am using arm-none-eabi-gcc (15:5.4.1+svn241155-1) 5.4.1 20160919 to compile.


The instruction FMXR FPEXC, r0 (in my start.s file) gives the following error when compiling to enable VFP.

Error: selected processor does not support `fmxr FPEXC,r0' in ARM mode


my compiler flags are

COPS = -Wall -nostdlib -nostartfiles -ffreestanding -Iinclude -O2 \
-mcpu=cortex-a53 -mfpu=neon -mfloat-abi=hard -mfpu=crypto-neon-fp-armv8


What could be the cause for the error?

Schnoogle
Posts: 41
Joined: Sun Feb 11, 2018 4:47 pm

Re: When compiling for Pi3 in Arch32 enabling VFP

Mon Jul 16, 2018 8:47 am

Hi sheroy,

as far as 8 can see you are using the -mfpu directive twice.
I’m also using arm-none-eabi to cross compile my bare metal stuff.

I’m using this settings:
-mfpu=neon-fp-armv8 -mfloat-abi=hard -march=armv8-a

and the compiler does except and compile the fmxr instruction.

BR
Schnoogle

sheroy
Posts: 33
Joined: Fri Jun 14, 2013 5:34 pm

Re: When compiling for Pi3 in Arch32 enabling VFP

Tue Jul 17, 2018 7:24 pm

I tried I get the same error.

Schnoogle
Posts: 41
Joined: Sun Feb 11, 2018 4:47 pm

Re: When compiling for Pi3 in Arch32 enabling VFP

Tue Jul 17, 2018 7:51 pm

Hi,

well, than the issue might be your -mcpu flag set to cortex-a53 ... I’m not using this one. Instead I do -mtune=cortex-a53 together with -march=armv8-a

Hope this helps.
BR,
Schnoogle

sheroy
Posts: 33
Joined: Fri Jun 14, 2013 5:34 pm

Re: When compiling for Pi3 in Arch32 enabling VFP

Tue Jul 17, 2018 8:19 pm

last time the compiler flags were

-mfpu=neon-fp-armv8 -mfloat-abi=hard -march=armv8-a

It yet gave the same error.

AlfredJingle
Posts: 69
Joined: Thu Mar 03, 2016 10:43 pm

Re: When compiling for Pi3 in Arch32 enabling VFP

Sat Jul 21, 2018 12:23 pm

For what it is worth, I use:

Code: Select all

--no-warn -mcpu=cortex-a53+crc -mfpu=neon-vfpv4
which in my case ( I use as, not gcc ) works fine and only reports errors.
going from a 6502 on an Oric-1 to an ARMv8 is quite a big step...

sheroy
Posts: 33
Joined: Fri Jun 14, 2013 5:34 pm

Re: When compiling for Pi3 in Arch32 enabling VFP

Fri Aug 31, 2018 2:37 pm

I have not yet been able to figure out the problem. I have changed my compiler and have started using ARM DS5 to compile and use the makefile with a few modifications.

The compiler is obtained from https://developer.arm.com/open-source/g ... /downloads and linked to the DS5 toolchain.


To refresh the error provided by
arm-none-eabi-gcc -Iinclude -MMD -c src/start32.S -o build/start32_s.o

is

src/start32.S: Assembler messages:
src/start32.S:103: Error: selected processor does not support `vmsr fpexc,r0' in ARM mode


I have not yet been able to enable the floating point unit, I have tried many options (Linux and windows) and have not yet been able to enable the FP unit.


Attached below is a copy of my makefile

Code: Select all

ARMGNU ?= arm-none-eabi-
#ARMGNU ?= 

COPS =   -Wall -nostdlib -nostartfiles -ffreestanding -Iinclude -O2  \
         -mcpu=cortex-a53  -mfpu=neon-vfpv4 -mfloat-abi=hard -march=armv8-a+neon+fpv3 

#COPS =   -Wall -nostdlib -nostartfiles -ffreestanding -Iinclude -O2  \
#         -mfpu=neon-vfpv4 -mcpu=cortex-a53 -mfloat-abi=hard -march=armv8-a 

#old flags
#-mfpu=neon-vfpv4  -mfloat-abi=hard -march=armv7-a  -mtune=cortex-a53


ASMOPS = -Iinclude

BUILD_DIR = build
SRC_DIR = src


all :kernel7.img


clean:
	del  $(BUILD_DIR)\*.o
	del  $(BUILD_DIR)\*.d
#	del  $(BUILD_DIR)\*.elf


$(BUILD_DIR)/%_c.o: $(SRC_DIR)/%.c
#	mkdir -p $(@D)
	$(ARMGNU)gcc $(COPS) -MMD -c $< -o [email protected]


$(BUILD_DIR)/%_s.o: $(SRC_DIR)/%.S
	$(ARMGNU)gcc $(ASMOPS) -MMD -c $< -o [email protected]


C_FILES = $(wildcard src/*.c)
ASM_FILES = $(wildcard src/*.S)

#OBJ_FILES = $(wildcard $(BUILD_DIR)/*.o)
OBJ_FILES = $(C_FILES:$(SRC_DIR)/%.c=$(BUILD_DIR)/%_c.o)
OBJ_FILES += $(ASM_FILES:$(SRC_DIR)/%.S=$(BUILD_DIR)/%_s.o)


DEP_FILES = $(OBJ_FILES:%.o=%.d)
-include $(DEP_FILES)

#include the previously built object files
#OBJ_FILES += $(wildcard $(BUILD_DIR)/*.o)

kernel7.img: $(SRC_DIR)/linker32.ld $(OBJ_FILES)
	$(ARMGNU)ld -T src/linker32.ld  -Map output.map -o $(BUILD_DIR)/kernel7.elf  $(OBJ_FILES)
	$(ARMGNU)objcopy $(BUILD_DIR)/kernel7.elf -O binary kernel7.img
	$(ARMGNU)nm -n  $(BUILD_DIR)/kernel7.elf >  $(BUILD_DIR)/output.symbol
	$(ARMGNU)objdump -D $(BUILD_DIR)/kernel7.elf > $(BUILD_DIR)/output.list

attached is my start.S file extract to enable the FP unit...

Code: Select all

@FPU_enable:
@	MRC p15, 0, r0, c1, c1, 2
@	ORR r0, r0, #3<<10
@	MCR p15, 0, r0, c1, c1, 2
@
@	mrc p15,0,r0,c1,c0, #2			// R0 = Access Control Register
@	orr r0, #(0x300000 + 0xC00000)	// Enable Single & Double Precision
@	mcr p15,0,r0,c1,c0, #2			// Access Control Register = R0
@	mov r0, #0x40000000				// R0 = Enable VFP
	vmsr fpexc,r0					// FPEXC = R0  --- THIS LINE ALWAYS GIVES AN ERROR!!!
@

if I comment vmsr fpexc,r0 out I am able to compile.

sheroy
Posts: 33
Joined: Fri Jun 14, 2013 5:34 pm

[solved] Re: When compiling for Pi3 in Arch32 enabling VFP

Fri Aug 31, 2018 3:39 pm

Sorry fixed it... my assembler options were not being updated

User avatar
paulwratt
Posts: 78
Joined: Fri Jun 12, 2015 12:15 am

Re: When compiling for Pi3 in Arch32 enabling VFP

Mon Oct 01, 2018 4:21 am

Sorry fixed it... my assembler options were not being updated
What does this mean?
I have not yet been able to enable the floating point unit, I have tried many options (Linux and windows) and have not yet been able to enable the FP unit.
Both DietPi and RetroPie MUST build and work on various different machines, including RPi, so if you use their build settings for the 3 different CPU's and it still does not work, the problem is then with your setup.

As alluded to in a previous post, use of "arch=" and "tune=" is preferred over "cpu=". This is the same technique that allows Atari ST gcc builds form v2 to v8 of GCC and its specific BinUtils version.

BTW, does anyone know where to get a pre-compiled archive or package of any gcc-arm-none-eabi for RPi's other than the OS's repo . I use my RPi as everyday systems in a 12v mobile setup, so compiling it myself is out of the question (unless RaspberryPi Foundation ever releases a 2Gb or 4Gb RPi).

User avatar
Paeryn
Posts: 2146
Joined: Wed Nov 23, 2011 1:10 am
Location: Sheffield, England

Re: When compiling for Pi3 in Arch32 enabling VFP

Mon Oct 01, 2018 6:12 am

paulwratt wrote:
Mon Oct 01, 2018 4:21 am
Sorry fixed it... my assembler options were not being updated
What does this mean?
If you look at the Makefile shown the -mcpu and -march options were only applied when compiling C code (using COPTS). For assembly files no -mcpu or -march options were being applied (using ASMOPTS).
paulwratt wrote:
Mon Oct 01, 2018 4:21 am
Both DietPi and RetroPie MUST build and work on various different machines, including RPi, so if you use their build settings for the 3 different CPU's and it still does not work, the problem is then with your setup.
Not sure what DietPi and RetroPie have to do with this thread, sheroy hadn't mentioned anything about what they were compiling. Especially as sheroy said a month ago that they had identified the error, was the error was, and that it was now fixed.
She who travels light — forgot something.

Return to “Bare metal, Assembly language”

Who is online

Users browsing this forum: No registered users and 3 guests