DENX . U-Boot . ARCNotes

GNU Toolchain for ARC

The most recent release of pre-built GNU tools for ARC could be obtained from here -

At the moment the most recent version is arc-2015.06.

Following pre-built tools could be used for building U-Boot for any ARC boards:

Important notes

  1. Only uClibc toolchain could be used for building U-Boot because elf32 version doesn't support linkage of Position Independent Executables (-pie).
  2. Pre-built tools are compatible with 64-bit hosts only, if one needs to run it on 32-bit host then toolchain could be built on 32-bit host with whether scripts from or with up to date Buildroot.
  3. RedHat/!CentOS 5.x uses earlier version of glibc and thus is not-compatible with pre-built toolchain.
  4. From U-Boot v2015.04rc2 on libc is built in U-Boot itself. This allows to use either uClibc toolchain for ARC (be it liitle- or big-endian, for ARCompact or ARCv2) for U-Boot building. This is because gcc itself in all ARC toolchains may generate code for any ARC core. The only significant difference between toolchains is pre-built libs that could be linked in resulting executable. Now we don't rely on anything pre-built so any toolchain will work.

Prepare U-Boot to work with MetaWare debugger

This U-Boot version is linked as position-independent executable (POE) which is required for normal operation of this bootloader. Unfortunately even the most recent version of MetaWare debugger cannot work with POE executables.

That's why it's required to modify u-boot elf to fake MDB.

Starting from U-Boot v2015.04rc1 all written above could be made by executing a special make target "mdbtrick" like this:

 make mdbtrick

For earlier versions of U-Boot following manual procedures will do the trick:

Note that after this modification all debug information will be stripped from elf.

If you're going to use u-boot.bin image for loading it directly in memory note that it must be loaded in memory starting from CONFIG_SYS_TEXT_BASE and then set PC to the same address.

Debug U-Boot on ARC with MetaWare debugger

Before relocation

U-Boot as a simple ELF built for ARC and so could be used with MDB as any other bare-metal application.

The only note is since U-Boot for ARC is linked as PIE (Position Independent Executable) and MDB currently cannot handle PIE ELFs it is required to modify ELF header of resulting output file and strip all debug information. See section above for available options.

After relocation

Non-SPL (and as of now SPL is not supported in ARC port) U-Boot auto-relocates early on start to the very end of available RAM. That means that all symbols change its addresses and debugger can no longer show proper disassmbly or values of variables.

Fortunately there's a way to map relocated symbols to existing U-Boot elf ("u-boot" file produced by "make" command). In case of MDB 2 things has to be done for that (commands must be entered in "Command" prompt of MDB):

  1. Remove existing data for pre-relocation symbols
     delete mod all
  2. Load symbols with new [relocation] offset
     symbols u-boot -load=+0x1ef8d000

Debug U-Boot on ARC with GDB-server

Please refer to generic description here: 10.1. Debugging of U-Boot

Running U-Boot on ARC in Free nSIM

Free nSIM (ARC's new generation simulation engine) is available after simple registration here:

Once downloaded and extracted from tarball make sure its "nSIM/bin" folder is in your PATH.

  1. For little-endian target:
    make arcangel4_defconfig && make
    nsimdrv -prop=nsim_isa_family=a700 -prop=nsim_isa_atomic_option=1 -prop=nsim_mmu=3 -prop=icache=32768,32,2,0 \
    -prop=dcache=32768,32,4,0 -prop=nsim_isa_dpfp=none -prop=nsim_isa_shift_option=2 -prop=nsim_isa_swap_option=1 \
    -prop=nsim_isa_bitscan_option=1 -prop=nsim_isa_sat=1 -prop=nsim_isa_mpy32=1 -prop=nsim_isa_enable_timer_0=1 \
    -prop=nsim_isa_enable_timer_1=1 -prop=nsim_mem-dev=uart0 u-boot

  1. For big-endian target:
    make arcangel4-be_defconfig && make
    nsimdrv -prop=nsim_isa_family=a700 -prop=nsim_isa_atomic_option=1 -prop=nsim_mmu=3 -prop=icache=32768,32,2,0 \
    -prop=dcache=32768,32,4,0 -prop=nsim_isa_dpfp=none -prop=nsim_isa_shift_option=2 -prop=nsim_isa_swap_option=1 \
    -prop=nsim_isa_bitscan_option=1 -prop=nsim_isa_sat=1 -prop=nsim_isa_mpy32=1 -prop=nsim_isa_enable_timer_0=1 \
    -prop=nsim_isa_enable_timer_1=1 -prop=nsim_mem-dev=uart0 -prop=nsim_isa_big_endian=1 u-boot

ARC custodian tips

Repo URL: ssh://

----- Revision r1.9 - 09 Dec 2015 - 22:25 - AlexeyBrodkin
Copyright © 2002-2022 by DENX Software Engineering