OpenCores
URL https://opencores.org/ocsvn/m1_core/m1_core/trunk

Subversion Repositories m1_core

[/] [m1_core/] [trunk/] [tools/] [bin/] [compile_test] - Blame information for rev 14

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 2 fafa1971
#!/bin/bash
2
#
3
# Compile a test for the M1 and build the memory.hex file.
4
#
5
# Parameter is test name without extension (e.g. to compile
6
# $M1_ROOT/tests/hello.c) run "compile_test hello".
7
#
8
# Requires mipsel-linux-gcc (see Download section on srisc.com).
9
 
10 14 fafa1971
if [ -z "$M1_ROOT" ]; then echo "***ERROR***: M1_ROOT variable is undefined, please set it and run 'source sourceme'."; exit 1; fi
11
if ! [ -d "$M1_ROOT" ]; then echo "***ERROR***: directory '$M1_ROOT' does not exist, please check it and run 'source sourceme' again."; exit 1; fi
12
 
13 2 fafa1971
cd $M1_ROOT/tests
14
rm -f *.o *~ *.bin                  # Make clean
15
if ( test $# != 1 ) then
16
  echo "compile_test - Script to compile a test for the M1 Core";
17
  echo "(C) 2006 by Simply RISC";
18
  echo "Usage:";
19
  echo "      compile_test ";
20
  echo "where parameter is the test name without extension (e.g. 'hello').";
21
  exit 1;
22
fi
23
if ( ! test -e $1.c ) then
24
  echo "ERROR: Test $1.c does not exist into the tests directory!";
25
  exit 1;
26
fi
27
 
28
mipsel-linux-gcc -c -O0 -mips1 $M1_ROOT/tools/src/boot.s
29
mipsel-linux-gcc -c -O0 -mips1 $1.c
30
mipsel-linux-ld -Ur -EL -o $1.bin boot.o $1.o
31
mipsel-linux-objdump -d -EL -w -z $1.bin > $1.dump
32
cat $1.dump | dump2hex.php -q > $1.hex
33
cp -f $1.hex code.txt
34
 
35
rm -f *.o *~ *.bin                  # Make clean
36
 

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.