From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 12388 invoked by alias); 13 Sep 2002 06:14:59 -0000 Mailing-List: contact sid-help@sources.redhat.com; run by ezmlm Precedence: bulk List-Subscribe: List-Archive: List-Post: List-Help: , Sender: sid-owner@sources.redhat.com Received: (qmail 12358 invoked from network); 13 Sep 2002 06:14:56 -0000 Received: from unknown (HELO blrexsr.sanyo.co.in) (202.54.90.2) by sources.redhat.com with SMTP; 13 Sep 2002 06:14:56 -0000 Received: by BLREXSR with Internet Mail Service (5.5.2653.19) id ; Fri, 13 Sep 2002 11:46:46 +0530 Message-ID: <6DF87017DA95D611AC6000606730DE9B11D76B@BLREXSR> From: Satish Kumar To: 'Robert Cragie ' , Satish Kumar , "'ijsung@csie.nctu.edu.tw '" Cc: "'ecos-discuss@sources.redhat.com'" , "'sid@sources.redhat.com'" Subject: RE: [ECOS] how to build an eCos library for ARM7tdmi simulator Date: Thu, 12 Sep 2002 23:14:00 -0000 MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" X-SW-Source: 2002-q3/txt/msg00048.txt.bz2 Hi, i followed the build procedure of sid, as stated in ur mails was able to finish it sucessfully. but i m not able to connect to the target board. i.e initially i tried this command: arm-elf-sid --board=arm7t-normalmap -gdb=2000 -EL --tksm & i got a message stating 'Unknown board arm7t-normalmap' later i tried a different command: arm-elf-sid --board=pid7t-normalmap -gdb=2000 -EL --tksm & this time,i got a message stating : [1] 816 well next when i run the command arm-elf-gdb twothread.x the debugger window opened with the source file displyed in the source window, now i clicked on Run->Connect to target. and i used the same settings as stated: Target: Remote/TCP. Host:localHost. port:2000 set breakpoint at 'cyg_user_start' and other breakpoint at the exit. on pressing ok, i get an Error message stating: Error:bad option "-modal" : must be -default,-icon,-message,-parent,-title, or -type.. and i m not able to run the program..plz kindly tell me how to run the sid simulator for arm7tdmi and how to run my application programs once they are compiled using the ecos library built for pid. satish -----Original Message----- From: Robert Cragie To: satishkumar@sanyo.co.in; ijsung@csie.nctu.edu.tw Sent: 9/4/02 2:14 PM Subject: FW: [ECOS] how to build an eCos library for ARM7tdmi simulator Just in case you didn't get it from the mailing list... -----Original Message----- From: Robert Cragie [mailto:rcc@jennic.com] Sent: 03 September 2002 16:07 To: ecos-discuss@sources.redhat.com Subject: FW: [ECOS] how to build an eCos library for ARM7tdmi simulator Further to my original message, I have now run through it step-by-step doing a clean install. There were some issues with the original text, so I have updated it. I am in the process of doing an SGML version. Robert Cragie, Design Engineer _______________________________________________________________ Jennic Ltd, Furnival Street, Sheffield, S1 4QT, UK http://www.jennic.com Tel: +44 (0) 114 281 2655 -----Original Message----- From: ecos-discuss-owner@sources.redhat.com [mailto:ecos-discuss-owner@sources.redhat.com]On Behalf Of Robert Cragie Sent: 03 September 2002 09:09 To: ecos-discuss@sources.redhat.com Subject: RE: [ECOS] how to build an eCos library for ARM7tdmi simulator Seeing as there is some interest in this, I am attaching the draft of my 'mini-HOWTO' on how I got it going. Note this is in draft state, and I have not followed it all step-by-step; the SID bits are from memory. I will have a go following step-by-step when I get a spare few minutes. I would also be interested to know how Cygwin users get on. [snip] eCos and SID on ARM PID target HOWTO

eCos and SID on ARM PID target HOWTO

This document describes howto set up the environments for getting eCos and a target application to work with SID. By the end of this tutorial, you should be able to:

  1. Build a simple, multi-threaded application linked with eCos.
  2. Build the SID simulator infrastucture to support a simulated ARM PID target.
  3. Debug and run the application using GDB (Insight) connected to a simulated ARM PID target.

What is eCos?

eCos is an embedded, configurable multi-threaded operating system which can target many systems and CPUs.

For more details see Redhat's eCos page.

What is SID?

SID is a simulation environment which allows a number of software-defined components to be built together to provide a target which simulates a real hardware target.

For more details see Redhat's SID page.

Assumptions

I am assuming use of the following environment:

  • Linux.
  • bash is used as the command shell.
  • The user's user ID is 'user'.
  • All created directories are based on the user's root directory (reached using 'cd ~', or 'cd /home/user').
  • Superuser access is possible.
  • Tcl/Tk is installed (8.0 or later)

It is undoubtedly possible to get it all working using cygwin on Windows(tm), but I have not done this.

The following syntax indicates a command run as user:

$ <command>

The following syntax indicates a command run as a superuser:

# <command>

Installing eCos

Getting eCos source

I would strongly recommend getting the latest CVS version of eCos, and not to attempt to use version 1.3.1, which still seems to be being used even though it is very old. The following contains extracts from Redhat's eCos anonymous CVS page.

Type the following command to login to the CVS server:

$ cvs -d :pserver:anoncvs@sources.redhat.com:/cvs/ecos login

You will be prompted for a password which is anoncvs. You only need to perform this login the first time you access the eCos CVS repository. The password is saved in the file .cvspass in your home directory for use in subsequent sessions.

It is recommended that you use different directory trees for the anonymous CVS sources and for full releases of eCos. Create a new directory for the check out and change to that directory:

$ mkdir ~/ecos-cvs

$ cd ~/ecos-cvs

Now type:

$ cvs -d :pserver:anoncvs@sources.redhat.com:/cvs/ecos co -P ecos

This command should initiate a connection to the CVS server and check out the latest version of eCos, including TCP/IP networking stack and SNMP. It may take quite a while.

If you are unable to use CVS, David Airlie of Parthus Technologies plc. places complete CVS snapshots here; obtain the latest one of these and unzip it into the ecos-cvs directory.

Getting eCos Configuration Tool Version 2

I would recommend using the graphical Configuration Tool as it is generally easier to use than trying to decipher the relatively terse configuration files to change options. The following contains extracts from Redhat's eCos Configuration Tool Version 2 page:

Download con figtool-2.11-i386.tar.gz (3.1Mb) or co nfigtool-2.11-i386.tar.bz2 (2.8Mb)

Login as superuser and unarchive the tar file into a suitable directory. I am assuming here that /opt/ecos/configtool is the required destination directory for all files (note: configtool does not have to be installed by superuser, but it is preferable):

$ su

# mkdir -p /opt/ecos/configtool/bin

# cd /opt/ecos/configtool/bin

# tar xvfz /home/user/configtool-2.11-i386.tar.gz

(or, if you dowloaded the bz2 version:)

# bunzip2 -c /home/user/configtool-2.11-i386.tar.bz2 | tar xvf -

As there is only one executable, it is probably easiest to create a symbolic link to it:

# ln -s /opt/ecos/configtool/configtool-2.11/bin/configtool /usr/bin/configtool

Alternatively, make sure that /opt/ecos/configtool/configtool-2.11/bin is added to your PATH environment variable.

The following files will be extracted to the installation directory:

configtool, ecoslogo.png, rhlogo.png, about.htm, README.txt, license.txt, ecosplatforms.tar.gz, manual/

Optionally, untar the contents of ecosplatforms.tar.gz into your home directory, where it will create a directory called .eCosPlatforms. The information in these files isn't yet used by the Configuration Tool, but will keep the tool from generating some warnings.

The executable is statically linked to the wxWindows library, but does require the GTK+ 1.2, GDK 1.2 and TCL 8.x libraries to be installed.

Note: On SuSE Linux, there needs to be an additional symbolic link to the Tcl library. Do the following:

# cd /usr/lib

# ln -s libtcl8.3.so libtcl.so

Getting arm-elf tools

As this is a complex procedure, you need to follow the directions here exactly. Once you have done this, you will have all the required tools needed to build for an arm-elf target (note this does not include the thumb target).

Note that the link to Insight 5.0 is broken. However, I have downloaded and installed I nsig ht 5.2.1 (insight-5.2.1.tar.bz2) instead and see that it has some worthwhile bugfixes from 5.0.

Building eCos environment for PID target

Set the repository

Assuming you have checked out the latest version to a directory called ecos-cvs, you need to set the following environment variable for the Configuration Tool to pick up where all the source is (known as the repository, not to be confused with the CVS repository):

$ ECOS_REPOSITORY=/home/user/ecos-cvs/ecos/packages; export ECOS_REPOSITORY

This line should also be added to your shell initialisation script (.bashrc, or .bash_profile)

Create the ecos.ecc file

Create a new directory in your home directory and change to it:

$ mkdir -p ~/ecos-targets/pid-current

$ cd ~/ecos-targets/pid-current

Run the configtool

Enter the following

$ configtool

You should see the Configuration Tool start.

Create default settings for the PID target

Select the Build->Templates... menu item. In the Hardware combo box, select ARM development board (PID), and press 'OK'.

Change the following options:

eCos HAL->ROM Monitor support->Work with a ROM Monitor to disabled (unchecked)

eCos HAL->Platform-independent HAL options->Route diagnostic output to debug channel to disabled (unchecked)

Now save the file as ecos.ecc using the File->Save as... menu item

Build the tree

To build the tree for the PID development board, select the Build->Generate Build Tree menu item. You will see three directories: ecos_build, ecos_install and ecos_mlt

Make the libraries

$ cd ecos_build

$ make

This will place all the required files for an application in ecos_install.

Create the 'two threads' example

$ cd ../ecos_install

$ mkdir examples

$ cd examples

Get the two threads source code from here. Copy it into a file called twothreads.c.

Build this as follows

$ arm-elf-gcc -g -I../include twothreads.c -L../lib -o twothreads.x -Ttarget.ld -nostdlib

There should be no errors. You now have the executable (twothreads.x) which you can download, debug and run on the SID target using Insight, or gdb.

Installing SID

Getting SID source

The following contains extracts from Redhat's SID page.

Type the following command to login to the CVS server:

$ cvs -z 9 -d :pserver:anoncvs@sources.redhat.com:/cvs/src login

You will be prompted for a password which is anoncvs. You only need to perform this login the first time you access the SID CVS repository. The password is saved in the file .cvspass in your home directory for use in subsequent sessions.

It is recommended that you use different directory trees for the anonymous CVS sources and for full releases of SID. Create a new directory for the check out and change to that directory:

$ mkdir ~/sid-cvs

$ cd ~/sid-cvs

Now type:

$ cvs -z 9 -d :pserver:anoncvs@sources.redhat.com:/cvs/src co sid

This command should initiate a connection to the CVS server and check out the latest version of SID. It may take quite a while.

If you are unable to use CVS, automated CVS snapshots are available here; obtain the latest one of these and unzip it into the sid-cvs directory.

Building SID

Having checked out the source, you should see a single src subdirectory in the sid-cvs directory. Create a build directory alongside this:

$ mkdir build

$ cd build

Login as superuser and run configure to produce the build tree. I am assuming here that /opt/sid is the required destination directory for all files:

$ su

# ../src/configure --prefix=/opt/sid --exec-prefix=/opt/sid 2>&1 | tee configure.out

You will need the additional patch submitted by Robert Cragie on 03-Sep-02:

# cd ~/sid-cvs/src/cgen/cpu

# patch -p0 < arm7.cpu.patch

# cd ~/sid-cvs/build/sid/component/cgen-cpu/arm7t

# make cgen-all

Now make all the files and install them:

# cd ~/sid-cvs/build

# make all install

Note that this may take a very long time (hours).

Add the executable directory to the path:

$ export PATH=/opt/sid/bin:$PATH

This line should also be added to your shell initialisation script (.bashrc, or .bash_profile)

Running a sample session

Change back to where the twothreads executable is:

$ cd ~/ecos-targets/pid-current/ecos_install/examples

Run SID with the following options:

$ arm-elf-sid --board=pid7t-normalmap --gdb=2000 -EL --tksm &

What this actually does is run a script file called arm-elf-sid. This in turn runs a more complex Perl script called configrun-sid, which builds the complex configuration file needed for SID on the fly, and then runs it.

  • The --board=pid7t option is a configrun-sid option which specifies that the configuration file for the PID7T target should be constructed. The additional -normalmap option ensures that the remapping operations done at startup by eCos do not affect the board.
  • The --gdb=2000 option is also a configrun-sid option which specifies that the configuration file should also include a stub to allow GDB connection to the PID7T target via TCP/IP using port 2000.
  • The -EL option specifies little-endian mode
  • The --tksm option is also a configrun-sid option which specifies that the configuration file should also include an experimental GUI interface which can show the 'innards' of the target. This is needed to see the output from the UART.
  • & simply runs it as a background task.

Select the experimental GUI window titled 'System Monitor' and left-click and hold on 'uart1' in the left hand column. Select 'GUIs' and then 'tk tty'. You should see an empty window called 'hw-uart-ns16550 uart1' come up.

Run GDB (I am assuming you are using Insight):

$ arm-elf-gdb twothreads.x

Connect to the target by selecting the Run->Connect to target menu item. Initially, you will get a dialog box; select the following options in the combo boxes on the left hand side:

Target Remote/TCP
Hostname localhost
Port 2000

Enable (check) the Set breakpoint at checkbox, and enter 'cyg_user_start' in the edit box to the right.

Disable (uncheck) the Display download Dialog checkbox.

Click on OK. You should see a dialog saying 'Successfully connected'; press OK on this dialog to dismiss it. Note that on Insight 5.2.1 these settings are remembered on further connections to the target.

Download the code to the target by selecting the Run->Download menu item.You should see a blue bar in the status bar showing the download progress.

Run the code by selecting the Run->Run menu item. You should see the code run up to the breakpoint specified at 'cyg_user_start'.

Continue the execution by selecting the Control->Continue menu item. You will see it hit another breakpoint at the end of 'main', and another at 'exit'; ignore these and continue the execution further by selecting the Control->Continue menu item in each case.

Select the 'hw-uart-ns16550 uart1' window. You should already see the following text:

Entering twothreads' cyg_user_start() function
Beginning execution, thread data is 0
Beginning execution, thread data is 1

Wait patiently. After a while, you should see something like the following:

Thread 0: and now a delay of 239 clock ticks
Thread 1: and now a delay of 230 clock ticks

You are now running a fully multi-thread application using eCos running on a simulated real target board (i.e. one which actually exists in real life).

Finishing the sample session

To finish, simply exit GDB as usual, and kill SID by typing:

$ killall -9 sid

Further issues

The main problem with the simulation is that the timer tick seems to be running much slower than it would do in real life. This needs to be looked at. If the delays are reduced in twothreads.c then the above will run quicker.

SID is a complex package, and modifying it for other targets will require a very good understanding of how it all works and fits together. It may also require additional components to be written. This is not a trivial task.