LLVM C/C++ HelloWorld

Project HelloWorld example using LLVM C/C++ compiler

This chapter covers the basics of C/C++ embedded RISC-V projects including creating, building, running, and debugging embedded RISC-V applications. The project referred to in this chapter is called “LLVM Hello World.” This application prints “Hello World” text and runs a simple for-loop as a simple demonstration. The application can also be built with LLVM toolchain and run on QEMU emulator.

Note: To build, run and debug Embedded applications with QEMU emulator, please install the xplor-studio-elf blueprint first. Please refer to Guidelines for more information.

Create a new project

To create LLVM Hello World Embedded Project, select File > New > C Project choose RISC-V Embedded Project > RISC-V LLVM Sample project and Toolchains: LLVM Baremetal Toolchain for RISC-V.

example image

As the image above, there is no option as LLVM Baremetal Toolchain for RISC-V because this XploR Studio does not contain LLVM toolchain.

To use this toolchain, please install xplor-clang blueprint (refer to Guidelines for more information).

After installation and restart the IDE, you can see the creating-project widget like:

example image

Please refer to Create a new project for more information on other steps.

Update build settings

The build setting is the same as the quick-start project’s settings. Please refer to Update build settings for more information.

Build project

The build step is the same as the quick-start project’s step. Please refer to Build project for more information.

Running and Debugging project with QEMU emulator

The running and debugging step is the same as the quick-start project’s step. Please refer to Running and Debugging project with QEMU emulator for more information.