Risc-V Bare Metal C Hello World!

preview_player
Показать описание
I walk through creating a bare-metal hello world C program for the Risc-V architecture and test it using QEMU.

One note that I did not mention in the video...some might say why I did not use the ENTRY(_start) clause in the linker. Because it would make no difference in this case. ENTRY just writes to the elf header. Because there is not boot loader, the entry point in the header does not matter. The only thing that matters is the order of the code sections. And because I placed the hello.o before start.o in the linker, unless the KEEP directive is used, listing order will govern.
Рекомендации по теме
Комментарии
Автор

As a person learning c and microcontrollers, this was very informative. The way you organized the lecture also made it easy to follow. I now understand a little better how a computer boots and runs the main function.

Aplysia
Автор

EXCELLENT !!!
More videos on RISC-V please !

magmacodes
Автор

I like to learn more about riscv topics like this

jpmorallo
Автор

Awesome. Nice work spreading knowledge ❤

MariusHeier
Автор

Reminds me of the joke about the microcontroller version of 'Hello World':

"How many transistors does it take to blink an LED?"



AS MANY AS POSSIBLE.

davidgari
Автор

2 questions:

Is that linker file stuff working the same way if using clang instead of gcc?
Also, will you show how it is done with Rust and Zig in future videos?

Bonus question :)
in riscv assembler with gcc is it mov <target>, <source> or mov <source>, <target>?

Since GCC for x86 keeps insisting to use that AT&T notation or however it is called...

Bonus remark:
It has been a few decades since I did UART16550 programming. But the way your uart_putchar() function is written, you do not really use the FIFO. There is a way to check if the FIFO can still hold one more character. You, in turn check if the FIFO is empty.

ruffianeo