FPGA, SoC, And CPLD Boards And Kits
FPGA Evaluation and Development Kits
5993 Discussions

How to successfully compile U-Boot?


I have been following this project guide in an effort to complete a custom SoC-FPGA build for my DE10 Nano booting the FPGA and embedded linux from an SD card.




I am on step where I attempt to compile my U-boot file and get this error:


CHK   include/config/uboot.release

 CHK   include/generated/version_autogenerated.h

 CHK   include/generated/timestamp_autogenerated.h

 UPD   include/generated/timestamp_autogenerated.h

 CC   lib/asm-offsets.s

lib/asm-offsets.c:1:0: error: bad value (generic-armv7-a) for -mtune= switch

 // SPDX-License-Identifier: GPL-2.0+


make[1]: *** [Kbuild:44: lib/asm-offsets.s] Error 1

make: *** [Makefile:1655: prepare0] Error 2


Of note is the possibility that I didn't complete

-synthesis of my build correctly, since after running the sdram .tcl, it did not successfully compile, but did prior to so I ran with that .sof

-had to upgrade my Gcc to 6.5

-my socfpga_cyclone5_socdk.h file did not contain a macro of "CONFIG_BOOTCOMMAND" as described in step or a macro "CONFIG_EXTRA_ENV_SETTINGS" as described in step Nevertheless, I did save the substitute preprocessor directives found in those steps.

-I may have gone wrong so many other places

-this error says armv7 but the de10 nano has an A9?

0 Kudos
1 Reply

I have spent several days trying to solve this problem, but found none of them working.

But fortunately I solved this after pits and pits.


I was tying to build uboot 2017.11.


pit 1.  no config

         sudo apt-get install -y bison flex 

         make socfpga_de10_nano_defconfig

pit 2. no gcc

        apt-get install crossbuild-essential-armhf

pit 3. cc1: error: bad value (‘generic-armv7-a’) for ‘-mtune=’ switch

        export ARCH=arm;export CROSS_COMPILE=arm-linux-gnueabihf-


        make V=1 ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf-

pit 4. tc-parser.tab.o:(.bss+0x10): multiple definition of `yylloc'; scripts/dtc/dtc-lexer.lex.o:(.bss+0x0): first defined here

        nano scripts/dtc/dtc-lexer.lex.c
              //YYLTYPE yylloc;
              extern YYLTYPE yylloc;

pit 5. arm-linux-gnueabihf-gcc: error: unrecognized -march target: armv5

       this took me 2-days to solve, if did  armv7 or armv5t it would give you something like this.

              {standard input}:35: Error: selected processor does not support `mcr p15,0,r3,c7,c5,0' in Thumb mode

        nano .\arch\arm\Makefile

               # Replace
              # arch-$(CONFIG_CPU_V7) =$(call cc-option, -march=armv7-a, \
              #                   $(call cc-option, -march=armv7, -march=armv5))
              arch-$(CONFIG_CPU_V7) =$(call cc-option, -march=armv7-a, \
                                      $(call cc-option, -march=armv7-a, -march=armv7-a))


Through these pits, you should be able to compile the u-boot.


pit 6.  You may follow this guide to plant uboot into SDCard


The patch is not necessary.


Device Boot Start End Sectors Size Id Type
/dev/sdc1 18432 223231 204800 100M b W95 FAT32
/dev/sdc2 223232 61765631 61542400 29.4G 83 Linux
/dev/sdc3 2048 18431 16384 8M a2 unknown

$ dd if=u-boot-spl.sfp of=/dev/sdc3 bs=64k seek=0

$ dd if=u-boot.img of=/dev/sdc3 bs=64k seek=4


0 Kudos