application tutorial

Chan Kim ckim at
Wed Jan 4 04:44:49 UTC 2017


 Hi, Denis, 
I’m not using rtems now but reading your email, I thought I can give you some information.
In my case, in the Makefile of my rtems application build, I see these lines.

include $(RTEMS_CUSTOM)
include $(PROJECT_ROOT)/make/leaf.cfg

The RTEMS_MAKEFILE_PATH is set as an environment variable, and it should look like (for example) 

You can find the rule for $OBJS and definition of $(make-exe) in file $(PROJECT_ROOT)/make/leaf.cfg which reads something like /some/where/rtems-4.10.99-kernel/build-rtems/rtems-package/make/leaf.cfg.

define make-exe

And I found in rtems-package/share/rtems4.11/make/Templates/Makefile.lib there are some definitions for OBJS

# C and C++ source names, if any, go here -- minus the .c or .cc
C_PIECES=xxxd xxxe xxxf


And rules for .o files maybe defined by the make program itself?
Hope this helps,



보낸 사람 :  "Denis Obrezkov" <denisobrezkov at>

보낸 날짜 :  2017-01-03 19:10:52 ( +09:00 )

받는 사람 :  Alan Cudmore <alan.cudmore at>, users at <users at>

참조 :  

제목 :  Re: application tutorial


Thank you for your answer. 
I've already build a cross-compiler and rtems. And sample applications work.

I want to note that it is pretty easy to build rtems with rsb. But it is also a bit confusing, because, for example, when we build an embedded linux distribution (with buildbot or without it), we know exactly where binaries and headers from linux kernel and libc located (because we specified it). So, it is easy to create a new application. It is much harder with with an unknown for many people RSB build system and complicated autotools files.

It seems, that I found binary and headers location - they are obviously in a build directory (shame for me). And now I can understand the makefile of an example application. But I still can't understand two things:
Where is a newlib binary?


I see code in the hello world example's makefile:
$(PGM): $(OBJS)

could you explain where is the rule for $(OBJS) and what is $(make-exe)?


Sorry, for such stupid questions, but there are so much different .cfg, .am, .in, waf, configure files, that it is very hard to understand what is happening. 


2017-01-03 3:07 GMT+02:00 Alan Cudmore <alan.cudmore at>:

Hi Denis, 


The simplest application is the RTEMS hello example.


Typically you use the RTEMS source builder tool ( RSB ) to build and install an RTEMS cross compiler. Next, you download, configure, build, and install the RTEMS kernel. Finally you would build your own application outside of the RTEMS source tree and link to the RTEMS library and startup code to create a standalone executable that is loaded to the target. 


There are some getting started docs here to help setup a cross compiler and build the RTEMS source with examples:

(Not sure if that is the latest, but I believe the “sis” BSP has been removed. I use the sparc/erc32 BSP in it’s place) 


If you want to move on from the samples and build your own application outside of the RTEMS tree, I have a sample application framework here:


This gives you an example of how to create a simple RTEMS application with a RAM disk, shell and some sample commands to run on the shell. The wafscript or Makefile link in the necessary libraries for the chosen BSP. 

You can use this with RTEMS 4.11 and 4.12 ( git head ). 


It’s pretty easy to build for the sparc erc32 BSP and run with the sparc-rtems4.11-run command line simulator.


To build, I use the “waf” build tool ( ). When you build for erc32 for example, the executable program will be in :


rki.elf is the final executable that is loaded into the simulator.


Hope this helps,



On Jan 2, 2017, at 8:54 AM, Denis Obrezkov <denisobrezkov at> wrote:


Hello, can you point me to some manual how to create a simple application with rtems?
I read a lot of your tutorials like POSIX  tutorial, C Guide, Ada guide, Dev. environment guide, but I can't find out how to create a simple application.

I found that I am not alone:

I saw examples for rtems, but I have other questions, for example:
Where should I place my source code? Should I place it inside of a rtems tree?

How should I organize my development environment? For example, I want to make an application for a host computer, make myself sure that it works, and then cross-compile it for a target board.
What is the structure of an rtems binary? is it something like a "newlib.a+rtems_kernel.a+userapplication.a".img? 




Regards, Denis Obrezkov
users mailing list
users at



Regards, Denis Obrezkov

More information about the users mailing list