Skip to content

pervices/firmware

Repository files navigation

1. Quick Start

To quickly compile a product variant, you can try the following
commands. Note carefully that they are used for our own, internal, machines, and
may not work for you. The remainder of this README provides additional
information on how to get a compile working for you.

The following commands run the compilation steps in Docker to 
ensure consistent compatibility with each product.
Compiling with Docker installed on your machine is preferred. 
However, if you wish to compile without Docker you must install 
the appropriate toolchain and use the legacy script.

On archlinux without Docker, you will need to install the "arm-linux-gnueabihf-gcc" toolchain,
which is available on yaourt.

1.a Automatic Compile Routines

    sh autobuild.sh -p <PRODUCT> -v <RTM_VERSION> -r <NUM_RX> -t <NUM_TX> -s <MAX_RATE_MHZ> (optional) --rx_40ghz_fe --use_3g_as_1g --user_lo

    List options: sh autobuild.sh --help

    Example 1: sh autobuild.sh -p VAUNT -v RTM10 -r 4 -t 4 -s NA
    Example 2: sh autobuild.sh -p TATE_NRNT -v RTM5 -r 4 -t 4 -s 1000 --use_3g_as_1g --user_lo
    Example 3: sh autobuild.sh -p LILY -v RTM1 -r 4 -t 4 -s 500

If you are compiling without Docker, the "legacy-autobuild.sh" script should be used instead.
The legacy script accepts all the same arguments as above.

    List options: sh legacy-autobuild.sh --help

    Example: sh legacy-autobuild.sh -p VAUNT -v RTM10 -r 4 -t 4 -s NA

2. Manually specifying Build Variant Target

To specify whether to build a Cyan ("Tate") or Crimson ("Vaunt") server variant
you will need to specify PRODUCT=VAUNT or PRODUCT=TATE when calling ./configure.

This variable modifies specific properties, such as the number of front end boards,
and register file mappings to ensure operation. By default, firmware targets
Crimson ("Vaunt") product variants.

Only one product may be specified at a time, and you must specify one of them for
compilation to succeed.

3. Manually cross-compiling from a development computer.

To build the HPS binaries from a host computer, you may be required to specify
a non-standard location for your compiler and build chain. To ensure that your
modified build chain is correctly specified and propagated across the build, you
may specify the specific compiler as a configure flag.


For Crimson, we currently use the armv7l hard-float toolchain that is available here;
https://archlinuxarm.org/wiki/Distcc_Cross-Compiling 

For Cyan, we should be able to use the ARMv8 toolchain from above, but this is presently untested.

To target the ARM processors used by Crimson and Tate, you can use;

./configure \
    --prefix=/usr \
    --host=arm-unknown-linux-gnueabihf

It's likely that your default system toolchain will not immediately support the
target arm host. If that's the case, you can choose to directly specify the
compiler using the CC and CXX flags.

For the internal PV machines that haven't been configured with the new toolchain;

   CXX="/usr/x-tools/x-tools7h/arm-unknown-linux-gnueabihf/bin/arm-unknown-linux-gnueabihf-g++" \
   CC="/usr/x-tools/x-tools7h/arm-unknown-linux-gnueabihf/bin/arm-unknown-linux-gnueabihf-gcc" \

And then add the CFLAGS and instructions appropriate for either Crimson or Cyan.
   
3. Compile Optimizations

To further optimize the design for either Crimson or Cyan, you can also specify
the CFLAGs when calling configure.

For Crimson (Vaunt), the following CFLAGS and configure flags have been tested;

CFLAGS="-Wall -O3 -pipe -fomit-frame-pointer -Wall \
        -march=armv7-a -mtune=cortex-a9 -mfpu=neon" \
        ./configure --prefix=/usr --host=arm-linux-gnueabihf

For Cyan (Tate), the following CFLAGS and configure flags have been tested;

CFLAGS="-Wall -O3 -pipe -fomit-frame-pointer -Wall \
        -march=armv7-a -mtune=cortex-a53 -mfpu=neon" \
        ./configure --prefix=/usr --host=arm-linux-gnueabihf

4. Installing the toolchain on archlinux

You may opt to install the arm-linux-gnueabihf-gcc on archlinux using yaourt;

yaourt -S arm-linux-gnueabihf-gcc --noconfirm

This will automatically try and install the complete tool chain. If you need to
install the packages sequentially, you may try doing so, using;


yaourt -G arm-linux-gnueabihf-binutils arm-linux-gnueabihf-linux-api-headers \
    arm-linux-gnueabihf-binutils \
    arm-linux-gnueabihf-gcc-stage1 \
    arm-linux-gnueabihf-glibc-headers \
    arm-linux-gnueabihf-gcc-stage2 \
    arm-linux-gnueabihf-glibc \
    arm-linux-gnueabihf-gcc

You'll also need to install the packages in the above order.