IPB

Welcome Guest ( Log In | Register )

 
Reply to this topicStart new topic
> using Petalinux
nicolas.herve
post Jul 20 2009, 01:07 PM
Post #1


Member
**

Group: Members
Posts: 5
Joined: 8-July 09
Member No.: 2,496



Hi all !

I am tempting to use the latest Petalinux distribution with the image filter example (PSP_Xilinx_Microblaze, Tutorial 4: Using uClinux), that is to substitute the windows-version prebuilt uclinux cross-tools with an up-to-date Petalinux environment.

Following the steps of the Impulse tutorial, step 5 has to be replace with the configuration of the linux kernel.
In my case, I have configured a system with kernel version 2.6, the glibc library and a MMU.
Then in step 6 the Makefile have to be changed in order to use the Petalinux cross-tools.

In particular the original Makefile compiles with mb-gcc, I have changed for mb-linux-gcc and it would links the final executable with the following command (after variable substitution)

CODE
$ make -f Makefile_orig -n | tail -1
/opt/Impulse/CoDeveloper3/uClinux/elf2flt/ld-elf2flt -Os -g -elf2flt -L/opt/Impulse/CoDeveloper3/uClinux/lib/uClibc/lib
-o img img_sw.o tiff.o co_init.o libimpulsec.a /opt/Impulse/CoDeveloper3/uClinux/lib/uClibc/lib/crt0.o -lc
/opt/Impulse/CoDeveloper3/uClinux/tools/lib/gcc-lib/microblaze/2.95.3-4/libgcc.a
/opt/Impulse/CoDeveloper3/uClinux/tools/microblaze/lib/libc_hard_shift.a -lc


that I have simply changed in

CODE
$ make -f Makefile_petalinux -n | tail -1
mb-linux-gcc -o img img_sw.o tiff.o co_init.o libimpulsec.a


It compiles without claiming, but when I test the executable on the target with arguments, I have a segmentation fault.
So the build should not be ok.


CODE
# ./img
usage: fpga_edge <input file> <output file>
# ./img peppers.tiff output.tiff
Edge Detect Demo
----------------
Running...
Segmentation fault



What is missing ?

Full content of my Makefile is included at end of mail.

Nicolas


---
ifeq ($(FSL),)
FSL = 0
endif
IMPULSEC_HOME=/opt/Impulse/CoDeveloper3
UCLINUX=$(IMPULSEC_HOME)/uClinux

UCLIB_INC=$(INCLUDE)
UCLIB_LIB=$(UCLINUX)/lib/uClibc/lib

MB_LIB=$(UCLINUX)/tools/microblaze/lib

MB_GCC_LIB= /opt/Xilinx/10.1/EDK/gnu/microblaze/lin64/lib/gcc/microblaze-xilinx-elf/4.1.1
MB_LIB_LIB= /opt/Xilinx/10.1/EDK/gnu/microblaze/lin64/microblaze-xilinx-elf/lib

MB_CC=mb-linux-gcc
MB_LD=mb-linux-ld
MB_AR=mb-linux-ar

CFLAGS=-Os -g -fomit-frame-pointer -DIMPULSE_FIRST_FSL=$(FSL) -Dlinux -D__linux__ -Dunix -D__uClinux__ -DEMBED -I$(UCLIB_INC) -fno-builtin -mno-xl-soft-mul -O -mno-xl-soft-div -mxl-barrel-shift

LFLAGS=-Os -g -elf2flt
#-L$(UCLIB_LIB)


LIBS= $(UCLIB_LIB)/crt0.o \
-lc \
$(MB_GCC_LIB)/libgcc.a \
$(MB_LIB)/libc_hard_shift.a \
-lc

img: img_sw.o tiff.o co_init.o libimpulsec.a
$(MB_CC) -o $@ img_sw.o tiff.o co_init.o libimpulsec.a
# $(MB_LD) $(LFLAGS) -o $@ img_sw.o tiff.o co_init.o libimpulsec.a $(LIBS)

libimpulsec.a: co_stream.o co_signal.o co_register.o co_memory.o co_process.o co_type.o
$(MB_AR) -r $@ co_stream.o co_signal.o co_register.o co_memory.o co_process.o co_type.o

.c.o:
$(MB_CC) $(CFLAGS) -o $@ -c $<

clean:
rm -rf *.o img
Go to the top of the page
 
+Quote Post
nicolas.herve
post Jul 22 2009, 10:42 AM
Post #2


Member
**

Group: Members
Posts: 5
Joined: 8-July 09
Member No.: 2,496



Indeed the question could be reformulate as :
- how to use the linux fslfifo kernel driver with C-to-FPGA ?

A kernel driver is required when using MMU with memory protection with linux since the FSL instructions are priviledged instructions.

Go to the top of the page
 
+Quote Post
RalphBodenner
post Jul 27 2009, 07:13 PM
Post #3


Advanced Member
***

Group: Admin
Posts: 348
Joined: 4-January 05
Member No.: 3



I would take a look at BlueCat Linux and the PSP we offer for it, as I suspect it may use a similar driver. The relevant source and Makefiles are in %IMPULSEC_HOME%\Architectures\Xilinx\MicroBlaze\BlueCat\. There is also documentation for a BlueCat example here:

http://www.ImpulseAccelerated.com/ReadyToR...ECAT_MBLAZE.pdf

(We don't officially support Petalinux.)

Regards,
Ralph


--------------------
Ralph Bodenner
Impulse Accelerated Technologies, Inc.
Go to the top of the page
 
+Quote Post
nicolas.herve
post Jul 28 2009, 06:54 AM
Post #4


Member
**

Group: Members
Posts: 5
Joined: 8-July 09
Member No.: 2,496



Yes, indeed my grep searches lead me to the BlueCat include files.

% grep fslfifo -r $IMPULSEC_HOME
/opt/Impulse/CoDeveloper3/Architectures/Xilinx/MicroBlaze/BlueCat/inc/co.h:#include
"fslfifo_ioctl.h"
/opt/Impulse/CoDeveloper3/Architectures/Xilinx/MicroBlaze/BlueCat/inc/fslfifo_ioctl.h:
* drivers/char/xilinx_fsl/fslfifo_ioctl.h
/opt/Impulse/CoDeveloper3/Architectures/Xilinx/MicroBlaze/BlueCat/inc/fslfifo_ioctl.h:struct
fslfifo_ioctl_data {
/opt/Impulse/CoDeveloper3/Architectures/Xilinx/MicroBlaze/BlueCat/inc/fslfifo_ioctl.h:#define
FSLFIFO_CPUT _IOWR(FSLFIFO_IOCTL_BASE, 1, struct
fslfifo_ioctl_data)
/opt/Impulse/CoDeveloper3/Architectures/Xilinx/MicroBlaze/BlueCat/inc/fslfifo_ioctl.h:#define
FSLFIFO_CGET _IOWR(FSLFIFO_IOCTL_BASE, 2, struct
fslfifo_ioctl_data)
/opt/Impulse/CoDeveloper3/Architectures/Xilinx/MicroBlaze/BlueCat/bluecatlinux.xml:
<require file="Xilinx/MicroBlaze/BlueCat/inc/fslfifo_ioctl.h"
dst="driver/src" type="code"/>
/opt/Impulse/CoDeveloper3/Architectures/Xilinx/MicroBlaze/BlueCat/bluecatlinux.xml:
<require file="Xilinx/MicroBlaze/BlueCat/inc/fslfifo_ioctl.h"
dst="../user_app/libImpulseC" type="code"/>

The header of fslfifo_ioctl.h confirms their might be such a driver.
/*
* drivers/char/xilinx_fsl/fslfifo_ioctl.h
*
* IOCTL constants for the MicroBlaze FSL FIFO device driver
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* Copyright 2008 LynuxWorks
*
*/


I have tempted to adapt the tutoral code to use these driver, mixing the definitions in co.h files from $IMPULSE_HOME/Architectures/Xilinx/MicroBlaze/BlueCat/inc/co.h and the one copied in the tutorial directory, however, I'll need to work more on this, since it didn't work after my first tentatives.

So the question is : does LynuxWorks use the same fslfifo kernel drivers in Bluecat Linux that Petalogix use in Petalinux or does they use their own ones ? The two versions may not be compatible, so I could have to write my own co.h and related files.
Note that the Linux FSLFIFO kernel drivers for microblaze may be part of the official linux kernel or it will happen soon.

Nicolas
---
[1] developped by John Williams and co from Petalogix.


---
QUOTE (RalphBodenner @ Jul 28 2009, 12:13 AM) *
I would take a look at BlueCat Linux and the PSP we offer for it, as I suspect it may use a similar driver. The relevant source and Makefiles are in %IMPULSEC_HOME%\Architectures\Xilinx\MicroBlaze\BlueCat\. There is also documentation for a BlueCat example here:

http://www.ImpulseAccelerated.com/ReadyToR...ECAT_MBLAZE.pdf

(We don't officially support Petalinux.)

Regards,
Ralph

Go to the top of the page
 
+Quote Post

Reply to this topicStart new topic
1 User(s) are reading this topic (1 Guests and 0 Anonymous Users)
0 Members:

 



Lo-Fi Version Time is now: 10th September 2010 - 10:43 AM