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

Subversion Repositories openmsp430

[/] [openmsp430/] [trunk/] [core/] [sim/] [rtl_sim/] [bin/] [asm2ihex.sh] - Blame information for rev 2

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

Line No. Rev Author Line
1 2 olivier.gi
#!/bin/sh
2
#------------------------------------------------------------------------------
3
# Copyright (C) 2001 Authors
4
#
5
# This source file may be used and distributed without restriction provided
6
# that this copyright statement is not removed from the file and that any
7
# derivative work contains the original copyright notice and the associated
8
# disclaimer.
9
#
10
# This source file is free software; you can redistribute it and/or modify
11
# it under the terms of the GNU Lesser General Public License as published
12
# by the Free Software Foundation; either version 2.1 of the License, or
13
# (at your option) any later version.
14
#
15
# This source is distributed in the hope that it will be useful, but WITHOUT
16
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
17
# FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
18
# License for more details.
19
#
20
# You should have received a copy of the GNU Lesser General Public License
21
# along with this source; if not, write to the Free Software Foundation,
22
# Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
23
#
24
#------------------------------------------------------------------------------
25
#
26
# File Name: asm2ihex.sh
27
#
28
#------------------------------------------------------------------------------
29
 
30
###############################################################################
31
#                            Parameter Check                                  #
32
###############################################################################
33
EXPECTED_ARGS=5
34
if [ $# -ne $EXPECTED_ARGS ]; then
35
  echo "ERROR    : wrong number of arguments"
36
  echo "USAGE    : asm2ihex.sh <test name> <test assembler file> <definition file>   <rom size> <ram size>"
37
  echo "Example  : asm2ihex.sh c-jump_jge  ../src/c-jump_jge.s43 ../bin/template.def 2048       128"
38
  exit 1
39
fi
40
 
41
 
42
###############################################################################
43
#               Check if definition & assembler files exist                   #
44
###############################################################################
45
 
46
if [ ! -e $2 ]; then
47
    echo "Assembler file doesn't exist: $2"
48
    exit 1
49
fi
50
if [ ! -e $3 ]; then
51
    echo "Linker definition file template doesn't exist: $3"
52
    exit 1
53
fi
54
 
55
 
56
###############################################################################
57
#               Generate the linker definition file                           #
58
###############################################################################
59
 
60
RAM_SIZE=$5
61
ROM_SIZE=$4
62
ROM_BASE=$((0x10000-$ROM_SIZE))
63
 
64
cp  $3  ./rom.def
65
sed -i "s/ROM_BASE/$ROM_BASE/g" rom.def
66
sed -i "s/ROM_SIZE/$ROM_SIZE/g" rom.def
67
sed -i "s/RAM_SIZE/$RAM_SIZE/g" rom.def
68
 
69
 
70
###############################################################################
71
#                  Compile, link & generate IHEX file                         #
72
###############################################################################
73
msp430-as      -alsm         $2     -o $1.o     > $1.l43
74
msp430-objdump -xdsStr       $1.o              >> $1.l43
75
msp430-ld      -T ./rom.def  $1.o   -o $1.elf
76
msp430-objcopy -O ihex       $1.elf    $1.ihex

powered by: WebSVN 2.1.0

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