Cannot build u-boot for CycloneV on DE10 Nano

Hello,

I’m having trouble building a baremetal u-boot (ie. the preloader) for the Cyclone V on an DE10 Nano development board from a Windows10 PC. I’ve followed the instructions at [https://rocketboards.org/foswiki/Documentation/SoCEDS]

I have the following installed:
Soc EDS v20.1 standard
Cygwin: x86_64
Linaro baremetal toochain: gcc-linaro-7.5.0-2019.12-i686-mingw32_arm-eabi

The instructions for building u-boot on the RocketBoards page are:
export CROSS_COMPILE=arm-eabi-
make socfpga_cyclone5_defconfig
make -j 24

However this fails after building scripts/basic/fixdep. It doesn’t seem to like the command:
$(call if_changed_dep,host-csingle) in scripts/makefile.host

Attempting to build U-boot results in the following:

I’m not sure what the problem is - an issue with the version of gcc compiler or perhaps the wrong CROSS_COMPILE arguments are provided (despite the instructions)?

I’ve managed to resolve the issue above by making the following changes to the makefile and adding a missing directory:

  1. In makefile in the u-boot-socfpga directory, change -ansi to -std=gnu11
    ifeq ($(HOSTOS),cygwin)
    KBUILD_HOSTCFLAGS += -std=gnu11
    endif

  2. Add .exe to $(CC) here:
    export CC_VERSION_TEXT := $(shell $(CC).exe --version | head -n 1)

  3. The include file u-boot-socfpga\inlude\configs\socfpga_cyclone5_socdk.h tries to include the file baseaddr_ac5.h* from u-boot-socfpga\arch\arm\include\asm\arch, which does not exist. Create the directory u-boot-socfpga\arch\arm\include\asm\arch-socfpga and copy the file base_addr_ac5.h from u-boot-socfpga\arch\arm\mach-socfpga\include\mach into this new directory.

  4. To ensure find.exe is called from the Cygwin binary path (c:\intelfpga\20.1\host_tools\cygwin\bin) rather than the from C:\windows\system32, add the definition: HOST_TOOLCHAIN_DIR := $(dir $(shell which $(HOSTCC))) in makefile below the definition of HOSTCC. Next, change find in the line:
    autoconf_is_old := $(shell find . -path ./$(KCONFIG_CONFIG) -newer
    to: $(HOST_TOOLCHAIN_DIR)find

This allows “make socfpga_cyclone5_defconfig” to execute correctly.
The next part (make -j 24) now fails, as shown below:

scripts/kconfig/conf  --syncconfig Kconfig
  CFG     u-boot.cfg
  GEN     include/autoconf.mk.dep
  CFG     spl/u-boot.cfg
  GEN     include/autoconf.mk
  GEN     spl/include/autoconf.mk
  UPD     include/generated/timestamp_autogenerated.h
===================== WARNING ======================
This board does not use CONFIG_WDT (DM watchdog support).
Please update the board to use CONFIG_WDT before the
v2019.10 release.
Failure to update by the deadline may result in board removal.
See doc/driver-model/migration.rst for more info.
====================================================
  CC      lib/asm-offsets.s
  CC      arch/arm/lib/asm-offsets.s
  CFGCHK  u-boot.cfg
: No such file or directory
: No such file or directory
make[1]: *** [scripts/Makefile.build:153: lib/asm-offsets.s] Error 2
make[1]: *** Deleting file 'lib/asm-offsets.s'
comm: file 1 is not in sorted order
make: *** [Makefile:1049: .binman_stamp] Error 1
make: *** Deleting file '.binman_stamp'
make: *** Waiting for unfinished jobs....
make[1]: *** Waiting for unfinished jobs....
make[1]: *** [scripts/Makefile.build:153: arch/arm/lib/asm-offsets.s] Error 2
make[1]: *** Deleting file 'arch/arm/lib/asm-offsets.s'
make: *** [Makefile:1837: prepare0] Error 2

Any ideas?