-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathassemble.sh
executable file
·32 lines (20 loc) · 1.11 KB
/
assemble.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
#!/bin/bash
source ~/modules/bash/colors.sh
FILE=./blink
printc "Generating jump table...\n" "green"
./jump-table.py
printc "Assembling...\n" "green"
rm -f "${FILE}.elf"
#gdb can't recognize function start
#mipsel-linux-gnu-as -g -o test.o test.s
#mipsel-linux-gnu-ld -g -o test test.o
#compile with gcc instead
#mipsel-linux-gnu-gcc -Wa,-ahln -Xassembler --listing-cont-lines -Xassembler 100 -static -march=m4k -save-temps -g -o "${FILE}.elf" "${FILE}.s" > "${FILE}.lst"
#compile main.c and call assembly from there - works but doesn't show assembly source in gdb
#mipsel-linux-gnu-gcc -static -march=m4k -save-temps -g -c main.c
#mipsel-linux-gnu-as -ahln --listing-cont-lines 100 -g -o "${FILE}.o" "${FILE}.s" > "${FILE}.lst"
#mipsel-linux-gnu-gcc -static -march=m4k -save-temps -g -o "${FILE}.elf" main.o "${FILE}.o"
#compile with gcc - no PIC
mipsel-linux-gnu-gcc -Wa,-ahln=${FILE}.lst -Wa,-g -Xassembler --listing-cont-lines -Xassembler 100 -static -march=m4k -save-temps -mno-abicalls -mno-shared -g -o "${FILE}.elf" "${FILE}.s" #> "${FILE}.lst"
mips-decode blink.lst blink-decode.lst
printc "Done assembling\n" "green"