Learn with SHAKTI

My First C program


Open a file in text editor, Lets say hello.c is the C file.

or

Write a simple C program to print Hello world (Copy paste the below content in it and save the file.)



Compile


Before starting compilation, Please check if the shakti-tools are installed.

On successful compilation, a executable binary named hello.elf will be generated.



Run


The executable is ready. Now execute the program using spike and pk. spike is the hardware simulator that simulates RISC-V. pk is the proxy kernel, which provides drivers to use the peripherals.

Output:



Object dump for the compiled C Program


objdump displays the assembly code contained in an elf file.

Use vim or gedit to view the objdump file created i.e hello.dump

or