Is your project stuck?

Try Zylin's Roadside Assistance services

eCos demo for Nios with OpenCores Ethermac

This demo runs the eCos httpd web interface demo on Altera Nios II development kit with Ethermac.
  1. Program demo.sof
  2. Read IP number from nios2-terminal

    Main 1

  3. Use nios2-elf-gdb to load httpd
  4. Point your browser to http://<ip address assigned by DHCP>/monitor

    Main 1

The ethermac HDL & driver was rough around the edges when this demo was made, the SVN repository has already progressed significantly.

Performance on NEEK

NEEK does not have the best memory subsystem, but even so the eCos + Ethermac combination sports 1mByte/s performance as of writing before any optimisations has been done and with relatively little Nios instruction/data cache.

Obviously FPGAs provide a lot of flexibility for streamlining things for your specific application, including making changes to the eCos driver and handling packets in hardware entirely up to and including the TCP/IP stack. 1mByte/s is a nice starting point for NEEK though.

eCos for Nios

Be warned! This version of eCos for Nios is not oriented towards "getting something up and running via point and click", but rather at solving some harder problems when porting applications to Nios. To use this you will minimally need to be versant in GCC tools, Nios and possibly even eCos.

Altera Nios has eCos support that this is based on. The nios2ecos51.exe is a bit long in the tooth and the Nios eCos support at www.ecosforge.net offers some nice featuers.

  1. Not tied to any version of eCos.
  2. Includes driver for OpenCores Ethermac. The TSE is nice, but it is ca. 3-6x bigger than the OpenCores Ethermac(depending on configuration and measurements numbers used). It is bit of an overkill for most eCos type applications.
  3. Not tied to any version of Quartus
This Nios eCos support uses the excellent, but poorly advertised, multi-repository feature (much like a PATH variable) to point eCos configuration tools to a prioritized list of eCos repositories to use. Place the Nios eCos repository at the front of this path to override others. The multi-repository feature is not compatible with the eCos configtool, but work is underway at eCosForge to address that. A necessary, but worthwhile price to pay for the increased maintainability for non-trivial projects.

Altera OpenCores Ethermac

The Ethermac is not tied to eCos in any way. It will work with uCLinux, Linux or InterNiche as well.

Download the Quartus install package from SVN directly:

http://www.ecosforge.net/ecosforge/trunk/nios2ecos/eth_ocm.

Download source code

The source is available at the SVN source repository from http://www.ecosforge.net/ecosforge/trunk/nios2ecos/.

See also http://www.nioswiki.com/ECos.

License

This stuff is covered by various eCos licenses and also some LGPL licenses. Should be usable in just about all projects. The licenses *are* a bit out of date, e.g RedHat assigned all copyright wholesale to FSF for eCos a while ago + for some of the eCos stuff the copyright is not listed as FSF, but that's only required to get this code committed to the "official" eCos repository.

There will probably be little interest in the eCos community to have this stuff committed to the "official" eCos repository, nor is there a whole lot of point in doing so given eCos excellent support for multiple repositories. Being a soft CPU the needs and life cycle will be different from the run-of-the-mill MCU that eCos has hundres of HALs for.

Build hello world based on ptf file

Instructions for downloading and building an eCos test application with your ptf file. With prior eCos experience and a steady hand the instructions below will be decipherable...

Install ecosconfig tool and put it in the path. The simplest way to do this is to install the latest version of eCos. Otherwise you can (try) to build ecosconfig yourself, which is anything between hard and trivial depending on your luck w/eCos version and the OS you're running.

cd /tmp
mkdir ecostest
cd ecostest
svn checkout http://www.ecosforge.net/ecosforge/trunk/nios2ecos
cd nios2ecos/
cvs -z3 -d :pserver:anoncvs@ecos.sourceware.org:/cvs/ecos co -P ecos
export ECOS_REPOSITORY=/tmp/ecostest/nios2ecos/packages:/tmp/ecostest/ecos/packages
cd nios2ecos
source nios_env.sh
cd ..
mkdir buildptf
cd buildptf
# FULL PATH to .ptf file...
nios2configgen --ptf=/tmp/ecostest/buildptf/cycloneIII_3c25_niosII_standard_sopc.ptf --cpu=cpu
ecosconfig new nios2_neek default
ecosconfig tree
make
make tests

Voila! Now try firing up the nios GDB server and run "install/tests/kernel/current/tests/tm_basic"....

Getting help

If you need support for this Nios eCos HAL you can try zylin-discuss, ecos-discuss mailing lists or solicit professional services from Zylin or other eCos consultants. Patches are most welcome and can be posted to zylin-discuss or ecosforge mailing lists. Should be needless to say: this is not for the faint of heart.

Note: the FPGA needs work. It only works with 10Mbit, at 100Mbit it's flaky. Make sure to test ethermac at 10Mbit before you attempt 100Mbit.


ZY1000 JTAG Debugger
ARM7/9/11, XScale, Cortex-M3
Fast. No drivers!