title: How can I compile C code to get a bare-metal skeleton of a minimal RISC-V assembly program?
body: <p>I have the following simple C code:</p>
  
  <pre><code>   void main(){
      int A = 333;
      int B=244;
      int sum;
      sum = A + B;  
  }
  </code></pre>
  
  <p>When I compile this with </p>
  
  <pre><code>$riscv64-unknown-elf-gcc code.c -o code.o
  </code></pre>
  
  <p>If I want to see the assembly code I use</p>
  
  <pre><code>$riscv64-unknown-elf-objdump -d code.o 
  </code></pre>
  
  <p>But when I explore the assembly code I see that this generates a lot of code which I assume is for Proxy Kernel support (I am a newbie to riscv). However, I do not want that this code has support for Proxy kernel, because the idea is to implement only this simple C code within an FPGA.</p>
  
  <p>I read that riscv provides three types of compilation: Bare-metal mode, newlib proxy kernel and riscv Linux. According to previous research, the kind of compilation that I should do is bare metal mode. This is because I desire a minimum assembly without support for the operating system or kernel proxy. Assembly functions as a system call are not required. </p>
  
  <p>However, I have not yet been able to find as I can compile a C  code for get a skeleton of a minimal riscv assembly program.  How can I compile the C code above in bare metal mode or for get a skeleton of a minimal riscv assembly code?</p>