August 8, 2018

The Nanopi Fire3 - A compiler for 64 bit arm

Up to now I have been working with 32 bit ARM boards (the BBB and OrangePi) with Cortex-A8 and Cortex-A7 processors. Now I am beginning work with the Nanopi Fire3 which has 64 bit (armv8) Cortex-A53 processors. The first thing I find myself wanting to do is to rebuild U-Boot, and the instructions to do so direct me to use CROSS_COMPILE=aarch64-linux-. Up to now I have been using arm-linux-gnu-gcc -mcpu=cortex-a7 as a cross compiler. And typing arm-linux-gnu-gcc --target-help indicates that this compiler will generate 64 bit code, so I could add some option switches and continue to use it.
Known ARM architectures (for use with the -march= option):
    armv2 armv2a armv3 armv3m armv4 armv4t armv5 armv5e armv5t armv5te armv5tej armv6 armv6-m armv6j armv6k armv6kz armv6s-m armv6t2 armv6z armv6zk armv7 armv7-a armv7-m armv7-r armv7e-m armv7ve armv8-a armv8-a+crc armv8-m.base armv8-m.main
    armv8-m.main+dsp armv8.1-a armv8.2-a armv8.2-a+fp16 iwmmxt iwmmxt2 native

  Known ARM CPUs (for use with the -mcpu= and -mtune= options):
    arm1020e arm1020t arm1022e arm1026ej-s arm10e arm10tdmi arm1136j-s arm1136jf-s arm1156t2-s arm1156t2f-s arm1176jz-s arm1176jzf-s arm2 arm250 arm3 arm6 arm60 arm600 arm610 arm620 arm7 arm70 arm700 arm700i arm710 arm7100 arm710c arm710t arm720 arm720t
    arm740t arm7500 arm7500fe arm7d arm7di arm7dm arm7dmi arm7m arm7tdmi arm7tdmi-s arm8 arm810 arm9 arm920 arm920t arm922t arm926ej-s arm940t arm946e-s arm966e-s arm968e-s arm9e arm9tdmi cortex-a12 cortex-a15 cortex-a15.cortex-a7 cortex-a17
    cortex-a17.cortex-a7 cortex-a32 cortex-a35 cortex-a5 cortex-a53 cortex-a57 cortex-a57.cortex-a53 cortex-a7 cortex-a72 cortex-a72.cortex-a53 cortex-a73 cortex-a73.cortex-a35 cortex-a73.cortex-a53 cortex-a8 cortex-a9 cortex-m0 cortex-m0.small-multiply
    cortex-m0plus cortex-m0plus.small-multiply cortex-m1 cortex-m1.small-multiply cortex-m23 cortex-m3 cortex-m33 cortex-m4 cortex-m7 cortex-r4 cortex-r4f cortex-r5 cortex-r7 cortex-r8 ep9312 exynos-m1 fa526 fa606te fa626 fa626te fa726te fmp626
    generic-armv7-a iwmmxt iwmmxt2 marvell-pj4 mpcore mpcorenovfp native strongarm strongarm110 strongarm1100 strongarm1110 xgene1 xscale

Many compiler choices

I run Fedora 27 on my intel desktop. A quick search through the DNF database shows that a number of ARM toolchains are available for me to install, including aarch64-linux:
[tom@trona ~]$ grep arch64 dnf.list
binutils-aarch64-linux-gnu.x86_64       2.29-3.fc27                     fedora  
gcc-aarch64-linux-gnu.x86_64            7.1.1-3.fc27                    fedora  

[tom@trona ~]$ grep arm-linux dnf.list
binutils-arm-linux-gnu.x86_64           2.29-3.fc27                     @fedora 
gcc-arm-linux-gnu.x86_64                7.1.1-3.fc27                    @fedora 

[tom@trona ~]$ grep arm dnf.list | grep gcc
arm-none-eabi-gcc-cs.x86_64             1:7.1.0-5.fc27                  @fedora 
gcc-arm-linux-gnu.x86_64                7.1.1-3.fc27                    @fedora 
nacl-arm-gcc.x86_64                     4.9.2-9.git336bd0b.fc26         fedora  
I have had little luck discovering what all of these are, but there seems to be little harm in having more than one of them on my machine. The aarch64 toolchain would seem to be the "Linaro" toolchain, and given that it is the one the Nanopi Fire3 Wiki instructs me to use to rebuild U-Boot, I will go ahead and install it.
dnf install gcc-aarch64-linux-gnu
Last metadata expiration check: 2:17:41 ago on Fri 10 Aug 2018 08:19:18 AM MST.
Dependencies resolved.
==============================================================================================================================================================================================================================================================
 Package                                                                   Arch                                                  Version                                                         Repository                                              Size
==============================================================================================================================================================================================================================================================
Installing:
 gcc-aarch64-linux-gnu                                                     x86_64                                                7.2.1-1.fc27                                                    updates                                                 13 M
Installing dependencies:
 binutils-aarch64-linux-gnu                                                x86_64                                                2.29.1-1.fc27                                                   updates                                                2.3 M

Transaction Summary
==============================================================================================================================================================================================================================================================
Install  2 Packages


Have any comments? Questions? Drop me a line!

Tom's electronics pages / [email protected]