MetadataShow full item record
This masters thesis report presents the work leading to a C compiler for the NanoRisc processor. The NanoRisc is a general purpose embedded RISC-processor with simple architecture aimed at replacing custom logic in Systems on Chip (SOC) designs. Basic tools for writing and debugging small programs are already in existence, but these are not sufficient for larger and more complex programs. As the C programming language is the de facto standard for writing high level language programs for small microprocessors a C compiler was desirable. Prior to developing a compiler the NanoRisc processor's suitability for the C programming language was evaluated. The NanoRisc architecture was found to be C friendly with a sufficient number of general registers and stack functionality to facilitate a C compiler. For the compiler development several approaches was considered including an implementation from scratch and using a compiler generator. In the end the decision fell on retargeting the Gnu C Compiler (GCC) version 4.1.0. This choice was made because of GCC's quality, feature completeness and the fact that it is the most widespread open-source compiler framework today. GCC also made it possible to focus on the compiler back end generating code for the NanoRisc processor, not using time developing another C front end. The only concern in choosing GCC was the developing time as it is a large and complex system. The process of retargeting GCC consists of specifying GCC's rich set of parameters and describing the target architecture in a special machine description language. The important aspects of this process is analyzed and explained in the source code. In the end the developing time needed to retarget GCC was even greater than suspected resulting in that the compiler was not running at the end of this project.