GNU Toolchain for ARC
The most recent release of pre-built GNU tools for ARC could be obtained from here - https://github.com/foss-for-synopsys-dwc-arc-processors/toolchain/releases
At the moment the most recent version is arc-2014.12
Available are 4 flavors of uClibc GNU toolchains for ARC:
- Only uClibc toolchain could be used for building U-Boot because elf32 version doesn't support linkage of Position Independent Executables (
- 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 https://github.com/foss-for-synopsys-dwc-arc-processors/toolchain/tree/arc-2014.12 or with up to date Buildroot.
- RedHat/!CentOS 5.x uses earlier version of glibc and thus is not-compatible with pre-built toolchain.
- 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.
Run U-Boot on ARC 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.
Note that after this modification all debug information will be stripped from elf.
Starting from U-Boot v2015.04rc1 all written above could be made by executing a special make target "mdbtrick" like this:
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
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.
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):
- Remove existing data for pre-relocation symbols
delete mod all
- 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
ARC custodian tips