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
/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
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
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












