RISC-V is an open standard instruction set architecture (ISA) based on established reduced instruction set computer (RISC) principles since 2010. RISC-V supports three word-widths, 32, 64, and 128 bits, and a variety of subsets. In this project, you will learn the high-level language translation flow and study the relations between high-level C/C++ code and RISC-V assembly. You are required to write a simple Makefile to build your own executable program, library, compiled objects, and RISC-V assembly codes from a C/C++ project with multiple source files. For consistency, we use two GNU RISC-V 32-bit toolchains (riscv32-unknown-elf-* and riscv32-unknown-linux-gnu-*) in this project.
Please submit (A) your program project and (B) study report according to the following rules:
- There are at least 3 C/C++ source code files in your program project.
- Upload your source code tarball including your Makefile, which can generate the executable program, library, compiled objects, assembly codes, and so on.
- Write a report to elaborate the compiled RISC-V assembly code in correspondence of your C/C++ source code.
- Compare both the elf-gcc and linux-gnu-gcc compilation results with and without using the -static compilation option by using objdump.
- In your program, declare a variety of C/C++ variable types with and without non-zero initialization and identify the actual physical locations in either final binary program or run-time memory. Summarize your observations.
- The filename is your student ID (e.g., B12345678.tgz and B12345678.pdf).
Reference:
- GCC and Make: Compiling, Linking and Building C/C++ Applications
URL: https://www3.ntu.edu.sg/home/ehchua/programming/cpp/gcc_make.html
- 12 Linux GNU Binary Utilities Binutils Commands with Examples
URL: https://www.thegeekstuff.com/2017/01/gnubinutilscommands/ [3] The RISC-V Instruction Set Manual,
URL: https://github.com/riscv/riscvisamanual/releases/download/RatifiedIMAFDQC/riscvspec20191213.pdf
- The Newlib C Library,
URL: https://sourceware.org/newlib/
- The GNU C Library (glibc),
Reviews
There are no reviews yet.