-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathjarm.sh
executable file
·46 lines (33 loc) · 1.54 KB
/
jarm.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
#!/bin/bash
# USAGE: jarm.sh (-c | -d) <src_file>.s
# -c to use console I/O. -d to use a devices.txt file in the same directory.
file=$2
file="./bin/${file%.*}" # rips the extension off the file
if [ "$1" == "-c" ] ; then
jarmopt="-c" # just use the console without any devices described in a 'devices.txt' configuration file
elif [ "$1" == "-d" ] ; then
jarmopt="-d devices.txt" # load device file for JARM; we use the default of devices.txt in the same directory
else
echo "USAGE: jarm.sh -c|-d <src_file>.s"
exit
fi
if [ -z "$2" ] ; then # need to provide a source file.
echo "USAGE: jarm.sh -c|-d <src_file>.s"
exit
fi
if [ ! -d "./bin" ]; then # makes the bin directory for annoying binaries.
mkdir "./bin"
fi
arm-none-eabi-linux-as -aghls="$file-listing.txt" $2 -o $file.elf # use assembler listing
# -mcpu=cortex-m3 -mthumb --specs=rdimon.specs -lc -lrdimon -g ### this is for arm-none-eabi-gcc ###
if [ $? -ne 0 ] ; then # non zero exit status --> error
echo "arm-none-eabi-linux-as exited with error. no file generated"
exit
fi
file $file.elf # exibe o tipo do executavel ($file) gerado
arm-none-eabi-objdump -D $file.elf > $file.txt
# "disassembla" o executavel no arquivo $file.txt a partir do rótulo "main:"
# add '-c' switch to run jarm for console based I/O.
#'-d' for devices. it uses devices.txt (in the same dir) as a default
jarm $jarmopt -l $file.elf # uses -c or -d devices.txt # -l is for our executable file.
# echo -e "\nPATH=$PATH:~/mc404/jarm" >> ~/.profile # append jarm bin directory to the PATH in profile