This shows you the differences between two versions of the page.
| Next revision | Previous revision |
| wiki:aca2019:sscompiler [2019/01/19 20:27] – created Andreas Moshovos | wiki:aca2019:sscompiler [2019/01/19 20:47] (current) – Andreas Moshovos |
|---|
| Test that the compiler works: | Test that the compiler works: |
| |
| ''cd ~ | ''cd ~; |
| mkdir sstest | mkdir ACA; |
| cd sstest | cd ACA |
| '' | '' |
| |
| Create a c file, say //hello.c//, containing a simple printf. Something like this: | Create a c file, say //hello.c//, containing a simple printf. Something like this: |
| |
| ''#include <stdio.h> | ''#include <stdio.h>\\ |
| | \\ |
| main() | main()\\ |
| { | {\\ |
| printf ("hello\n"); | printf ("hello\n");\\ |
| } | }\\ |
| '' | '' |
| |
| |
| ''/usr/local/ss/v3/sslittle-na-sstrix-gcc -O hello.c -o hello'' | ''/usr/local/ss/v3/sslittle-na-sstrix-gcc -O hello.c -o hello'' |
| | |
| | Check if things look alright: |
| | |
| | ''file hello'' |
| | |
| | Should return: |
| | |
| | ''hello: MIPSEL ECOFF executable (paged) not stripped - version 2.11'' |
| |
| Also do this: | Also do this: |
| |
| It should generate a file //hello.s//. Open it and it should be assembly for PISA (looks nearly identical to MIPS). | It should generate a file //hello.s//. Open it and it should be assembly for PISA (looks nearly identical to MIPS). |
| | |
| | Another very useful tool is //ss...-objdump//. It allows you to inspect binary files such as object files and executables. You can use it for example to find our which virtual address a function or a variable has been mapped. |
| | |
| | Try this command: |
| | |
| | ''/usr/local/ss/v3/bin/sslittle-na-sstrix-objdump --syms hello > hello.syms'' |
| | |
| | Look in //hello.syms// to find all the symbols that are defined. You should be able to find _main in there, the address where your main function has been compiled to. |
| |
| |
| |