µClinux
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 as well as a collection of user applications, libraries and tool chains. If you are new to uClinux, it is very helpful to read the uClinux FAQ and uClinux-dist Developers Guide . There is a very helpful uClinux wiki site for blackfin, and it apply 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.
- If you want 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,
The kernel code for Nios II was developed by Microtronix. But they didn't release update for a long time. We based on the code, and improve it.
- It is ported in uClinux-dist, which is the build enviroment most familiar to uClinux developers. There are richer set of libraries and user apps. Microtronix picked only some of them to make their release.
- 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.3, which is free and binary compatible with RHEL5. You may find step by step guide on Linux installation and usage from Redhat's doc . You may install it to a (20+GB suggested) partition on your PC along with 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 sof, download image, debug and program flash using 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 QuartusforLinux for details. You can find links to major linux distributions here. Don't use Redhat9, for 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 Linux PC, so that it can share files with 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 Linux shell to program JTAG on coLinux under Windows. You must use 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 MMU , 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 be not available for a new custom board. You can mount other devices or filesystem later,eg jffs2, in user space.
Hardware requirements
You should start with a minimal system with only,
- Nios II f or s core, with 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 hardware multiplier, but you will need some hack.
Let's start it step by step
- TryOutuClinux with pre-built binary images if you have Altera Nios dev boards.
- InstallNios2Linux install the source and build tools. Or you can use prebuild BinaryToolchain .
- UClinuxDist build uClinux kernel and a collection of user applications.
Linux Articles in the Wiki:
- Bugs and suggestions
- Accessing your own hardware from userland programs
- Accessing hardware registers from user space programs shows how to manage a device via an mmap'ed file
- Accessing hardware registers from user space programs shows how to manage a device via an mmap'ed file
- How to use a Flash file system to save configuration data:
- MTD access CFI flash, NAND flash or EPCS/SPI flash
- FlashProgrammer boot from cfi or epcs flash, use flash to store files.
- Activate a Flash file system
- command line and scrips
- Shell if you need more powerful shell than sash.
- set up more complex initialization scripts
- using haserl scripts for runtime configuration
- Upload files using boa and cgihtml
- Debugging
- DebugKernel using insight gdb GUI to debug kernel.
- DebugApps debug user space applications using gdb, gdbtui, insight or ddd.
- EclipseCDT install and develop/debug with Eclipse CDT IDE. ( Eclipse IDE outdated)
- Nios2IDE import uClinux-dist to Nios2 IDE, and debug.
- Altera NIOS Sudio (Beta, no support for uCLinux yet)
- CompileHello It is easy to compile a simple program. And IO programming in user space.
- LinuxConfig basic kernel config .
- EPCSGuide Document outlining various uses for EPCS Configuration device
- EtherNet Ethernet device drivers and kernel network configuration
- NFSFileSytem NFS support and Root NFS.
- CompactFlash CF drive and IDE hard disk, CD/DVD reader/writer .
- AlteraPCI example design and driver for Altera PCI compiler in host bridge mode.
- UsbHost USB host drivers and device drivers.
- ModuleProgramming example hello kernel module.
- BuildrootGuide guide to build the cross compiler, uClibc and rootfs.
- BusyBox use busybox alone, without buildroot.
- KernelPatches Nios II kernel from linux-2.6.11 to 2.6.23 .
- CustomBootLoader boot from onchip memory instead of cfi or epcs flash.
- Mpeg2Dec mpeg2 decoder library.
- MmcSd mmc sd driver .
- WiFi wireless LAN 802.11 b/g .
- Robotic
- Running Java on uclinux-niosII board
- FrameBuffer VGA, PS/2, USB mouse kbd
- Video i2c, cmos camera sensor
- lcd_16207 kernel driver and example for the 2x16 LCD Display
- loginHOWTO How to set up a login prompt
- GitServer mini howto setup a git server to publish projects.
- ContributingCode mini howto commit patches to git uClinux-dist repository.
- BinaryToolchain install binary of Nios II cross-gcc compiler.
- CGI and Boa demo for DE2 using CGI in C and boa
- RootDevice boot kernel from device instead of initramfs
- NetSnmp build net-snmp.
- PortingApps add new packages to uClinux.
Supported devices,
NET: dm9000,smc91111,opencore eth,mtip1000
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
Support Forum
Nios uClinux forum is the place to post questions. Don't post questions or comments on this wiki. If you have good suggestions or successful experiences to share, please update the wiki directly.
Before you post any questions, check the wiki and search previous posts first. If you can't find answer, then post as a new topic on the forum. When your questions got answered or resolved, it is suggested that you should update the wiki. It will be helpful to others and avoid repeated questions.
Mailing lists
Mailing lists are the prime communication between developers.
You must adjust your mail client to send "plain text" format e-mail to the lists. Don't send "HTML" format e-mail.
You should not send "test" mail.
If you want to reply a post, you should quote only the minimum necessary part of previous post. And reply AFTER the quote. Reply to the "list", not the sender.
nios2-dev mailing list for Nios II specific topics.
uclinux-dev mailing list for uClinux topics.
Wish List and To Do
ToDo list
Tutorial and Projects
- 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.
The document about implementing and testing is located at:
http://www.hs-augsburg.de/~carcass/nios2-uClinux/uClinux_Nios2_Devicedrivers_and_Testapplication_Documentation.pdf
The project-files are located here:
http://www.hs-augsburg.de/~carcass/nios2-uClinux/
Links,
Redhat's doc , linux installation guide and gnu tools usage, Must-Read for newbie.
RPJday's wiki on Nios2 uClinux , step by step guide.
Nacide's linux tutorial , in-depth technical notes.
Linux doc project a collections of howto, guide, tutorial.
GNU gcc,make,...
Jdhar's site with Nios II kernel svn and many drivers
the coldfire uclinux note
Nios II uClinux guide in Chinese by Alex Liu
http://uclibc.org/downloads/Glibc_vs_uClibc_Differences.txt
Linux Hardware Compatibility Lists & Linux Drivers
Tips for planning an embedded Linux project
Embedded Linux best practices
Books on Embedded Linux
http://trac.cross-lfs.org/, very detailed e-book available here called "Cross-Compiled Linux From Scratch".
No comments:
Post a Comment