Hallo,
I use Linux suse 11.4. 64bit and precompiled GHDL in 32bit mode.
In my makefile I have to use the -Wa,--32 and the -Wl,-m32 this works nice.
ghdl -a -Wa,--32 --work=work --workdir=work
../rtl/memory/ahb_memory.vhd
ghdl -e -Wa,--32 -Wl,-m32 --ieee=synopsys -fexplicit --workdir=work
-Pwork tb_lm_cpu
now I want to link VHPI C funtions together.
I tried out the files from myhdl
http://www.myhdl.org/lib/exe/fetch.php/dev:vhdl_cosim:vpi-ex.tar.gz
The makefile have been adapted this options.
-----Makefile-------------------------------
CC=gcc
CFLAGS=-Wall -g -I.
all: run-vpi
myhdl_vpi.o: myhdl_vpi.c
$(CC) -c -fPIC $(CFLAGS) myhdl_vpi.c
myhdl.vpi: myhdl_vpi.o
$(CC) --shared -o myhdl.vpi myhdl_vpi.o
disptree:
ghdl -a -Wa,--32 disptree.vhdl
ghdl -e -Wa,--32 -Wl,-m32 -Wl,-Wl,-E disptree
run-vpi: myhdl.vpi disptree
./disptree --vpi=./myhdl.vpi
clean:
rm -f myhdl_vpi.vpi
rm -f *.o
tar:
tar cvf vpi-ex-ghdl.tar myhdl_vpi.c Makefile vpi_user.h
------------------------------------------------------------------------------------------------------------------
I got an error.
red@linux-nrd1:~/iso/myhdl/ghdl> make
ghdl -a -Wa,--32 disptree.vhdl
ghdl -e -Wa,--32 -Wl,-m32 -Wl,-Wl,-E disptree
./disptree --vpi=./myhdl.vpi
loading VPI module './myhdl.vpi'
./myhdl.vpi: wrong ELF class: ELFCLASS64
./disptree:error: cannot load VPI module
make: *** [run-vpi] Error 1
red@linux-nrd1:~/iso/myhdl/ghdl>
Second atempt with a library.
-----------other
makefile-------------------------------------------------------
CC=gcc
CFLAGS=-Wall -g -I.
all: run-vpi
myhdl_vpi.o: myhdl_vpi.c
$(CC) -c -fPIC $(CFLAGS) myhdl_vpi.c
myhdl.vpi: myhdl_vpi.o
ar ruv -X32 libmysim.a myhdl_vpi.o
# $(CC) -Wa,--32 -Wl,-m32 --shared -o myhdl.vpi myhdl_vpi.o
disptree:
ghdl -a -Wa,--32 disptree.vhdl
# ghdl -e -Wl,-Wl,-E disptree
ghdl -e -Wa,--32 -Wl,-m32 -Wl,-L. -Wl,-lmysim disptree
run-vpi: myhdl.vpi disptree
# ./disptree --vpi=./myhdl.vpi
./disptree
clean:
rm -f myhdl_vpi.vpi
rm -f *.o
tar:
tar cvf vpi-ex-ghdl.tar myhdl_vpi.c Makefile vpi_user.h
gcc -c -fPIC -Wall -g -I. myhdl_vpi.c
ar ruv -X32 libmysim.a myhdl_vpi.o
ar: creating -X32
a - libmysim.a
a - myhdl_vpi.o
ghdl -a -Wa,--32 disptree.vhdl
ghdl -e -Wa,--32 -Wl,-m32 -Wl,-L. -Wl,-lmysim disptree
/usr/lib64/gcc/x86_64-suse-linux/4.5/../../../../x86_64-suse-linux/bin/ld:
skipping incompatible ./libmysim.a when searching for -lmysim
/usr/lib64/gcc/x86_64-suse-linux/4.5/../../../../x86_64-suse-linux/bin/ld:
skipping incompatible .//libmysim.a when searching for -lmysim
/usr/lib64/gcc/x86_64-suse-linux/4.5/../../../../x86_64-suse-linux/bin/ld:
cannot find -lmysim
collect2: ld returned 1 exit status
ghdl: compilation error
make: *** [disptree] Error 1
I got also an Error.
Have you any suggestion for linking such files?????
Thank you René
_______________________________________________
Ghdl-discuss mailing list
[email protected]
https://mail.gna.org/listinfo/ghdl-discuss