Nuvoton NUC970 NonOS BSP
 All Files Variables Modules Pages
GNU C/C++ compiler collection build

for bare metal development on NUC970 processor series

This part of the BSP project do not officially supported by Nuvoton Technology Corp.

https://github.com/OpenNuvoton/NUC970_NonOS_BSP/issues/3

Currently we (Nuvoton) only plan to support Keil development environment in NUC970 bare bone BSP.

GNU toolchain includes this packages

Package versions

Directories will be used for build & install

directories for build and install :

make dirs

If you want to follow build process step by step manually, this is a first command creates directory structure required for build toolchain from source code

``` BSP/gnu$ make -f nuc976.mk dirs `` Note then you must run it inBSP/gnudirectory `` ~/BSP/gnu/nuc976.mk ~/BSP/gnu/toolchain.mk

~/BSP/gnu/cross ~/BSP/gnu/sysroot ~/BSP/gz /tmp /tmp/src ```

Download source code packages

``` BSP/gnu$ make -f nuc876.mk gz ```

We'll skip this step assuming you already used BUildroot with /home/user/gz as a directory for its source code archive.

Configuration

Source build of every package is managed by autotools, which generates special configure script resides in every source code package.

Every make package command

To control every package confgiguration we use $CFG_PACKAGE variables

binutils: assembler, linker and object file tools

$TARGET and $CPU must be configured before toolchain.mk will be run, so we use

```nuc976.mk

ARCH = arm CPU = arm926ej-s TARGET = -none-eabi

CFG_CPU = –with-cpu=

-include toolchain.mk ```

Run build command:

``` BSP/gnu$ make -f nuc976.mk binutils ```

Make target first tests is source code ready:

```toolchain.mk binutils: //configure ```

Source code unpack

All makefile targets makes packet build uses automatic dependency resolving:

``` //configure: /binutils/ cd ; xzcat $< | tar x && touch $@ ```

When you run any package build it will first unpack source to $SRC:

``` BSP/gnu$ make -f nuc976.mk binutils cd /tmp/src ; xzcat /home/dpon/gz/binutils/binutils-2.29.1.tar.xz | tar x && touch /tmp/src/binutils-2.29.1/configure ```

Package build: makefile section structure

``` [1] .PHONY: binutils [2] binutils: //configure [3] [4] rm -rf /binutils ; mkdir /binutils ; cd /binutils ;\ [5] $< &&\ [6] -j4 &&\ [7] install [8] ```

  1. declare that this make targets is not files, but just a names:
    • make tool will not check filesystem for this names to find what files were updated, and what files must be rebuilt by dependency
  2. make targets
    • all file names (targets) in left side of a make rule point on files which should be rebuilt...
  3. make sources
    • ...if any file in sources list changed
  4. make rule body must be padded with TAB symbols, no spaces
    • make rule body contains generic OS commands must be run for targets update
    • In make rule commands you can substitute sources and tagets using pseudovariables:
      • $< first source name
      • $^ full sources list splitted by spaces
      • $? only changed sources list
      • $@ target name
  5. (re)create empty directory for out-of-tree build
  6. run source package configure creates set of script files will be run build itself
  7. make in parallel with -jN (N can be equal to number of processor cores on your workstation desktop)
  8. install builded package into $CROSS (--prefix)

libs0: support libraries required for GCC build

For gcc build we require a set of support libraries. We can rely on libxxx-dev packages provided by your Linux distribution, but for devkit portability we'll build them from sources like a part of this toolchain build.

dot_inline_dotgraph_1.png

``` BSP/gnu$ make -f nuc976.mk libs0 ```

gcc0: standalone C compiler for libc build

On first stage we need minimal C compiler with all features disabled, able to build code without use of standard C library (libc).

gcc has deep bound with libc, so to build libc we need standalone gcc

CFG_GCC0

``` gcc0: //configure [1] rm -rf /gcc ; mkdir /gcc ; cd /gcc ;\ [2] $< &&\ [3] -j4 all-gcc && install-gcc &&\ [4] -j4 all-target-libgcc && install-target-libgcc [5] ```

  1. package : source code
  2. out of tree build directory
  3. configure
  4. build & install only gcc core
  5. build & install only libgcc

``` BSP/gnu$ make -f nuc976.mk gcc0 ```

gdb: GNU debugger

We need it for GNU gdb remote debugging

``` BSP/gnu$ make -f nuc976.mk gdb ```