Skip to content

Bare-Metal ARM Toolchains for Altera SoCFPGA and NXP LPC32xx targets

License

Notifications You must be signed in to change notification settings

thomask77/ct-ng-toolchains

Repository files navigation

Bare-Metal ARM Toolchains

This repository contains Crosstool-NG configurations and helper scripts to build Windows and Linux toolchains for my personal use.

Changelog

2018-06-01

Updated to GCC 8.1.0. Remember to re-run ./bootstrap.sh when updating from an older version.

2017-10-22

Updated to GCC 7.2.0. Remember to re-run ./bootstrap.sh when updating from an older version.

Installation

  • Tested on Ubuntu 16.04 LTS and Debian 8.7
sudo apt-get update
sudo apt-get install -y build-essential automake gperf bison flex gawk libncurses5-dev python-dev texinfo help2man mingw-w64

./bootstrap.sh

How to build

Build a single toolchain:

./build-toolchain.sh gcc-arm-socfpga_hf-eabi-linux

.. or build all of them:

./build-toolchain.sh gcc-*

Building all toolchains requires 45 GB of disk space and will take about 2 hours on a recent Core i7 machine.

Afterwards, you will (hopefully) find nicely packaged toolchains in the "releases" folder.

Changing configurations

Each toolchain directory has a defconfig-file. To make changes, execute:

../crosstool-ng defconfig
../crosstool-ng menuconfig
../crosstool-ng saveconfig

Altera SoCFPGA (Cortex-A9)

Altera's SoC EDS includes a variant of Sourcery CodeBench Lite. While the full version supports the "hard" floating point ABI, the lite edition only supports "softfp" -- i.e. floating point arguments are passed in integer registers on function calls.

The alternatives are no better: GNU ARM Embedded only supports Thumb mode (which is 10% slower), and Linaro's arm-eabi toolchain only does software floating point (on purpose, for bootloaders). All other prebuilt toolchains are either proprietary or outdated.

Configuration Settings

  • Use fastest floating point ABI

    -mfloat-abi=hard

  • newlib options

    • Reeantrancy with multi-thread and multi-core support (see 10, 11)

      -DREENTRANT_SYSCALLS_PROVIDED -D__DYNAMIC_REENT__

    • Disable NEON optimized memcpy to prevent floating point instructions in otherwise integer-only code.

      As there is no better flag (see 12), newlib is configured with

      -mno-unaligned-access

NXP LPC32xx (ARM926EJ-S)

Mentor Graphics stopped to release Sourcery CodeBench Lite in 2013 (and only supported softfp anyways).

Configuration Settings

  • Use fastest floating point ABI

    -mfloat-abi=hard

  • newlib

    • Reentrancy with multi-thread support

      -DREENTRANT_SYSCALLS_PROVIDED