diff options
Diffstat (limited to 'thesis/status.tex')
-rw-r--r-- | thesis/status.tex | 85 |
1 files changed, 85 insertions, 0 deletions
diff --git a/thesis/status.tex b/thesis/status.tex new file mode 100644 index 0000000..29eff12 --- /dev/null +++ b/thesis/status.tex @@ -0,0 +1,85 @@ +\section{Current status} +\label{sec:status} + +\begin{multicols}{2} + +In this section, we briefly discuss the current status of the Thumb backend for Clean. + +\subsection{Run-time system} +\label{sec:status:rts} +The latest version of the RTS can be found at \url{https://git.camilstaps.nl/clean-run-time-system.git/}. +The Thumb backend is located in the \texttt{thumb2*} files and can be built with \texttt{Makefile.linux\_thumb2}. + +Register aliases have been used to ease changing the register allocation. +The current allocation is set in \texttt{thumb2regs.s}. + +The Clean RTS has three garbage collectors: + a copying, + a compacting + and a marking collector. +At this point only the first works. +The expectation is that the others can be fixed rather easily and that only a few bits need to be flipped. +We don't expect any problems other than the ones encountered in the copying collector (which has been discussed in \cref{sec:code-addresses}). + +\subsection{Code generator} +\label{sec:status:cg} +The latest version of the code generator can be found at \url{https://git.camilstaps.nl/clean-code-generator.git/}. +The Thumb-specific part is in the \texttt{cgthumb2*} files and + throughout other files in a few \texttt{\#ifdef} blocks. +It can be built with \texttt{Makefile.linux\_thumb2}. + +There are two code generators: + one that generates readable assembly code (\texttt{thumb2was.c}) + and one that generates object code (\texttt{thumb2as.c}). +At the moment of writing, only the first has been adapted to work for Thumb --- + the second is the same as the ARM code generator. + +\subsection{Building programs} +\label{sec:status:building} +To build a file \texttt{mymodule.icl} for a Thumb target, the following workflow can be used: + +\begin{minted}{bash} + # Build _system, needed only once + cg _system -s _system.s + as -o _system.o _system.s -march=armv7-a + + # Build cgopts, needed only once + as -o cgopts.o cgopts.s -march=armv7-a + + # Build actual program + clm -ABC mymodule + cg Clean\ System\ Files/mymodule -s mymodule.s + as -o mymodule.o mymodule.s -march=armv7-a + cc -o mymodule \ + /path/to/rts/_startup.o \ + /path/to/_system.o \ + cgopts.o \ + mymodule.o \ + -lc -lm \ + -march=armv7-a +\end{minted} + +The \texttt{\_system.abc} that is needed can be taken from any Clean distribution \parencite{clean}. + +In \texttt{cgopts.s}, some variables are set that are normally added by the Clean make tool \texttt{clm}. +The file may look like this: + +\begin{minted}{ual} + .data + .global ab_stack_size + .global flags + .global heap_size + .global heap_size_multiple + .global initial_heap_size + + heap_size: .word 0x00200000 + ab_stack_size: .word 0x00080000 + flags: .word 0x00000008 + heap_size_multiple: .word 0x00001400 + initial_heap_size: .word 0x00019000 +\end{minted} + +Another option to build Clean programs using the Thumb backend is to get the Clean make tool \texttt{clm} from \url{https://svn.cs.ru.nl/repos/clean-tools/trunk/clm/} and build it so that \texttt{NO\_ASSEMBLE} is \emph{not} defined + (which will cause it to execute the readable code generator instead of the object code generator). + +\end{multicols} |