Tag Archive | fedora

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

Scratchbox + Maemo SDK 4.1.1 on Fedora 9

My everyday working machine is based on Fedora 9 x86_64. Since Scratchbox is officially supported only by i386 archs I have been looking for an optimal solution to get it working inside of my box.

The most clean solution is to fake an i386 architecture by using setarch command, this way the checking prerequisites are satisfied and you able to install scratchbox by following the usual procedure, with some workarounds.

Scratchbox know limitations:

Qemu “mmap_min_addr” value grather than 4096

Edit /etc/sysctl.conf and add:
vm.mmap_min_addr = 4096

Scratchbox doesn’t work when VDSO support is enabled in the host’s kernel.

To disable VDSO support in x86_64 kernels you need to add the vdso32=0 options
in your kenel boot line

Edit /boot/grub/menu.lst and add vdso32=0 my kernel boot looks like:

kernel /vmlinuz-2.6.26.6-79.fc9.x86_64 ro root=/dev/VolGroup00/LogVol00 rhgb quiet vdso32=0

Reboot your machine so VDSO can be disabled.

Installing Scratchbox:

Get the installer script:
wget http://repository.maemo.org/stable/4.1.1/maemo-scratchbox-install_4.1.1.sh

Give executable permitions to the script:
chmod +x maemo-scratchbox-install_4.1.1.sh

Disable Selinux:
echo 0 > /selinux/enforce

Other wise the installer script will complain

Fake a i386 arch:

sudo setarch i386

Run installer script:

sudo ./maemo-scratchbox-install_4.1.1.sh -s <install-path> -u <your-username>

This will take a while, when it finish you will see a massage like this:

Installation was successful!
—————————-

Installing Maemo SDK:

Download SDK installer script

wget http://repository.maemo.org/stable/4.1.1/maemo-sdk-install_4.1.1.sh

Give executable permitions to the script:
chmod +x maemo-sdk-install_4.1.1.sh

Fake i386 arch:

setarch i386

Satrt sbox service:

sudo <sb-install-path>/sbin/sbox_ctl start

Run the sdk install script
sh ./maemo-sdk-install_4.1.1.sh -y -s -d <sb-install-path>

Testing scratchbox and the sdk:

Install Xephyr server to forward sb xorg-X11

sudo yum install xorg-x11-server-Xephyr

Start Xephyr server:

Xephyr :2 -host-cursor -screen 800x480x16 -dpi 96 -ac -extension Composite

Start sbox and login

sudo /opt/scratchbox/sbin/sbox_ctl start

/opt/scratchbox/login

Create a file named hello-maemo.c and add the following lines:

/*********/

#include <hildon/hildon-program.h>
#include <gtk/gtkmain.h>
#include <gtk/gtkbutton.h>

int main(int argc, char *argv[])
{
/* Create needed variables */
HildonProgram *program;
HildonWindow *window;
GtkWidget *button;

/* Initialize the GTK. */
gtk_init(&argc, &argv);

/* Create the hildon program and setup the title */
program = HILDON_PROGRAM(hildon_program_get_instance());
g_set_application_name(“Hello maemo!”);

/* Create HildonWindow and set it to HildonProgram */
window = HILDON_WINDOW(hildon_window_new());
hildon_program_add_window(program, window);

/* Create button and add it to main view */
button = gtk_button_new_with_label(“Hello!”);
gtk_container_add(GTK_CONTAINER(window), button);

/* Connect signal to X in the upper corner */
g_signal_connect(G_OBJECT(window), “delete_event”,
G_CALLBACK(gtk_main_quit), NULL);

/* Begin the main application */
gtk_widget_show_all(GTK_WIDGET(window));
gtk_main();

/* Exit */
return 0;
}

/*********/

Compile the hello-maemo example:

gcc -o hello-maemo hello-maemo.c `pkg-config –cflags gtk+-2.0 hildon-1` -ansi -Wall `pkg-config –libs gtk+-2.0 hildon-1`

Set the DISPLAY variable to poit to the Xephyr server

export DISPLAY=:2

Start the maemo scratchbox enviroment test script:

af-sb-init.sh start

Run the hello_maemo application:

run-standalone.sh ./hello_maemo

hello_maemo

References:

http://www.progbox.co.uk/wordpress/?p=453

http://znark.com/blog/2008/09/21/maemo-sdk-on-fedora-9

Follow

Get every new post delivered to your Inbox.