dnx RTOS 2.2.0 "Eagle"
 All Data Structures Functions Variables Typedefs Enumerations Enumerator Groups Pages
Application Development


Programs can be developed similarly as in a standard PC. The dnx RTOS provides standard C API functions that can be used in the same way as in PCs. Besides standard libraries, special libraries are provided, e.g: network, thread, time, and OS. For more details see Libraries accessible from user space. Created programs are compiled in the project building time and are integral part of the system, but have different functionality. Each program can be started in many instances and at any time. The user decides which program will be started. Programs integrated in the system are called built-in programs, and can be listed by using procfs file system (typically localized in the /proc/bin directory). The variables of each program are localized in the RAM and are dynamically allocated at program setup. The program code is compiled and is stored in the ROM memory of the microcontroller.

Libraries accessible from user space

Libraries listed below are accessible from users' application and are directly supported by dnx RTOS. Many libraries are not standard, some libraries are modified for best usage for embedded applications. Other standard libraries can be used but there is no warranty that library will work correctly. There are severals libraries that are not officially supported e.g. <stdbool.h>, <stdint.h> but there is not reasons to not use those libraries because are used internally by system. In general, most of libc libraries can be used without any issues. There are documented libraries that are modified for system purposes.

Application Limitations

The dnx RTOS program implementation has some limitations:

  • Global variables are provided by the main global structure and access to those variables are provided by the global pointer. This pointer is individually created for each program instance. To share global variables between the modules of the program, the user has to share the global variable structure in the header that is included in each module. The global variable structure is created by using GLOBAL_VARIABLES_SECTION {} macro.
  • The global variables cannot be preloaded at program startup. The user has to initialize values of defined global variables if the value other than zero is required.
  • If the user wants to create a constant then it should be inserted beyond the global variable section, because constants are stored in the ROM memory.
  • The main function of the program has to be created by using the int_main() macro. Those macros create special hidden variables that are used by the system.
  • Environment variables are not supported.

Application Registration Details

As was mentioned above, each program in order to be visible should be registered in the system register. The system register is localized in the ./src/application/programs/program_registration.c file. This file is created automatically by the build script. No other actions are needed to add a new program to the system. To create a new program just create a new folder in the ./src/application/programs/ and add program’s files and Makefile. The only one note is that the program’s name should be the same as folder name (int_main() macro). Program’s Makefile is automatically added to the main system’s Makefile.

One can use ./tools/addprogram.sh script to create program template. It is the easiest way to create own program.

Example Application

A simple program is presented in this section.

// FILE: example_program.c
// BRIEF: This is simple program example
#include <stdio.h>
#include <stdlib.h>
// global variables
int my_variable;
int my_zero;
// constants
static const int my_constant = 100;
int_main(example_program, STACK_DEPTH_LOW, int argc, char *argv[])
// access to global variable
global->my_variable = my_constant;
// welcome message
puts("Hello! This is example program!");
printf("Program name: %s\n", argv[0]);
puts("Program arguments:");
for (int i = 1; i < argc; i++) {
printf("%d: %s\n", i, argv[i]);

Makefile script:

# Makefile for GNU make
CSRC_PROGRAMS += example_program/example_program.c

File structure:

  • ./src/application/programs/example_program/example_program.c
  • ./src/application/programs/example_program/Makefile

Users' Libraries

Libraries are stored in the ./src/application/libs folder and are automatically added to the system by the script at build process. Libraries are added to the system when contains the Makefile. To use a library in the program just include their header. To remove library from project just remove library folder (and remove dependencies from application).

Example of Makefile script for library:

# Makefile for GNU make
CSRC_LIB += mbus/mbus.c mbus/mbus_garbage.c mbus/mbus_signal.c
HDRLOC_LIB += mbus

Example how to use created library in application:

#include ...
#include <mbus.h>
#include ...
int_main(...) {


To obtain applications and libraries code examples please browse ./src/application/programs/ and ./src/application/libs/ folders.