• Home
  • About
    • Organization Structure
    • Organizing Committee
    • Privacy Policy
  • Membership
    • Apply for Membership
    • Membership Info
    • Our Members
  • Summits
    • 2024 Summit
    • 2022 Summit
    • 2020 Summit
    • 2019 Summit
    • 2018 Summit
  • Resources
    • About seL4®
    • seL4® Foundation
    • TCCoE Repository
    • Existing Platforms and Capabilities
  • Training
  • Contact
⟵ Exercise-0
table of contents
Exercise-2 ⟶

seL4 Level-1 Tutorials - Exercise #1: Hello World!

Objectives
  • Build a basic application using TCCoE seL4 repository.
  • Work with cmake & ninja
  • Print a debug message to console.
Steps
This exercise focuses on getting the build environment ready for use. For this exercise, we manually do what the common command section does in order to get a better understanding of the process.
  • Open a terminal and change working directory to root directory of the sel4-files, and start a container.
$ cd /home/$USER/sel4-files $ container # it is important to start the container in this directory, otherwise, version script will not work properly $ ls -l
You should get the following output:
2. Navigate to level-1-tutorials directory and link to version 1.0
$ cd level-1-tutorials $ ./version 1.0
You should get the following output:
3. Use cmake to initialize the build environment. cmake can be configured with different code generators. For seL4, they use ninja. Furthermore, cmake can also have a cache file which contains common configuration. In this case, it is the settings.cmake file which allows cmake to find seL4 and its libraries, as well as to properly configure the architecture/platform targets. Finally, the last argument sent to cmake is the actual directory of the project that needs to be built. This directory must include a CMakeLists.txt file which specifies exactly how the project needs to be built. Anything starting with -D is a variable that can be defined anywhere in the command line arguments. Here, we use -DARCH=x86 which tells cmake to define a variable called ARCH and set its value to x86.
$ cd application/build $ mkdir exercise-1-x86 $ cd exercise-1-x86 $ cmake -G Ninja -DARCH=x86 -c ../../../settings.cmake ../../core/exercise-1 $ ninja # build project $ ./simulate # to exit qemu: Ctrl + A ⟶ X
4. Modify application/core/exercise-1/src/main.c, using any editor of your choice (e.g. gedit, vi, nano, ..., etc.), and add `printf` before the program returns:
int main() { printf("Hello World!\n"); return 0; }
Note: it is important to use \n for the output buffer to properly display the message in simulation.
5. Recompile and simulate (in application/build/exercise-1-x86)
$ ninja # build project $ ./simulate # to exit qemu: Ctrl + A ⟶ X
The output should be:
⟵ Exercise-0
table of contents
Exercise-2 ⟶
seL4 is a trademark of LF Projects, LLC. Trusted Computing Center of Excellence™ is a tradename of The Computing Center of Excellence, Inc. Copyright © 2022 The Computing Center of Excellence, Inc.

We use cookies to enable essential functionality on our website, and analyze website traffic. By clicking Accept you consent to our use of cookies. Read about how we use cookies.

Your Cookie Settings

We use cookies to enable essential functionality on our website, and analyze website traffic. Read about how we use cookies.

Cookie Categories
Essential

These cookies are strictly necessary to provide you with services available through our websites. You cannot refuse these cookies without impacting how our websites function. You can block or delete them by changing your browser settings, as described under the heading "Managing cookies" in the Privacy and Cookies Policy.

Analytics

These cookies collect information that is used in aggregate form to help us understand how our websites are being used or how effective our marketing campaigns are.