Sie sind auf Seite 1von 27

Notes on uCLinux for Spartan 3E 1500 Development Kit

using EDK 9.1 and PetaLinux


Duy-Ky Nguyen 2007-July-10
© All Rights Reserved

Note :
HW : It is 1500 because it’s modified from 500, the only change is FPGA from XC3S500E to XC3S1600E.
The reference board 500E-RevD is copied as 1600E-Rev B, FPGA changes from 500 to 1600. That’s it. While
there’s a refenece board 1600E-RevA.
SW : Select Xilinx 500 from PetaLinux as it’s the closest for the target board.

This document is based on an open-source MicroBlaze port of uCLinux from PetaLogix.com


• petalinux-v0.20-rc3.tar.gz (318 MByte compressed)

1. SW Platform
An auto-config.in will be created for Linux 2.4

Select 66.67 MHz for 100 BaseT Ethernet

I:\_MY_EDK\_DKN_\DOC\PetaLinux_v4.doc 11/4/2007 @ 5:18 PM


Select PetaLinux OS with Frequency 66666667 Hz

Select lmb_memory = dlmb_ctlr, flash_memory_bank=0, flash_memory=FLASH_16Mx8

PetaLinux_v4.doc Page 2 of 27
Select main_memory_bank=0, main_memory=DDR_SDRAM_32Mx16, stdin-out=DTE,
TARGET_DIR=../../… If TARGET_DIR is left blank, the auto-config.in will not be copied from dir
microblaze_0/libsrc/petalinux to the top project folder

Click Software – Generate Libraries and BSPs to create auto-config.in

This auto-config.in must be converted into UNIX format before copied to PetaLinux

./petalinux-v0.20-rc3/software/petalinux-dist/linux-2.4.x/arch/microblaze/platform/microblaze-auto

PetaLinux_v4.doc Page 3 of 27
2. PetaLinux
Download a uCLinux distro from petalogix.com petalinux-v0.20-rc3.tar.gz

2.1. General Configuration


This distro works for “make menuconfig”, not xconfig. This distro will be used on CentOS PC as
recommnded, infact CentODS 4 on VMWare 5.

It's easier if using "make xconfig". It seems to me that there's a tiny bug in
~/petalinux-v0.20-rc3/tools/linux-i386/microblaze-uclinux-tools/microblaze-
uclinux/include/config/config.tk

By adding

set CONFIG_PRODUCT "SP3E500"

at the top of the file

then we're able to use make xconfig.

Vendor/Product : Select Xilinx and Spartan3E500

PetaLinux_v4.doc Page 4 of 27
Kernel/Libraries : Select Linux 2.4, Customize Kernel, Customize Vendor, Update Default

SAVE and EXIT

2.2. Kernel Configuration

PetaLinux_v4.doc Page 5 of 27
Processor type and Features : < > GPIO driver

Load Keypad support as Module <M>

PetaLinux_v4.doc Page 6 of 27
General setup : Use defaults with Networking support

PetaLinux_v4.doc Page 7 of 27
PetaLinux_v4.doc Page 8 of 27
MTD : Use defaults

RAM/ROM/Flash : <*> Intel/Sharp

PetaLinux_v4.doc Page 9 of 27
PetaLinux_v4.doc Page 10 of 27
Mapping flash : Select PetaLinux Autoconfig and Generic filesystem

Network device : <*> Network device support


PetaLinux_v4.doc Page 11 of 27
Ethernet : <*> Xilinx

SAVE and EXIT

PetaLinux_v4.doc Page 12 of 27
2.3. System Configuration & Update Default Settings

TFTP

Network Address : Static IP

PetaLinux_v4.doc Page 13 of 27
BusyBox : DMESG, GREP

PetaLinux_v4.doc Page 14 of 27
3. Modify PetaLinux
3.1. Input Driver
The distro supports RevC with rotary button switch using Btn_Decoder_Bus. Our Rev-D does not have this.
There’re 2 options of adaption (1) modify HW file (MHS, pcores, …) (2) modify driver. Both way were caaried
out and the SW approach was found simpler. In the file linux-2.4.x/drivers/input/keypaddev.c, do t2 changes
below

* CONFIG_XILINX_BTN_DECODER_0_IRQ -> CONFIG_XILINX_GPIO_2_IRQ


* CONFIG_XILINX_BTN_DECODER_0_BASEADDR -> CONFIG_XILINX_GPIO_2_BASEADDR

3.2. U-Boot

3.2.1. Linux Input Driver


The Linux driver/input/keypaddev.c must be modified to correct IRQ

3.2.2. U-Boot Config


The board config u-boot/includes/configs/petalinux-xxxx.h must be fixed to correct u-boot script

3.2.3. U-Boot cmd_mem.c - cfi_flash.c


The common/cmd_mem.c and drivers/cfi_flash.c should be modified to monitor programming flash with dot ‘.’
as it takes a lot of time to program the kernel.

PetaLinux_v4.doc Page 15 of 27
4. Testing Linux Image
We will use USB JTAG to test Linux kernel image

make menuconfig
make dep
make all

All images, inc. u-boot, will be created in folder images, and also copied tp TFTP, as u-boot will get images
over thw network and program the flash.
Copy these images from Linux PC to WXP. On the WXP, cd to this dir and do the following

../images>> xmd
XMD% connect mb mdm
XMD% dow –data image.bin 0x44000000
XMD% con 0x44000000
XMD% exit
../images>>

PetaLinux_v4.doc Page 16 of 27
5. U-BOOT
Image Flash Location Note
u-boot-s.bin Top of Flash Relocatable of u-boot.bin
0x00000 : u-boot
0x40000 : env
0x80000 : config
image.ub 0xC0000 kernel after mkimage of image.bin to add magic number of
filesystem
Kernel is locked at offset $C0000
FPGA + RawBoot Bottom of Flash Using BPI-Down config mode
0xFBAB80 The starting address makes the last byte of the file at the last
location of the flash

U-BOOT will be used use to burn kernel across network using TFTP. So network parameters are set by “make
menuconfig – user – settings – system settings – Network Addresses”.

The first time u-boot loaded into flash, it keeps complaining about Bad CRC until its env is saved

U-boot> saveenv

Note : all u-boot commands support lazy typing, eg savve for saveenv, pri for printenv. Type help for
help

PetaLinux_v4.doc Page 17 of 27
Reboot the target, and type pri to see what u-boot cmd available

To erase the u-boot env


U-Boot> run era_env

To update the u-boot itself


U-Boot> run up_ubt

To update the Linux kernel


run up_krnl

PetaLinux_v4.doc Page 18 of 27
PetaLinux_v4.doc Page 19 of 27
Top of Flash @ $43000000

U-Boot start $47fc0000

PetaLinux_v4.doc Page 20 of 27
Malloc starts $47f60000

Board Info start $47f5ffd0

PetaLinux_v4.doc Page 21 of 27
Boot Parameters start $47f4ffd0

DDR SDRAM start $44000000

6. Adding new File

PetaLinux_v4.doc Page 22 of 27
Filesystem
PetaLinux uses read-only CRAMFS. So we’ll consider 2 issues (1) How to add new files (2) How to test SW
during development using NFS mount, ie (a) edit and compile code on a host and (b) download and run on the
target

6.1. Adding New File


There is a filesystem under folder “romfs” which is going into the target. New file could be a special file, eg
device filke, or a regular one, like an executable one. A device file must be in folder “romfs/dev/”. If a regular
file is a user application, it should be in “romfs/home”.

To add a device file, go to folder “romfs/dev” and do command

touch @newdev,c,major,minor

To add a regular file, just simply copy it to, say “romfs/home”

Lastly, run command to make image for the target

make image

If we want to run an executable user application, say my_LCD, right at start of target session, we need to
modify the file “romfs/etc/rc” by adding to its bottom the line below

/home/my_LCD

Make sure it’s executable.

6.2. Using NFS Mount


We can edit and compile user application in whatever folder we want, but we have to copy the executable
application into “NFS-able” folder.

Assume the host has a folder “/root/petalinux/myApps” to be NFS mount. An user application must be copied
intop this folder and this folder must be NFS-mount to run this application.

A folder is called “NFS-able” must meet the conditions on the HOST below
• make sure the kernel is configured to support NFS mount
• make sure the NFS folder has the mode 777
• the host must have the line “/root/petalinux/myApps *(rw,no_root_squash,no_all_squash)” in the
file “/etc/exports”
• NFS is activated on the host using “/etc/init.d/nfs restart”

To mount the NFS-able host folder to the target folder /mnt on the target

mount -t nfs target_IP:/root/petalinux/myApps /mnt -o rsize=2048,wsize=2048

To save typing and to avoid typo mistake on the target, the folder “romfs/etc” should be added a file “fstab”
with content below

host_IP:/root/petalinux/myApps /mnt nfs rsize=2048,wsize=2048 0 0

PetaLinux_v4.doc Page 23 of 27
On the target, right after bootup, run command

mount /mnt

it will read the file fsatb and mount the correct folder /root/petalinux/myApps

7. NFS Boot
To do net boot, we have to config networking option with level autoconfiguration and Root filesystem on NFS.
In addition, we have to setup DHCPD and NFS on the host.

NOTE : Unable to compile PetaLinux with this option !

[M] GPIO driver

PetaLinux_v4.doc Page 24 of 27
[*] IP: kernel level autoconfiguration
[*] IP: DHCP support

<*> Kernel automounter version 4 support

[*] Root Filesystem on NFS

PetaLinux_v4.doc Page 25 of 27
PetaLinux_v4.doc Page 26 of 27
8. References
http://developer.petalogix.com/wiki/UserGuide

PetaLinux_v4.doc Page 27 of 27

Das könnte Ihnen auch gefallen