Welcome, guest ( Login )

RecentChangesFeed

Recent Changes
Export table
Page:MmcSd
Revision:7
Last edited:07/24/2008 05:03PM (5 hours ago)
Edited by:hippo5329@yahoo.com.tw

SD/SDIO/MMC Host Driver

  • Please visit http://www.fps-tech.net/products.html for detailed information on the FPS-Tech SD/SDIO/MMC Host Driver.
  • uClinux driver is available in test-nios2 branch of the sopc git repository
  • Example Quartus project and Evaluation IP is available on link above
  • If you are interested in using the core, please request a free license for the 1-bit DAT version.

There are two example designs for MMC/SD on NEEK. One with JDhar's IP, and another use Altera SPI. The one from JDhar got higher performance using master dma and SDIO mode. While the Altera SPI is compatible with application chooser using PIO and SPI mode.

Please follow RootDevice if you want to use MMC/SD as root filesystem.Please note, there are two formatting method for a SD media (or other flash media),1. without partition table, use entire capacity. this is the default when you formatting a black media on Windows.You will need to use "mkdosfs -I /dev/sda" (substitute the device) . but not /dev/sda1.On nios2, the SD device is /dev/mmcblk0.2. with partition table, this may have better compatibility across Linux and digital camera.You will need to use "fdisk /dev/sda" to create FAT16 partition, type 06.Then "mkdosfs /dev/sda1"On nios2, the SD device is /dev/mmcblk0p1.1. neek_ocm_sdio.zipselect the driver for nios_mmc, and select the filesystem you want to support, eg, vfat and ext3. The sdio_host component should be named as "sdio", otherwise you have to modify linux-2.6/arch/nios2/kernel/setup.c . Device Drivers -->  [*] MMC/SD card support  ---> [*]   MMC block device driver                [*]     Use bounce buffer for simple hosts   [ ]   SDIO UART/GPS class support            [ ]   MMC host test driver                         *** MMC/SD Host Controller Drivers ***                      [*]   NIOS SD/SDIO/MMC Host  File systems  ---> [*] Ext3 journalling file system support DOS/FAT/NT Filesystems  ---> [*] VFAT (Windows-95) fs support(437) Default codepage for FAT(iso8859-1) Default iocharset for FAT-*- Native language support  ---> [*]   Codepage 437 (United States, Canada)[*]   NLS ISO 8859-1  (Latin 1; Western European Languages)NIOS_MMC: FPS-Tech SD/SDIO/MMC Host Core, version 1.0NIOS_MMC: F_MAX: 15000000 Hz, F_MIN: 915 HzNIOS_MMC: Host built with 1-bit DAT driverNIOS_MMC: Using block-prefetching mmc0: new SD card at address 0002blk_queue_max_sectors: set to minimum 8blk_queue_max_phys_segments: set to minimum 1blk_queue_max_hw_segments: set to minimum 1blk_queue_max_segment_size: set to minimum 4096mmcblk0: mmc0:0002 TWTTI 124672KiB  mmcblk0: p1 p2mount -t vfat /dev/mmcblk0p1 /mnt  # for partition 1ormount -t vfat /dev/mmcblk0 /mnt  # for no partition table on card2. neek_ocm_spi.zipselect the driver for mmc_spi, and select the filesystem you want to support as above.The Altera spi component should be named as "mmc_spi", otherwise you have to modify linux-2.6/arch/nios2/kernel/config.c .Device Drivers -->  [*] SPI support  --->  [*]   Altera SPI Controller[*] MMC/SD card support  ---> [*]   MMC block device driver                [*]     Use bounce buffer for simple hosts   [ ]   SDIO UART/GPS class support            [ ]   MMC host test driver                         *** MMC/SD Host Controller Drivers ***  [*]   MMC/SD over SPI                         mmc_spi spi2.0: ASSUMING SPI bus stays unshared!mmc_spi spi2.0: ASSUMING 3.2-3.4 V slot powermmc_spi spi2.0: SD/MMC host mmc0, no DMA, no WP, no poweroffTCP cubic registeredNET: Registered protocol family 17RPC: Registered udp transport module.RPC: Registered tcp transport module.Freeing unused kernel memory: 676k freed (0x1f6000 - 0x29e000)mmc0: new SD card on SPImmcblk0: mmc0:0000 TWTTI 124672KiB  mmcblk0: p1 p2
Page:PortingApps
Revision:2
Last edited:07/24/2008 07:54AM (14 hours ago)
Edited by:hippo5329@yahoo.com.tw

Before you do the porting, you should check if if the apps/libs are already ported in uClinux-dist (uclinux.org) or Blackfin uclinux-dist.If none exist, you can add the apps/libs into uClinux-dist. The uClinux-dist uses the build system from Linux kernel, with Kconfig and Makefile. You will need to add an config entry in Kconfig, and a rule in Makefile.

Add hello apps to uClinux-dist

Take the hello apps example,1. edit file user/Kconfig, add an entry after the line of menu "Miscellaneous Applications",config USER_HELLO_HELLO    bool "hello"    help      The hello example2. add a line to user/Makefile , dir_$(CONFIG_USER_HELLO_HELLO) += hello3. mkdir ~/uClinux-dist/user/hello    put hello.c in user/hello dir,4. create Makefile in user/hello dir,EXEC = hello

OBJS = hello.oall: $(EXEC)$(EXEC): $(OBJS) $(CC) $(LDFLAGS) -o $@ $(OBJS) $(LDLIBS)romfs: $(ROMFSINST) /bin/$(EXEC)clean: -rm -f $(EXEC) *.elf *.gdb *.o

Staging dir structure

In nios2 uclinux, a staging dir is created at built time, and libs/apps are installed to this dir. Then "make romfs" will copy them to "romfs" dir.This is very similar to the staging dir of  "buildroot".

You may take exmples from user/net-snmp, lib/libgmp.

In user/net-snmp, there are

Makefile  net-snmp-5.2.1

In lib/libgmp, there are

gmp-4.2.2  Makefile

The sources are located in a subdir, and a Makefile is added to build and install. You should take a look at the Makefile.

configure

Many packages use configure  or automake/autoconf tools. Please find documents about them from gnu.org or Redhat's.

You can find out options with "./configure --help".

If you got unknow machine type error, add nios2 to config.sub .--- config.sub~    2003-12-23 20:07:13.000000000 +0800+++ config.sub    2006-07-12 14:47:00.000000000 +0800@@ -278,6 +278,11 @@     m88110 | m680[12346]0 | m683?2 | m68360 | m5200 | v70 | w65 | z8k)         ;; +    nios2 | nios2-* | nios2 | nios2-*)+        basic_machine=nios2-altera+        os=-linux+        ;;+     # We use `pc' rather than `unknown'     # because (1) that's what they normally are, and     # (2) the word "unknown" tends to confuse beginning users.

fork()

fork() is not supported for nommu, so you should use vfork() instead.

#if EMBED  pid = vfork();#else  pid = fork();#endif

bcopy/bzero/index/rindexbcopy/bzero/index macro

These func are marked legacy. They should not be used. You can replace them with memmove/memset/strchr/strrchr. memmove/memset/strchr.

Page:CompileHello
Revision:18
Last edited:07/24/2008 07:26AM (14 hours ago)
Edited by:hippo5329@yahoo.com.tw

Linked from µClinux

To compile a simple program, just add -elf2flt to link flag

Create a file, hello.c

#include <stdio.h>int main(void){  printf("hello world\\n"); world\n");}

nios2-linux-uclibc-gcc hello.c -o hello -elf2flt

The compiled object format is FLAT.You may check it with,

nios2-linux-uclibc-flthdr hello

hello Magic: bFLT Rev: 4 Build Date: Mon Jun 5 21:49:44 2006 Entry: 0x40 Data Start: 0x4a8c Data End: 0x5c48 BSS End: 0x7ca8 Stack Size: 0x1000 Reloc Start: 0x5c48 Reloc Count: 0x11e Flags: 0x1 ( Load-to-Ram )

Then copy hello to the romfs/bin dir. Rebuild the kernel image for initramfs.cp hello ~/uClinux-dist/romfs/bincd ~/uClinux-distmake

Boot nios2 uClinux, and runhello

The default stack size of application is 4KB, you can change it with -elf2flt="-s <new stack size>" option, eg ,nios2-linux-uclibc-gcc hello.c -o hello -elf2flt="-s 16000"will have stack size as 16KiB.

The default include dir search path is /opt/nios2/include (or staging_dir/include if you use buildroot) The default library search path is /opt/nios2/lib (or staging_dir/lib if you use buildroot)The default apps library is uClibc's libc, so you don't need -lc .If you use math, you need -lm .If you use pthread, you need -lpthread .If you use crypt, you need -lcrypt .

You will need those include headers, too.The order of libraries is important, the linker will search only one pass by default.

example apps to use button pio.

Add hello as an user apps to uClinux-dist

Follow uClinux-dist/Documentation/Adding-User-Apps-HOWTO .
  1. add a line to user/Makefile , dir_$(CONFIG_USER_HELLO_HELLO) += hello
  2. (for master branch only) add a line to misc section of config/config.in, bool 'hello' CONFIG_USER_HELLO_HELLO
  3. mkdir ~/uClinux-dist/user/hello
  4. put hello.c in user/hello dir,
  5. create Makefile in user/hello dir,
EXEC = hello

OBJS = hello.oall: $(EXEC)$(EXEC): $(OBJS) $(CC) $(LDFLAGS) -o $@ $(OBJS) $(LDLIBS)romfs: $(ROMFSINST) /bin/$(EXEC)clean: -rm -f $(EXEC) *.elf *.gdb *.o

   6. (for non-master branches) edit file user/Kconfig, add an entry after the line of menu "Miscellaneous Applications",

config USER_HELLO_HELLO    bool "hello"    help      The hello example

Porting apps or libs

Most apps and libs used to have a configure. You can find out options with "./configure --help". If you got unknow machine type error, add nios2 to config.sub .--- config.sub~    2003-12-23 20:07:13.000000000 +0800+++ config.sub    2006-07-12 14:47:00.000000000 +0800@@ -278,6 +278,11 @@     m88110 | m680[12346]0 | m683?2 | m68360 | m5200 | v70 | w65 | z8k)         ;; +    nios2 | nios2-* | nios2 | nios2-*)+        basic_machine=nios2-altera+        os=-linux+        ;;+     # We use `pc' rather than `unknown'     # because (1) that's what they normally are, and     # (2) the word "unknown" tends to confuse beginning users.

IO programming in user space.

Note, you are doing in user space, with uclibc and included from /opt/nios2/include. It is not kernel space. You can not use interrupt. You can not use nios2 HAL, either.

You should know about the cache in Nios II. (BadOman:) The first 2GB of address space is cached. The second 2GB is non-cached. These are not two seperate memory spaces or anything so there is a total of 2GB of address space (mirrored memory). This only applies for Nios II Full version with Data Cache. Nios II Standard version is uncached, so there should be no problems.In other words address 0x00000000 (cachable) maps to address 0x8000000 (non-cachable)" " " " " " 0x00000001 " " " " " " " " 0x8000001 (and so on .....)So use the first 2GB for non-peripheral access (local memory), and the second 2GB for peripherals

You can define memory pointer access, and you can make it uncached by setting address bit 31.eg, 0x00004000 -> 0x80004000

Or use port address defined in nios2_system.h, eg na_button_pio.#include </home/hippo/uClinux-dist/linux-2.6.x/include/nios2_system.h>

#define inw(port) (*(volatile unsigned *)(port))                # for io read,#define outw(d,port) (*(volatile unsigned *)(port))=(d)    # for io write,

As an alternative, you can use these two defines (which are always uncached), they are similar to the Nios2-IDE functions :#define IORD(address,offset) (*(volatile unsigned *)(((address)|0x80000000)+4*(offset)))#define IOWR(address,offset,value) (*(volatile unsigned *)(((address)|0x80000000)+4*(offset)))=(value)

Page:µClinux
Revision:152
Last edited:07/24/2008 07:14AM (15 hours ago)
Edited by:hippo5329@yahoo.com.tw

µClinuxThe 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 4.6, which is free and binary compatible with RHEL4. 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 v8.0 (including Quartus,Nios2eds) at this moment.
  • You should start with a mininal system with only Nios II f or s core, sdram (minimum requirement 8MB), one full featured timer, and a jtag/serial console
  • 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.
  • Note in Linux, irq 0 means auto-detected, so you must not use irq 0 for ANY devices (except for timer).
  • Remember, there is no MMU on current Nios II, so no virtual memory, no shared objs/libs, no fork, and stack size is fixed.
  • 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.

Let's start it step by step

  1. TryOutuClinux with pre-built binary images if you have Altera Nios dev boards.
  2. InstallNios2Linux install the source and build tools. Or you can use prebuild BinaryToolchain .
  3. UClinuxDist build uClinux kernel and a collection of user applications.

Tutorial and Projects

Linux Articles in the Wiki:

Supported devices,

NET: dm9000,smc91111,opencore eth,mtip1000IDE: altcfUSB: isp116x,isp1362, isp1760/1761CHAR: uart,watchdog,pio/button,spi,ps/2 keyboard mouse.MMC: mmc coreMTD: EPCSI2C: opencore i2c, ds1307, i2c-gpioPCI: altpciVIDEO: 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, 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

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.

blackfin uClinux guide ,

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 notebooks about kernel Nios II uClinux guide in Chinese by Alex Liuhttp://uclibc.org/downloads/Glibc_vs_uClibc_Differences.txtLinux Hardware Compatibility Lists & Linux DriversTips for planning an embedded Linux projectEmbedded Linux best practicesBooks on Embedded Linux

Page:InstallNios2Linux
Revision:26
Last edited:07/23/2008 11:20PM (22 hours ago)
Edited by:hippo5329@yahoo.com.tw

Here we will setup the source to build Nios2 uClinux. branch "test-nios2" , per 20080619.

If you already have the toolchain and working uClinux-dist git repo, then you can skip the "new install" below and go to the second half, "Distro upgrade".

New install

You must have a Linux desktop with software development packages. Login as root or use sudo to install these packages.On Fedora,RHEL,Centossudo yum install git-core make gcc ncurses-devel bison flex gawk gettext ccache zlib-devel On Suse,sudo zypper install git-core make gcc ncurses-devel bison flex gawk gettext ccache zlib-devel On Debian/Ubuntu,sudo apt-get updatesudo apt-get install git-core make gcc ncurses-dev bison flex gawk gettext ccache zlib1g-dev libx11-dev texinfo

Please check your git version with "git --version". If it is older than 1.5.3.x, please update to the latest.

On Ubuntu, check if the default shell is "bash"ls -l /bin/shThis should give "/bin/sh -> bash",Otherwise, change it with,sudo rm /bin/shsudo ln -s bash /bin/shfollowed by a logout and log back in again.

As root, check if you have "cc" which is a symlink to "gcc" ?which gccgcc -vwhich cccc -vif not, cd /usr/binln -s gcc cc

Make sure you have 5GB or more free disk space. Please download the tar file nios2-linux-20080619.tar , 880MB. Best thanks to Altera's kindly hosting these files.(but don't use Windows ftp, it corrupt the files)

ftp://ftp.altera.com/outgoing/nios2-linux-20080619.tar

(SHA1SUM bb851b5494b4ae5c6ccdcfa5625b0f4d9340252a nios2-linux-20080619.tar)We use "git" to keep the source. You make check out GitServer later. The git database inside the tar file was compressed, so we don't do compression on the tar file.

You can build in any working directory as a user account, eg. in your home (say /home/hippo). The tar file contains a nios2-linux dir.

tar xf <path_to>nios2-linux-20080619.tar  # untar the package

cd nios2-linuxls   # see what's inbinutils  gcc3       README           uClibc        use_http_for_updatecheckout  insight    toolchain-build  uClinux-distelf2flt   linux-2.6  u-boot           update

# check out the source./checkout

Now the source for the Nios2 uClinux and gnutools was ready.

linux-2.6: the Linux kernel source, which is stock Linux kernel plus Nios2 specific patches. The current version is v2.6.26-rc6.uClinux-dist: the uClinux userspace libraries and applications. We will build uClinux here.

binutils,gcc3,elf2flt,insight: the gnu tools.uClibc: the main userspace libraries, which is smaller that glibc. please note, newlib doesn't support Nios2 uClinux.

u-boot: a powerful boot loader and monitor, DasUBoot .

We will proceed to build the toolchain. If you don't want or fail to build it yourself, you may use the prebuild BinaryToolchain.

cd toolchain-buildgit clean -f -x -d   # clean on restartmake gcc elf2flt gdb-hostcd ..

It might take hours to build.

The default installation path is 'toolchain-build/build/nios2'. Then setup the PATH for the tools, you can add a line at the end of file ~/.bash_profile (or ~/.profile on Debian/Ubuntu) ( the file is hidden, you have to use "ls -a" to find it . For "gedit" use open Location, and enter the file name), like thisPATH=$PATH:/home/hippo/nios2-linux/toolchain-build/build/nios2/bin

Logout and login again. You can use the tools now. Run this to verify that you have it in your command search path,nios2-linux-uclibc-gcc -v

Try to compile a simple hello.c like this,

#include <stdio.h>int main(void){  printf("hello world\\\\\\\\n"); world\\\\n");}

nios2-linux-uclibc-gcc hello.c -o hello -elf2flt

The compiled object format is FLAT.You may check it with,

nios2-linux-uclibc-flthdr hello

Optionally, add links for ccache, as root or via sudoln -s /usr/bin/ccache /usr/lib/ccache/nios2-linux-uclibc-gcc ln -s /usr/bin/ccache /usr/lib/ccache/nios2-linux-uclibc-g++ln -s /usr/bin/ccache /usr/lib/ccache/nios2-linux-uclibc-c++When you compile something, the cache will be used and the compilation run faster. You can check cache status with,ccache -s

Now you can follow UClinuxDist to build the kernel. You should build in the new source tree, nios2-linux/uClinux-dist .

cd uClinux-distmake menuconfigmake vendor_hwselect SYSPTF=<path to your system ptf>make

Release note

Important changes in this release, nios2-linux-20080619,

1. the arch name is now "nios2", (but not nios2nommu). Use current development branch test-nios2 by default.2. the kernel source linux-2.6.x and uClibc are removed from uClinux-dist. the kernel source is now external linux-2.6 (from linux-2.6.git) at the same directory level as uClinux-dist.3. the previous nios2_system.h is relocated to include/asm-nios2/nios2.h, and now the port/memory address is physical address , without cache-bypass, ie no address bit 31 set.4. mtd partition maps file altera.c , microtronix.c and EPCS drivers are removed. Now they are in the platform device data of arch/nios2/kernel/config.c, using generic physical maps , m25p80 and altera spi driver.5. many arch/drivers reworked/added, such as timer, interrupt handler, cache, ioremap, uart/jtaguart, framebuffer, spi, TSE.6. adopt the Makefile from blackfin uclinux-dist, with many userspace libs/apps merged from blackfin. eg, ncurses, openssl, directfb, freetype..etc.7. introduce the staging dir, with all libs and headers installed there. the previous include dir was removed.

The latest branch is "test-nios2". Despite the "test" in the name, this does not mean "unstable". All future works and support will base on this branch. I won't update those older branches with the limited time available. Please migrate to the new branch.The uClinux-dist dose not contain the kernel now. It should stick with "test-nios2" branch. It will merge updates from uclinux.org and blackfin uclinux.The development of nios2 kernel will stick with mainly the "test-nios2" branch, with proper tags follow Linus' releases. eg "v2.6.26-nios2" tag when Linus release "v2.6.26" stable. Then it will move on to v2.6.27-rc1, but not with a new branch. It is still "test-nios2" branch.Though there will be some experimental branches from time to time, but they will be merged into the main branch "test-nios2" at proper time. And then deleted.If you need a "stable" branch, you can create local branch off the stable tags. You might apply patches from stable-queue git. Or you want to freeze. It is all up to you.

git clone git://git.kernel.org/pub/scm/linux/kernel/git/stable/stable-queue.git  # patches for stable releases

Update

After you have first successful boot, you can get updates from server. Change to the nios2-linux dir,

(Only if you are behind a proxy firewall and cannot use git protocol, you can change the git to use http to get updates from community server with this command, "./use_http_for_update" . You will need to add the setup of proxy to your login profile (.bash_profile or .profile),export http_proxy=http://proxy_server:port_number )Now fetch updates from server with, "./update" .++++++++++++++++++++++++++++++(note) if the kernel couldn't start after update..

Please disable optimize for size, or start with default config again.General setup -->[ ] Optimize for size   <== unselect

Distro upgrade

If you already have the toolchain and working uClinux-dist git repo, you don't have to download the new tar ball nios2-linux-20080619.tar .

As the kernel source is removed from the uClinux-dist dir, you need a kernel source dir. At the same dir level of uClinux-dist, don't cd uClinux-dist. Clone the kernel source from the Linus' git.

git clone -n git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux-2.6.gitOr if you are behind a proxy firewall,git clone -n http://www.kernel.org/pub/scm/linux/kernel/git/torvalds/linux-2.6.git

ls   # see what's inlinux-2.6        uClinux-dist

cd linux-2.6

Edit the file .git/config, change the origin url to sopc server,

[remote "origin"]        url = git://sopc.et.ntust.edu.tw/git/linux-2.6.git        fetch = +refs/heads/*:refs/remotes/origin/*Or if you are behind a proxy firewall,[remote "origin"]         url = http://sopc.et.ntust.edu.tw/git/linux-2.6.git         fetch = +refs/heads/*:refs/remotes/origin/*

Next, create the new branch "test-nios2" and checkout,

git fetch origingit branch --track test-nios2 origin/test-nios2git checkout test-nios2cd ..

Then, checkout the "test-nios2" branch of uClinux-dist,

cd uClinux-distgit clean -f -x -dgit fetch origingit branch --track test-nios2 origin/test-nios2 git checkout -f test-nios2  # forced Now, you may build as before in this uClinux-dist dir,

make menuconfigmake vendor_hwselect SYSPTF=<your_system.ptf> make

migration

The important point is that the kernel source tree was removed from uClinux-dist, and used external linux-2.6 (from git). And the old arch name "nios2nommu" is changed to "nios2".

If you have local commit in older branches, either v2.6.26-nios2 or pre v2.6.26-nios2, you will have to move the local kernel patches from uClinux-dist/linux-2.6.x/ to linux-2.6/ .First, find your local commit sha1 id in the old branch of uClinux-dist, usinggit log <old branch> <dir of interest>orgitk <old branch> <dir of interest>eg,cd uClinux-distgitk v2.6.24-uc-myabc linux-2.6.x/Take down the sha1 ID of the commit, 7-8 digits is enough. say, abc6789.Use git-format-patch to generate patches for cherry-pick,git format-patch abc6789^..abc6789Or you can use a range, and pick only you need.git format-patch <from>..<to>Some 0001-......patch will be generated.Filter the patches to change the path and arch reference,sed -i -e szlinux-2.6.x/zzg 0*patchsed -i -e sznios2nommuznios2zg 0*patchThen create your local branch from test-nios2 branch of linux-2.6/Now you can apply these patchescd ../linux-2.6# create and checkout local branch from test-nios2# track the remote, depend on how you set remote,# in the new tar ball, the origin is sopc.et.ntust.edu.twgit branch --track test-nios2-myabc origin/test-nios2git checkout test-nios2-myabcgit am <path_to_the_patches>****************************************************For other dir in uClinux-dist, eg, vendors/Altera, generate patches from your local commit.cd uClinux-distgitk v2.6.24-uc-myabc vendors/Alteragitk format-patch <from>..<to>Filter the patches to change the arch reference,sed -i -e sznios2nommuznios2zg 0*patchNow create your local branch from test-nios2 of uClinux-dist, and apply the patches,git branch --track test-nios2-myabc origin/test-nios2git checkout test-nios2-myabcgit am <path_to_the_patches>

Page:NetSnmp
Revision:NEW
Last edited:07/23/2008 05:54PM (07/23/2008)
Edited by:hippo5329@yahoo.com.tw

To build net-snmp, please enter apps config,Network Applications  --->  [*] net-snmp                    [*]   Build mini agent          [ ]   Build Applications (NEW)  [*]   Build static              [ ]   Install manuals (NEW)     [ ]   Install scripts (NEW)     [*]   Install MIBs              [ ]     Enable MIB loading (NEW)[ ]   Disable SNMP v1 (NEW)     [ ]   Disable SNMP v2c (NEW)    [ ]   IPv6 support (NEW)        [ ]   Exclude transports (NEW)  [ ]   With OpenSSL (NEW)        [ ]   Override defaults (NEW)   [ ]   Additional MIBS (NEW)     Create a snmpd.conf to romfs/etc/snmp/snmpd.conf, with single line,rwcommunity  publicBoot your nios2 board, config ethernet. Then start snmpd,> snmpd & Query the nios2 board from another Linux box with net-snmp installed:$ snmpwalk -v 1 -c public 172.20.11.51 systemSNMPv2-MIB::sysDescr.0 = STRING: uClinux uClinux 2.6.23-uc0-gb13c4d1f-dirty #138 PREEMPT Wed Mar 5 12:48:49 MST 2008 nios2nommuSNMPv2-MIB::sysObjectID.0 = OID: NET-SNMP-MIB::netSnmpAgentOIDs.10DISMAN-EVENT-MIB::sysUpTimeInstance = Timeticks: (80124) 0:13:21.24SNMPv2-MIB::sysContact.0 = STRING: jchen@SNMPv2-MIB::sysName.0 = STRING: uClinuxSNMPv2-MIB::sysLocation.0 = STRING: UnknownSNMPv2-MIB::sysORLastChange.0 = Timeticks: (16) 0:00:00.16SNMPv2-MIB::sysORID.1 = OID: IF-MIB::ifMIBSNMPv2-MIB::sysORID.2 = OID: SNMPv2-MIB::snmpMIBSNMPv2-MIB::sysORID.3 = OID: TCP-MIB::tcpMIBSNMPv2-MIB::sysORID.4 = OID: IP-MIB::ipSNMPv2-MIB::sysORID.5 = OID: UDP-MIB::udpMIBSNMPv2-MIB::sysORID.6 = OID: SNMP-VIEW-BASED-ACM-MIB::vacmBasicGroupSNMPv2-MIB::sysORID.7 = OID: SNMP-FRAMEWORK-MIB::snmpFrameworkMIBComplianceSNMPv2-MIB::sysORID.8 = OID: SNMP-MPD-MIB::snmpMPDComplianceSNMPv2-MIB::sysORID.9 = OID: SNMP-USER-BASED-SM-MIB::usmMIBComplianceSNMPv2-MIB::sysORDescr.1 = STRING: The MIB module to describe generic objects for network interface sub-layersSNMPv2-MIB::sysORDescr.2 = STRING: The MIB module for SNMPv2 entitiesSNMPv2-MIB::sysORDescr.3 = STRING: The MIB module for managing TCP implementationsSNMPv2-MIB::sysORDescr.4 = STRING: The MIB module for managing IP and ICMP implementationsSNMPv2-MIB::sysORDescr.5 = STRING: The MIB module for managing UDP implementationsSNMPv2-MIB::sysORDescr.6 = STRING: View-based Access Control Model for SNMP.SNMPv2-MIB::sysORDescr.7 = STRING: The SNMP Management Architecture MIB.SNMPv2-MIB::sysORDescr.8 = STRING: The MIB for Message Processing and Dispatching.SNMPv2-MIB::sysORDescr.9 = STRING: The management information definitions for the SNMP User-based Security Model.SNMPv2-MIB::sysORUpTime.1 = Timeticks: (3) 0:00:00.03SNMPv2-MIB::sysORUpTime.2 = Timeticks: (6) 0:00:00.06SNMPv2-MIB::sysORUpTime.3 = Timeticks: (6) 0:00:00.06SNMPv2-MIB::sysORUpTime.4 = Timeticks: (6) 0:00:00.06SNMPv2-MIB::sysORUpTime.5 = Timeticks: (6) 0:00:00.06SNMPv2-MIB::sysORUpTime.6 = Timeticks: (7) 0:00:00.07SNMPv2-MIB::sysORUpTime.7 = Timeticks: (16) 0:00:00.16SNMPv2-MIB::sysORUpTime.8 = Timeticks: (16) 0:00:00.16SNMPv2-MIB::sysORUpTime.9 = Timeticks: (16) 0:00:00.16
Page:Video
Revision:8
Last edited:07/23/2008 08:15AM (07/23/2008)
Edited by:reisswolf

V4L2 specificationsUSB Video driverssome other drivers and apps (include a nice video debug tool)Bayer RGB (raw pixel)

i2c-gpio

(STOP, this driver may need update..)This is a simple i2c bus driver based on pio. Most I2C tasks are initialization, so you don't really need a hardware I2C core. You can use the gpio.zip component. The default is port bit[0] for SDA, bit[1] for SCL. You may need to edit linux-2.6.x/arch/nios2nommu/kernel/setup.c if you have different port pins assignment.In kernel config,Processor type and features --> --- Platform drivers Options[*] GPIO-Based I2C Interface

In your top level design,.bidir_port_to_and_from_the_gpio_0 ( { I2C_SCLK, I2C_SDAT }),

i2c from opencores

ellis summaried,

As mentioned by jdhar there is "A ready made avalon component - no need to do all of this." under:http://via.fps-tech.org/svn/fpga/cores/i2c_master/trunk/->copy the folder and files into a folder in your Quartus projectdirectory, SOPC Builder will find the component automatically. Add thecomponent to your SOPC Builder system and connect the signals to somepins.

Or you can find a sopc v7.2/v8.0 ready component,contributed by longshot, in the project area of nios forum, OpenCores I2C

The single hdl files, some usefull documentation and programming examples (chapter 6 of "I2C_specs.doc") can be found under:http://www.opencores.org/cvsweb.shtml/i2c/

The opencore i2c component should be named as "i2c_0" and "i2c_1".Otherwise you will have to modify linux-2.6/arch/nios2/kernel/config.c.In your top level design:       inout            HC_I2C_SCLK;      inout            HC_I2C_SDAT;and for component named "i2c_0":      .i2c_scl_to_and_from_the_i2c_0 (HC_I2C_SCLK),      .i2c_sda_to_and_from_the_i2c_0 (HC_I2C_SDAT),Kernel config,        [*] I2C support  --->    [*]   I2C device interface          I2C Hardware Bus support  --->    [*] OpenCores I2C Controller 

User space device interface

Please check, linux-2.6/Documentation/i2c/dev-interface .You can use i2c-tools to help probe and dump,  Miscellaneous Applications  --->  --- LM SENSORS  [*] i2c-tools /> ls /usr/sbini2cdetecti2cdumpi2cgeti2cset
Page:haserl
Revision:18
Last edited:07/23/2008 05:14AM (07/23/2008)
Edited by:mschnell

Using Haserl scripts for HTML based Runtime Configuration

For many projects its a good idea to have your users use a browser to do runtime configuration with the device. Of course you need to have a Flash file system to store the configuration values. See the appropriate articles on Flash and on rc-Files on how to install a Flash file system and use it for holding system variables in one or more configuration files.Usually, when doing runtime configuration via http, you need to write a cgi-program (in C or a scripting language like php) that takes the user's inputs and creates html code, that the http server can send to the client's browser. Writing a dedicated C program seems a lot too high level for the simple task we want to accomplish here, and learning php as an additional language and implementing the php interpreter also does not seem appropriate for a small embedded device.Haserl is a quite small tool that allows to write scripting code directly in normal html pages. Moreover it does not contain a scripting language interpreter but can be used (e.g.) with an existing command line (shell script) interpreter like bash or msh. Thus the haserl scripts are a mixture of html and shell script code and you don't need to create html code programmatically and/or provide as well a program and some html based pages. The haserl scrips can be created using a html editor like Quanta.haserl is provided as a "miscellaneous program" with the µCLinux distr. msh is part of the busybox.The web server boa is provided with the µCLinux distr. Attached here, you'll find a file that contains haserl scripts and shell scripts that work together to show some system states on a web page and allow for some common realtime configuration settings like "use DHCP" and "use IP-Address".

Additional considerations

With the actual distribution (July 2008) haserl only seems to work with boa when a line like
	syslog(LOG_DEBUG, "haserl start");
is added to e.g. main() in the haserl code and the sylog daemon is activated. (right now nobody seems to know why it does not work otherwise. It does work when called from a command line and it works with boa on a PC.) Any help on this issue is very much appreciated !Haserl makes heavy use of the echo command, both because it uses echo when handling the script and because each haserl script will contain lots of echo commands (or "<%: some text maybe containing $VARIABLES %>"   phrases that haserl converts to echo commands.) Now msh has no builtin command "echo" but same needs to be provided externally as an executable file (or symlink). With the µCLinux distr, this echo executable dwells in busybox, too, which of course is a huge file. With XIP (execute in place ) this is no problem, as busybox usally is located in a RAM based file system and does not need loding. But right now (July 2008) the NIOS µCLinux distr's tool chain does not support XIP. That is why it makes sense to install an extra small "echo" utility instead of activating echo in busybox. This will speed up the access to haserl script pages greatly. The source code of such an echo usility is provided here.
Page:Initialization Script
Revision:34
Last edited:07/23/2008 05:12AM (07/23/2008)
Edited by:mschnell

The init process, that automatically is started by the Kernel, first starts the script file /etc/rc and then uses /etc/inittab to start more processes, if some are defined there. By default the uCLinux-dist uses an empty inittab thus only /etc/rc is used to bring up the system.By default the uCLinux-dist uses sash (compiled as the "sh" executable in /bin) as the shell that executes the rc script. This is nice, as sash has a lot of useful "internal" commands and has a very small footprint. OTOH, sash is a very basic shell and can't do things like "if" and does not support pipes from and to files and between the processes it starts. Thus it often is not good enough for more complex shell scripts. If one day, the uCLinux Tool Chain might support XIP (Execute in place: executables in memory based file systems can be executed without loading [copying] them), it will make more sense to drop sash completely and use msh as the only shell and activate all necessary commands as "external" commands in busybox.On a  "full" Linux with an MMU-enabled NIOS, supposedly shared libraries can be used, and the concept based on busybox again will need some rethinking. A way to use more complex shell scripts with sash as the initial shell, is to activate msh and some "external" shell commands (such as "echo" and "cat") in busybox:... / BusyBox / Coreutils  --->
[*] cat [*] echo
... / BusyBox / Shells  --->
[*] msh
Now we can just call several shell scripts from rc and have them executed by msh (as usual, this is done by defining the interpreter in the first line of the script:
#!/bin/msh 

and setting the executable flags for the script file.In rc, the script is now simply called like a normal executable.

Usually the complex script files will be located in /etc. To have them moved there, they are created in vendor/altera/nios2 and the Makefile in that directory is edited to handle them appropriately.

It makes much sense to use one or more simple script files in a Flash file system that are called (i.e. "sourced") by the rc-file(s) and just do some environment settings that are to be acknowledged by the initialization scripts.

These Flash based files can be changed "online" by an appropriate mechanism. Very easy is doing this with FTP (which is enabled in our uCLinux-dist by default). A much more user-friendly way is to do this with a web browser via boa and cgi. Here using a "haserl" script would be most appropriate, but - curiously right now (July 2008) even though haserl only works on out dist if a syslog() call is added to provided with the source code and ucLinux-dist - unfortunately, on the syslog daemon is running (while it target device  I was not able to make boa successfully run a haserl script (which works easily on a PC-Linux installation). Any help on this issue is very much appreciated !

Example initialization scripts

You must have "msh" shell and the apps "echo" and "cat" in busybox enabled (see on top)!

An example of cascaded initialization scripts is provided here. These are used in the current version of the binary NEEK distribution that can be found on the TryOutuClinux  page.

/etc/rc is the initial script executed by the init process using /bin/sh (thus sash)/etc/rc0 is called by rc0 and executed by msh. Here the configuration is read and decisions are made based on the configuration settings. rc0 writes the file /etc/rcc that can be read by any shell using the "source" or "." command to use the preprocessed configuration options.

/etc/rcts does additional system configuration settings

/etc/rca is meant for starting the primary applications (based on configuration settings)

/etc/rcd does the default configuration settings that are used even if the configuration in flash is not (yet) available

/etc/rcc can be read by any shell (sash using the "source", msh using the "." command) to use the preprocessed configuration options. As the environment variables can be e.g. names of additional script files, decisions that are done when rc0 was executed can get effective later.

/mnt/configflash/rc1 is located in the Flash. It does configuration settings and can be edited on the running device.

File /etc/rc (created in vendors/Altera/nios2)

mount -t proc proc /procmount -t sysfs sysfs /sysmount -t usbfs none /proc/bus/usbmkdir /var/tmpmkdir /var/logmkdir /var/runmkdir /var/lockmkdir /var/emptyifconfig lo 127.0.0.1route add -net 127.0.0.0 netmask 255.0.0.0 locat /etc/motd########################## FLASH                 ##########################mkdir /mnt/configflashmount -t jffs2 /dev/mtdblock0 /mnt/configflash########################## Read configuration    ##########################/etc/rc0source /etc/rcc########################## APPLICATIONS          ##########################/etc/rca########################## AFTER STARTING APPS   ##########################  

File /etc/rc0 (created in vendors/Altera/nios2)

#!/bin/msh#using the more versatile shell to read the configuration settingsRC=/etc/rcdif [ -e $RC ]; then   echo reading configuration settings in $RC  . $RCfiRC=/mnt/configflash/rc1if [ -e $RC ]; then   echo reading configuration settings in $RC  . $RCfiif [ $NANOX == Y ]; then   RC=/etc/rcts  if [ -e $RC ]; then     echo reading configuration settings in $RC    . $RC    if [ -e $TSLIB_CALIBFILE ]; then      echo touch screen support enabled      export TSLIB_FBDEVICE      export TSLIB_CONSOLEDEVICE      export TSLIB_CALIBFILE      export TSLIB_TSDEVICE    else      export TSLIB_FBDEVICE=none      export TSLIB_CONSOLEDEVICE=none      export TSLIB_CALIBFILE=none      export TSLIB_TSDEVICE=none    fi   fifiRC=/etc/rccecho HOSTNAME=$HOSTNAME > $RCecho DHCP=$DHCP >> $RCecho IP=$IP >> $RCecho INETD=$INETD >> $RCecho BOA=$BOA >> $RCecho NANOX=$NANOX >> $RCecho DEMO=$DEMO >> $RCecho DEMOPIC=$DEMOPIC >> $RCecho TSLIB_FBDEVICE=$TSLIB_FBDEVICE >> $RCecho TSLIB_CONSOLEDEVICE=$TSLIB_CONSOLEDEVICE >> $RCecho TSLIB_CALIBFILE=$TSLIB_CALIBFILE >> $RCecho TSLIB_TSDEVICE=$TSLIB_TSDEVICE >>$RCecho =========================cat $RCecho =========================/bin/sh -c hostname $HOSTNAMEif [ $DHCP == Y ]; then   echo starting dhcp client  dhcpcd -p -a -h $HOSTNAME eth0 &else  echo set IP to $IP  /bin/sh -c ifconfig eth0 $IPfiif [ $INETD == Y ]; then   echo starting inetd  inetd &fiif [ $BOA == Y ]; then   echo starting boa  boa &fiif [ $NANOX == Y ]; then   echo starting nano-X  nano-X &  nanowm &fi

File /etc/rcts (created in vendors/Altera/nios2)

TSLIB_FBDEVICE=/dev/fb0TSLIB_CONSOLEDEVICE=noneTSLIB_CALIBFILE=/mnt/configflash/pointerclTSLIB_TSDEVICE=/dev/input/event0  

File /etc/rca (created in vendors/Altera/nios2)

#!/bin/msh#using the more versatile shell to start application. /etc/rccif [ $DEMO == Y ]; then   echo starting nano-X demo  nxview $DEMOPIC &fi  

File /etc/rcd (created in vendors/Altera/nios2)

# Default configuration# used if the flash based configuration files are not availableHOSTNAME=uclinuxDHCP=Y IP=0.0.0.0INETD=YBOA=YNANOX=YDEMO=YDEMOPIC=/etc/p.jpg  

File /etc/rcc (created on the fly by rc0)

HOSTNAME=uclinuxDHCP=YIP=192.168.37.173INETD=YBOA=YNANOX=YDEMO=YDEMOPIC=/mnt/configflash/demo.jpgTSLIB_FBDEVICE=/dev/fb0TSLIB_CONSOLEDEVICE=noneTSLIB_CALIBFILE=/mnt/configflash/pointerclTSLIB_TSDEVICE=/dev/input/event0 

File /mnt/configflash/rc1 (created in the devices flash file system e.g. via FTP)

HOSTNAME=uclinuxDHCP=YIP=192.168.37.173BOA=YDEMO=YDEMOPIC=/mnt/configflash/demo.jpg 
Page:uCLinux on NEEK via SD-Card Application Loader
Revision:10
Last edited:07/21/2008 06:55AM (07/21/2008)
Edited by:mschnell

This uCLinux distribution was created using the current (July 2008) uClinux-dist and BuildRoot system, informations and downloads from the NIOSWiki and the eek.sh script provided with the NEEK. Kernel messages can be seen on the NEEK serial port (115,200 baud, no parity). After booting, a shell interface is launched on the serial port.The network (done with the newest version of open the source "Igor" ipCore) comes up and gets configured by DHCP (if desired).A shell can be accessed via Telnet.Files can be viewed and uploaded via FTP: ananymous login: on  /home/ftp, root login (password uClinux): all dirs (busybox->ls has been needed to be activated for this). dirs. If you are not connected to a DHCP server, please run "ifconfig eth0 www.xxx.yyy.zzz" in the serial port session to activate the network when starting the first time.Access via HTTP to /home/http is granted. Here a small homepage with a demo cgi-program and a demo haserl based cgi configuration script can be tested.A flash based file system in the NEEK flash is mounted and can hold configuration settings (see Wiki->startup-scripts).A Nano-X based GUI is started on the NEEK LCD touchscreen. Release Notes: - as this speeds up the haserl scrips a lot, I created an "echo" work alike in C and used this instead of the one in Busybox. The 21 line C source is provided with the binary.echo.c:
#include <stdio.h>int main (int argc, char **argv) {  int lf, c, i, j;  char *s;  s =*(++argv);  if ((*s == '-') && (*(s+1) == 'n')) {    lf = 0;    argv++;    argc--;   } else {    lf = '\\n'; '\n';   };   for (i=argc-2; i>=0; i--) {    s =*argv;    while (c=*s++) putchar(c);    if (i) c = ' '; else c = lf;    if (c) putchar(c);    argv++;  };  return 0;};
Page:echo.c
Revision:NEW
Last edited:07/21/2008 05:38AM (07/21/2008)
Edited by:mschnell

Page:romfs.tar.gz
Revision:NEW
Last edited:07/21/2008 04:48AM (07/21/2008)
Edited by:mschnell

Page:GitServer
Revision:79
Last edited:07/19/2008 07:05AM (07/19/2008)
Edited by:hippo5329@yahoo.com.tw

mini-howto setup and use a git server for kernel development

'git' is a version control system written by Linus. It is widely used by kernel developers. You can find tutorials and manuals from git.This page is a brief description of how to use git to access a public server, sopc, which is created to host open-source projects of nios2 and alike. 

This server is located at the Embedded System Lab., Electronic Engineering Department, National Taiwan University of Science and Technology . The server was maintained by Mon-Chau Shie, who is an assistant professor of the Electronic Dept., NTUST. Many thanks for his kind support.(The server is behind a firewall, and you won't be able to ping.)

All contributions to kernel and u-boot should conform to the Linux kernel coding style; see the file "Documentation/CodingStyle" and the script "scripts/Lindent" in your Linux kernel source directory.

Use the git as a user (readonly)

As user on local machine,1. install git-core package , as root or via sudo.  (Note, older git packages may have problem. v1.5.2 or higher is required. Try the latest version, or build it from source)On Fedora,RHEL,  yum install git-core  ( for Centos rpms http://schwarzecker.homelinux.net/ )On Suse, zypper install git-core gitkOn Debian,Ubuntu, sudo apt-get install git-coreIf you have older version, try update. Or better, build from the latest git source, which is 1.5.3.8 at this time of writing.You can check your installed git version with "git --version" .If have older version and you want to build from source, uninstall or remove the old package.http://www.kernel.org/pub/software/scm/git...1.5.3.8.tar.bz2(later versions are now available - look for them here http://www.kernel.org/pub/software/scm/git/)tar jxf git-1.5.3.8.tar.bz2 # extract to any directory outside uClinux-distcd git-1.5.3.8./configuremakesudo make install  # will install git to /usr/local/bin2. As a user, download the source tarball. It is about 413MB, and it would take a while. Best thanks to Altera's kindly hosting these files.Please do not clone from sopc server, as we have network loading issue at NTUST. (sha1sum 238a4c9a4b5ccc7458119e06aedc9820d008a9a2  uClinux-dist-20080131.tar)tar xf uClinux-dist-20080131.tarcd uClinux-distlsYou won't be able to see any files yet, because all the files are compressed inside the hidden .git dir.You can brow your local git using "gitk" GUI, which is included in git-core package.gitk &3. Find what branches are here and use master(stable) branch. git branch -a  master* nios2  v2.6.23-uc  origin/HEAD  origin/fixme  origin/master  origin/nios2  origin/test  origin/v2.6.23-ucgit checkout master # uClinux-dist-20070130 stable, kernel v2.6.19Now you can see the sources like this,lsbin      Documentation  lib          linux-2.6.x  README  uClibcconfig   freeswan       linux-2.0.x  Makefile     SOURCE  userCOPYING  include        linux-2.4.x  openswan     tools   vendors4. STOP HERE. Go back to UClinuxDist . You should be able to build and run uClinux now.make menuconfigmake vendor_hwselect SYSPTF=/path_to/your_system_ptfmakeThe following step 5 and 6 are optional. They get the latest update patches. You should follow it ONLY AFTER the first successful build and boot.5. Only if you are blocked by firewall to use git:// port 9418, you can use http:// instead. But it will be slower than using git:// . Don't use http:// unless you have no choice.Edit file .git/config, and change [remote "origin"]  url to http:// . [remote "origin"]        url = http://sopc.et.ntust.edu.tw/git/uClinux-dist.git        fetch = +refs/heads/*:refs/remotes/origin/*If you are behind a http proxy firewall, you will need to add the setup of proxy to your login profile (.bash_profile or .profile)export http_proxy=http://proxy_server:port_numberMIRRORS You can choose the mirror nearest to you and replace the url in remote "origin".url = http://git.opensource.emlix.com/git/nios2/uclinux-dist.git (DE) gitweb = http://git.opensource.emlix.com/  . (Best thanks to emlix.com)6. Get updates from git server,git pullAfter getting the updates, make again. Sometimes, you may need to clean before make for the changes to take effect.make user_cleanmake

7. You may switch to the "test-nios2" branch, which contains the latest drivers and software.InstallNios2Linux .

Use the git as a project contributors (can write)

(If you want to contribute, please send me ,Hippo, an e-mail attaching a public key for ssh access. ie, run 'ssh-genkey' and send me the file ~/.ssh/id_rsa.pub. Please also give me your real name and preferred user name on this server. This will allow you to push the git server.)As user on local machine, setup your local git as described in previous section.1. as a user, give your real name as it is a norm in Linux kernel mailing list.  git config --global user.email "you@email.com"  git config --global user.name "Your Name"2. edit .git/config, add ssh to remote origin, [remote "origin"]        url = ssh+git://sopc.et.ntust.edu.tw/git/uClinux-dist.git        fetch = +refs/heads/*:refs/remotes/origin/*OR[remote "origin"]        url = ssh+git://your_account_name@sopc.et.ntust.edu.tw/git/uClinux-dist.git        fetch = +refs/heads/*:refs/remotes/origin/* 3. edit, test, commit...Please add signoff (-s) to your commits. Please add "nios2:" to the commit message of nios2 arch specific patches, or names of the subsystem or drivers otherwise. See http://www.kernel.org/pub/software/scm/git/docs/user-manual.html#creating-good-commit-messagesgit status  # check which files should be committedgit diff the_files_or_subdir_to_be_updated  # double check the diffgit add the_files_or_subdir_to_be_updatedgit commit -s  # commit with your signoff, git log # have a look at your commit logIf you found any mistakes after commit, you can revert with "git reset --soft HEAD^".4. when you are ready, you may send your new  commit to the public servergit push Or, you can submit the patches via e-mail , eg to nios2-dev mailing list.git format-patch  AAAA..BBBB   # generate patches from commit AAAA to commit BBBB, output numbered patchesgit send-email --smtp-server your.mail.server --to whom@where  0001-xxxx.patch5. if you want to make a lot of changes or develop a new driver, you may create an experimental branch. You can push the branch early so that others can join the test.git branch my_test_branchgit checkout my_test_branch...edit,test,commit...git push origin my_test_branch6. You can use git-format-patch and git-am to cherry-pick and merge branches, read the man pages.

git format-patch AAAA..BBBB # generate patches from commit AAAA to commit BBBB, create numbered patches 00xxx.patchgit checkout v2.6.23-ucgit pullgit am 00xxx.patchgit log # check againgit push origin v2.6.23-uc

Setup a git server for public

This is how I setup the sopc git server using Debain 4.0. It should be the same for Ubuntu. It is welcome to mirror the sopc server.Install a minimum system with netinst.iso . As root on server,0. Add this line, for updated git packages from backports.org .deb http://www.backports.org/debian etch-backports main contrib non-freeto your /etc/apt/sources.list. 1. apt-get install openssh-server apache2 rsync   apt-get -t etch-backports install git-core git-daemon-run gitweb 2. edit file /etc/apache2/sites-available/gitweb, replace "example.org" with your domain name.<VirtualHost *>    ServerName git.example.org    ServerAdmin webmaster@localhost    HeaderName HEADER    # bogus but safe DocumentRoot    DocumentRoot /var/cache/git    ErrorLog /var/log/apache2/gitweb-error.log    CustomLog /var/log/apache2/gitweb-access.log combined    Alias /robots.txt /var/www/cvs.robots.txt    Alias /gitweb.css /var/www/gitweb.css    Alias /git-logo.png /var/www/git-logo.png    Alias /git-favicon.png /var/www/git-favicon.png    Alias /git /var/cache/git    ScriptAlias / /usr/lib/cgi-bin/gitweb.cgi    RedirectMatch permanent "^/~(.*)$" "http://example.org/~$1" </VirtualHost>ln -s /etc/apache2/sites-available/gitweb /etc/apache2/sites-enabled/100-gitweb(optionally, copy png files from git source git/gitweb to /var/www)(optionally, make link for ssh, ln -s /var/cache/git / ) 3. prepare for publishing, you can place the git in home or ( other shared ?) dir, eg /home/you/git/uClinux-dist.git, then add a symlink in /var/cache/git .as a user,cd ~mkdir gitcd gitmkdir uClinux-dist.gitcd uClinux-dist.gitgit --bare init --sharedgit remote add origin git://sopc.et.ntust.edu.tw/git/uClinux-dist.gitgit  --bare fetch   # to pull from server at origin, will take some time at first runtouch git-daemon-export-ok     # to enable git://git --bare update-server-info  # to enable http://chmod a+x hooks/post-updateedit description               # to display on gitwebYou can add a cron job to pull updates from origin daily,cd /home/you/git/uClinux-dist.gitgit --bare fetchas root, add this link for publishing.ln -s /home/you/git/uClinux-dist.git /var/cache/git4. update your DNS server, resolve both names to the same ip. git.example.org is the virtual host. example.com is the real host.

Summary of branches on sopc server

We have bandwidth issue with our git server at NTUST. To help reduce the network loading, please don't clone directly from sopc server whenever possible.binutils.git    binutils These patches were merged to buildroot. You won't need to use this directly.master : gnu binutils nios2-buildroot : nios2 devel for buildroot nios2 : nios2eds gnutools boards.git    dev board projects DE1_SD_Card_Audio : example quartus project and tryout zImage elf2flt.git    elf2flt utility These patches were merged to buildroot and uclinux.org CVS. You won't need to use this directly.nios2 : nios2 devel for elf2flt master : sync to elf2flt cvs at uclinux.org daily gcc3.git    gcc 3.4 These patches were merged to buildroot. You won't need to use this directly.master : gnu gcc3 nios2-buildroot : nios2 devel for buildroot nios2 : nios2eds gnutools insight.git    Insight GDB v6_4_nios2 : nios2 devel for insight v6.4 master : insight nios2-buildroot : nios2 devel for buildroot gdb : gnu gdb nios2 : nios2eds gnutools linux-2.6.git    Linux kernel. To use this git, please clone from Linus' git and fetch from sopc server. See KernelPatches.master : sync to Linus' git daily v2.6.23-uc : nios2 devel for v2.6.23-uc0 u-boot.git    Das U-BootTo use this git, please clone from DENX git and fetch from sopc server.master : sync to DENX git daily nios2 : nios2 devel uClinux-dist.git    uClinux distro To use this git, please download uClinux-dist-20080131.tar and fetch from sopc server.nios2 : nios2 devel for uClinux-dist-test (unstable) master : nios2 devel for uClinux-dist (stable) test : patches of uClinux-dist-test from uclinux.org

ref:

/usr/share/doc/git-core/http://www.kernel.org/pub/software/scm/git/docs/user-manual.html#maintaining-topic-branches
Page:NEEK-uCLinux-eek.zip
Revision:8
Last edited:07/18/2008 06:01AM (07/18/2008)
Edited by:mschnell

Page:MTD
Revision:9
Last edited:07/18/2008 05:43AM (07/18/2008)
Edited by:hippo5329@yahoo.com.tw

(this page describe the "test-nios2" branch, older branches may not apply)

MTD is the driver for various flash devices, such as CFI flash, SPI flash, and NAND flash. You need to enable the specific driver to access the flash. The single or multiple flash chips can be divided in to partitions which can be accessed as char devices /dev/mtd0..3 or block devices /dev/mtdblock0..3.

The CFI flash component should be named as "ext_flash", and the EPCS controller component should be named as "epcs_controller", otherwise you have to modify linux-2.6/arch/nios2/kernel/config.c .

The mtd partition map is located in linux-2.6/arch/nios2/kernel/config.c . You will need to edit the maps and buswidth for your boards.

Eg, the NEEK has 16 bits data bus, and has partitions defined by the apps chooser, please refer to the user guide.

static struct mtd_partition nios2_partitions[] = {static struct mtd_partition nios2_partitions[] = {

#elif defined(CONFIG_ALTERA_NEEK_C3)    {     .name = "romfs/jffs2",     .size = 0x300000,     .offset = 0xd00000,     },    {     .name = "catalog",     .size = 0x020000,     .offset = 0,     },    {     .name = "application",     .size = 0xb80000,     .offset = 0x180000,     },    {     .name = "selector",     .size = 0x160000,     .offset = 0x020000,     .mask_flags = MTD_WRITEABLE,    /* force read-only */     }#else#elif defined(CONFIG_ALTERA_NEEK_C3)    {     .name = "romfs/jffs2",     .size = 0x300000,     .offset = 0xd00000,     },    {     .name = "catalog",     .size = 0x020000,     .offset = 0,     },    {     .name = "application",     .size = 0xb80000,     .offset = 0x180000,     },    {     .name = "selector",     .size = 0x160000,     .offset = 0x020000,     .mask_flags = MTD_WRITEABLE,    /* force read-only */     }#else

static struct physmap_flash_data nios2_flash_data = {#if defined(CONFIG_ALTERA_NEEK_C3)    .width = 2,        /* 16 bits data bus */#elsestatic struct physmap_flash_data nios2_flash_data = {#if defined(CONFIG_ALTERA_NEEK_C3)    .width = 2,        /* 16 bits data bus */#elseIf you use epcs controller and your fpga is not Cyclone or Cyclone II, you must change the epcs reg offset from 0x200 to 0x400 in the config.c above.

#if (defined(CONFIG_SPI_ALTERA)  || defined(CONFIG_SPI_ALTERA_MODULE)) && defined(na_epcs_controller)#define EPCS_SPI_OFFSET 0x200    /* FIXME */  <== change this to 0x400 if your fpga is not Cyclone or Cyclone II

In uClinux-dist, run "make menuconfig", change the kernel setting,

Processor type and features -->

Platform (Altera Nios II Embedded Evaluation Kit support)   <== change this to your dev board

Device Drivers -->

#### To enable MTD

[*] Memory Technology Device (MTD) support --->--- Memory Technology Device (MTD) support[ ] Debugging (NEW)[ ] MTD concatenating support (NEW)[*] MTD partitioning support[ ] RedBoot partition table parsing (NEW)[ ] Command line partition table parsing (NEW)[ ] TI AR7 partitioning support (NEW)

*** User Modules And Translation Layers ***[*] Direct char device access to MTD devices-*- Common interface to block layer for MTD 'translation layers[ ] TI AR7 partitioning support (NEW)*** User Modules And Translation Layers ***[*] Direct char device access to MTD devices-*- Common interface to block layer for MTD 'translation layers[*] Caching block device access to MTD devices

#### To enable CFI flash

RAM/ROM/Flash chip drivers --->[*] Detect flash chips by Common Flash Interface (CFI) probe[ ] Detect non-CFI AMD/JEDEC-compatible flash chips (NEW)[ ] Flash chip driver advanced configuration options (NEW)[*] Support for Intel/Sharp flash chips # for neek[*] Support for AMD/Fujitsu flash chips # others[ ] Support for ST (Advanced Architecture) flash chips (NEW)[ ] Support for RAM chips in bus mapping (NEW)[ ] Support for ROM chips in bus mapping (NEW)[ ] Support for absent chips in bus mapping (NEW)

Mapping drivers for chip access --->[ ] Support non-linear mappings of flash chips (NEW)[*] CFI Flash device in physical memory map(0x8000000) Physical start address of flash mapping (NEW) # ignored, we will pass platform data(0) Physical length of flash mapping (NEW) # ignored, we will pass platform data(2) Bank width in octets (NEW) # ignored, we will pass platform data[ ] Generic uClinux RAM/ROM filesystem support (NEW)[ ] Map driver for platform device RAM (mtd-ram) (NEW)

#### To enable EPCS SPI flash

[*] SPI support --->--- SPI support*** SPI Master Controller Drivers ***[*] Altera SPI Controller-*- Bitbanging SPI master*** SPI Protocol Masters ***[ ] SPI EEPROMs from most vendors (NEW)[ ] User mode SPI device driver support (NEW)[ ] Infineon TLE62X0 (for power switching) (NEW)

[*] Memory Technology Device (MTD) support --->Self-contained MTD device drivers --->[ ] Support for AT45xxx DataFlash (NEW)[*] Support most SPI Flash chips (AT26DF, M25P, W25X, ...)[*] Use FAST_READ OPCode allowing SPI CLK <= 50MHz (NEW)

#### To enable flash filesystem support

File systems --> Miscellaneous filesystems  --->

[*] Journalling Flash File System v2 (JFFS2) support

###### end of kernel config#### user application config

Flash Tools  ---> --- MTD utils

[*] mtd-utils

[*] eraseall

In the Boot log you should see:

Altera NDK flash (AMD): Found 1 x16 devices at 0x0 in 16-bit bank Intel/Sharp Extended Query Table at 0x010A Intel/Sharp Extended Query Table at 0x010A Intel/Sharp Extended Query Table at 0x010A Intel/Sharp Extended Query Table at 0x010A Intel/Sharp Extended Query Table at 0x010AUsing buffer write methodUsing auto-unlock on power-up/resumecfi_cmdset_0001: Erase suspend on write enabledcmdlinepart partition parsing not availableRedBoot partition parsing not availableUsing Altera NDK partition definitionCreating 4 MTD partitions on "Altera NDK flash (AMD)":0x00200000-0x00800000 : "romfs/jffs2"0x00000000-0x00200000 : "loader/kernel"0x00800000-0x00c00000 : "User configuration"0x00c00000-0x01000000 : "safe configuration"

If you are unsure that the flash range for JFFS2 (see boot log) is empty you can do:

eraseall /dev/mtd0

To use the Flash based file system you do

mount -t jffs2 /dev/mtdblock0 /mnt

Page:neek_ocm_spi.zip
Revision:4
Last edited:07/17/2008 06:47PM (07/17/2008)
Edited by:hippo5329@yahoo.com.tw

Page:neek_ocm_sdio.zip
Revision:5
Last edited:07/17/2008 06:46PM (07/17/2008)
Edited by:hippo5329@yahoo.com.tw

Page:BinaryToolchain
Revision:40
Last edited:07/16/2008 10:18PM (07/16/2008)
Edited by:hippo5329@yahoo.com.tw

Linked from UClinuxDist

Attached are binary of the tools to run on Linux PC and root fs from buildroot. You can use it to compile kernel and apps.

Login as a user account on Linux PC, eg, hippo. The user home dir will be /home/hippo, short form as ~/ .

Use web browser to download the cross tools (69MB). Best thanks to Altera's kindly hosting these files. (but don't use Windows ftp, it corrupt the files)(sha1sum 6873249d8eae7c2981aac6791f044ddaab507566  nios2gcc-20080203.tar.bz2) Open a terminal. Run as root or use sudo,sudo tar jxf nios2gcc-20080203.tar.bz2 -C /

The cross gcc tools was expected to be installed in /opt/nios2 dir. But you may install in any other dirs. Then setup the PATH for the cross gcc, you can add a line at the end of file ~/.bash_profile (or ~/.profile on Debian/Ubuntu) ( the file is hidden, you have to use "ls -a" to find it . For "gedit" use open Location, and enter the file name)

PATH=$PATH:/opt/nios2/binAfter you change the .bash_profile or .profile, you need to logout and login again. So that it will be in the PATH when you login.

Check with,echo $PATHIt should display like this, with nios2 path at the end,/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/opt/nios2/bin

To verify the cross gcc, try out,nios2-linux-uclibc-gcc -vIt should display the info,Reading specs from /opt/nios2/lib/gcc/nios2-linux-uclibc/3.4.6/specsConfigured with: /root/buildroot/toolchain_build_nios2/gcc-3.4.6/configure --prefix=/opt/nios2 --build=i386-pc-linux-gnu --host=i386-pc-linux-gnu --target=nios2-linux-uclibc --enable-languages=c --enable-shared --disable-__cxa_atexit --enable-target-optspace --with-gnu-ld --disable-nls --enable-threads --disable-multilib --enable-cxx-flags=-staticThread model: posixgcc version 3.4.6

Then try build kernel and apps as in the UClinuxDist .

Optionally, you can install ccache, the compiler cache, which can reduce the compilation time a lot.Install required package, as root or via sudo On Fedora,RHEL,  yum install ccacheOn Debian/Ubuntu, (via sudo)apt-get install ccacheThen add links, still as root or via sudoln -s /usr/bin/ccache /usr/lib/ccache/nios2-linux-uclibc-gcc ln -s /usr/bin/ccache /usr/lib/ccache/nios2-linux-uclibc-g++ln -s /usr/bin/ccache /usr/lib/ccache/nios2-linux-uclibc-c++When you compile something, the cache will be used, you can check cache status with,ccache -s
Page:UsbHost
Revision:9
Last edited:07/15/2008 08:07PM (07/15/2008)
Edited by:hippo5329@yahoo.com.tw

uClinux setup for USBHostIn kernel menuconfig, Turn on SCSI device and SCSI disk.SCSI device support --->[ ] RAID Transport Class                           [*] SCSI device support                            [ ] SCSI target support                            [*] legacy /proc/scsi/ support                         *** SCSI support type (disk, tape, CD-ROM) *** [*] SCSI disk support                             

Turn on host-side usb, usb dev filesystem, your hcd (eg : ISP1362 or ISP 116x), and the usb device you want to use (eg : mass storage device).

[*] USB support  --->

--- USB support                                                   [*]   Support for Host-side USB                                   [ ]     USB verbose debug messages                                [ ]     USB announce new devices                                          *** Miscellaneous USB options ***                         [*]     USB device filesystem                                     [*]     USB device class-devices (DEPRECATED)                     [ ]     Dynamic USB minor allocation                              [ ]     Rely on OTG Targeted Peripherals List                     [ ]     Disable external hubs                                             *** USB Host Controller Drivers ***                       [ ]     Cypress C67x00 HCD support                                [ ]     ISP116X HCD support                                       [*]     ISP1362 HCD support                                       [ ]     ISP 1760 HCD support                                      [ ]     SL811HS HCD support                                       [ ]     R8A66597 HCD support                                            *** NOTE: USB_STORAGE enables SCSI, and 'SCSI disk support'       *** may also be needed; see USB_STORAGE Help for more infor [*]   USB Mass Storage support                                    [ ]     USB Mass Storage verbose debug                           

[ ]   USB Monitor   # unselect this

Turn on file system support, eg, FAT,

File systems --> DOS/FAT/NT Filesystems ---> [*] MSDOS fs support [*] VFAT (Windows-95) fs support (437) Default codepage for FAT (iso8859-1) Default iocharset for FAT Native Language Support --> (iso8859-1) Default NLS Option [*] Codepage 437 (United States, Canada) [*] NLS ISO 8859-1 (Latin 1; Western European Languages)

If you are using DE2, you may try the example project DE2_System_v1.6/DE2_demonstrations/DE2_NIOS_HOST_MOUSE_VGA of the DE2 v1.6 CD.

when booting, the kernel will detect your hcd, your usb devices.

usbmon: debugfs is not availabledriver isp1362-hcd, 2005-04-04isp1362-hcd isp1362-hcd: ISP1362 Host Controllerisp1362_hc_reset:isp1362-hcd isp1362-hcd: new USB bus registered, assigned bus number 1isp1362-hcd isp1362-hcd: irq 4, io mem 0x80c810d0isp1362_hc_start:isp1362-hcd isp1362-hcd: ISP1362 Memory usage:isp1362-hcd isp1362-hcd: ISTL: 2 * 256: 512 @ $0000:$0100isp1362-hcd isp1362-hcd: INTL: 16 * ( 64+8): 1152 @ $0200isp1362-hcd isp1362-hcd: ATL : 32 * ( 64+8): 2304 @ $0680isp1362-hcd isp1362-hcd: USED/FREE: 3968 128usb usb1: configuration #1 chosen from 1 choicehub 1-0:1.0: USB hub foundhub 1-0:1.0: 2 ports detectedISP1362 Host Controller, irq 4Initializing USB Mass Storage driver...usbcore: registered new driver usb-storageUSB Mass Storage support registered.Freeing unused kernel memory: 436k freed (0x1a0000 - 0x20c000)init started: BusyBox v1.1.1-pre0 (2006.04.20-12:52+0000) multi-call binaryBusyBox v1.1.1-pre0 (2006.04.20-12:52+0000) Built-in shell (msh)Enter 'help' for a list of built-in commands.#

usb 1-2: new full speed USB device using isp1362-hcd and address 3usb 1-2: configuration #1 chosen from 1 choicescsi1 : SCSI emulation for USB Mass Storage devices Vendor: USB 2.0 Model: Mobile Disk Rev: 2.00 Type: Direct-Access ANSI SCSI revision: 02SCSI device sda: 256000 512-byte hdwr sectors (131 MB)sda: Write Protect is offsda: assuming drive cache: write throughSCSI device sda: 256000 512-byte hdwr sectors (131 MB)sda: Write Protect is offsda: assuming drive cache: write through sda: sda1sd 1:0:0:0: Attached scsi removable disk sda# fdisk -l /dev/sdaDisk /dev/sda: 131 MB, 131072000 bytes16 heads, 32 sectors/track, 500 cylindersUnits = cylinders of 512 * 512 = 262144 bytes Device Boot Start End Blocks Id System/dev/sda1 * 1 499 127728 6 FAT16# mount -t vfat /dev/sda1 /mnt# cd /mnt# ls

Linux Host Controller driver for the NXP (was Philips semi) ISP176x USB High Speed Host Controller PCI kit. This driver provides BULK, INTERRUPT, and ISOCHRONOUS transfer support.  hcd and dcd on sf.net . Bernard ported the driver to a PXA255 running 2.6.17. It's at http://dagobah.ucc.asn.au/isp1761/. See http://sourceforge.net/mailarchive/forum.p...&forum_id=38940 for more info. If you are designing a new board, you should consider ISP1761 instead of ISP1362. The ISP1761 is much faster (at high speed) and support more features.

Understanding and developing Linux USB drivers

SOPC Component for ISP1362

For SOPC Builder, create a new component using this verilog file ISP1362_CTRL.v. Click next until the "interface" tab, then make the following changes :

  •     Slave Adressing : Native
  •     Units : ns
  •     Setup : 100
  •     Read Wait : 100
  •     Write Wait : 100
  •     Hold : 100

After creating the component, add it to your design. Make sure it is named "ISP1362". Thats it.

After compiling the design, the pin assignments must be set. The pin names used in the verilog code matches the pin names used in the DE2 User manual. Make sure the pin assignment is done correctly. This works in Altera Quartus 7.1sp1.

SOPC Component for ISP1161A (also works with Microtronix USB-Ethernet daughterboard)

Add this file (ISP1161A_CRTL_hw.tcl) into your Quartus Project folder, and refresh your SOPC builder. It will then be available under UTM > ISP1161A. Add it into your project and rename the component to "usb". This works in Altera Quartus 8.0.

If the above method gives errors, or doesnt work with a newer version of quartus, use this file (ISP1161_CTRL.v) and create a new component.

Set irq_n as "Interrupt Sender - irq_n". Make sure to assign this interrupt sender to the Avalon bus in the next page.

Set all the USB chip pins as "Conduit - export".

In the next page, set the following values for timing :

  •     Units : ns
  •     Setup : 100
  •     Read Wait : 100
  •     Write Wait : 100
  •     Hold : 100

After creating the component, add it to your design. Make sure it is named "usb". Thats it.

After compiling the design, the pin assignments must be set. The pin names used in the verilog code matches the pin names used in the DE2 User manual. Make sure the pin assignment is done correctly.When compiling uClinux, make sure to choose the correct device driver in the "make menuconfig" command.

Page:LinuxConfig
Revision:17
Last edited:07/15/2008 06:11PM (07/15/2008)
Edited by:hippo5329@yahoo.com.tw

Console device

In kernel menuconfig, you should usually select either jtag uart or serial uart for console device (but not both).NOTE, you can use JTAG UART console during development. But if you don't connect a nios2-terminal, the program will hang. So you shouldn't use JTAG UART console for standalone or production. You must disable JTAG UARTconsole then. You still need a console device after disabling JTAG UART console, otherwise the init task will exit and panic. You may use Nios serial uart as console, or use Virtual Terminal (actually it can be dummy) as console. You should use exactly only one of them for console.

Device Drivers ---> Character devices ---> Serial drivers --->

[ ] 8250/16550 and compatible serial support         *** Non-8250 serial port support ***         [*] Altera JTAG UART support                     [*]   Altera JTAG UART console support     #  ifif you use jtag uart (with a USB (Blaster) cable Blaster cable) on a nios2-terminal    nios2-terminal,[ ]     Bypass output when no connection      # go without a nios2-terminal  ] Nios serial support [*] [*] Altera JTAG UART support                          (4)   Maximum number of Altera UART ports        (115200) Default baudrate support [*] Support for console on Altera JTAG UART ports  [ ]   Altera UART console support                # if

if you use serial uart (with a 9-pin RS-232C cable cable) on a terminal emulator such as minicom or ckermit ckermit,[*] Nios serial support [*] Support for console on Nios UART [ ] Altera JTAG UART support

if you use neither jtag uart nor serial uart, and you might use telnetd or hyperterminal sshd alike, or framebuffer/keyboard/mouse/nano-X, then you can use virtual terminalDevice Drivers ---> Character devices --->[*] Virtual terminal[*]   Support for console on virtual terminal

The jtag uart will freeze if there is no nios2-terminal connected. You can keep the system working without a jtag connection, by turn on[*]     Bypass output when no connectionThe jtag uart will connect again when there is a nios2-terminal on jtag connection.The init prog will start a shell on the console device. So if you want to run app which use uart, then you should not enable uart console.

File mode mapping on initramfs

If your user id and group id on Linux are not 500, change these to your id instead. This will be used to map user file/dir ownership to root in initramfs.

If your user id and group id on Linux are not 500, change these to your id instead. This will be used to map user file/dir ownership to root in initramfs.

General setup --> (for new kernels)ORDevice Drivers --> Block devices --> (for 2.6.11-uc0)(500) User ID to map to 0 (user root)(500) Group ID to map to 0 (group root)

Processor type and features-->(0x00500000) Link address offset for booting.The zImage load address is ( your sdram base address + link address offset ). The boot loader will uncompress the code to the beginning of sdram. If the uncompressed code is bigger than the default 5M, the two area will overlap and corrupt. The compressed image offset should be adjusted to a higher value when the kernel image is big, eg, large files in romfs dir. You can change this value to about 2/3 of the size of your sdram, eg, 20M out fo 32M. I suggest 2/3 because the gzip compression ratio is about 1:2. The zImage boot loader does not relocate/move itself.

If you can not find Platform board support of your board in Processor features, just use the default.

Serial Uart on NEEK

The serial uart TXD pin is a dual purpose pin, you have to change the pin usage,Assignements -> Device Settings -> Device -> Device and Pin Options -> Dual-Purpose Pins -> nCEO -> Use as regular IO

   input        HC_UART_RXD;   output        HC_UART_TXD;  

      .rxd_to_the_uart                              (HC_UART_RXD),      .txd_from_the_uart                            (HC_UART_TXD),

Page:ToDo
Revision:33
Last edited:07/15/2008 03:35AM (07/15/2008)
Edited by:mschnell

GNU / Buildroot Tool Chain

  • support for Execute in Place ("XIP") for nommu flavor (needs completely position independent code ("PIC") support by the Compiler)

Kernel Arch

  • Every pieces of nios2 code should be reviewed and compared again those of m68knommu or other arch.Files to be revised:
    • file1...
    • file2...
  • Coding style clean up.
  • Optional MPU support.
  • Optional "full" Linux with MMU

Kernel Drivers

  • All drivers should use platform driver model.Drivers to be revised:
    • driver1...
    • driver2...
  • Opencore I2C driver,   there is the driver in mainline kernel, but we need platform data and testing.
  • SPI driver, the old one is useless. The new one should be developed.
  • DMA interface driver, the old one is useless.
  • NEEK LCD framebuffer
  • NEEK touch screen driver
  • "programmable timer" driver for "tickless Linux" (the appropriate hardware needs to designed, too)
  • ioremap as a macro to inline it if nommu

File Systems

  • cifs (Samba) client (hangs)

Make / Configuration System

  • Add NEEK to board selection=== done ===
  • When XIP is available move as many apps as possible into busybox by default (init, shell, ...)
  • When XIP is available use a better shell than sash by default
  • Makefile glitch: 10 times "Making symlinks in include/". Once seems to be enough.
  • Better integration of the definition of the pof file to be used

User Space Libs and Apps

  • Compiling error when gdb-server is activate=== gdbserver is not enabled as default any more ===
  • More "user friendly" FTP server by enabling ls in busybox on default and adding password for root (and a user uclinux) in passwd
  • Start inetd and boa in rc on default (no harm done, if they can't run due to not Ethernet configured)
  • "haserl" does not compile (Makefile problem) === partly solved ===  (On some systems a dummy file "NEWS" seems to be necessary.)
  • "haserl" does not work=== partly solved ===  (After adding a line syslog("Haserl start") in main() main it works due to a miracle. It only works if the syslog daemon is running) miracle.)

Documentation

  • "make help" should create a decent output. At least listing the available make targets including the "_only" and "_clean" stuff.
  • how to modify the various real-time configuration files
    • RC (easy: /vendor)
    • passwd (easy: /vendor)
    • initd.conf
    • services
    • stuff in vendors/Altera/nios2nommu/romfs_list
    • ...
  • inittab / rc
  • how to save the Kernel and application/library configuration in a way that it survives a "git checkout -f" or "git clean -d" or "make real_clean"
  • ...

Politics

  • Have Altera and/or SLS mirror (or run) the GIT server (with HTTP support)
  • Communicate with SLS about company <-> community collaboration and preserving a common code base
  • Suggest NIOS arch for inclusion into the main line Kernel
  • Method to assign to-do issues to programmers and to track progress
  • A great deal of the necessary documentation is not specific to the NIOS arch. There should be a central uCLinux-dist documentation Wiki for that.
Page:ISP1161A_CTRL.v
Revision:NEW
Last edited:07/14/2008 01:11AM (07/14/2008)
Edited by:vishnu350

Page:ISP1161A_CTRL_hw.tcl
Revision:NEW
Last edited:07/14/2008 01:11AM (07/14/2008)
Edited by:vishnu350

Page:DebugKernel
Revision:20
Last edited:07/10/2008 06:49PM (07/10/2008)
Edited by:hippo5329@yahoo.com.tw

You can use insight GDB GUI to debug kernel. Insight is the (same) GDB integrated with GUI interface.You must include JTAG debug module in SOPC Builder. Using level 1 is OK. But level 2 is better, as it supports two hardware data watchpoints.(Placing a hardware data watchpoint as "awatch *(int *)0" is very useful to catch a common NULL pointer dereference bug.)

The debug info (-g) is disabled by default. To enable debug info,

Kernel hacking -->[*] Kernel debugging  [*] Compile the kernel with debug info

To disable optimization of your driver, add rule like this to your Makefile, eg, driver/net/Makefile,CFLAGS_atse.o = -O0You may find more info fromlinux-2.6/Documentation/kbuild/makefiles.txt

The kernel object file is linux-2.6.x/vmlinux, which is an ELF format object containing debug information. You can not use zImage here, as the debug information is stripped off. You may use the same method to debug u-boot or others. If you want to debug kernel modules or user space programs, you need will more setup than what is described here. The debugging of user space programs will be discussed in another wiki later.1.You will need USB-blaster and jtagd properly configured. Run "jtagconfig" to verify it is working.You may refer to QuartusforLinux , LinuxGdbServer or alteraforum for related.2. Configure sof nios2-configure-sof  path_to/your_system.sof3. Edit a file, say linux.gdb, containing gdb startup commands. You may add more break points to the codes which you want to debug.This is optional, but it is handy to use a command file rather than do it by hand.file linux-2.6.x/vmlinuxtarget remote localhost:2342load linux-2.6.x/vmlinuxbreak *start_kerneljump *_start4. Edit a short shell script, say debuglinux.sh, to start gdb-server to listen at, say 2342 port, and start insight. Remember to do chmod +x debuglinux.sh . You can also modify nios2-debug to do the same job.nios2-gdb-server-wrapped --reset-target --tcpport 2342 & nios2-elf-insight --command=path_to/linux.gdb 5. If you use jtag uart for console, you need to start "nios2-terminal".Then start debugger. cd uClinux-distpath_to/debuglinux.shUsing cable "USB-Blaster [USB 4-1.2]", device 1, instance 0x00Pausing target processor: OKListening on port 2342 for connection from GDB: accepted6. Wait about 1 minute. The insight GUI will come out with a source code window, stopped at main() in start.c . You can begin debugging now.You may find more insight usage from Redhat GNUPro Debugger Tools PDF (2454 KB) .You may also find GDB manual at your nios2eds installation, file:///opt/altera7.2/nios2eds/documents/gnu-tools/gdb/gdb.html .Peter Jay Salzman's GDB guide: Using GNU's GDB DebuggerTo debug module, see Module section offsets in /sys/module [LWN.net]  .kernel config,General setup ---> [*] Configure standard kernel features (for small systems) ---> [*] Load all symbols for debugging/ksymoopsThen, you can find the section locations of module, and add symbols.
Page:Nios2IDE
Revision:3
Last edited:07/10/2008 06:20PM (07/10/2008)
Edited by:hippo5329@yahoo.com.tw

You can import the uClinux-dist to Nios2 IDE, ie Eclipse, and debug kernel.

The debug info (-g) is disabled by default. To enable debug info,

Kernel hacking --> [*] Kernel debugging  [*] Compile the kernel with debug info 1. Open Nios2 IDE from a shell, ie, run "nios2-ide" .2. From IDE menu, import the uClinux-dist dir. After you press [finish], it will take some time scanning the dir.File > Import > Altera Nios II > Existing Nios II software build tools project or folder into workspaceProject contents :  < brow to your uClinux-dist dir >Project name : < eg, uclinux  >  # you cannot use uClinux-dist as project name, it doesn't like "-".3. Connect jtag cable to your board, and configure your fpga with nios2-configure-sof if it is not configured yet.4. Select project uclinux from the left-hand side of the windows.Set Up a Debug Configuration.Run > Debug As > Nios II Hardware5. A Debug Configuration Manager will come out,Nios II ELF Excutable: linux-2.6.x/vmlinuxSOPC Builder System PTF File: < brow to your system.ptf >Click [Apply]Click [Debug]6. If the Confirm Perspective Switch dialog box appears, click Yes. You can debug the kernel now.Ref, Nios II Software Developer’s Handbook, ch3. Introduction to the Nios II Software Build ToolsNios II IDE help, Running and Debugging on Hardware