ST AN 2119 APPLICATION NOTE

 

AN 2119

®

APPLICATION NOTE

 

Getting Started with uClinux for STR71x

 

 

INTRODUCTION

UClinux is a derivative of the Linux 2.0 kernel intended for use as an operating system in microcontroller applications.The tools, files and procedures described in this document will help you get started using uClinux on any of the STR71x, ARM7TDMI core-based microcontrollers.

Necessary software and hardware tools

The uClinux software kit is designed for use with the STR710 Evaluation Board (STR710-EVAL).

Note: Building the uClinux kernel requires a host PC running the Linux OS.

The uClinux software kit includes the uClinux operating system (OS) and the bootloader required for booting up the board and loading uClinux. The OS is ported from the standard distribution uClinux-dist-20040408, which implements the Linux kernel 2.4.24-uc0. The software tools can be downloaded at www.uclinux.org, or using the following direct links:

ARM-ELF toolchain (arm-elf-tools-20030314) www.uclinux.org/pub/uClinux/arm-elf-tools/ arm-elf-tools-20030314.sh

uClinux full distribution (uClinux-dist-20040408) www.uclinux.org/pub/uClinux/dist/ uClinux-dist-20040408.tar.gz

To compile an application independently from a uClinux image (Section 5.2) you will also need the make JFFS2 special utility. You can download it at: sources-redhat.oc1.mirrors.redwire.net/jffs2/ mkfs.jffs2

The STR710 Evaluation Board has been designed by STMicroelectronics for evaluation and application development for the STR71x ARM7TDMI core-based devices and includes an STR710F processor. The STR710F device can be programmed using the RealView ICE-ME JTAG run control device, or other programming tools for ARM7TDMI core-based microcontrollers.

Note: Programming the STR710F on the evaluation board requires the use of an in-circuit programmer/incircuit emulator with JTAG interface and the appropriate programming software. You can find more information about development tools for STR7 at www.st.com/mcu.

February 2005

Rel. 1.0

1/19

Getting Started with uClinux for STR710

Getting started

To help you get started using uClinux in your STR71x application, this document provides procedures to help you:

Install the tools

Build the uClinux kernel

Use the bootloader

Use uClinux

Add your application for debugging

If you want to upload the uClinux image (zimage.bin) provided in the binary files of the uClinux distribution to an STR71x device, refer to the section Use the bootloader.

This distribution of uClinux already contains a sample application for read/write of I2C EEPROM for demonstration purposes. However, if you already have an application that you want to try with uClinux, refer to the section Add your application for debugging.

For more information, you can refer to Additional references.

2/19

Getting Started with uClinux for STR710

1 Install the tools

This section explains how to install the software tools that are required to build the uClinux image on a host PC running Linux. To correctly install the tools you must Install the arm-elf toolchain, Install the uClinux distribution and Patch the uClinux distribution for STR710.

1.1Install the arm-elf toolchain

To install the arm-elf toolchain,

1Login as “root.”

2From the directory that contains the arm-elf toolchain, run:

sh arm-elf-tools-20030314.sh

The rest of the installation is automatic. When this installation is complete, continue by installing the uClinux distribution.

1.2Install the uClinux distribution

To install the uClinux distribution on your PC:

1Login as the user that you are going to use for development.

2Copy the file uClinux-dist-20040408.tar.gz to the user's home directory, or wherever you want to work from.

3Go to the directory that you downloaded the file to, and run:

tar xzvf uClinux-dist-20040408.tar.gz

The uClinux file structure will be extracted to the chosen directory. A sub-directory is created called uClinux-dist, which contains the whole distribution.

When this is complete, continue by patching the uClinux distribution for use with STR710.

1.3Patch the uClinux distribution for STR710

1Copy the uClinux-dist-20040408-str710-patch.tar.gz file from the uClinux package for STR7 to the uClinux-dist directory and then run:

tar xzvf uClinux-dist-20040408-str710-patch.tar.gz

The uClinux-dist-20040408-str710-patch file is output in the chosen directory. This file is the STR710 porting patch file for uClinux-dist-20040408 distribution, implementing the Linux kernel 2.4.24-uc0.

2 Now, run:

cd uClinux-dist

patch -p1 < uClinux-dist-20040408-str710-patch

The ST directory and its sub-directory STR710 are added to the "vendors" directory in the uClinux-dist directory. Once this has been done, you are ready to Build the uClinux kernel.

3/19

ST AN 2119 APPLICATION NOTE

Getting Started with uClinux for STR710

2 Build the uClinux kernel

Once you have installed the tools, you can configure and build the kernel into a binary file. You don’t need to be logged on as root from this point on.

2.1 Configure the uClinux kernel

1 To configure the kernel, go to the uClinux-dist directory and run the configuration utility:

make menuconfig

This will run the configuration program that is shown in Figure 1, below.

Figure 1: uClinux configuration main menu

2In the configuration program, select Vendor/Product Selection.

3Enter your vendor/product combination, the Kernel version and the Libc version according to the table below:

Table 1: Vendor/product combination

Vendor / product selection

Vendor

ST

 

 

 

 

ST products

STR710

 

 

 

Kernel / library /defaults

Kernel Version

Linux-2.4.x

selection

 

 

Libc version

uClibc

 

 

 

 

 

Default all settings (lose changes)

-

 

 

 

 

Customize kernel setting

-

 

 

 

 

Customize vendor/user setting

-

 

 

 

 

Update default vendor setting

-

 

 

 

4 Save this configuration by selecting Exit and choosing Save.

4/19

Getting Started with uClinux for STR710

Note: Choosing the options: Customize Kernel settings or Customize Vendor/User settings will run other menus after you exit and save the menuconfig settings. For descriptions of each option, select help.

When configuring for the first time, set the following to default: Default all settings (lose changes),

Customize kernel setting, Customize vendor/user setting, Update default vendor setting.

You can also use make config or make xconfig to configure the basic kernel.

2.2Build the uClinux kernel

In order to correctly set up all the dependencies, when the configuration process completes:

1 First, run:

make dep

2 Once this is completed, run the following commands:

make lib_only

make user_only

make romfs

make romfs

make image

Note: You need to run make romfs twice, because the first time romfs.img is generated in the uClinuxdist/images directory, it is only about 15K. This is not the correct size. After the first make romfs, the "init" has not been built into romfs.img. After the second make romfs, the size of romfs.img is larger than 200K. This is the correct size.

After compiling with no errors, there should be a new binary file (zimage.bin), in the uClinux-dist/ images directory. This is the uClinux binary file.

Once you have built the uClinux binary file, you need to load this file into the external Flash of the STR710F device of the STR710-EVAL using the bootloader.

5/19

Getting Started with uClinux for STR710

3 Use the bootloader

The bootloader allows you to load the uClinux binary file (zimage.bin) to external Flash on the evaluation board. Loading the bootloader for requires the use of a programmer or in-circuit emulator with JTAG interface and the software to drive it. For this purpose, we have used the RealView Developer Kit (RVDK) for ST and the RVICE-ME JTAG run control device that is with this kit.

The following sections provide procedures for using the bootloader including how to:

Load the bootloader to the STR710-EVAL board

Configure the host computer for serial download

Configure and connect the STR710-EVAL board for serial download

Serial download an image to external SRAM

Program the image to external Flash

Boot uClinux

3.1Load the bootloader to the STR710-EVAL board

The bootloader (71xboot-R10.bin) image has to be programmed in the beginning of the external Flash memory (0x60000000). It must be executed first after a power up or a reset. It allows the loading of the uClinux image (zimage.bin) into the external SRAM (0x62000000) via a serial port.

To load it using RVDK:

1Set SW13, SW14, SW15 on the STR710-EVAL board to RAM boot mode, as shown on page 13 of the STR710-EVAL Datasheet.

2Install and start RVDK.

3Connect the RVICE-ME JTAG run control device to your PC and the JTAG (CN9) port on your STR710-EVAL board.

4In RVDK, select Debug>Memory/Register Operations>Upload/Download Memory file… in the main menu.

Figure 2: RVDK for ST memory operations menu

The Upload/Download file from/to Memory dialog box appears (see Figure 3).

6/19

Loading...
+ 13 hidden pages