alan.cudmore at gmail.com
Tue Jan 3 12:21:53 UTC 2017
I understand your confusion. Currently there is a mixture of autoconfig, waf , and the examples use a custom makefile configuration.
When I setup my RTEMS development environment, I use:
$HOME/rtems — base directory
$HOME/rtems/rtems-src — I checkout the RTEMS source here
$HOME/rtems/bsps - I install BSP libraries here
$HOME/rtems/tools - I install the RSB toolchains here
$HOME/rtems/apps — I put my apps such as the RKI project here
So, when I build a toolchain with RSB, ( 4.11, Sparc for example )
It goes in:
Note that multiple toolchains for 4.11 can be installed here ( sparc, arm, x86, etc )
Similarly, I can use
for RTEMS 4.12 tools as well.
I believe the newlib libraries and headers are installed along with the tools.
The setup can be powerful because all of the cross compiler tools for different versions and architectures can co-exist.
I also build the RTEMS source separately, and I use the ./bootstrap, configure, make, and make install steps
During the configure step, I specify:
$HOME/rtems/bsps/4.11 as the install prefix, so I know where the compiled RTEMS libraries and headers will reside. Once installed, the build directory is no longer needed.
This also works for multiple architectures and versions of RTEMS.
Once the tools and RTEMS libraries and headers are compiled and installed, you have a SDK ready to develop applications.
With the correct application makefiles, you do not need to worry as much about the exact locations of the libraries and headers.
If you look at the RKI standard makefile:
You can see that there are environment variables that point to the location of the tools and RTEMS libraries/bsps.
As you can see in this makefile, the individual RTEMS libraries are not called out. I believe the -specs bsp_specs and -qrtems options take care of that.
( also note that the paths in that makefile do not separate tools and bsps.. I have not updated that in a while. In that example, tools and bsps were installed in $HOME/rtems/4.11, which will work, but I prefer to separate them )
So that is an example of a custom made makefile for an application. The rtems-waf tool is another way to build an application.
Look at the README.waf for an example of how to use the waf tool.
The RTEMS project has a goal of replacing the auto configure scripts for the RTEMS kernel source with a waf build system.
The simple examples can also be built using a waf script. I have an example on my disk, I should post it to my GitHub account soon for reference.
> On Jan 3, 2017, at 5:10 AM, Denis Obrezkov <denisobrezkov at gmail.com> wrote:
> 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 gmail.com <mailto:alan.cudmore at gmail.com>>:
> Hi Denis,
> The simplest application is the RTEMS hello example.
> https://git.rtems.org/rtems/tree/testsuites/samples/hello <https://git.rtems.org/rtems/tree/testsuites/samples/hello>
> 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:
> https://devel.rtems.org/wiki/TBR/UserManual/Quick_Start <https://devel.rtems.org/wiki/TBR/UserManual/Quick_Start>
> (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:
> https://github.com/alanc98/rki <https://github.com/alanc98/rki>
> 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 ( waf.io <http://waf.io/> ). 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 gmail.com <mailto:denisobrezkov at gmail.com>> 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:
>> http://rtems-users.rtems.narkive.com/rQP1z7Pg/rtems-application-tutorial <http://rtems-users.rtems.narkive.com/rQP1z7Pg/rtems-application-tutorial>
>> http://stackoverflow.com/questions/23794870/rtems-how-to-compile-and-execute-programs <http://stackoverflow.com/questions/23794870/rtems-how-to-compile-and-execute-programs>
>> 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 rtems.org <mailto:users at rtems.org>
>> http://lists.rtems.org/mailman/listinfo/users <http://lists.rtems.org/mailman/listinfo/users>
> Regards, Denis Obrezkov
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the users