Skip to content

SPEC2000 on ARC

Alexey Brodkin edited this page Aug 8, 2018 · 23 revisions

Prerequisites

Prepare SD-card image

Accommodate pre-built native tools configuration specifics

As of today pre-built native toolchain for ARC HS is built against uClibc with configuration that differs from Buildroot. It has enabled UCLIBC_HAS_LOCALE and disabled UCLIBC_HAS_XLOCALE while Buildroot enables both options in uClibc if user wants to have support of locales on target.

With vanilla Buildroot user will see a message about inability to resolve __ctype_b on running gcc on target. So we'll satisfy native tools requiremens with that simple change in Buildroot sources:

diff --git a/package/uclibc/uclibc.mk b/package/uclibc/uclibc.mk
index 7de9219873..da2605cb24 100644
--- a/package/uclibc/uclibc.mk
+++ b/package/uclibc/uclibc.mk
@@ -338,7 +338,6 @@ define UCLIBC_LOCALE_CONFIG
        $(call KCONFIG_SET_OPT,UCLIBC_BUILD_MINIMAL_LOCALES,"$(UCLIBC_LOCALES)",$(@D)/.config)
        $(call KCONFIG_DISABLE_OPT,UCLIBC_PREGENERATED_LOCALE_DATA,$(@D)/.config)
        $(call KCONFIG_DISABLE_OPT,DOWNLOAD_PREGENERATED_LOCALE_DATA,$(@D)/.config)
-       $(call KCONFIG_ENABLE_OPT,UCLIBC_HAS_XLOCALE,$(@D)/.config)
        $(call KCONFIG_DISABLE_OPT,UCLIBC_HAS_GLIBC_DIGIT_GROUPING,$(@D)/.config)
 endef
 else

Configure and build SD-card image with Buildroot

Use the most recent Buildroot release and the following defconfig:

BR2_arcle=y
BR2_archs38=y
BR2_KERNEL_HEADERS_4_16=y
BR2_TOOLCHAIN_BUILDROOT_LOCALE=y
BR2_PTHREAD_DEBUG=y
BR2_TOOLCHAIN_BUILDROOT_CXX=y
BR2_TARGET_GENERIC_HOSTNAME="hsdk"
BR2_TARGET_GENERIC_ISSUE="Welcome to the HSDK Platform"
BR2_SYSTEM_DHCP="eth0"
BR2_ROOTFS_POST_IMAGE_SCRIPT="support/scripts/genimage.sh"
BR2_ROOTFS_POST_SCRIPT_ARGS="-c board/synopsys/hsdk/genimage.cfg"
BR2_LINUX_KERNEL=y
BR2_LINUX_KERNEL_CUSTOM_VERSION=y
BR2_LINUX_KERNEL_CUSTOM_VERSION_VALUE="4.17.13"
BR2_LINUX_KERNEL_DEFCONFIG="hsdk"
BR2_LINUX_KERNEL_CONFIG_FRAGMENT_FILES="board/synopsys/hsdk/linux.fragment"
BR2_PACKAGE_BUSYBOX_SHOW_OTHERS=y
BR2_PACKAGE_STRACE=y
BR2_PACKAGE_NTP=y
BR2_PACKAGE_NTP_NTPDATE=y
BR2_PACKAGE_OPENSSH=y
BR2_PACKAGE_RSYNC=y
BR2_PACKAGE_COREUTILS=y
BR2_PACKAGE_HTOP=y
BR2_TARGET_ROOTFS_EXT2=y
BR2_TARGET_ROOTFS_EXT2_4=y
# BR2_TARGET_ROOTFS_TAR is not set
BR2_TARGET_UBOOT=y
BR2_TARGET_UBOOT_BUILD_SYSTEM_KCONFIG=y
BR2_TARGET_UBOOT_CUSTOM_VERSION=y
BR2_TARGET_UBOOT_CUSTOM_VERSION_VALUE="2018.07"
BR2_TARGET_UBOOT_BOARD_DEFCONFIG="hsdk"
BR2_TARGET_UBOOT_NEEDS_DTC=y
BR2_TARGET_UBOOT_FORMAT_ELF=y
BR2_TARGET_UBOOT_ENVIMAGE=y
BR2_TARGET_UBOOT_ENVIMAGE_SOURCE="board/synopsys/hsdk/uboot.env.txt"
BR2_TARGET_UBOOT_ENVIMAGE_SIZE="0x4000"
BR2_PACKAGE_HOST_DOSFSTOOLS=y
BR2_PACKAGE_HOST_GENIMAGE=y
BR2_PACKAGE_HOST_MTOOLS=y

Deploy resulting sdcard.img on SD-card

Resize Ext partition of SD-card

Buildroot prepares SD-card image of the smallest size possible and for that creates partitions of sizes exactly matching contents to be put there by Buildroot. But since more contents need to be installed on the same SD-card it's required to resize the second (ext) partition of SD-card.

Note this is only doable in Linux environment because Windows doesn't support Ext.

In Linux Gnome Disks or Gparted utilities might be used for this purpose.

Even though as of now there's no good data pointing to the minimal size of the partition to accommodate tools binaries as well as artefacts generated by SPEC it should be safe to have a couple of Gigabytes.

Install native toolchain

Copy contents of release tarball to /opt folder on previously prepared SD-card

Install SPEC2000 sources

Actions on target

  1. Make native tools available for a target, i.e. copy it over to target's /opt

  2. Create a smlink from native GCC to CC (Perl configuration scripts looks strictly for cc):

    cd /opt/arc_gnu_2018.03_prebuilt_uclibc_le_archs_native_install/bin/
    ln -s gcc cc
    
  3. Perl's Errno module tries to find errno.h only in /usr/include or /usr/local/include (see https://perl5.git.perl.org/perl.git/blob/HEAD:/ext/Errno/Errno_pm.PL), satisfy this requirement with symlink this way:

    ln -s /opt/arc_gnu_2018.03_prebuilt_uclibc_le_archs_native_install/ /usr/local
    
  4. Build SPEC tools:

    cd tools/src
    ./buildtools
    
  5. Run SPEC. This will first build benchmarks an then execute them:

    . ./shrc
    runspec --config linux-arc-gcc.cfg --reportable int
    

    Note Busybox has no source applet so we use . instead.

  6. Rerun SPEC keeping eveything built

    runspec --config linux-arc-gcc.cfg --reportable int --make_no_clobber
    

    Otherwise all previously produced binaries will be nuked and we'll start over from scratch.

Clone this wiki locally