Thesis documents

Many people had contact me asking for references about my thesis and decide to post them online so any one could take a look at the work I did last year, hope this helps to every one interested; The general goal was:

Hardware/software co-design approach for re-configurable architectures based on the Xilinx ML507 PowerPC 440 platform.
This thesis aims to find a reliable solution for bringing the Linux operating system on embedded devices, focusing on Xilinx re-configurable architectures as a base platform.

I will continue to maintain Yoctoproject Xilinx meta layer [1] as soon I get some free time, hope in the next week’s I will publish some patch’s, I’m going to set a personal goal, meta-xilinx should get official BSP layer by Yoctoproject release 1.2 target for April 2012.

For now thesis is located here [alligator-os]
and presentation at [alligator-
os_17012011
].

Advertisements

Gsoc midterm, where to go next?

Gsoc midterm evaluations pass last week, and there’s some good news about the status of my project, since the close relation between Openembedded and Poky I extend the support for Xilinx platforms to Poky which is faster than OE to build the rootfs for the reason that are far less recipes to parse and some others features. While Poky support for virtex5 platforms resolves my thesis problem to provide a graphical desktop, it also makes easier the software development for new users by using the Poky Anjuta plug-in although in can be used with OE.

Ponky on xilinx virtex5

Microblaze support still needs some work, but I’m close to complete it there’s no major changes
that I need to add to OE just resolve some issues with gcc and binutils related on shared libraries
linkage, there was reported a similar problem in OE mailing list, and going to start looking on that
direction.

And since Gsoc program is approaching to the end, I’m considering to start looking on labor
market, but first I need to complete my thesis and unfortunately this means a two month slip
:(, at the moment I’m having some hard to track issues on a hardware bridge from the system
bus to a simple peripheral and requires to learn how to use chip-scope (virtual logic analyzer)
to track the signals in order to validate its behavior. Thank fully there are some channels on
YouTube where I can learn in a simple and pain less way thanks to several Indian Technology
Institutes for having lectures online.

Openembedded on xilinx virtex 4,5 support

In this lasts weeks I’have been working on Openembedded
for generic support for Xilinx virtex4, virtex5; Only u-boot and the
Linux kernel needs attention to be configured for the final target arch
since it can be Powerpc 405, 440 or Microblaze. Final arch settings needs
some user configuration in local.conf file it should be set the target
board options:

# Generic Powerpc 440 based board
MACHINE = “xilinx-virtex5”
TARGET_ARCH = “powerpc”
TARGET_CPU = “440”
TARGET_TUNE = “ppc440”
# Hardware project options
XILINX_BSP_PATH = “${HOME}/workspace/ppc44x/xilinx-ml507”
XILINX_BOARD = “ml507”

The machine can be xilinx-virtex4, xilinx-virtex5 or xilinx-mb-gen (generic microblaze)
the final arch can be override by setting TARGET_* values, for example for virtex5
family board targeting microblaze
TARGET_ARCH = “microblaze”
TARGET_CPU = “microblaze”
TARGET_TUNE = “microblaze”
I know that this is kind of odd but until I fix how to override this values inside conf
machine files this would be useful for testing stage.

The logic for setting the target options for u-boot and the kernel are handled in
xilinx-bsp.class where I add some logic for the configure settings based on the
TARGET_ARCH and XILINX_BOARD values, a similar approach is needed in config machine
files to do the black magic on setting the default options for a particular target
board.

I had problems with running any ace file (fpga bitstream + elf executable) from compact
flash on ML405 target board, on power-up the board was just flashing a led indicating an
error on compact flash read, and to solve the problem I had to add an option on
`etc/bitgen.ut` file

-g Match_cycle:NoWait

I’m not sure but it seems that my compact flash is the problem;

There’s a lot still to be done specially for Microblaze support, where I have to still
deal with glibc or uClibc to be integrated in OE, or to get working an external toolchain
Also fully test Angstrom on ml405 board since it’s failing when running init scripts it
complains about permissions errors.

The OE code changes can be found at http://gitorious.org/oe-microblaze

GSoC first week

I start working on OE microblaze support and is kind of tricky,
there are several efforts on updating gcc, binutils, glibc, and
I’m integrating from Xilinx repos since they are the most updated
versions available for microblaze; Still glibc build is failing
due to a mis configuration in binutils; So I have to options,
add a prebuild toolchain in OE or fix glibc; the exact error occurs at
linking the final objects ld complains about “unsupported emulation” to
workaround this there’s an run-time variable that can be used to set the
emulation mode `LDEMULATION` but fails in a later stage, so the error
roots are in binutils configuration.
OE changes are stored at http://gitorious.org/oe-microblaze/oe-microblaze

Xilinx provide me some target platform (ML405, ML507), for testing/validation
one of my concerns was import taxes from Mexican customs, but I provide the
paperwork to claim professional development usage to be extent of pay taxes,
well that’s one good thing of Mexican custom regulations, and I didn’t pay a
single dollar :). Thanks John and Grant for making possible to have some
hardware at home, that would free the only single ML507 board from my
school.

From Google every student is still waiting on welcome package and payment
cards, they are estimated to be delivered in two weeks, well lets wait and
see if Google is generous and send us a cool nexus one ;).

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.

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