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

Subversion Repositories s1_core

[/] [s1_core/] [trunk/] [tools/] [bin/] [compile_test] - Blame information for rev 105

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

Line No. Rev Author Line
1 7 fafa1971
#!/bin/bash
2
#
3 103 fafa1971
# Compile a test for the S1 Core and build the files
4
# rom_harness.hex and ram_harness.hex.
5 7 fafa1971
#
6
# Parameter is test name without extension (e.g. to compile
7 103 fafa1971
# $S1_ROOT/tests/hello.c) just run "compile_test hello".
8 7 fafa1971
#
9 103 fafa1971
# Note: requires sparc64-linux-gcc (see Download section on
10
# http://www.srisc.com).
11 7 fafa1971
 
12 86 fafa1971
if [ -z "$S1_ROOT" ]; then echo "***ERROR***: S1_ROOT variable is undefined, please set it and run 'source sourceme'."; exit 1; fi
13
if ! [ -d "$S1_ROOT" ]; then echo "***ERROR***: directory '$S1_ROOT' does not exist, please check it and run 'source sourceme' again."; exit 1; fi
14
 
15 38 fafa1971
# Prepare the environment
16 7 fafa1971
cd $S1_ROOT/tests
17
rm -f *.o *~ *.bin *.dump *.hex     # Make clean
18
if ( test $# != 1 ) then
19
  echo "compile_test - Script to compile a test for the S1 Core";
20
  echo "(C) 2006 by Simply RISC";
21
  echo "Usage:";
22
  echo "      compile_test ";
23
  echo "where parameter is the test name without extension (e.g. 'hello').";
24
  exit 1;
25
fi
26
if ( ! test -e $1.c ) then
27
  echo "ERROR: Test $1.c does not exist into the tests directory!";
28
  exit 1;
29
fi
30
 
31 38 fafa1971
# Compile the dumper
32 7 fafa1971
gcc -o $S1_ROOT/tools/bin/dump2hex.bin $S1_ROOT/tools/src/dump2hex.c
33
 
34 38 fafa1971
# Compile the boot code
35 73 fafa1971
sparc64-linux-as -ah -am -o boot/boot.bin boot/boot.s
36 38 fafa1971
sparc64-linux-objdump -d -EB -w -z boot/boot.bin > boot/boot.dump
37 103 fafa1971
grep "  " boot/boot.dump | egrep -v "file format" | dump2hex.bin > boot/rom_harness.hex
38 38 fafa1971
 
39
# Compile the C test
40 73 fafa1971
sparc64-linux-gcc -c -O0 $1.c
41
sparc64-linux-ld -Ur --script=$S1_ROOT/tools/src/linker.map -EB -o $1.bin $1.o
42
sparc64-linux-objdump -d -EB -w -z $1.bin > $1.dump
43 103 fafa1971
grep "  " $1.dump | egrep -v "file format" | dump2hex.bin > ram_harness.hex
44 38 fafa1971
 
45 103 fafa1971
#rm -f *.o *~ *.bin *.dump           # Make clean
46 7 fafa1971
 

powered by: WebSVN 2.1.0

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