Skip to main content Skip to local navigation

Writing a RISC-V Assembler file for Segger Embedded Studio

I like practical programming. That can be tough with assembler. But one of the important things to recognize is that you can limit the

amount of support work that you have to do in assembler by embedding your assembler code in a C or C++ project.

In this video I show how to

  1. Create a C project
  2. Write a simple main function in C
  3. Write a simple assembler function in a separate file
  4. Call that assembler function from C
  5. Return a value from the assembler function back to C

And then simulate the whole thing.

Here's the video:


a pen

James Andrew Smith is a Professional Engineer and Associate Professor in the Electrical Engineering and Computer Science Department of York University's Lassonde School, with degrees in Electrical and Mechanical Engineering from the University of Alberta and McGill University.  Previously a program director in biomedical engineering, his research background spans robotics, locomotion, human birth and engineering education. While on sabbatical in 2018-19 with his wife and kids he lived in Strasbourg, France and he taught at the INSA Strasbourg and Hochschule Karlsruhe and wrote about his personal and professional perspectives.  James is a proponent of using social media to advocate for justice, equity, diversity and inclusion as well as evidence-based applications of research in the public sphere. You can find him on Twitter. Originally from Québec City, he now lives in Toronto, Canada.