RISC-V assembly language tutorial

Our friends at Western Digital have just released a series of videos on YouTube in which their CTO Martin Fink shows how to use VS Code to write an assembly language “SuperBlink” program for the HiFive1.

Martin covers tools setup, HIFive1 documentation including reading memory maps to find addresses of GPIO ports and registers, mixing C and ASM, manipulating GPIO in assembly language, building the program and downloading.

A pretty good tutorial I think.

1 Like

Hi Bruce,

Sounds interesting, but Google has left me wanting. Can you share a link?

Thanks,

Try https://www.youtube.com/watch?list=PL6noQ0vZDAdh_aGvqKvxd0brXImHXMuLY&v=eR50d6CDOys

1 Like

Great! Thanks.

Please note that the free version of platform.io does not include some features (like debugging); you need a paid subscription in order to be fully functional.

No problem - the paid subscription is very affordable!

That was a link! The forum software puts it inline, but you can click on the “YouTube” in the bottom right corner to open a new window at YouTube, with the entire playlist shown.

I’ve spotted two bugs in the code. One very very minor, but the other should be fixed. Anyone want to try find them?

I’ve just worked through the video, following along.

You get a free 30 day trial of “pro”, so the debugger works.

It looks like gdb is a free option instead of their debugger, but I couldn’t immediately figure out how to get it to work. It certainly should be possible as it’s just using standard freedom-e-sdk tools underneath.

Annoyingly, I couldn’t find any way to get a disassembly, except to right click .pioenvs/freedom-e300-hifive1/ and choose “Open in Terminal” and then manually type “riscv64-unknown-elf-objdump -d firmware.elf | less”

You get a free 30 day trial of “pro”, so the debugger works.

yeah, sure, but I still prefer open source free solutions

gdb is a free option instead of their debugger

I doubt gdb will be able to show peripheral registers any time soon, like GNU MCU Eclipse and now platform.io

I couldn’t find any way to get a disassembly

this looks like a limitation of VSC debugging protocol, affecting all debug sessions, not only platform.io; I saw several issues recorded on GitHub, but Microsoft did not provide any clue if/when they’ll add it.

The https://godbolt.org/ compiler explorer includes clang’s riscv32 compiler.