Demo with Linaro Linux Desktop on SoCrates board with Keyboard/Mouse/Screen/Camera
Video
Introduction
This project utilizes EBV
SoCrates board to demonstrate the Linux Linaro OS running on the Altera Cyclone V
SoC device. This project allows you to boot linux and use mjpeg streamer with USB camera. This project can be built using the features of the 13.0 release.
The purpose of this project was to test some of the capabilities of the
SoC hardware. The video pipeline is implemented in the FPGA portion of the
SoC using Altera's Video IP (VIP) suite and some of the manualy made parts written with VHDL to enable streaming to LVDS
DLC0700DDG -T-1 screen . A frame buffer DMA component in the FPGA reads the video buffer information from DDR in the HPS and writes it into the video pipeline.
This project is based on the Detlev Zundel's kernel tree and using Chris Rauter's driver for Altera VIP frame buffer.
Requirements
- EBV SoCrates 1.12 board or later
- SD card adapter
- 8 GB microSD card
- USB HUB
- Female to Female USB adapter
Building the demo
Requirements
- Quartus 13.0sp1
- Build toolchain - only if you wish to build the kernel source and the device tree. Not necessary if you are using the provided uImage and dtb files.
- SOC EDS 13.0
- Needed to compile linux kernel
- Custom kernel
- Linaro Linux Root filesystem
Build the Quartus project
- Download archived project file (.qar)
- Open project file and extract it
- Start Qsys and generate system.
- Full compile whole project
Linux Kernel Configuration and Drivers
Driver summary / Kernel changes summary
- Frame buffer driver
- Update kernel build configuration
- Update kernel device tree
- Altera VIP frame buffer has to be added to device tree
How to get the kernel source and compile (optional : uImage and dtb files attached to this project)
- Get archieved kernel source files
- Run patch from attached files
- Compile the kernel
#setup build environment
export ARCH=arm
export CROSS_COMPILE=arm-linux-gnueabihf-
export LOADADDR=0x8000
#import default config(patch will enable new drivers in this config)
make socfpga_defconfig
#make a new uImage
make uImage
#build the device tree
#You need this device tree to get the drivers to work!
make socfpga_cyclone5.dtb
NOTE: You can use allready compiled uImage and device tree which is attached
U-BOOT arguments
You will have to add few commands to u-boot since
SoCrates is not automatically allowing FPGA part to use HPS DDRAM memory. Also you will have to increase size of DMA to enable video streaming and parallel use of keyboard and mouse with camera.
There are two ways for changing enviorment variables for u-boot and both of them will be demonstrated here.
Changing variables with setenv command
setenv axibridge ffd0501c
setenv axibridge_handoff 0x0
setenv l3remap ff800000
setenv l3remap_handoff 0x00000019
setenv bridge_enable mw $axibridge ${axibridge_handoff}; mw $l3remap ${l3remap_handoff}
setenv bootcmd 'run bridge_enable_handoff; run mmcload; run mmcboot'
setenv mmcboot 'setenv bootargs console=ttyS0,57600 root=${mmcroot} rw rootwait coherent_pool=2M;bootm ${loadaddr} - ${fdtaddr}'
setenv bootdelay 10
saveenv
Those commands will allow FPGA to use DDRAM from HPS side, and will increase DMA on 2 Mbyte
Changing variables with mkenvimage
Mkenvimage tool can be found in folder Project/software/spl_bsp/uboot-socfpga/tools/mkenvimage
- Insert microSD card image to PC
- From directory Project/software/spl_bsp run commands
-
uboot-socfpga/tools/mkenvimage -s 4096 -o ubootenv.bin uBootInitRAMFsEnv.txt</span>
-
sudo dd if=ubootenv.bin of=/dev/sdX bs=512 seek=1</span>
NOTE: File uBootinitRAMFsEnv.txt can be found in attachments
Create the SD Card Image
Partition SD Card Image
- Determine the device associated with the SD card on the host by running the following command before and after inserting the card in the reader:$ cat /proc/partitions Let's assume it is /dev/sdx
- Repartition the card, with the sudo fdisk/dev/sdx command
$ Use p to print current partitioning
$ Use d to delete all partitions one by one
-
Create partition using these options, pressing enter after each one: n p 2 4096 +4496384 t 83
Create partition using these options, pressing enter after each one: n p 1 9000000 +20480K t 1 b
Create partition using these options, pressing enter after each one: n p 3 2048 +1024K t 3 a2
- Press w to write partitions to card, then exit
-
Verify the card was partitioned correctly, it should look like this (use fdisk and p to see it):
Device Boot Start End Blocks Id System
/dev/sdx1 9000000 9020480 20480 b W95 FAT32
/dev/sdx2 4096 8996863 4496384 83 Linux
/dev/sdx3 2048 4095 1024 a2 Unknown
- Make partition one a DOS partition
$ sudo mkdosfs /dev/sdx1
Place the preloader and u-boot in the binary partition
- dd if=preloader_with_header.img of=/dev/sdx3 bs=64k seek=0
- sudo dd if=u-boot.img of=/dev/sdx3 bs=64K seek=4
Copy the Linux kernel and Device Tree file to the Fat 32 partition
- mkdir /sdcard
- mount /dev/sdx1 /sdcard
- cp uImage.bin /sdcard/uImage
- cp socfpga.dtb /sdcard/socfpga.dtb
- umount /sdcard
- sync
Copy the Linaro Root Filesystem to the Linux partition
The linaro rootfs can be found in attachments.
- mount /dev/sdx2 /sdcard
- cp /binary /sdcard
- umount /sdcard
- sync
Booting the system
Please refer to Figure 2 in the
SoCrates datasheet for the layout of
SoCrates board.
- Install the microSD card in the SoCrates
- Set the Dip Switch P18 mode to OFF OFF ON ON OFF ON OFF ON
- P4 jumper should connect pins 1 and 2 and pins 5 and 6
- Use USB HUB to connect a keyboard, mouse and camera
- You can use USB to mini USB B cable, because drivers are set so the board always works as a host device.
- Connect LVDS TFT Display to P2 FPGA connector
- Connect a terminal cable to UART connector
- Connect Ethernet cable
- Connect USB blaster cable
- Power the board
- Programthe FPGA part while bootdelay is loading
- Wait for Linux to start
- Login with: account root, pasword root or with startx
Root filesystem
It is necessary to Download Linaro Linux Root file system from
official site. You can easily install mjpeg-streamer and stream USB camera to ethernet or take a pictures with it.
We used Linaro 13.0, but that release is not available anymore, so you can try with the new one.