This is our new webpage. If you prefer the old one, it's here. If something's not working right, let us know at contact@antmicro.com or use the contact form. Thanks!
 
 
 
 
 
 

Posts Tagged ‘eCos’

May 9th, 2012
OpenRISC Ethernet driver for eCos RTOS

We have been maintaining the eCos real-time OS for openRISC for some time now, but what has been an obstacle to use it in a wider array of applications was the lack of suitable driver support enabling the construction of a platform featuring a richer set of interfaces.

In a series of posts, we have decided to amend this situation by writing, contributing and showing how to use drivers for some essential peripherals for ORPSoC.

The first peripheral we are going to work with is Ethernet.

We have written drivers to support OpenCores ethmac Ethernet controller (http://opencores.org/project,ethmac). It is already commited to main OpenRISC eCos repository which we’re maintaining.

The driver for the Ethernet controller will be automatically added to the eCos build if we select any network stack. We can pick from the following:

– TCP/IP stack from OpenBSD
– TCP/IP stack from FreeBSD (including KAME IPv6)
– Lightweight TCP/IP stack: lwIP (note: originally created by Adam Dunkels at the Center for Networked Systems at SICS, with whom we cooperate)

For example, in order to build eCos with the FreeBSD stack, the following steps have to be taken:

1
2
3
4
5
ecosconfig new orpsoc default
ecosconfig add CYGPKG_NET
ecosconfig add CYGPKG_NET_FREEBSD_STACK
ecosconfig add CYGPKG_IO_FILEIO
ecosconfig add CYGPKG_IO_ETH_DRIVERS

Before we proceed to compilation, we need to do some additional configuration of the driver and the network stack. The most important configuration options are of course the MAC address of the Ethernet controller itself as well as the IP address (either static or dynamically allocated via DHCP) of the device. The configuration can be done in two ways: either using the GUI program, configtool, or via editing ecos.ecc.

When we are done, we should issue:

1
2
ecosconfig tree
make

which results in a compiled eCos with Ethernet and TCP/IP support. The nice thing is that the network services API in eCos is POSIX-compliant, so the networking programs look and work just like Linux ones. It is best to look at some examples, residing in the packages/net/common/current/tests/ directory – especially ping_test.c and server_test.c are worth noting.

Note: the code described in this post is available here.

March 23rd, 2012
eCos-3.0 port to OpenRISC tracking mainline

Recently we have ported eCos-3.0 for the openRISC, and in other posts described how to reset the ordb2 board and how to build programs for it in the eCos.

We are hoping that this will be a solid piece of help for those who want to work with OpenRISC with a real-time operating system, and for those who want to use the new devboard from opencores.

Now the port has been updated to track the eCos mainline, thoroughly tested – passing all tests on the ordb2 board – and is hosted on OpenCores SVN.

Detailed instructions on using the port are published on the official wiki page.

March 13th, 2012
Running eCos on the OpenRISC ordb2 board

UPDATE: the eCos for OpenRISC is now tracking mainline eCos and more configurations are tested, so the whole procedure was a bit simplified!

Downloading the new version of eCos will be described in a new note and linked to here.

Ant Micro is maintaining and developing the eCos port for OpenRISC – you can find the wiki page of the port at the opencores server.

So far, the port was being tested in the or1ksim simulator which is considered a golden model of the OpenRISC1000 architecture. However, it’s always best to see how a port performs on real hardware.

Recently, ORSoC shared the new ordb2 development board with us. The board is based on Altera Cyclone IV E FPGA chip and is equipped with all popular interfaces.

To verify that everything works fine, we tested the eCos port on the board by running a set of eCos tests and simple multi-threaded programs.

Below are the instructions how to run eCos programs on ordb2 board. UPDATE: Not all configuration options are yet supported, but the default configuration is well tested and stable, so the .ecc file provided previously is no longer needed.

In order to build eCos for ordb2, follow these instructions:

1
2
3
4
5
6
mkdir ecos_openrisc
cd ecos_openrisc
ecosconfig new orpsoc
ecosconfig tree
make
make tests

After issuing these commands tt is possible to run eCos tests on the board. In order to upload the binaries using GDB, the or_debug_proxy program is needed.

Please note that FT4232 support was added to or_debug_proxy on 16th september 2011 – older builds will not work.

To establish a connection with board, issue the following command:

1
or_debug_proxy -r 50001

This will open a tcp port for the GDB RSP connection.

It is now possible to open a UART connection. Please note, that it is better to open the UART connection after starting or_debug_proxy. It is because or_debug_proxy causes the system to reorder USB devices when connected to the FTDI chip.

The configuration file assumes that the UART is running at a 115200 baud rate.

To open a UART device using picocom, issue the following command:

1
picocom -b 115200 /dev/ttyUSB1

The number next to ttyUSB may be different across systems.

Everything is ready to upload a test binary. We will use GDB and connect to or_debug_proxy.

1
2
3
4
5
or32-elf-gdb [test binary]
target remote :50001
load
spr npc 0x100
c

Now that we know how to connect to the board, let’s make a simple hello world application. A minimal eCos hello world program looks pretty standard:

1
2
3
4
5
#include <stdio.h>
int main(void) {
  printf("hello world\n");
  return 0;
}

To build the program, use the following flags with or32-elf-gcc:

1
2
3
4
5
6
7
or32-elf-gcc \
   -g \
   -Iecos_openrisc/install/include \
   -Lecos_openrisc/install/lib \
   -nostdlib \
   -Tecos_openrisc/install/lib/target.ld \\
   main.c

It is now possible to upload the resulting binary file the same way described above. Have fun programming for eCos on the openRISC devboard!

October 31st, 2011
eCos-3.0 port for OpenRISC

During our work with the OpenRISC platform we were missing our favourite real-time operating system – eCos. Although some porting work had been performed earlier, the eCos port was no longer supported. With the development of the OpenRISC project, as a result of toolchain and other changes, it had stopped working.

Also, it was based on the now obsolete 2.0 version of eCos.

We decided that a freshly updated eCos port could be useful both in our work and for the OpenRISC community, and here it is!

On http://opencores.org/or1k/ECos you will find the associated wiki page and from there you can download the code, of which Piotr Skrzypek is the maintainer.

August 29th, 2009
I²C in eCos on AT91SAM7 platforms

Using eCos on AT91SAM7 family processors has generally been a positive experience, however, the absence of some important functionalities can be somewhat of a problem. One of the most striking deficiencies of eCos is the lack of an interrupt-based driver for I²C, a popular bus used especially with various sensor chips. As we had to devise such a driver in one of our projects, we publish it below. The code can be used for the eCos userspace application on both SAM7X and SAM7S and, after some modification, can successfully be used seperately from the eCos platform.
The code is released on the BSD license. We appreciate any remarks!


First we have to declare a few variables – mutex and flag handles, and some buffer structures:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
       // rx_tx_struct
       typedef struct {
            cyg_int16 len;
            cyg_uint16 index;
             char *buffer;
       } I2C_RX_TX_STRUCT;
       I2C_RX_TX_STRUCT rx_data_struct, tx_data_struct;
       // handles, flags, mutexes
       cyg_flag_t rxrdy_flag;
       cyg_flag_t txrdy_flag;
       cyg_flag_t txcomp_flag;
       cyg_flag_t done_flag;
       cyg_handle_t  hIntr;
       cyg_interrupt intr;
       cyg_mutex_t twi_mutex;

(more…)

 

Copyright © 2009 - 2012 ant micro. All rights reserved. | Design: Duind.com