Skip to content

SPEC2000 on ARC

Alexey Brodkin edited this page Aug 30, 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_TARGET_TZ_INFO=y
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

Copy full sources of SPEC2000 anywhere on SD-card. For example let's put it in /spec2000.

Now we're ready to start a target board and do all the rest right on target.

Actions on target

Prepare environment

Add native tools' bin folder to PATH environment variable:

export PATH=/opt/arc_gnu_2018.03_prebuilt_uclibc_le_archs_native_install/bin/:$PATH

Create a symlink from native GCC to CC

cd /opt/arc_gnu_2018.03_prebuilt_uclibc_le_archs_native_install/bin/
ln -s gcc cc

This is required because Perl configuration scripts looks strictly for cc.

Create a symlink to /usr/local/include

mkdir /usr/local
ln -s /opt/arc_gnu_2018.03_prebuilt_uclibc_le_archs_native_install/include /usr/local/include

This is requireв because 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).

Build SPEC tools

cd /spec2000/tools/src
./buildtools

Run SPEC

Many command-line options and configuration tricks are explained in docs/runspec.txt document that's distributed as a part of SPEC2000 sources.

Prepare SPEC environment

cd /spec2000
. ./shrc

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

Build and run all integer benchmarks

runspec --config linux-arc-gcc.cfg --iterations 1 --noreportable -I int

Note --iterations 1 instructs SPEC to run all benchmarks once.

Put -I flag to ignore failed tests.

Re-run benchmarks keeping everything previously built

runspec --config linux-arc-gcc.cfg --iterations 1 --noreportable --make_no_clobber int 

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

Generate reportable results

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

This will force rebuild all benchmarks from scratch and run each benchmark 3 times in a row.

Clone this wiki locally