Skip to content
This repository has been archived by the owner on Feb 14, 2024. It is now read-only.

Latest commit

 

History

History
56 lines (40 loc) · 1.84 KB

README.md

File metadata and controls

56 lines (40 loc) · 1.84 KB

Hello World!

This is a basic example how to use RIOT in your embedded application. It prints out the famous text Hello World!. The code itself may look like your usual C beginners hello-world example.

Task 1

Build the application, flash the firmware and connect to the board through the serial port.

1. Open a terminal and navigate to the application directory.

2. Build the application by executing GNU Make.

$ make all

3. Connect your board using the USB cable.

4. Flash the built firmware image into the board's memory.

$ make flash

5. Initiate a serial communication with the board.

$ make term

6. Reset your board by pressing the 'Reset' button. You should see the "Hello World!" message.

main(): This is RIOT! (Version: 2022.04-devel)
Hello World!

7. To exit the serial terminal program, press Ctrl + C.

Optionally, you can run all the commands above as a single line:

$ make all flash term

Intro to RIOT build system

This example should foremost give you an overview how to use the Makefile system. Let's take a look at the Makefile file in the application directory:

  • First you must give your application a name, which is commonly the same as the name of the directory it resides in.

  • Then you can define a default BOARD for which the application was written. By using e.g. make BOARD=nrf52840dk you can override the default board.

  • The variable RIOTBASE contains an absolute or relative path to the directory where you have checked out RIOT. If your code resides in a subdirectory of RIOT, then you can use $(CURDIR) as it's done in here.

  • The variable QUIET, which is either 1 or 0, defines whether to print verbose compile information, or hide them, respectively.

  • The last line of your Makefile must be include $(RIOTBASE)/Makefile.include.