UClinux

cancel
Showing results for 
Search instead for 
Did you mean: 

UClinux

UClinux

 

 

The original uClinux was a derivative of Linux 2.0 kernel intended for microcontrollers without Memory Management Units (MMUs). Later the patches of uClinux were merged back to the mainstream Linux 2.6 kernel. Today's uClinux as an operating system includes Linux kernel releases for 2.0 2.4, and 2.6 and a collection of user applications, libraries, and toolchains. If you are new to uClinux, reading the uClinux FAQ and uClinux-dist Developers Guide is very helpful. There is a very helpful uClinux wiki site (http://docs.blackfin.uclinux.org/) for blackfin, and it applies to Nios II as well.

Why develop on Linux when you have the IDE on Windows?

The IDE on Windows is not good for uClinux kernel/apps development,

  • The IDE's compiler defaults to newlib, while we prefer to use uClibc in uClinux. Software building and porting will be much easier with the compiler created from buildroot.
  • The tools run much faster, and with less trouble on Linux. After using Linux, you will feel the IDE on Windows moves like turtles.
  • To develop Nios II uClinux, you should work on Linux and learn Linux. You can learn a lot when working on Linux, and the "Linux know-how" is the key to success on Nios II uClinux.

Advantages over the Microtronix's release 1.4

Microtronix developed the kernel code for Nios II. But they didn't release updates for a long time. We based on the code and improved it.

  • It is synced up to the latest Linux kernel release, which means improvements, bugfixes, and more drivers supported. If you will develope drivers, it is important to keep up.
  • we add support of compressed kernel image, which can save around 50% flash usage.
  • we use initramfs, which is easier to use than romfs, especially for custom boards.
  • we add drivers for EPCS,PCI,VGA,PS/2 etc.

Quartus for Linux - recommended

  • You will need to add a PC, to run Linux. If you are new to Linux, you can try CentOS 5.5 i386 32bits distro, which is free and binary compatible with RHEL5. You can find a step by step guide on the Linux installation and usage from Redhat"s doc . You may install it to a (20+GB suggested) partition on your PC along with an other OS, eg, Windows XP. Though it is not necessary, it is very useful to install Quartus for Linux. You will be able to configure the .sof, download the image, debug and program the flash using the USB Blaster, all on your Linux PC. Even if you don't have a license (to generate hardware programming files), you can still install it and use it to develope software. Please refer to Quartus for Linux for details. You can find links to major Linux distributions here. Don't use Redhat9, as its make is too old.
  • If you didn't install Quartus for Linux or you don't have a license to compile hardware, you can setup a samba server or client on a Linux PC, so that it can share files with a Windows PC. You can use Quartus II and Nios II on Windows to design hardware, then build software on Linux. But you must install and develop software on a native Linux filesystem, not a Windows shared drive. You may copy the kernel image to Windows for download and testing.
  • If you have only a Windows PC, you can still construct a Linux environment using coLinux , which will run under Windows, see Nios2Colinux. You may use VMWare, too. But they may be difficult for a Linux newbie. Note, you cannot use the Linux shell to program JTAG on coLinux under Windows. You must use the Nios II command shell for Windows to program JTAG in this case.

Before you start

  • Always update your tools to the latest version: ie, Altera Design suite v9.0 (including Quartus,Nios2eds) at this moment.
  • The Nios II kernel image is configured with a SOPC builder PTF file, and it will only run on the same hardware generated SOF file.
  • Remember, the current version of uClinux does not use an MMUaadhar cardceiling fans with lightsbathroom exhaust fan, so no virtual memory, no shared objs/libs, no fork, and stack size is fixed. As such, do not include the MMU in your Nios II build.
  • The application executable format on uClinux is not ELF, but (compressed) binary flat format, FLT.
  • We will use initramfs (which is quite new to uClinux), instead of romfs. The initramfs is compressed. The rootfs (initrd) image can be linked into the kernel, and make the booting easier. You don't need other devices, such as MTD, CF/IDE, NFS for rootfs to start up your uClinux. As they may not be available for a new custom board. You can mount other devices or filesystem later.

Hardware requirements

You should start with a minimal system with only,

  • Nios II f or s core, with a hardware multiplier, (f-core suggested, s-core is slower).
  • sdram (minimum requirement 8MB),
  • one full featured timer,
  • a jtag/serial uart

Note in Linux, irq 0 means auto-detected, so you must not use irq 0 for ANY devices, except for timer.

It is possible to use e-core, but it will be very, very slow.

It is possible to run without a hardware multiplier, but you will need some hacking.

Let's start it step by step

  1. Try Out uClinux with pre-built binary images if you have Altera Nios dev boards.
  2. Install Nios II Linux Install the source and build tools. Or you can use prebuild Binary Tool chain.
  3. UClinux Dist build uClinux kernel and a collection of user applications.

Linux Articles in the Wiki

using haserl scripts for runtime configuration

Board support package

When you do "make vendor_hwselect", it will extract the parameters of your custom hardware (address, irq, freq etc) from your sopc PTF file into nios2-linux/uClinux-dist/linux-2.6.x/include/asm-nios2/nios2.h. Then they are used by kernel through the file nios2-linux/linux-2.6/arch/nios2/kernel/config.c. You might need to modify the config.c file to match the component instant name.

Supported devices

NET: dm9000,smc91111,opencore eth,mtip1000, altera_tse

IDE: altcf

USB: isp116x,isp1362, isp1760/1761

CHAR: uart,watchdog,pio/button,spi,ps/2 keyboard mouse.

MMC: mmc core

MTD: EPCS

I2C: opencore i2c, ds1307, i2c-gpio

PCI: altpci

VIDEO: altfb

 

Tutorial and Projects

  • Tutorial Video There is a Tutorial video available base on the above document that demonstrates how to boot uclinux on Nios II processor with mmu on DE2-115 board but you can apply this configuration to any custom board in order to boot uclinux, Qsys and Kernel configuration is described in the video
  • custom hardware and driver, The project was to create a custom piece of hardware which we had to add to the standard Nios II core and write a linux driver to drive this hardware under uClinux. By piie.
  • "Device drivers and Test application for a SOPC solution with Nios II softcore processor and μClinux", a excellent guide to DE1/DE2 projects from hans_wurst.

Links

Version history
Last update:
‎12-21-2022 03:27 PM
Updated by: