EmbeddedRelated.com
Forums

Compilation of Plasma SW under Linux

Started by Wojciech Zabolotny January 2, 2008
Hi All,

I have successfully compiled the Plasma soft CPU for my Xilinx Spartan 3E
Starter Kit (the version of Plasma core
http://www.opencores.org/projects.cgi/web/mips/overview 
contains the top entity and UCF needed for this board).

However I was not able to generate my own software for this CPU.
The provided tools (
http://www.opencores.org/projects.cgi/web/mips/gccmips_elf.zip,
http://www.opencores.org/projects.cgi/web/mips/tools_bin.zip,
http://www.opencores.org/projects.cgi/web/mips/gmake.zip
)
are "Windows-only" and unfortunately do not run under wine emulator.

I have changed the makefile to make use of the mips-linux-gnu-gcc
or mipsel-linux-gnu-gcc packages (available from 
http://buildd.emdebian.org/debian/ )

It was also necessary to replace some backslashes with slashes.

vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv
# Customize for Linux                                                           
CC_X86 = gcc -Wall -O -g                                                        
CP = cp                                                                         
RM = rm -rf                                                                     
#BIN_MIPS = ../../mips/sde/bin                                                  
VHDL_DIR = ../vhdl                                                              
#GCC_MIPS  = mipsel-linux-gnu-gcc $(CFLAGS)                                     
#AS_MIPS   = mipsel-linux-gnu-as                                                
#LD_MIPS   = mipsel-linux-gnu-ld                                                
#DUMP_MIPS = mipsel-linux-gnu-objdump                                           
GCC_MIPS  = mips-linux-gnu-gcc $(CFLAGS)                                        
AS_MIPS   = mips-linux-gnu-as                                                   
LD_MIPS   = mips-linux-gnu-ld                                                   
DUMP_MIPS = mips-linux-gnu-objdump                                              
                                                                                
# Customize for Windows                  
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

To make sources compiling I had to add the redefiniton 
of strncat2 to the rtos.h file:

vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv
#define strcpy     strcpy2  //don't use intrinsic functions                     
#define strcat     strcat2                                                      
#define strncat     strncat2 // <= added by WZab                                                   
#define strcmp     strcmp2                                                      
#define strlen     strlen2    
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

Unfortunately, even after this adjustments, there are still problems
after "make rtos" I get the following messages:

mips-linux-gnu-ld: boot.o: warning: linking PIC files with non-PIC files

../tools/convert_bin.exe
test.axf -> code.txt & test.bin
Entry=0x10000c50 length=0=0x0

I can try to force mips-linux-gnu-as to generate the PIC file by
adding the "-KPIC" option, but then I get the following warning:

mips-linux-gnu-as -KPIC -o boot.o ../tools/boot.asm
../tools/boot.asm: Assembler messages:
../tools/boot.asm:35: Warning: No .cprestore pseudo-op used in PIC code
../tools/boot.asm:85: Warning: No .cprestore pseudo-op used in PIC code

Anyway the convert_bin complains as before.

So I have two questions:
1) How to avoid the problem with PIC code?
2) Is it possible to generate the ROM contents with the standard tool like
   mips(el)-linux-gnu-objcopy ?
   Or how to fix the convert to work under linux?
-- 
TIA & Regards,
Wojciech M. Zabolotny