Compiling u-boot with nios2-clang
I tried the u-boot project for bug finding in the nios2 backend. After fixing a bunch of bugs and implementing some missing features, nios2-clang can finally build u-boot !
First of all, compile and install nios2-clang as explained in the last post, Nios2 II port of LLVM/clang: Status.
As mentioned, you will need the altera gcc tool-chain. The software tool Quartus II web edition comes with Nios II Embedded Design Suite, you can get it at altera-quartus-web.
Supposing that you already have Quartus II + Nios II EDS installed at /opt/altera/14.0, enter the nios command shell
$ /opt/altera/14.0/nios2eds/nios2_command_shell.shSet the following environment variable with the path to Nios II system headers and libraries.
$ export NIOS2_SYSDIR=/opt/altera/14.0/nios2eds/bin/gnu/H-x86_64-pc-linux-gnu/lib/gcc/nios2-elf/4.7.3Get u-boot and create a fresh build directory
$ git clone https://github.com/ivanllopard/nios2-u-boot.git
$ cd nios2-u-boot
$ mkdir buildFinally, choose a Nios II compatible board and build u-boot
$ make O=build synapse_config
$ make O=build/ CC=nios2-clang gccincdir="$NIOS2_SYSDIR/include -L$NIOS2_SYSDIR"