Archive for the ‘Embedded’ Category

Xilinx Moves to AXI Protocol Fast

May 2, 2011

With the release of ISE 12.4 earlier in the year, 13.1 in last month, and the first 7-series Kintex device in production, Xilinx is moving fast to AXI (Advanced eXtensible Interface) protocol. AXI is one of the interface standard from ARM’s AMBA (Advanced Microcontroller Bus Architecture).

Here’s what happening:

  • Embedded Processor is in PowerPC to ARM transition
  • IP is moving to a single interconnect standard (AXI4) for Embedded, DSP and Connectivity domains
  • MicroBlaze is in PLB to AXI transition since v8

Coming ISE release will support AXI only 7-series devices. Virtex-6 and Spartan-6 have both PLB and AXI support.

PetaLogix released PetaLinux SDK 2.1 in April with full support of ISE 13.1 and AXI. I was able to bring up PetaLinux with AXI bus easily by following Board Bringup Guide.

PetaLinux with AXI

One important difference between PLB and AXI is, MicroBlaze with AXI is in little endian.

I can’t wait for Zynq-7000 EPP coming out. And MicroBlaze/AXI with PetaLinux is a good head start.

Advertisements

Linux Bring-Up on SoPC

February 21, 2011

System-on-Programmable-Chip is an emerging trend in the embedded world.
Here’s what I did to bring-up Petalinux on Xilinx Spartan-6 devkit SP605/SP601.
Petalinux is an embedded Linux distribution for Xilinx FPGA’s MicroBlaze softcore. Since SDK v1.3, the current release as of early 2011, Petalinux supports PowerPC440 hardcore.
Once you have the right hardware and software tools, such as devkit (SP605 or SP601), Xilinx ISE (12.4, 12.3 is fine), Petalinux SDK (v1.3) and a Linux host (a Xubuntu 10.4 VM on Macbook), it is surprising easy to bring-up Linux on FPGA. The idea is the same if you have a different hardware and software combination.

1. Install Xilinx ISE 12.4 for Linux. Petalinux SDK depends on Xilinx design suite to run.

I installed ISE (Embedded Edition) to a CIFS network share, which is a Journaled HFS+ external portable USB2 hard drive connected to Macbook (it is worth for another article to cover the topic, may be some other time). If ISE is installed on a virtual disk, it takes about 12G space for ISE, EDK, PlanAhead, LabTools and SDK (not all are necessary for our purpose).
Here’s how ISE 12.4 is setup.

ISE 12.4

Xilinx JTAG Platform Cable drive needs to be installed too. I installed CP210x USB/UART driver on Macbook host.

2. Install Petalinux SDK 1.3

The SDK should be installed on a Linux file system, because of some Linux specific symbolic links. I installed it to my Xubuntu’s second ext4 virtual disk.

Here’s how Xilinx and Petalinux (/media/users) are mounted:

Mounts

Here’s how SDK is setup. I installed it to /software/target/ because of the specific need for the projects I am working on.

SDK 1.3

3. Treakin Ubuntu
The following first two changes are needed for SDK under Ubuntu.

  • SDK scripts are using pushd/popd, so replace /bin/sh (link to /bin/dash) and point it to /bin/bash.
  • Create symbolic link /usr/bin/gmake, pointing to /usr/bin/make.
  • I also found a weird thing about SDK 1.3. It looks for some files from ISE 12.3, so create a symbolic link 12.3 and points it to 12.4 (See Picture ISE 12.4).
  • 4. Design hardware
    PetaLogix’s Board Bringup Guide is extremely useful, but not all that clear. To bring up Linux, it needs UART, system timer, DDR and MicroBlaze hardware, Ethernet and Flash are optional. UART, system timer and Ethernet must be interrupt driven.
    Create a folder, say sopc, under $PETALINUX/hardware/user-platforms.
    Launch Xilinx Platform Studio (enter $xps &) and choose Base System Builder wizard.

    Base System Builder wizard

    Create New XPS Project by specifying project file name, say sopc.xmp under $PETALINUX/hardware/user-platforms/sopc, and search path at $PETALINUX/hardware/edk_user_repository.

    XMP Project

    Keep “PLB system” as the default interconnect type, and move BSB wizard forward to “Board Select”. Choose “Spartan-6 SP605 Evaluation Platform” as the “Board Name”.

    SP605

    Move BSB wizard forward by using all default selections till “Peripheral Configuration”. Add xps_timer, check “Use Interrupt” option and choose “Two timers are present” for “Configuration Mode”.

    xps timer

    Check “Use Interrupt” option for Ethernet_MAC.

    Ethernet

    For RS232_Uart, select 115200 for “Baud Rate”, and check “Use Interrupt” option.

    UART

    Move to “Cache Configuration”, and check both “Instruction Cache” and “Data Cache”.

    Cache

    Move the wizard to the end to finish BSB, and go back to XPS. In “System Assembly View” tab, double click MicroBlaze instance to launch “MicroBlaze Configuration Wizard”. Select “Linux with MMU” configuration, and then “OK” button to finish the wizard.

    Select “Software Platform Settings” from XPS “Software” menu. For “Software Platform” tab, select “petalinux” as “OS” under “OS & Library Settings” section.

    Software Platform Petalinux

    For “OS and Lib Configuration” tab, make the selections for peripheral as highlighted in the following screenshot. If FLASH is used in the design, make sure its value is properly set.

    OS and Lib Configuration

    Now the hardware design is done, time to build bitstream by selecting “Generate Bitstream” from “Hardware” menu.
    Before doing that, and if FLASH is used, make sure FLASH’s base address must be after DDR3. It can be changed and verified from XPS “System Assembly View” tab under “Address”.
    In my environment, it takes about 22 minutes to finish the build process. The generated bit file is located at: $PETALINUX/hardware/user-platforms/sopc/implementation/sopc.bit. It will be used to configure Spartan-6 FPGA on SP605 later.

    5. Design software

  • Create software platform by using: petalinux-new-platform:
    petalinux-new-platform -c <cpu-arch> -v <VENDOR> -p <PLATFORM> 

    Create Software Platform

    Architecture configuration, Linux kernel configuration, and DTS file, etc., are generated at: $PETALINUX/software/petalinux-dist/vendors/tcao/sopc.

  • Configure Software Platform:
    petalinux-copy-autoconfig -v <VENDOR> -p <PLATFORM> PROJECT_FILE 

    Configure Software Platform

    FPGA configuration files and drivers are copied to proper folders in $PETALINUX/software/petalinux-dist/linux-2.6.x.

  • Configure Kernel and Applications.
    petalinux-config-kernel
    petalinux-config-apps 

    Configure Kernel and Apps

  • Build Linux Kernel
    cd $PETALINUX/software/petalinux-dist
    make 

    Build Kernel

    It takes about 21 minutes to build the kernel. Kernel image is at:
    $PETALINUX/software/petalinux-dist/images/image.elf.

    6. Upload configuration and application
    Now comes the fun part to configure FPGA and unload Linux kernel. Connect JTAG USB and USB/UART cables to the host, power on SP605 or SP601 board. I forward the JTAG USB connection to VM, and keep USB/UART connection to host (baud rate is 115200).

  • Configure FPGA
    Navigate to the hardware project folder and launch XMD:
    $xmd
    XMD% fpga -f xxx.bit

    FPGA Programming

  • Upload Linux Image
    Within XMD, connect to Microblaze core, upload the Linux image and boot Linux:
    XMD% connect mb mdm
    XMD% dow xxx.elf
    XMD% run

    Linux Upload

    From serial console, login as root.

    Petalinux Console

  • Change VMware virtual machine’s MAC address

    February 9, 2010

    When I try out evaluation software, such as ARM RVDS4 Professional, TI CCS4, I would often run them on different platforms, say Fedora, Ubuntu, and/or XP. The problem is that licenses are often locked on particular machine per ethernet MAC address.
    After couple of tries and googling, I figured out how to change MAC address for VMware virtual machines. My host is a Macbook Pro/OS X 10.6, VMware Fusion 3.0.1. My ethernet device is listed as ethernet0. Here’s what I did.
    Open virtual machine’s configuration file, .vmx file in your favorite editor, change two lines:
    1) ethernet0.addressType = “generated” to “static”, and
    2) ethernet0.generatedAddress = “your existing MAC address” to
    ethernet0.address = “you new MAC address”

    This gives me better opportunity to evaluate software before making the purchase call.

    I found out, in another day, that by using MAC address type of vpx, it allows you to use address in the range of “00:50:56:xx:xx:xx.”

    Build a custom Linux kernel for Beagleboard

    February 1, 2010

    After couple of successful tries to build Angstrom, Android and TI’s MontaVista for Beagleboard since last year, I decided to build a custom kernel with C6x DSP, NEON, OpenGLES2 and JPEG2000 decoder support.
    Here are what I have:

  • MacBook Pro 3.06 G Core 2 Duo, 4G DDR3 and 320G HD.
  • VMWare Fusion 3 for Mac.
  • VM Xubuntu (kernel 2.6.31-17) with cross-compiling toolchain built from my earlier projects.
  • Beagleboard Rev B6.
  • PL2303 based USB-Serial adapter.
  • Kensington USB Mini Dock with Ethernet.

    Here’s how I did to format a 4G SD card to get started:

  • FAT32 at first partition for booting
  • ext3 for file systems

    If the SD card is formatted, you will see hidden folders and files, such as .Trashes, created by OS X. You can delete them in Linux VM. To avoid OS X creates them again when you disconnect the SD card from VM, like showed below:
    you have to unmount the SD card manually from VM, and then remove it directly from SD card slot off Macbook.

    First, let’s partition the SD card. You can also find details from here.
    Once the “Apple Internal Memory Card Reader” is connected to VM from Fusion, find out which device is used by running dmesg. In my system, it is /dev/sdb.
    Format it by “sudo fdisk /dev/sdb”, followed by fdisk “d” command to delete any existing partitions if there are any. Use “p” command to verify there is no partition left. It may also tell how much space available, and in this case it is:
    Disk /dev/sdb: 4041 MB, 4041211904 bytes.

    Here’s what I created:
    Device Boot Start End Blocks Id System
    /dev/sdb1 * 1 17 136521 c W95 FAT32 (LBA)
    /dev/sdb2 18 491 3807405 83 Linux

    Don’t forget toggle the bootable flag for the first partition before committing the changes. Then format the first partition with:
    mkfs.msdos -F 32 /dev/sdb1 -n boot
    and the second partition with:
    mkfs.ext3 /dev/sdb2

    Mount both partitions to check. Then unmount the partitions and remove the SD card directly from SD card slot. The SD card is ready for boot loader and file system installation.