Forums

Skip to content

Advanced search
  • Quick links
    • Unanswered topics
    • Active topics
    • Search
  • FAQ
  • Login
  • Register
  • Board index Architectures & Platforms Gentoo on ARM
  • Search

RK3288 gcc -mcpu optimization conflict

Gentoo on all things ARM. Both 32 bit and 64 bit.
Tell about your hardware and CHOST.
Problems with crossdev targeting ARM hardware go here too.
Post Reply
  • Print view
Advanced search
7 posts • Page 1 of 1
Author
Message
M95D
Tux's lil' helper
Tux's lil' helper
Posts: 126
Joined: Fri Jan 03, 2020 9:40 am

RK3288 gcc -mcpu optimization conflict

  • Quote

Post by M95D » Mon Jan 09, 2023 7:50 pm

Hi.

Hardware is Asus TinkerBoard S, with RK3288 (armv7-a with vfpv3 and NEON). Specs here.
I'm trying to cross-compile a kernel for it. I used the official linux (git clone from torvalds repo) and crossdev -t arm-unknown-linux-gnueabihf to generate a toolchain.
Now I'm trying to build the kernel with these options:

Code: Select all

export ARCH=arm
export CROSS_COMPILE="arm-unknown-linux-gnueabihf-"
export KCFLAGS="-O2 -pipe -mcpu=cortex-a17 -mfpu=neon-vfpv3"
export KCPPFLAGS=$KCFLAGS
make
...and I get this warning:

Code: Select all

cc1: warning: switch '-mcpu=cortex-a17' conflicts with switch '-march=armv7-a'
I didn't set any -march switch. Where does that come from?
And why is there a conflict? Isn't cortex-a17 an armv7-a CPU?

Thanks.

PS:
I also tried:

Code: Select all

KCFLAGS="-O2 -pipe -mfloat-abi=hard -march=armv7ve+neon-vfpv3 -mcpu=cortex-a17 -mfpu=neon-vfpv3"
... and I got:

Code: Select all

...
  AR      init/built-in.a
  AR      usr/built-in.a
  CC      arch/arm/vfp/vfpmodule.o
{standard input}: Assembler messages:
{standard input}:687: Error: D register out of range for selected VFP version -- `vldr d16,.L113'
{standard input}:691: Error: D register out of range for selected VFP version -- `vstr d16,[r2]'
{standard input}:791: Error: D register out of range for selected VFP version -- `vldr d16,.L113'
{standard input}:1198: Error: D register out of range for selected VFP version -- `vldr d16,.L176'
{standard input}:1201: Error: D register out of range for selected VFP version -- `vstr d16,[r4,#496]'
make[3]: *** [scripts/Makefile.build:252: arch/arm/vfp/vfpmodule.o] Error 1
Last edited by M95D on Tue Jan 10, 2023 8:52 am, edited 1 time in total.
Top
rab0171610
l33t
l33t
Posts: 721
Joined: Sat Dec 24, 2022 1:41 am

  • Quote

Post by rab0171610 » Tue Jan 10, 2023 7:58 am

Until someone with more experience in this area chimes in . . .
Prior to ARMv8, the ARM architecture distinguished between VFP and NEON floating-point support. NEON was not fully IEEE 754 compliant, and there were instructions that VFP supported which NEON did not. These issues have been resolved with ARMv8.
https://embeddedartistry.com/blog/2017/ ... r-options/

Have you thoroughly read:
https://gcc.gnu.org/onlinedocs/gcc/ARM-Options.html
If you have studied it then you can ignore the suggestion.
However, a note from this (GCC) link:
If the selected floating-point hardware includes the NEON extension (e.g. -mfpu=neon), note that floating-point operations are not generated by GCC’s auto-vectorization pass unless -funsafe-math-optimizations is also specified. This is because NEON hardware does not fully implement the IEEE 754 standard for floating-point arithmetic (in particular denormal values are treated as zero), so the use of NEON instructions may lead to a loss of precision.

That may have been fixed with ARMv8?

Also, from the GCC link , I think it is possible you are somehow inadvertently setting -march (as a default or implied setting):
-mcpu=name+extension…
This specifies the name of the target ARM processor. GCC uses this name to derive the name of the target ARM architecture (as if specified by -march)

The the following link is old and not 100% relevant, but it may give you some info that might help explain what the significance of the conflicting -march switches:
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=58869

Lastly, instead of:

Code: Select all

-march=armv7ve+neon-vfpv3
Is it possible, considering the errors about vldr d16 being out of range for the VFP version, that you might need to use:

Code: Select all

-march=armv7ve+neon-fp16
That will include the 16D FPU registers:
+neon-fp16
The Advanced SIMD (Neon) v1 and the VFPv3 floating-point instructions, with the half-precision floating-point conversion operations.
That is if the cortex-a17 supports this.
Top
M95D
Tux's lil' helper
Tux's lil' helper
Posts: 126
Joined: Fri Jan 03, 2020 9:40 am

  • Quote

Post by M95D » Tue Jan 10, 2023 9:24 am

I know that -mcpu should select -march and -mtune automatically and I really didn't specify any -march, but somehow a conflicting -march is automatically selected. I don't understand where that came from. Does crossdev somehow set a default -march in the generated toolchains? If so, how do I remove that?

RK3288 specs say it supports vfpv3:
Include VFP v3 hardware to support single and double-precision add, subtract, divide, multiply and accumulate, and square root operations
I couldn't find any info about how many registers it has, but it's clearly not half-precision, so xxx-fp16 would be wrong.
I read the gcc manual and I can't find any neon-vfpv3-d16, not in -mcpu and not in -mfpu. I think neon implies 32 registers.

Somehow I missed that note about gcc not using neon due to loss of precision. I'll try without -neon, with -vfpv3 only.
Top
NeddySeagoon
Administrator
Administrator
User avatar
Posts: 56094
Joined: Sat Jul 05, 2003 9:37 am
Location: 56N 3W

  • Quote

Post by NeddySeagoon » Tue Jan 10, 2023 10:09 am

M95D,


Set up the default .config file to your likeing

Code: Select all

ARCH=arm CROSS_COMPILE=arm-unknown-linux-gnueabihf- make <your_defconfig>
Tweak the cofig. Including setting the build options.

Code: Select all

ARCH=arm CROSS_COMPILE=arm-unknown-linux-gnueabihf- make menuconfig
Build almost normally

Code: Select all

ARCH=arm CROSS_COMPILE=arm-unknown-linux-gnueabihf- make -jX
where X suits the build host.

Now you have the kernel binary, the matching *dtb and kernel modules ready to install. Copy them.

Intsall your arm kernel modules to INSTALL_MOD_PATH=

Code: Select all

ARCH=arm CROSS_COMPILE=arm-unknown-linux-gnueabihf- modules_install INSTALL_MOD_PATH=/mnt/gentoo
Do not pass

Code: Select all

export KCFLAGS="-O2 -pipe -mcpu=cortex-a17 -mfpu=neon-vfpv3"
export KCPPFLAGS=$KCFLAGS 
Trust the kernel build system

The -march switch will come from the kernel .config file.
Regards,

NeddySeagoon

Computer users fall into two groups:-
those that do backups
those that have never had a hard drive fail.
Top
NeddySeagoon
Administrator
Administrator
User avatar
Posts: 56094
Joined: Sat Jul 05, 2003 9:37 am
Location: 56N 3W

  • Quote

Post by NeddySeagoon » Tue Jan 10, 2023 10:10 am

Moved from Portage & Programming to Gentoo on ARM.

It an ARM thing
Regards,

NeddySeagoon

Computer users fall into two groups:-
those that do backups
those that have never had a hard drive fail.
Top
M95D
Tux's lil' helper
Tux's lil' helper
Posts: 126
Joined: Fri Jan 03, 2020 9:40 am

  • Quote

Post by M95D » Tue Jan 10, 2023 1:56 pm

[quote="NeddySeagoon"]
Do not pass

Code: Select all

export KCFLAGS="-O2 -pipe -mcpu=cortex-a17 -mfpu=neon
The -march switch will come from the kernel .config file.[/quote]
I didn't know that. Thanks!
Top
M95D
Tux's lil' helper
Tux's lil' helper
Posts: 126
Joined: Fri Jan 03, 2020 9:40 am

  • Quote

Post by M95D » Fri Jan 13, 2023 7:59 am

It does work with latest git master, but there is problem booting that kernel. The board turns itself off while booting the kernel, without any error, it just powers off without even finishing the current debug line on the serial port.
So I tried kernel v5.15 and it does't work.

Code: Select all

$ git checkout v5.15
$ ARCH=arm CROSS_COMPILE=arm-unknown-linux-gnueabihf- make clean
$ ARCH=arm CROSS_COMPILE=arm-unknown-linux-gnueabihf- make -j1

...

  CHK     include/generated/compile.h
  UPD     include/generated/compile.h
  CC      init/main.o
/tmp/ccswHRub.s: Assembler messages:
/tmp/ccswHRub.s:1378: Error: selected processor does not support `cpsid i' in ARM mode
/tmp/ccswHRub.s:1627: Error: selected processor does not support `cpsid i' in ARM mode
/tmp/ccswHRub.s:1689: Error: selected processor does not support `cpsie i' in ARM mode
/tmp/ccswHRub.s:1732: Error: selected processor does not support `dsb ' in ARM mode
/tmp/ccswHRub.s:1921: Error: selected processor does not support `cpsie i' in ARM mode
/tmp/ccswHRub.s:2066: Error: architectural extension `mp' is not allowed for the current base architecture
/tmp/ccswHRub.s:2067: Error: selected processor does not support `pldw [r4]' in ARM mode
/tmp/ccswHRub.s:2070: Error: selected processor does not support `pld [r4]' in ARM mode
/tmp/ccswHRub.s:2076: Error: selected processor does not support `ldrex r3,[r4]' in ARM mode
/tmp/ccswHRub.s:2078: Error: selected processor does not support `strex r1,r2,[r4]' in ARM mode
make[1]: *** [scripts/Makefile.build:277: init/main.o] Error 1
make: *** [Makefile:1868: init] Error 2
Top
Post Reply
  • Print view

7 posts • Page 1 of 1

Return to “Gentoo on ARM”

Jump to
  • Assistance
  • ↳   News & Announcements
  • ↳   Frequently Asked Questions
  • ↳   Installing Gentoo
  • ↳   Multimedia
  • ↳   Desktop Environments
  • ↳   Networking & Security
  • ↳   Kernel & Hardware
  • ↳   Portage & Programming
  • ↳   Gamers & Players
  • ↳   Other Things Gentoo
  • ↳   Unsupported Software
  • Discussion & Documentation
  • ↳   Documentation, Tips & Tricks
  • ↳   Gentoo Chat
  • ↳   Gentoo Forums Feedback
  • ↳   Duplicate Threads
  • International Gentoo Users
  • ↳   中文 (Chinese)
  • ↳   Dutch
  • ↳   Finnish
  • ↳   French
  • ↳   Deutsches Forum (German)
  • ↳   Diskussionsforum
  • ↳   Deutsche Dokumentation
  • ↳   Greek
  • ↳   Forum italiano (Italian)
  • ↳   Forum di discussione italiano
  • ↳   Risorse italiane (documentazione e tools)
  • ↳   Polskie forum (Polish)
  • ↳   Instalacja i sprzęt
  • ↳   Polish OTW
  • ↳   Portuguese
  • ↳   Documentação, Ferramentas e Dicas
  • ↳   Russian
  • ↳   Scandinavian
  • ↳   Spanish
  • ↳   Other Languages
  • Architectures & Platforms
  • ↳   Gentoo on ARM
  • ↳   Gentoo on PPC
  • ↳   Gentoo on Sparc
  • ↳   Gentoo on Alternative Architectures
  • ↳   Gentoo on AMD64
  • ↳   Gentoo for Mac OS X (Portage for Mac OS X)
  • Board index
  • All times are UTC
  • Delete cookies

© 2001–2026 Gentoo Foundation, Inc.

Powered by phpBB® Forum Software © phpBB Limited

Privacy Policy

 

 

magic