Learn with SHAKTI
My First ASM Program
spike simulates the real hardware. The necessary files to compile and simulate an ASM program in spike environment, are hosted inside the spiking folder. Learn more about spike, vim editor, RISC-V GDB and OpenOCD!
Please, copy and paste the below commands to download the spiking folder.
cd $HOME
git clone https://gitlab.com/shaktiproject/software/spiking.git
Move to spiking folder.
cd spiking
Open a file in a text editor and save it inside spiking folder
vim example.S
or
gedit example.S
example.S content:
Compile
Before starting compilation, Please check if the shakti-tools are successfully installed.
Please ensure you're inside spiking folder and run the below command
riscv64-unknown-elf-gcc -nostdlib -nostartfiles -T spike.lds example.S -o example.elf
On successful compilation, a executable binary named example.elf will be generated.
Object dump for the compiled ASM Program
riscv64-unknown-elf-objdump displays the dis-assembled code of the elf file.
riscv64-unknown-elf-objdump -d example.elf &> example.dump
Use vim or gedit to view the objdump file created i.e log
vim example.dump
or
gedit example.dump