<div dir="ltr"><br><div class="gmail_extra"><br><div class="gmail_quote">On Tue, Jan 3, 2017 at 6:21 AM, Alan Cudmore <span dir="ltr"><<a href="mailto:alan.cudmore@gmail.com" target="_blank">alan.cudmore@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div style="word-wrap:break-word">I understand your confusion. Currently there is a mixture of autoconfig, waf , and the examples use a custom makefile configuration. <div><br></div><div>When I setup my RTEMS development environment, I use:</div><div>$HOME/rtems — base directory</div><div>$HOME/rtems/rtems-src — I checkout the RTEMS source here</div><div>$HOME/rtems/bsps  - I install BSP libraries here</div><div>$HOME/rtems/tools - I install the RSB toolchains here</div><div>$HOME/rtems/apps — I put my apps such as the RKI project here</div><div><br></div><div>So, when I build a toolchain with RSB, ( 4.11, Sparc for example ) </div><div>It goes in:</div><div>$HOME/rtems/tools/4.11/</div><div>Note that multiple toolchains for 4.11 can be installed here ( sparc, arm, x86, etc ) </div><div>Similarly, I can use </div><div>$HOME/rtems/tools/4.12/</div><div>for RTEMS 4.12 tools as well. </div><div><br></div><div>I believe the newlib libraries and headers are installed along with the tools.</div><div><br></div></div></blockquote><div>Yes.</div><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div style="word-wrap:break-word"><div></div><div><div>The setup can be powerful because all of the cross compiler tools for different versions and architectures can co-exist.</div></div><div><br></div><div>I also build the RTEMS source separately, and I use the ./bootstrap, configure, make, and make install steps</div><div>During the configure step, I specify:</div><div>$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. </div></div></blockquote><div><br></div><div>And should NOT be referenced by the application build system.</div><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div style="word-wrap:break-word"><div>This also works for multiple architectures and versions of RTEMS.</div><div><br></div><div>Once the tools and RTEMS libraries and headers are compiled and installed, you have a SDK ready to develop applications. </div><div>With the correct application makefiles, you do not need to worry as much about the exact locations of the libraries and headers. </div><div><br></div><div>If you look at the RKI standard makefile:</div><div><a href="https://github.com/alanc98/rki/blob/master/Makefile" target="_blank">https://github.com/alanc98/<wbr>rki/blob/master/Makefile</a></div><div>You can see that there are environment variables that point to the location of the tools and RTEMS libraries/bsps. </div><div>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. </div><div><br></div></div></blockquote><div><br></div><div><br></div><div>The math, C, and gcc support libraries are in a location implicitly known to the compiler.</div><div><br></div><div>The -B option specifies where the BSP is. The -specs option adds on BSP specific options with</div><div>the -qrtems enabling them.</div><div><br></div><div><a href="https://gcc.gnu.org/onlinedocs/gcc/Directory-Options.html#Directory-Options">https://gcc.gnu.org/onlinedocs/gcc/Directory-Options.html#Directory-Options</a> documents the -B option.<br></div><div>It treats the argument as a system directory and that's the BSP directory for RTEMS.</div><div><br></div><div>If you build extra libraries, I tend to recommend building them with BSP specific options and</div><div>installing them under the BSP directory. That way they are optimized for the BSP's CPU</div><div>and the -B picks them up. Sometimes a library can be built BSP independent and installed</div><div>with the compiler.</div><div><br></div><div><br></div><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div style="word-wrap:break-word"><div></div><div>( 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 )</div><div><br></div></div></blockquote><div><br></div><div>I use separate install points for tools and BSPs for testing. That way I can remove a BSP install</div><div>at any time without reinstalling tools. Handy since the BSP can be more volatile than the tools.</div><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div style="word-wrap:break-word"><div></div><div>So that is an example of a custom made makefile for an application. The rtems-waf tool is another way to build an application. </div><div>Look at the README.waf for an example of how to use the waf tool. </div><div><br></div><div><a href="https://github.com/alanc98/rki/blob/master/README.waf" target="_blank">https://github.com/alanc98/<wbr>rki/blob/master/README.waf</a></div><div><br></div><div>The RTEMS project has a goal of replacing the auto configure scripts for the RTEMS kernel source with a waf build system. </div><div><br></div><div>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. </div><span class="gmail-HOEnZb"><font color="#888888"><div><br></div><div>Alan</div></font></span><div><div class="gmail-h5"><div><br></div><div><br></div><div><br></div><div><div><div><div><blockquote type="cite"><div>On Jan 3, 2017, at 5:10 AM, Denis Obrezkov <<a href="mailto:denisobrezkov@gmail.com" target="_blank">denisobrezkov@gmail.com</a>> wrote:</div><br class="gmail-m_1667684516566258016Apple-interchange-newline"><div><div dir="ltr"><div><div><div><div>Thank you for your answer. <br>I've already build a cross-compiler and rtems. And sample applications work.<br><br></div>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.<br><br></div>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:<br></div>Where is a newlib binary?<br><br></div><div>I see code in the hello world example's makefile:<br>$(PGM): $(OBJS)<br>    $(make-exe)<br></div><div>could you explain where is the rule for $(OBJS) and what is $(make-exe)?<br><br></div><div>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. <br></div></div><div class="gmail_extra"><br><div class="gmail_quote">2017-01-03 3:07 GMT+02:00 Alan Cudmore <span dir="ltr"><<a href="mailto:alan.cudmore@gmail.com" target="_blank">alan.cudmore@gmail.com</a>></span>:<br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div style="word-wrap:break-word">Hi Denis,<div><br></div><div>The simplest application is the RTEMS hello example. </div><div><a href="https://git.rtems.org/rtems/tree/testsuites/samples/hello" target="_blank">https://git.rtems.org/rtems/tr<wbr>ee/testsuites/samples/hello</a></div><div><br></div><div><div>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. </div></div><div><br></div><div>There are some getting started docs here to help setup a cross compiler and build the RTEMS source with examples:</div><div><a href="https://devel.rtems.org/wiki/TBR/UserManual/Quick_Start" target="_blank">https://devel.rtems.org/wiki/T<wbr>BR/UserManual/Quick_Start</a></div><div>(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) </div><div><br></div><div><div>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:</div><div><a href="https://github.com/alanc98/rki" target="_blank">https://github.com/alanc98/rki</a></div><div><br></div><div>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. </div><div>You can use this with RTEMS 4.11 and 4.12 ( git head ). </div><div><br></div><div>It’s pretty easy to build for the sparc erc32 BSP and run with the sparc-rtems4.11-run command line simulator.</div><div><br></div><div>To build, I use the “waf” build tool ( <a href="http://waf.io/" target="_blank">waf.io</a> ). When you build for erc32 for example, the executable program will be in :</div><div>rki/build/sparc-rtems4.11-erc3<wbr>2/rki.elf</div><div>rki.elf is the final executable that is loaded into the simulator.</div><div><br></div><div>Hope this helps,</div><div>Alan</div><div><br></div><div><div><blockquote type="cite"><div><div class="gmail-m_1667684516566258016h5"><div>On Jan 2, 2017, at 8:54 AM, Denis Obrezkov <<a href="mailto:denisobrezkov@gmail.com" target="_blank">denisobrezkov@gmail.com</a>> wrote:</div><br class="gmail-m_1667684516566258016m_-7446857271882909985Apple-interchange-newline"></div></div><div><div><div class="gmail-m_1667684516566258016h5"><div dir="ltr"><div><div><div><div><div>Hello, can you point me to some manual how to create a simple application with rtems?<br></div>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.<br><br></div>I found that I am not alone:<br><a href="http://rtems-users.rtems.narkive.com/rQP1z7Pg/rtems-application-tutorial" target="_blank">http://rtems-users.rtems.narki<wbr>ve.com/rQP1z7Pg/rtems-applicat<wbr>ion-tutorial</a><br><a href="http://stackoverflow.com/questions/23794870/rtems-how-to-compile-and-execute-programs" target="_blank">http://stackoverflow.com/quest<wbr>ions/23794870/rtems-how-to-<wbr>compile-and-execute-programs</a><br><br></div>I saw examples for rtems, but I have other questions, for example:<br></div>Where should I place my source code? Should I place it inside of a rtems tree?<br></div><div>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.<br></div>What is the structure of an rtems binary? is it something like a "newlib.a+rtems_kernel.a+usera<wbr>pplication.a".img? <br><br><br clear="all"><div><div><div><div><div><div><br>-- <br><div class="gmail-m_1667684516566258016m_-7446857271882909985gmail_signature">Regards, Denis Obrezkov</div>
</div></div></div></div></div></div></div></div></div>
______________________________<wbr>_________________<br>users mailing list<br><a href="mailto:users@rtems.org" target="_blank">users@rtems.org</a><br><a href="http://lists.rtems.org/mailman/listinfo/users" target="_blank">http://lists.rtems.org/mailman<wbr>/listinfo/users</a></div></blockquote></div><br></div></div></div></blockquote></div><br><br clear="all"><br>-- <br><div class="gmail-m_1667684516566258016gmail_signature">Regards, Denis Obrezkov</div>
</div>
</div></blockquote></div><br></div></div></div></div></div></div><br>______________________________<wbr>_________________<br>
users mailing list<br>
<a href="mailto:users@rtems.org">users@rtems.org</a><br>
<a href="http://lists.rtems.org/mailman/listinfo/users" rel="noreferrer" target="_blank">http://lists.rtems.org/<wbr>mailman/listinfo/users</a><br></blockquote></div><br></div></div>