Showing results for 
Search instead for 
Did you mean: 
Intel Support hours are Monday-Fridays, 8am-5pm PST, except Holidays. Thanks to our community members who provide support during our down time or before we get to your questions. We appreciate you!

Need Forum Guidance? Click here
Search our FPGA Knowledge Articles here.

Linux with MMU on VEEK/t-Pad

Linux with MMU on VEEK/t-Pad

This is a test example of Linux for Terasic's VEEK/t-PAD. Both hardware and software source are included, you can run the Linux and X Window system from the Application Selector.


You need

  • Terasic's VEEK or t-PAD kit (you can use DE2-115 base board instead of these).
  • Blank SD card which support SPI mode (2GB SD card is preferable to test X window).
  • PS2 or USB keybord.
  • LAN (cross) cable.

If you want to test X window and its applications, make 3 partions in your SD card, for example using 'fdisk' command with your PC(of course, your PC's OS must be Linux!). And format it, like

mkfs.vfat /dev/mmcblk0p1

mkfs.ext3 /dev/mmcblk0p2

mkswap /dev/mmcblk0p3

Note that you need free spaces more than 800MB in /dev/mmcblk0p2. The Swap area is optional. If your VEEK/t-PAD can't execute the 'Application Selector', restore the factory image from the kit's CD. And set the jumper switch 'JP1' (for ETHERNET0) to '2-3 short', because this example uses MII mode for the Ether Phy's interface. For ETHERNET1, set 'JP2' to '1-2 short' (RGMII mode). ETHERNET1 supports 1Gb Ether mode, but ETHRENET0 only supports up to 100Mb one.



extract these on your PC, and copy them into the folder of '/Application_Selector/NiosII_Linux' on /dev/mmcblk0p1 (of course, you must make these folders if not exists).

 To test the X window system and alsa sound system, download next 14 files,

·       File:DE2 115 NIOS HOST MOUSE VGA HW.bin.gz

·       File:Linux SW.bin.gz

·       File:Usr.bin.tar.gz

·       File:Usr.doc.tar.gz

·       File:Usr.etc.tar.gz

·       File:Usr.home.tar.gz

·       File:Usr.include.tar.gz

·       File:Usr.lib 1.tar.gz

·       File:Usr.lib 2.tar.gz

·       File:Usr.lib 3.tar.gz

·       File:Usr.libexec.tar.gz


·       File:Usr.sbin.tar.gz

·       File:Usr.share 1.tar.gz

·       File:Usr.share 2.tar.gz

·       File:Usr.var.tar.gz

extract these on your PC, and copy all to /dev/mmcblk0p2. You may have the 'usr' directory which contains

bin doc etc home include lib libexec man sbin share var

Note: For lib_1, lib_2 and lib_3, extract and merge them into the folder 'lib'. Do same for share_1 and share_2 into the folder 'share'.

Boot Linux

 Plug the AC adapter and keyboard, insert the SD Card into the SD slot of your VEEK. Turn on the power, wait for the Application Selector to load, and select your application (NiosII_Linux in this case). It takes several minutes to load, but after the white screen, you can see the 'Tux' on your LCD display.

Linux.jpg (Click here for image)

Test X Window

 After the booting, you can use your keyboard, but the key-cord is US keyboard. To change the shell to 'bash', type

export HOME=/home


and mount SD card's mmcblk0p2 to /mnt, like

mount /dev/mmcblkp2 /mnt

or you have a script for short cut


If your keyboard is not US one, use 'loadkeys' command, for example to change Japanese 106, type like

loadkeys jp106

Before to execute your X window system, it is recommended to connect your PC and VEEK/t-PAD with 'telnet', against system freezing. If you want to use the ETHERNET0 connector, set your preferable IP address with the command,

ifconfig eth0 **.**.**.** netmask

on VEEK, and enter by telnet from your PC. (For ETHERNET1, change 'eth0' to 'eth1'.)

telnet **.**.**.**

(login name root, NO password!). In the case that VEEK/t-PAD phys will auto-negotiate and make the link 1000Base, use 'ethtool' or some to slow it down. From your VEEK/t-PAD side, try the next.

ethtool -s eth0 autoneg off speed 100 duplex full

(If the link speed is fixed at 10Mbps, once unplug your ethernet cable and plug it again.) 

Now you are ready to go, type


Wait and you can see the 'CROSS' mouse pointer and when it changes the shape to a arrow, 'WindowMaker' is booting. But it will take 5 minutes or more for the first booting (the WindowMaker does something to initialize). After your patience, you can see the 'Disktop' as follows.

WindowMaker.png (Click here for image)

 By press F12 or touch your screen, you can open the 'Applications' menu, but of course Firefox is not installed. The key-code maps are stored /mnt/usr/home/.Xmodmap. It's set according to jp106, so if you want to change, edit it with 'xedit' or 'editor'. To check key events, you can use 'xev'. If you need the calibration of touch screen, once exit from the X Window (you can do this by selecting the 'Session'->'Exit' from the 'Applications' menu), type

export TSLIB_CALIBFILE=/mnt/usr/etc/pointercal



and calibrate it. (Do not forget to 'sync', before power off.)

 'Window Maker' is a light-weight X11 window manager which has NEXTSTEP like user interface. For the details, refer next.

X Window Applications

Some programs are listed in the 'Applications' menu. If not, evoke it by using 'wterm'.


 To load 'tangogps', it takes 1 or 2 minutes because it requires many libraries. The response is a little bit dull, but you can connect your GPS receiver through RS232C. The driver 'gpsd' is stored in /mnt/usr/sbin.

Tangogps.png (Click here for image)


Also this is a GTK program and it takes several minutes to evoke. But we can use the file manager 'pcmanfm'.

Pcmanfm.png (Click here for image)

Note that the 'Applications' has no menu, and some functionalities such as 'Trash' will not work.

GAME xgalaga

 The shooting game 'xgalaga' is installed. If you want to make sound, please refer the item 'Alsa Sound System'.



xgalaga -window -winsize 468x540

Xgalaga.png (Click here for image)

Press key 'b', if you feel the game speed is too slow.

Miscellaneous Applications

Several X window applications are installed.

gtk-demo editor pclock wmagnify wmifs wmmon wterm xcalc xclipboard xconsole xedit xev xkill xload xman xrefresh xwd etc.

Miscellaneous_applications.png (Click here for image)

Alsa Sound System

 This example implies the experimental sound hardware and its driver. Plug your speaker or headphone into the 'line out', evoke the 'alsamixer',

Alsamixer.png(Click here for image)

and turn the 'Output Mixer HiFi' on. You have sample sound sources at /mnt/user/share/sound/alsa. But before playing, I recommend you to copy those to ramfs area, for example /. To play, use 'aplayer' or 'vplay' for *.wav files. You can also play *.mp3 files with 'mp3player' like

mp3player Ievan_Polkka(Replica ver.).mp3

Nios2 uses almost all its power to decode mp3, so do nothing except to press 'ctrl-c' during play and I recommend you to exit from X window and do this from your command console or through telnet. If you experience choppering of sounds, try

mp3player -B 1000000 Ievan_Polkka(Replica ver.).mp3

Note that this example uses WM8731 in slave mode. Do not use it in master mode.

To record sound, connect your mic or line source and try

vrec -w -b 16 -s 8000 <file name>.wav

but set the jack function or something appropriatly by using the 'alsamixer'. 8k, 44.1k, 48k and 96k sampling rates are supported.

Web Browser Midori (Experimental)

It's TOO slow and inpractical, but the webkit-1.0 (ver.2.17.9) is working. Maybe this is the largest application that has been executed on Nios2 CPU.

Midori.png (Click here for image)

If you want to execute it, set your "gate-way" and "name server" like

route add default gw <your gate-way's IP adr.>

echo "nameserver <your nameserver's IP adr.>" > /etc/resolv.conf

and type

midori http:/

. Someday, the browser shows this site (:- (Maybe it takes 10 minutes or more to reach 'Google' site).

Miscellaneous Support


The NFS(network file system) is supported and VEEK/t-Pad can be a client. To mount a folder, please type

portmap &

mount -t nfs -n -o nolock,rsize=1024,wsize=1024 <your nfs server's IP adr.>:/<the folder you want to mount> /<mount point>

. In details, please refer the page of NFS in this wiki.

To unmount,

umount -l /<mount point>

Swap File System

The swap file system is supported. If you made the swap space on 'mmcblk0p3', then

swapon /dev/mmcblk0p3

will enable the swap file system. To disenable it, type

swapoff /dev/mmcblk0p3

DHCP Client

If you have a DHCP server, you can use the next command

dhclient eth0

and get your IP address automatically.

Loadable Kernel Modules

Loadable kernel modules are supported. You can test the sample code for LCD 16207 by

insmod /mnt/usr/lib/modules/2.6.30/kernel/drivers/lcd/lcd_16207.ko

. After the loading, make a device file

mknod /dev/lcd -c 250 0

and you can write your message to the LCD by

echo "Hello LCD" > /dev/lcd

Magic SysRq key

The SysRq key is enabled by default. For example, Alt+SysRq+b will reboot the system. Moreover

echo g > /proc/sysrq-trigger

will break the kernel and force it to KDBG debug mode (board's UART is used for remote debugging).


The USB Blaster's connector can also be used as a UART. The UART protocol is 115200bps, 8 data bits, non-parity, 1 stop bit. /dev/ttyJ0 is assigned for its device file.

telnetd and ftpd

The daemon of telnet and ftp are installed. You can enter the telnet session from your PC by

telnet <your VEEK/t-Pad's IP adr.>

Be carefull because the login name is 'root' with NO password !!

GDB server

The gdbserver is installed, so you can remote-debug your program by

gdbserver <your PC's IP adr.>:<port No.> <your program> <[args]>

. From your PC side, evoke the nios2's gdb and connect them by

target remote <your VEEK/t-Pad's IP adr.>:<port No.>


OProfile is supported. Type

opcontrol --no-vmlinux


opcontrol --start

will start the profiling. To see reports, stop the profiling and use 'opreport'.

root@nios2:/lib# opreport -l | more

Overflow stats not available

warning: /no-vmlinux could not be found.

CPU: CPU with timer interrupt, speed 0 MHz (estimated)

Profiling through timer interrupt

samples % image name app name symbol name

10585 25.0984 no-vmlinux no-vmlinux /no-vmlinux

8648 20.5055 inflate

5238 12.4200 FcCompareValueList

1155 2.7387 pcf_load_font

1058 2.5087 free

871 2.0653 malloc

765 1.8139 memcpy

686 1.6266 FT_Stream_ReadFields

618 1.4654 FT_Stream_ExitFrame

530 1.2567 FT_Stream_EnterFrame

486 1.1524 ft_gzip_file_io

478 1.1334 jscyyparse(void*)

439 1.0409 pcf_get_metric

366 0.8678 ft_mem_qalloc

326 0.7730 __floatsidf

276 0.6544 ft_mem_alloc

246 0.5833 do_lookup_x

225 0.5335 ft_mem_realloc

187 0.4434 FcCharSetPutLeaf

171 0.4055 FT_Stream_ReadLong

Qt (for Test)


qt_test qt_codeeditor qt_browser qtperf4

are already installed in your SD card. To evoke those, type

qtperf4 -qws

for example, and hit 'return' key from your console mode (Don't try it from the X window system). I recommend you to use an USB mouse if you are using your VEEK/t-PAD board.

In Case of Hung Up

 Unfortunately, X Window server sometimes generates 'Segment Fault' and the screen will not return to console mode. In such case, Try to enter the system with 'telnet', type 'startx' and exit by 'ctrl-c'. Of course, the total solution is to press reset button 'KEY0'.

Unfortunately, if you don't have VEEK/t-PAD kit, but you have DE2-115...

VEEK/t-PAD kits are using the DE2-115 for their base boards, so we can test these samples with a (S)VGA monitor and one USB or PS2 mouse. For the 'Application Selector', download next, extract it

File:D115 Selector.tar.gz

and do next commands

quartus_pgm.exe -m jtag -c USB-Blaster[USB-0] -o "p;tPad_Selector.sof"

nios2-flash-programmer.exe --epcs --base=0x0a001800 tPad_Selector.flash

in your (altera) command console (note that this will overwrite and delete the DE2-115's factory sample). After the program download, once turn off the board and turn on again with your suitable SD card, you can select the items on the VGA monitor by pressing the KEY0 and KEY1, and load the program by pressing the KEY2 button.

NOTE: When you execute the 'nios2-flash-programmer' command, you may get an error like

No EPCS layout data - looking for section [EPCS-010216] .

In such case, please refer the Altera forum page for the 'nios2-flash-programmer' or the section

"A. Non-Standard Flash Memories" of "Nios II Flash Programmer User Guide" at pp.23.

If you want to test X Window system on your DE2-115, download next, extract and copy those to your '/mnt/usr/bin' directory.


To start the X with a USB mouse, type 'startx.usbmouse'. (If the mouse pointer will not move, once disconnect your mouse and plug it again.)

(More unfortunately) If your board has a Cypress USB IC, use next files instead of 'DE2_115_NIOS_HOST_MOUSE_VGA_HW.bin', etc.

File:DE2 115 NIOS HOST MOUSE VGA CYUSB HW.bin.tar.gz

File:Linux CYUSB SW.bin.tar.gz

Bluetooth Test

If you have a Bluetooth USB adapter, you can test it by using next files instead of 'Linux_SW.bin', etc.

For the NXP USB chip version

File:Linux BT SW.bin.tar.gz

For the Cypress USB chip version.

File:Linux CYUSB BT SW.bin.tar.gz

After the booting, mount the SD card and execute next two daemons.

dbus-daemon --config-file=/mnt/usr/etc/dbus-1/system.conf --fork

/mnt/usr/sbin/bluetoothd &

Check the adapter and get its name (hci0, hci1,...) by the next command.


If the state of 'hciX' is 'DOWN', try the next command

/mnt/usr/sbin/hciconfig hciX up

For example, to use a bluetooth mouse, you must do the paring. At first, scan the BD address of your mouse by

hcitool hciX scan

Scanning ...

XX:XX:XX:XX:XX:XX Bluetooth Mouse

. Set your mouse in paring mode, and execute

bluez-simple-agent hciX XX:XX:XX:XX:XX:XX

bluez-test-device trusted XX:XX:XX:XX:XX:XX yes

bluez-test-input connect XX:XX:XX:XX:XX:XX

. If you have no error and get the connection message, you can use your bluetooth mouse. Try


for example.

To Do

  • 1. Video For Linux ?
  • 2. Update Linux to the latest version.

No Warranty

 This design is working well in my t-Pad over 100 hours and there is no damage to my hardware, but I can't guarantee the result when you download this to your VEEK/t-Pad.

Hardware design files are here.



Pins Assigment file is here.


Version history
Last update:
‎06-24-2019 08:47 PM
Updated by: