GSoC participation

In the next months I’m going to continue working on Openembedded to add
support for Xilinx FPGAs platforms now as part of GSoC program and the
the Linux Foundation support via Grant L. who is my mentor, Grant
previously worked in OE to add support for Xilinx virtex 4 platforms and
is one of the Linux kernel developers for Powerpc so hes guide is valuable
for me.

The all idea of my project is to add OE support for Xilinx platforms,
Powerpc 405, 440 and Microblaze, where Microblaze represents the most
challenging arch to support since GCC support is recent I’m going to
face autotools hell when cross compiling the different utilities/programs
to generate a root file system for microblaze.

A special case for virtex4 (Powerpc 405) and virtex5 (Powerpc 440) board
families is that the target arch can be Powerpc or Microblaze so I need to
add some logic to override the final arch, but I think this is already handled
in the user configuration file (local.conf) via TARGET_ARCH variable.

So far I was able to generate XFCE and GPE images for graphical desktop support
for ml507 platform and changes are now on OE mailing list (I need to clean some
patchs and resend them) so once there integrated doing `bitbake xfce46-image`
you will get a nice desktop to play which includes Midori web browser.

Lately I’m been busy working on school final assignments and project so I can
finish earlier with the courses that I’m currently taking, since I want to have
more time working on my Gsoc project.

Advertisements

Openembedded xilinx-ml507 Xserver support

* Project in process

Finally after few weeks working on integrating xilinx display module (tft) on my hardware reference design (see xps_tft branch) is showing sings of been alive; I spend a complete week figuring out why the display hardware module always keep off, turn out the the reset pin, of the chip that drives the display, was driven to ground! damn you xilinx synthesis process that silently inform me about it; Whell after trying to use Linux to drive the display module I modify a test program to ensure that the module actually works.

Running the test program

1. Connect serial port
2. Connect Jtag
3. Connect LCD
4. Start Xilinx Platform Studio (xps)
5. Open the xps-tft project
6. Turn on board
7. Download bit stream
8. Open xmd debug application

xmd-console

9. Download executable program, in xmd console
dow TestApp_xps_tft_colorbar_ddr/executable.elf
10. Execute app
con
And you should see some numbers, screen blue, red, green and a colorbar

For openembedded xserver support I have to

* Enable some kernel options to enable the xilinx frame buffer driver documented at xilinx wiki
* Kernel patch to add support of new tft hardware version
* Include xorg configuration options
* Add xterm twm xclock to x11-sato-image
* Build x11-sato-image

Currently on power-up the board doesn’t loads the xilinxfb and the xserver fails to
initialize, I need to look on the modules.dep modules.xx to add the references and
make the proper changes on openembedded so it can magically start the xserver,
so far using insmod helps to test that the xilinx frame buffer driver works.

In target

cd /lib/modules/2.6.33/kernel/drivers/video/

insmod fb.ko
insmod cfbfillrect.ko
insmod cfbcopyarea.ko
isnmod cfbimgblt.ko
insmod xilinxfb.ko

Starting xserver by running

startx

And you should see

xilinx-ml507 xserver

Well I’m going to continue working on the auto-module load issue and look at sato
image init to see how matchbox is initialized, so I can have a cool window manager.
Also push some OE changes and update my oe-overlay so changes can be tested
earlier by any one interested.

My PC on fire!

Well almost; I upgrade my computer that I use for openembedded [1] builds with a
quad core processor, once I remove the old processor and put back everything in
place I turn on the computer and star a build from scratch to generate an
x11-sato-image [2], when I saw that the build process start I left to take dinner with
my parents and come back like two hours later, to my surprise a burning smell in
my room! so I brutally turn off my computer.

Once my computer cold down a little I open the case and everything look OK,
no wires around the CPU fan no apparent damage in the motherboard, so the
problem must be on the power supply, um strange my first tough is a brand
know power supply and it provides more that enough watts necessary to
power-up all my system, please don’t be the power supply (they are expensive
in Mexico) its out of warranty, it has more than 4 years, oh well let’s open it and
find out if I can fix it; And I did the fix was simple the fan got damage so I replace
it reassemble and plug everything back turn on and restart the build processes.

Power supply fix

This problem got me thinking that the high price on technology products are and
obstacle in order to generate our own innovations, I do spend a lot of money on
computers and gadgets which I pay the best case scenario like 20% over of their
price in a first world class country in some cases the deferential is up to the 100%.

Openembedded on xilinx ml507 quick how to

* Some notes are Fedora specific if you are using any other distro make the proper changes

I currently working on hardware/software co design project, my goals are at 
hardware level integrate peripheral modules following the wishbone spec at
software level boot the Linux kernel and develop the corresponding Linux device
driver. For first hardware candidate I’m consider a simple IO device that
I will connect to an encoder wheel so it can be used as an input device.

1. Install development libraries and tools on your host machine * Fedora way

sudo yum groupinstall “Development Libraries”
sudo yum groupinstall “Development Tools”

2. Set selinux in permissive mode

Edit the file /etc/sysconfig/selinux
sudo <your-favorite-text-editor> /etc/sysconfig/selinux
And set SELINUX to
SELINUX=permissive

3. Make Qemu happy set vm.mmap_min_addr = 0
Edit the file /etc/sysctl.conf
Add the next line
vm.mmap_min_addr = 0

4. Reboot so vm.mmap and selinux take effect

5. Getting some help scripts for setting openembedded

git clone git://github.com/aalonso/oe-utils
cd oe-utils

6. Setting Openembedded build environment

source oe-setup-env xilinx-ml507

The first time it will download Openembedded, Bitbake, create a work directories
structure and copy a local configuration file that you should edit to set the variables
XILINX_BSP_PATH and XILINX_MACHINE of your Xilinx XPS project dir.

7. Building console image

bitbake console-image

It would take a while depending on you computer monster; The result images are placed at

~/workspace/oe/build-xilinx-ml507/conf/tmp/deploy/glibc/images/xilinx-ml507

Angstrom-console-image-glibc-ipk-2009.X-test-20100319-xilinx-ml507.rootfs.tar
modules-2.6.32+git-r0-xilinx-ml507.tgz
u-boot-xilinx-ml507-git-r43.bin
uImage-2.6.32+git-r0-xilinx-ml507.bin
uImage-2.6.32+git-r0-xilinx-ml507.dtb

8. Build u-boot elf image

bitbake -b ~/workspace/oe/openembedded/recipes/u-boot/u-boot_git.bb

The build procedure will export the u-boot elf image to the hardware project dir
set via the XILINX_BSP_PATH variable

9. Generate ace image (u-boot + hardware model)

Use the script genace_all.sh provided in my hardware reference design; The scripts set xilinx devtools via “xlnx-env” script and can be found at previous blog post which is referenced as  “setup-xlnx”

10. Compact flash card partition layout

Disk /dev/sdc: 510 MB, 510418944 bytes
16 heads, 63 sectors/track, 989 cylinders
Units = cylinders of 1008 * 512 = 516096 bytes
Disk identifier: 0x001c2022
Device Boot      Start         End      Blocks   Id  System
/dev/sdc1   *           1         123       61960+   6  FAT16
/dev/sdc2             124         989      436464   83  Linux

11. Install the images to compact flash

Copy ace image to first partition
cp <project dir>/ML50X/cfg2/ml507_bsp_u-boot.ace /media/<first-partition>

Copy kernel image
cp <angstrom images dir>/uImage-2.6.32+git-r0-xilinx-ml507.bin /media/<first partition>/uImage.bin

Copy device tree blob
cp <angstrom images dir>/uImage-2.6.32+git-r0-xilinx-ml507.dtb /media/<firstpartition>/uImage.dtb

Extract root file system
sudo tar xf <angstrom images dir>/Angstrom-console-image-glibc-ipk-2009.X-test-20100319-xilinx-ml507.rootfs.tar -C /media/<second-partition>

Extract kernel modules
sudo tar xf <angstrom images dir>/modules-2.6.32+git-r0-xilinx-ml507.tgz -C /media/<second-partition>

12. First boot
Connect Uart1 to pc and open a serial terminal 9600 bps, 8N1 turn on board

13. Set u-boot variables

bootdelay=5
baudrate=9600
loads_echo=1
load_dtb=fatload ace 0 0x03000000 uimage.dtb 12288
load_kernel=fatload ace 0 0x03020000 uimage.bin 1890732
bootargs=console=ttyS0,9600 ip=on root=/dev/xsa2 rw
boot_addr=0x03020000 – 0x03000000
go=run load_dtb; run load_kernel; bootm $(boot_addr)
bootcmd=run go
stdin=serial
stdout=serial
stderr=serial

14. Reboot via system ace reset button

15. Subsequent development

Set OE dev environment

cd ~/workspace/oe/
source oe-setup-env xilinx-ml507

By default it updates Openembedded development branch and creates a
branch named xilinx-ml507 where you can add/improve bitbake recipes.

Sync your development branch with oe branch

cd ~/workspace/oe/openembbed
git merge org.openembedded.dev

More information about openembedded is here;

Angstrom on Xilinx ML507

* Important this is an experimental and ongoing project
After several kernel panics and machine exceptions I’m now been able to boot Linux on Xilinx Ml507 development platform; This board combines a Powerpc 440 cpu with standard peripherals like ethernet, serial ports, DVI, sata, etc. plus a large re configurable area where custom hardware can be developed and interconnected to the main CPU via the processor bus.
Xilinx provides a development environment but the Linux board support is pretty old since most vendors don’t support this board any more. Since there was previous work on Openembedded supporting previous version of this platform (Powerpc 405 based) adding support for Ml507 board is simple.
Most of the problems that arise in my initial efforts was setting the correct Kernel options, erroneous hardware configurations, missing dev nodes in final root file system. Christopher ‘Embedded Linux premier’ book prove to be a great reference also many of the xilinx application notes that I have to check to learn about the gotchas.
At my github repo there’s the result hardware project http://github.com/aalonso/xilinx-ml507 there’s two branches the master branch holds the reference design as described in the application note [1] the second branch adds the device tree infrastructure to generate the hardware descriptor file (*.dts) that the Kernel uses to find out about the resources available in the target system.
I push some patches to Openembedded developers list to add the corresponding support, this was important in order to simplify the process of replicating my developing environment for new team members in the lab at my faculty. Some of the problems that I still have is that ethernet device is not working, I have read some applications notes that mention that the driver provided in the Linux kernel only works in certain configuration mode; Alternative I can use the soft-ethernet hardware module since is reported that works.
Soon I will post a quick howto with the steps to boot Linux, for the moment
On the next week I’m going to give a crash course using Openembedded at my faculty, and also seriously thinking that my current project is a good candidate for participating in Google summer of code which is right at the corner.
[1] Using U-Boot with the Xilinx ML507 Evaluation Platform

Xilinx 11.4 on Fedora 12; Playing with Spartan 3e starter kit

A few months ago I was at the Mexico city airport waiting for my flight departure and to kill time I went to look at magazines shop and found a Linux Journal with an article that cough my eye “Bere-Metal hacks with fpga programming” Marco Fioretti
article describes some FPGA basics covering Xilinx design tools, so I give a try to use Xilinx suite using an target platform a Spartan3e starter kit.
Xilinx suite does a better job than Altera Quartus software, installation is simpler not to mention that far less workarounds to get the environment setup and running; I found Gorge’s wiki a well document procedure to install Xilinx tools plus installing an alternative Jtag driver. The next steps are a simplification to get everything working under Fedora 12.
1. Get Xilinx suite.
Go to http://www.xilinx.com/support/download/index.htm and get the full DVD suite or the Web installer client as you prefer; I downloaded the full suite `Xilinx_11.1_ISE_DS_SFD.tar`
2. Untar
tar xf Xilinx_11.1_ISE_DS_SFD.tar
3. Run the installer script
./xsetup
4. Install Jtag driver
Install dependencies
sudo yum -y install fxload libusb-devel
Get source code for alternative usb-driver
git clone git://git.zerfleddert.de/usb-driver
Build the driver
cd usb-driver
make
Copy the driver to a place that Xilinx tools can find it.
cp libusb-driver.so /opt/Xilinx/11.1/common/lib/lin64/
Copy udev rules and Jtag firmaware
cd /opt/Xilinx/11.1/common/bin/lin64/install_script/install_drivers/linux_drivers/pcusb/
sudo cp xusbdfwu.rules /etc/udev/rules.d/
sudo cp *.hex /usr/share/
Reload udev rules *Only needed the first time
sudo udevadm control –reload-rules
5. Create a setup-xlnx script and add the next lines
#!/bin/sh
# Xilinx Webpack 11.1
XILINX_BASE=”/opt/Xilinx”
XILINX_VERSION=”11.1″
DISPLAY=:0
source ${XILINX_BASE}/${XILINX_VERSION}/settings64.sh
source ${XILINX_BASE}/${XILINX_VERSION}/ISE/settings64.sh
source ${XILINX_BASE}/${XILINX_VERSION}/EDK/settings64.sh
# No need to preload usb library if you installed in a location
# where xlnx tools can find it
#export XIL_IMPACT_USE_LIBUSB=0
#export LD_PRELOAD=/usr/local/lib/libusb-driver.so
# Optional Xilinx license definitions, if you have access to them
#export XILINXD_LICENSE_FILE=”2100@pcdesign;X:\licenses\Xilinx.lic”
#export LM_LICENSE_FILE=”2100@pcdesign;X:\licenses\Xilinx.lic”
6. Open a terminal and source the setup-xlnx script
source setup-xlnx
7. Optionally run the xilinxupdate utility to get latest updates
xilinxupdate
8. Start playing with Xilinx tools
ise – hdl design
xps – system integration
xps_sdk – software development environment
impact – programming tool
9. Programming the FPGA
Once a you complete an hdl design you need to generate a bitstream file to program the FPGA the tools also crates a script that can be used to automate the programing process just run
impact -batch <project-path>/etc/download.cmd
10. Continue learning
I have found in youtube several tutorial for hdl design using Xilinx tools even complete courses thanks to several Indian institutes of Technology

2010

For me 2009 passed really fast, I complete almost the 70% of credits needed to graduate;
Participate in a couple of Linux events in Mexico city, giving some Fedora project talks;
Enjoy a summer job where I had the chance to travel to South Korea, I had to deal whit job
commitments and parting at Seoul which was the hard part :P; Work on my thesis which
I have an 10% of progress; Resist the tentative to leave school for many interesting job offers.
For this year the priority is school I need to cover the rest of my credits and work harder on
my thesis, for this I’m getting the right tools a new lap and a book `Essential Linux device drivers`
which by the way is pretty complete and has a must read chapter ‘Kernel facilities’ that deal with
kernel threads, linked list, hash list that for a newbie like me must be aware about the built
in helper APIs.
I would like to assist to CELF at San Francisco but reality always imposes, I’m short of covering
the expenses, Mexico did’t do a good job to deal the economical crisis we have a new increase
on taxes and basically a cost increase on everything, my scholarship will suffer a reduction,
thanks blind politicians! Actually around my classmates I feel a very high pessimism, is like
where are going to grow the unemployment rate once we finish whit our studies;
Thankfully they are several immigrant friendly countries.