Embedded Systems: C Language: #7. Demo: Assembly Language



Embedded Systems: C Language: #7. Demo: Assembly Language

Embedded Systems: C Language: #7. Demo: Assembly Language

𝗗𝗼𝗰𝗸𝗲𝗿 𝗦𝗲𝘁𝘂𝗽 𝗩𝗶𝗱𝗲𝗼:
https://www.youtube.com/watch?v=KJtUWnJr254

𝗣𝗿𝗲𝘃𝗶𝗼𝘂𝘀 𝗩𝗶𝗱𝗲𝗼:
https://youtu.be/GCyI9Zg4IT0

𝗙𝘂𝗹𝗹 𝗣𝗹𝗮𝘆𝗹𝗶𝘀𝘁:
https://www.youtube.com/playlist?list=PLFt5JBAXXlQow0PLTdqvaiIUMRa71VQHl

𝗜𝗻 𝘁𝗵𝗶𝘀 𝗩𝗶𝗱𝗲𝗼:
We will learn the basics of the RISC-V (rv32i) assembly language programming using the following example:

_start:
addi x1, x0, 5
addi x2, x0, 1
addi x3, x0, 0
loop:
add x3, x3, x2
addi x1, x1, -1
bnez x1, loop
j .

Specifically, we discuss the following:
– instructions.
– labels
– jump
– .

𝗖𝗵𝗮𝗽𝘁𝗲𝗿𝘀:
00:00 Explanation of example RISC-V (RV32I) Assembly Program
02:13 Brach Instructions and label
05:10 Precondition for running the experiments: Docker
06:04 Connecting to Docker
07:08 Opening a terminal in VSCode
07:53 Example Assembly program
08:51 (Start of) Analysing the assembly instructions
09:38 RISC-V Encode/Decode website
11:44 Pseudo-instruction: The special case of `bnez` instruction
13:43 Pseudo-instruction: Jump Instruction and making the CPU spin in place
14:58 Demo: Execution of the program
15:35 Demo: Launch QEMU, run `make debug`
16:12 Demo: Attach to QEMU using GDB, run `make gdb`
16:44 Demo: CPU Register ABI names mapped to non-ABI names
17:08 Demo: State of the CPU
17:35 Demo: Significance of the value of PC (Program Counter)
18:15 Demo: Executing an instruction at a time using `ni` command
20:08 Demo: Branch instruction and the effect on the program counter
23:03 Demo: Falling through the `bnez` instruction
23:53 Demo: CPU Spinning in Place: Effects of `j .`
24:14 Why use `j .`?
25:16 summary 1
25:58 Going over the RV32I instructions and confirming the usage
27:20 `addi` instruction
28:28 `bnez` instruction
30:29 `j .` instruction
33:20 Thought on labels and spaces

#inpyjama #cninja #embeddedsystems #embedded #clanguage #arm #riscv

Comments are closed.