Difference between revisions of "Build system (BELK/BXELK)"

From DAVE Developer's Wiki
Jump to: navigation, search
(Created page with "==Introduction== A build system is a set of tools, source trees, Makefiles, patches, configuration files and scripts that makes it easy to generate all the components of a com...")
 
Line 16: Line 16:
  
 
N.B. <u>Sometimes the download of the Vivado 2014.4 full package fails because of some download system malfunctioning, but the problem is barely noticeable, except by performing the MD5 check of the downloaded file. In case of problems, we suggest using the Multi-File Download (available on the same web page), that splits the full package in a collection of smaller files. If you use the Multi-File Download to get the "Vivado (No SDK)" package, you must also download the "Software Development Kit - 2014.4" package.</u>
 
N.B. <u>Sometimes the download of the Vivado 2014.4 full package fails because of some download system malfunctioning, but the problem is barely noticeable, except by performing the MD5 check of the downloaded file. In case of problems, we suggest using the Multi-File Download (available on the same web page), that splits the full package in a collection of smaller files. If you use the Multi-File Download to get the "Vivado (No SDK)" package, you must also download the "Software Development Kit - 2014.4" package.</u>
 +
===How BORA project files are managed===
 +
Since a Vivado project for the Zynq device is composed by a lot of files (including temporary and GUI-managed files), providing the BORA project files with the BELK is not considered as an efficient and user-friendly solution, for two main reasons:
 +
*we should provide a compressed archive for each version (updates, new features, bug fixes) of the project, wasting storage space and download bandwidth, introducing redundancy and complicating file management
 +
*there is no version control, which means that it's not possible to track changes to the project files, making development and release management complicated and error-prone
 +
The best solution to these problems is that we create and maintain a Git repository to store and track only the main files of the Vivado project. Therefore, the developer can clone the repository and keep it in sync with our modifications.
 +
The following diagram shows how the solution works:
 +
[[File:Belk-vivado-sdk-integration.png|thumb|center|600px|git-based Vivado project management]]
 +
BELK also provides the tools for keeping the files modified within the Vivado tools in sync with the local Git repository: with this solution, all the modifications are tracked and developers can take advantage of all the benefits of using git as a version control system.
 +
 +
The public git repository for BORA/Zynq project files is <code>git@git.dave.eu:dave/bora/bora.git</code>.
 +
Please note that BELK distribution provides the git archive of the .git directory of the repository, so the user can immediately get access to the development tree (please refer to section TBD).
 +
==Setting up the Linux development server environment==
 +
During development, user needs to interact with the target system. This section describes the tools that must be installed and configured on the Linux host system for this purpose.
 +
===TFTP Server===
 +
One of the most useful features of a bootloader during development is the capability to download the Linux kernel from the network. This saves a lot of time because developer doesn't have to program the image in flash every time he/she modifies it. U-Boot implements the TFTP protocol (see the <code>tftp</code> command), so the host system must be configured to enable the TFTP service. Installation and configuration of a TFTP server depends on the host Linux distribution.
 +
===NFS Server===
 +
One of the most important components of a Linux system is the root file system. A good development root file system provides the developer with all the useful tools that can help him/her on his/her work. Such a root file system can become very big in size, so it's hard to store it in flash memory. User could split the file system in different parts, mounting them from different media (flash, network, USB...). But the most convenient thing is to mount the whole root file system from the network, allowing the host system and the target to share the same files. In this way, the developer can quickly modify the root file system, even “on the fly” (meaning that the file system can be modified while the system is running). The most common way to setup a system like the one described is through NFS (installation and configuration depends on the host Linux distribution).
 +
===Pre-built toolchain===
 +
To start developing software for the BORA platform, users need a proper toolchain, which can be pre-built or built-from-scratch. Building a toolchain from scratch is not a trivial task (though using a recent build system is easier than in the past), so the recommended approach consists in using a pre-built toolchain.
 +
The toolchain used as a reference for BELK is the toolchain provided with the Xilinx SDK (usually installed into /opt/Xilinx/SDK/<Vivado_version>/gnu/arm/lin/bin).
 +
Once the toolchain is installed, create a a bash script (env.sh) containing the following lines:
 +
export PATH=<path_to_toolchain>:$PATH
 +
export ARCH=arm
 +
export CROSS_COMPILE=<toolchain_prefix>
 +
For example, for the Vivado 2014.4 release, the variables are the following:
 +
export PATH=/opt/Xilinx/SDK/2014.4/gnu/arm/lin/bin:$PATH
 +
export ARCH=arm
 +
export CROSS_COMPILE=arm-xilinx-linux-gnueabi-
 +
Use the following command to set up the environment shell variables required during the building procedure:
 +
source env.sh

Revision as of 09:17, 28 October 2015

Introduction[edit | edit source]

A build system is a set of tools, source trees, Makefiles, patches, configuration files and scripts that makes it easy to generate all the components of a complete embedded Linux system. A build system, once properly set up, automates the configuration and cross-compilation processes, generating all the required targets (userspace packages such as libraries and programs, the kernel, the bootloader and root filesystem images) depending on the configuration. In particular, using an integrated build system prevents from problems caused by misaligned toolchains, since a unique toolchain is used to build all the software components, including the customer application. Some well known structured build systems are the following:

Since various heterogeneous tools are required to build the software components for the BORA/BORAX SOM, BELK does not provide a fully structured build system. In particular, the Xilinx Zynq 7000 development tools are required to configure the system and build the FSBL, while the standard GNU tools are required to build U-Boot, kernel and user-space applications. In the following section, we will refer to the system running the Xilinx tools (that can be either a Microsoft Windows machine or a GNU/Linux machine) as the “Zynq development server”, and to the machine running the GNU/Linux tools as the “Linux development server”.

Setting up the Zynq development server environment[edit | edit source]

The following software packages must be installed on the Zynq development server:

  • Vivado® Design Suite version 2014.4
  • Xilinx Software Development kit
  • Python 2.7.x (C:\Python27 must be the installation directory on Windows)
  • A Git tool (e.g. for Windows: MsysGit http://msysgit.github.io/).

The Zynq 7000 development tools can be downloaded from the Xilinx website: http://www.xilinx.com/support/download/index.htm in the WebPACK™ Edition, which is a free version that provides instant access to the fundamental Vivado features and functionality at no cost. For the hardware requirements of the PC, please refer to http://www.xilinx.com/design-tools/vivado/memory.htm#zynq-7000. The Git tool is used to download the BORA/BORAX project files for Vivado from DAVE Embedded Systems' public git repositories, as described in the next section.

N.B. Sometimes the download of the Vivado 2014.4 full package fails because of some download system malfunctioning, but the problem is barely noticeable, except by performing the MD5 check of the downloaded file. In case of problems, we suggest using the Multi-File Download (available on the same web page), that splits the full package in a collection of smaller files. If you use the Multi-File Download to get the "Vivado (No SDK)" package, you must also download the "Software Development Kit - 2014.4" package.

How BORA project files are managed[edit | edit source]

Since a Vivado project for the Zynq device is composed by a lot of files (including temporary and GUI-managed files), providing the BORA project files with the BELK is not considered as an efficient and user-friendly solution, for two main reasons:

  • we should provide a compressed archive for each version (updates, new features, bug fixes) of the project, wasting storage space and download bandwidth, introducing redundancy and complicating file management
  • there is no version control, which means that it's not possible to track changes to the project files, making development and release management complicated and error-prone

The best solution to these problems is that we create and maintain a Git repository to store and track only the main files of the Vivado project. Therefore, the developer can clone the repository and keep it in sync with our modifications. The following diagram shows how the solution works:

git-based Vivado project management

BELK also provides the tools for keeping the files modified within the Vivado tools in sync with the local Git repository: with this solution, all the modifications are tracked and developers can take advantage of all the benefits of using git as a version control system.

The public git repository for BORA/Zynq project files is git@git.dave.eu:dave/bora/bora.git. Please note that BELK distribution provides the git archive of the .git directory of the repository, so the user can immediately get access to the development tree (please refer to section TBD).

Setting up the Linux development server environment[edit | edit source]

During development, user needs to interact with the target system. This section describes the tools that must be installed and configured on the Linux host system for this purpose.

TFTP Server[edit | edit source]

One of the most useful features of a bootloader during development is the capability to download the Linux kernel from the network. This saves a lot of time because developer doesn't have to program the image in flash every time he/she modifies it. U-Boot implements the TFTP protocol (see the tftp command), so the host system must be configured to enable the TFTP service. Installation and configuration of a TFTP server depends on the host Linux distribution.

NFS Server[edit | edit source]

One of the most important components of a Linux system is the root file system. A good development root file system provides the developer with all the useful tools that can help him/her on his/her work. Such a root file system can become very big in size, so it's hard to store it in flash memory. User could split the file system in different parts, mounting them from different media (flash, network, USB...). But the most convenient thing is to mount the whole root file system from the network, allowing the host system and the target to share the same files. In this way, the developer can quickly modify the root file system, even “on the fly” (meaning that the file system can be modified while the system is running). The most common way to setup a system like the one described is through NFS (installation and configuration depends on the host Linux distribution).

Pre-built toolchain[edit | edit source]

To start developing software for the BORA platform, users need a proper toolchain, which can be pre-built or built-from-scratch. Building a toolchain from scratch is not a trivial task (though using a recent build system is easier than in the past), so the recommended approach consists in using a pre-built toolchain. The toolchain used as a reference for BELK is the toolchain provided with the Xilinx SDK (usually installed into /opt/Xilinx/SDK/<Vivado_version>/gnu/arm/lin/bin). Once the toolchain is installed, create a a bash script (env.sh) containing the following lines: export PATH=<path_to_toolchain>:$PATH export ARCH=arm export CROSS_COMPILE=<toolchain_prefix> For example, for the Vivado 2014.4 release, the variables are the following: export PATH=/opt/Xilinx/SDK/2014.4/gnu/arm/lin/bin:$PATH export ARCH=arm export CROSS_COMPILE=arm-xilinx-linux-gnueabi- Use the following command to set up the environment shell variables required during the building procedure: source env.sh