2010

Wow another year ended and I’m being just to quite busy concluding with my master degree and doing part time open source projects. From March I begin working on Linux board bring up for several FPGA platforms under the umbrella of the Linux foundation and Google, as a GSoC project. By concluding my participation on GSoC represented the first of my goals for 2010 being a GSoC student; The second goal was to conclude with my studies which I did just a few weeks a go. The third one was getting back to professional labor market and GSoC counts, and from September I’ve been collaborating for a secret company which have many associates around the world and is so secrecy that we don’t know each other, well not exactly.

Working on both projects was quite challenging, in my school GSoC was perceived as a distraction, at some point it reach a critical point since part time activities are not allowed. Some school polices are obsolete and prevent collaboration between universities and companies, far from any other countries where participation in programs similar to GSoC are encorage and students can receive credits for their participation. On top of that in the first semester I was taking 3 courses, GSoC and thesis wow I was with just to much activities to do, I quit with my sport activities just to recover some time and increase my workdays to weekends, by the second semester I was concluding with GSoC and starting doing the heavy work of my thesis, still no weekends free until late September when I decide to celebrate with some friends and went to a nice place to have a few drinks which ended in nothing good I was victim of alcohol check points mafia in Mexico city and end up in jail for the weekend :(.

In November I attend to Linux Plumbers conference at Boston, where I meet a lot of people like some Ubuntu developers, Yocto project contributors and kernel hackers, well I need to continually attend this type of events since is where I can learn from others, working from home and living in a large city without a decent Linux user group does not help.

The only negative aspect in this year is that I don’t plan to continue participating in open source conferences in Mexico city, is hard when you have to deal with people that thinks that are free software contributors because they use open office. Imagine Debian community polices and apply it to a group with some technology knowledge but can’t write a line of code, um not exactly better wording is people that use open software but in any form they contribute to its development.  Most Mexico city Lugs are just to elitist, and the “elite” group just sucks! So what can be done to form a decent LUG? That’s another blog story.

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;

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.

Altera Quartus 2 on Fedora 11

On the past months I was enrolled in a “Hardware Description Languages” course where we work with FPGAs implementing several hardware designs, the class cover VHDL and Verilog and I feel quite comfortable working with Verilog. As target platform I use an Altera DE2 devboard and Quartus II IDE;

Installing Quartus II is quite trivial on Fedora 11

1. Install tcsh shell

su -c “yum install tcsh”

2. From www.altera.com/download

Download Quartus II web-install script

3. Give executable permissions to the script

chmod +x 90_altera_webinstall.sh

4. Install dependencies for the installer script (Only for 64 bit systems)

su -c “yum install glibc.i586 glibc-devel.i586”

su -c “yum install libSM.i586 libzip.i586 libXi.i586 libXrender.i586 libXrandr.i586”

su -c “yum install freetype.i586 fontconfig.i586”

5. Run the Quartus II web-install script

./90_altera_webinstall.sh

Follow the installer

altera-webinstall

altera-webinstall-02

altera-webinstall-03

6. Edit ~/.bashrc file and add the path for “quartus/bin”

export PATH=$PATH:/<quartus-install-dir>/quartus/bin

7. Open a new terminal and launch Quartus II IDE

quartus –64bit

With the previous steps you have Quartus II installed, you can now create your own design and simulate them, for downloading your designs to the FPGA you will need a helper script that will start/stop the jtag demon and to create a udev rule file to allow all user to access the usb-blaster device.

On DE2 development platform usb-blaster is used to interface the Jtag server and the FPGA. I have found some references about using usb-blaster in Linux by adding udev rules to properly handle the usb programmer.

8. Create a udev rules file at /etc/udev/rules.d/ such as 30-usb-blaster.rules

Add the following lines

# Altera DE2 USB blaster udev rules
# Adrian Alonso <aalonso00@gmail.com>
#
SUBSYSTEM==”usb”,SYSFS{idVendor}==”09fb”,SYSFS{idProduct}==”6001″,MODE=”0666″,SYMLINK+=”usb-blaster”

Basically when the Usb-blaster is connected to the computer, the udev rules are triggered and based on the idVendor and idProduct values a dev node is created /dev/usb-blaster whit the permissions for Read/Write for every user.

Reload udev rules

su -c “udevcontrol –reload_rules”

*Note: This is only necessary the first time to enable the new rules.

9. Copy the next script and place the script at /<quartus-install-dir>/quartus/bin/
*Note: Change the JTAGD variable for the correct path.
————————————————————————————————–
#!/bin/bash
# Jtag server for usb-blaster
# Based on Dalon Jtagd script
# Reference: http://forum.niosforum.com/forum/index.php?showtopic=5486
# Adrian Alonso <aalonso00@gmail.com>
# Fix stop demon

# Source functions library
source /etc/rc.d/init.d/functions

RET=0
PROG=”jtagd”
PID_FILE=/var/run/jtagd.pid
JTAGD=/opt/altera9.0/quartus/bin/jtagd

start ()
{
echo -n $”Starting $PROG sever:”
$JTAGD && success || failure
RET=$?
pidofproc $PROG >> $PID_FILE
echo
}

stop ()
{
local pid
pidfileofproc $JTAG >> pid
if [ -n $pid]; then
echo -n $”Stopping $PROG server”
killproc $JTAGD
else
failure $”Stooping $PROG”
fi
echo
}

case “$1″ in
start)
start
;;
stop)
stop
;;
restart)
stop
start
;;
*)
echo $”Usage: $0 {start|stop|restart}”
RET=1
esac

exit $RET
————————————————————————————————–

10. Start the Jtag server by

<script-name.sh> start

11. Create a jtag config file

touch /home/<user>/.jtag.conf

Yes, the file is empty, when launching the programmer from Quartus IDE it only checks if this file exits.

12. From Quartus II launch the programmer and select the device “usb-blaster” to be able to download your design.

programmer

13. SOPC builder fix

When I try to start the SOPC builder I just saw an splash screen and nothing happened, looking at the run time log files “sopc_builder_log.txt” (is placed on your main project directory), libXtst library is missing so just installing it will solve the problem.

su -c “yum install libXtst.i586”

spoc_builder

14. Working with NIOS IDE

Install dependency libraries

su -c “yum install gtk2.i586 libcanberra-gtk2.i586”

Create a script named nios2.sh and add the following lines (Make the proper changes)
————————————————————————————————–
#!/bin/bash
# User specific aliases and functions
export QUARTUS_64BIT=1
QUARTUS_BASE=/opt/altera9.0
export QUARTUS_ROOTDIR=$QUARTUS_BASE/quartus
export SOPC_KIT_NIOS2=$QUARTUS_BASE/nios2eds
export SOPC_BUILDER_PATH=$QUARTUS_BASE/nios2eds
unset GCC_EXEC_PREFIX
export PERL5LIB=/usr/lib/perl5/5.10.0
bash –rcfile $QUARTUS_ROOTDIR/sopc_builder/bin/nios_bash
————————————————————————————————–
Running the script will set the shell with all the environment variables needed to use the nios2 ide.

Start nios2-ide from the shell

nios2-ide

nios2-ide

There should be  a better way to wrap around 64bit libraries and avoid to install 32bit libraries to work with Quartus II.

GSoC Project

GstEditor

Project goal: Enhance GstEditor.

My purpose is to rewrite GstEditor using Python, PyGooCanvas and Gstreamer bindigns for python in order to deliver an rich eye candy GstEditor; Preserving all the previous good ideas such as the ability to load/save pipelines in gst-xml format.

Brendan Howell GstEditor Python port http://gsteditor.wordpress.com/ is based on PyGooCanvas version 0.40  and there’s a significantly API changes for latest stable API version, the first task will be to fix the user interface.

The benefits for the Gstreamer community:

  • Provide a flexible tool for learning purposes on how the Gstreamer framework works
  • Use the exported pipeline in gst-xml format  in new applications can help new developers to integrate Gstreamer.

I like to take part of the GstEditor team in order to gain experience on Gstreamer framework that in a near feature will let me participate in a complex tasks enhancing the Gstreamer framework.

This project will be part of my semester project for “Object Oriented Programing” course that I’m currently taking.

Work plan:

  1. User interface, create the user interface with Glade.
  2. Connect the appropriate signals for functions callbacks.
  3. Integrate PyGoocanvas for GstElements figure drawing.
  4. Reuse/enhance the Gstreamer playback engine.

About me:

I’m a student in computer engineering, my study fields covers embedded systems and software engineering, my everyday duties are around programming desktop application in C, Python or programming in hardware description languages such us verilog.

I feel comfortable in both fields software/hardware and actually I have some work experience as a software engineer, a year ago I was working with TI OMAP processor dealing with audio/speech codecs, basically I used to work on an API that communicates the DSP side with the GPP side, in top of this Gstreamer is used for QA,  this is where I had my first exposure dealing with pipelines!

I’m a contributor to the Fedora project https://fedoraproject.org/wiki/User:Aalonso, from time to time I give tech talks promoting the use of open source technologies, one way to reduce the technological dependency of my country is to generate open alternatives that can benefit every one.

My home country is Mexico, and my school blocks all the useful ports for software developing svn, git, irc, all blocked, since this can be an issue I will use my home computer as a http_proxy.

Some of the projects that I work on last semester are:

Csmile:

Is an small application that takes pictures from a webcam, is written in C and uses Gstreamer to render the frame video captured from the webcam, the final picture is encoded using pixbuf utilities. The application turn out to be a great example on how not to use Goobject since I never implement an interface for get/set properties that can be used for changing the video frame size, final picture size, and as you ca see the picture orientation.

screenshot-csmile

Sigbox:

Is a simple PyGtk application for digital filter design, the application can load an wav audio file, choose a segment and apply a FIR or IIR filter. I wrote this app to demonstrate that Python, Matplotlib, Scipy and Numpy can be used as a replacement for Matlab, although there’s a minor bug on the installation script that I haven’t fix.
Both projects can be downloaded from github

Fedora project ambassador

Hace unos días me registre como colaborador del proyecto Fedora como miembro del grupo de embajadores, la meta del grupo es de difundir el uso de Linux y tecnologías de software libre a lo largo del mundo. Personalmente me preocupa el hecho de que nuestro país no figure como potencia en cuanto al desarrollo de tecnologías de software, desarrolladores Mexicanos hay lo que siento que hace falta es la visión y un plan de acción de proyectos que contribuyan al desarrollo social y económico del país.

Bajo esa preocupación me uní al grupo y pretendo contribuir de la siguiente forma:

  • Dando platica de desarrollo de software libre.
  • Contribuir con los esfuerzos actuales trabajando junto a los representantes de Fedora en Mexico.
  • Asistir a los diferentes congresos de software libre y conocer gente con intereses similares.

————————————————————————————————————————————–

I just register as an ambassador for the Fedora project, the goal of this team is to spread the word of free software and Linux usage across the globe, I’m concern about the fact that in Mexico the usage of free software technologies is quite low, despite that the list of Mexican free software developers is large, to help spreading the word I’m going to promote the use of Fedora for free software development by:

  • Giving talks related of free software development.
  • Contribute with current efforts and local Fedora representatives.
  • Attend to the different Linux congresses and meet people with the same interests
Fedora aalonso
Fedora aalonso