RTEMS 5 how to run "hello" example

Gedare Bloom gedare at rtems.org
Thu Mar 18 16:06:07 UTC 2021


On Thu, Mar 18, 2021 at 3:22 AM Olga Syrbachova <syrba4eva28 at gmail.com>
wrote:

> Thank you very much for your reply! I really appreciate that someone is
> still trying to help me after so many questions from me :)
> I've got an error again, so I will describe here all my steps in case I'm
> doing something wrong and you can see where the problem could be.
> 1.
> olga at olga-H270M-DS3H:~/development$ git clone git://
> git.rtems.org/rtems-examples.git
> 2.
> olga at olga-H270M-DS3H:~/development$ cd rtems-examples
> 3.
> olga at olga-H270M-DS3H:~/development/rtems-examples$ git submodule init
> Submodule 'rtems_waf' (git://git.rtems.org/rtems_waf.git) registered for
> path 'rtems_waf'
> olga at olga-H270M-DS3H:~/development/rtems-examples$ git submodule update
> Cloning into '/home/olga/development/rtems-examples/rtems_waf'...
> Submodule path 'rtems_waf': checked out 'ad0890
> 4.
> olga at olga-H270M-DS3H:~/development/rtems-examples$ ./waf configure
> --rtems=$HOME/development/rtems/5 --rtems-tools=$HOME/development/rtems/5
> --rtems-bsps=sparc/erc32
>

Here, you need to add --rtems-version or it defaults to 6:
  ./waf configure --rtems=$HOME/development/rtems/5
--rtems-tools=$HOME/development/rtems/5 --rtems-bsps=sparc/erc32
--rtems-version=5


> Setting top to                           :
> /home/olga/development/rtems-examples
> Setting out to                           :
> /home/olga/development/rtems-examples/build
> RTEMS path is not valid, "/home/olga/development/rtems/5/share/rtems6" not
> found.
> (complete log in /home/olga/development/rtems-examples/build/config.log)
> 8c452c6a9bbb3bf7bbbcc9fc03fe46cc7f'
>
> As it was suggested by Gedare Bloom before: "We do encourage to try to use
> waf to build the examples though, so let's focus on that direction." I
> would really like to understand how to build the examples and later my own
> apps using waf :)
>
> Great. It should also work to build applications with Makefile or any
other kind of build system, but the trick is how to extract the build
configuration/variables that were used for RTEMS. We are (slowly) moving
toward an interface to get at those variables, with the rtems_waf module
providing the state-of-the-art and best developed method.


> On Wed, 17 Mar 2021 at 22:49, Gedare Bloom <gedare at rtems.org> wrote:
>
>>
>>
>> On Wed, Mar 17, 2021 at 2:23 PM Olga Syrbachova <syrba4eva28 at gmail.com>
>> wrote:
>>
>>> Thank you very much for your reply! I'm still confused about all the
>>> prefixes and PATHs. In the README.waf it is said to run
>>>
>>> $ waf configure --rtems=$HOME/Development/rtems/5 \
>>> --rtems-tools=$HOME/Development/rtems/5 \
>>> --rtems-bsps=sparc/erc32
>>>
>>> where $HOME/Development/rtems/build/5 is the path to tools and
>>> $HOME/Development/rtems/build/5 is the path to RTEMS Board Support
>>> Packages.
>>>
>>> I followed this tutorial
>>> https://medium.com/@mritunjaysharma394/installing-rtems-ecosystem-and-building-your-first-bsp-993d1cf38902
>>> installing RTEMS and building BSP. So in my case I built the tool suit in development/rtems/src/rsb/rtems
>>>
>>>
>>> $ ../source-builder/sb-set-builder --prefix=$HOME/development/rtems/5 5/rtems-sparc
>>>
>>> So the path to tools development/rtems/src/rsb/rtems, is it right? And
>>> I'm not sure what is a path to RTEMS Board Support Packages.
>>>
>>
>> All paths referenced by README.waf are installed paths, i.e., the prefix
>> that you used. It looks like that would be $HOME/development/rtems/5 for
>> your case, for the tools (as passed to sb-set-builder) and for rtems (if
>> you followed that blog post, it specifies the prefix to configure).
>>
>>
>>
>>
>>>
>>> On Wed, 17 Mar 2021 at 18:48, Gedare Bloom <gedare at rtems.org> wrote:
>>>
>>>>
>>>>
>>>> On Wed, Mar 17, 2021 at 10:22 AM Olga Syrbachova <syrba4eva28 at gmail.com>
>>>> wrote:
>>>>
>>>>> What do you mean "regular README file"? There are 3 of them: README,
>>>>> README.Makefile and README.waf. In README there is just a list of examples.
>>>>> I tried to follow the README.Makefile instructions, and after running:
>>>>>
>>>> Thanks I forgot we put those instructions into README.Makefile.
>>>>
>>>>
>>>>>
>>>>> olga at olga-H270M-DS3H:~/development/rtems-examples/hello/hello_world_c$
>>>>> RTEMS_MAKEFILE_PATH=${HOME}/development/rtems/5/sparc-rtems5/erc32 make
>>>>> clean
>>>>>
>>>>> and
>>>>>
>>>>> olga at olga-H270M-DS3H:~/development/rtems-examples/hello/hello_world_c$
>>>>> RTEMS_MAKEFILE_PATH=${HOME}/development/rtems/5/sparc-rtems5/erc32 make
>>>>>
>>>>> there appeared an empty folder "o-optimize" in the examples's
>>>>> directory. What's next?
>>>>>
>>>>> Weird, I'll take a look. We do encourage to try to use waf to build
>>>> the examples though, so let's focus on that direction.
>>>>
>>>>
>>> BTW: This worked for me. If you like, you can show what is the terminal
>> output from the second line
>> `RTEMS_MAKEFILE_PATH=${HOME}/development/rtems/5/sparc-rtems5/erc32 make`?
>>
>>
>>> And what do you mean "use ./waf"? When I run ./waf in "rtems-examples",
>>>>> it says
>>>>>
>>>>> olga at olga-H270M-DS3H:~/development/rtems-examples$ ./waf
>>>>> The project was not configured: run "waf configure" first!
>>>>> olga at olga-H270M-DS3H:~/development/rtems-examples$ waf configure --rtems=$HOME/development/rtems/build/5 \--rtems-tools=$HOME/development/rtems/5 \--rtems-bsps=sparc/erc32
>>>>>
>>>>>
>>>>  ./waf configure --rtems=$HOME/development/rtems/build/5
>>>> \--rtems-tools=$HOME/development/rtems/5 \--rtems-bsps=sparc/erc32
>>>>  ^
>>>>
>>>>> Command 'waf' not found, did you mean: ...
>>>>>
>>>>>   command 'paf' from deb libpod-abstract-perl
>>>>>   command 'wdf' from deb wit
>>>>>   ...
>>>>>
>>>>> On Wed, 17 Mar 2021 at 16:51, Gedare Bloom <gedare at rtems.org> wrote:
>>>>>
>>>>>>
>>>>>>
>>>>>> On Wed, Mar 17, 2021 at 9:11 AM Olga Syrbachova <
>>>>>> syrba4eva28 at gmail.com> wrote:
>>>>>>
>>>>>>> Thanks a lot! I have one more stupid question. How do I run examples
>>>>>>> from git? I've cloned rtems-examples and tried to follow the instructions
>>>>>>> from "README.waf", but it doesn't work. When I enter
>>>>>>>
>>>>>>>     $ waf configure --rtems=$HOME/development/rtems/bsps/5 \
>>>>>>>                     --rtems-tools=$HOME/development/rtems/5 \
>>>>>>>                     --rtems-bsps=sparc/erc32
>>>>>>>
>>>>>>> I get this error:
>>>>>>>        Command 'waf' not found, did you mean: ...
>>>>>>>
>>>>>>> Use ./waf
>>>>>>
>>>>>>
>>>>>>
>>>>>>> I probably do something wrong. Do I need to do the instructions from "README.waf" at all? Or do I need to proceed as in this tutorial https://docs.rtems.org/branches/master/user/start/app.html with every example's directory? I would really appreciate some step-by-step tutorial or instructions as I'm totally frustrated right now and don't understand what to do.
>>>>>>>
>>>>>>> Btw there is a makefile in every example's directory. Can I use it instead of waf to compile the applications? If this is the case how do I do it?
>>>>>>>
>>>>>>> You can do either way of building the examples, see the regular
>>>>>> README file for directions on the Makefile approach.
>>>>>>
>>>>>>
>>>>>>> Many thanks in advance for any help!!!
>>>>>>>
>>>>>>>
>>>>>>> On Tue, 16 Mar 2021 at 20:07, Joel Sherrill <joel at rtems.org> wrote:
>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>> On Tue, Mar 16, 2021 at 1:40 PM Olga Syrbachova <
>>>>>>>> syrba4eva28 at gmail.com> wrote:
>>>>>>>>
>>>>>>>>> Thank you very much for your reply and for your concern!
>>>>>>>>>
>>>>>>>>> Actually I'd like to create my own application and test some
>>>>>>>>> mechanisms, provided by RTEMS. This is a part of my Bachelor Thesis. I'd
>>>>>>>>> like, for example, to create two/three tasks and make them communicate
>>>>>>>>> with each other via queues, schedule them by priority etc. I have some
>>>>>>>>> experience with FreeRTOS. It is run via Visual Studio, which is quite
>>>>>>>>> simple. And now with RTEMS I am a bit frustrated and don't know where to
>>>>>>>>> start. That's why I followed the tutorial on the Website. "Hello World"
>>>>>>>>> program worked just fine, so I decided to try some more complicated
>>>>>>>>> applications before I start with my own, that's why I decided to build
>>>>>>>>> "ticker" with waf. Unfortunately I didn't find any helpful (for me)
>>>>>>>>> tutorial on how to create applications in RTEMS. I mean I can handle
>>>>>>>>> writing the App's code, but I don't get it how to compile and run it. So I
>>>>>>>>> was just going to do the same as in the tutorial, but with my own
>>>>>>>>> application. Is it the right way to proceed or is there another way ?
>>>>>>>>>
>>>>>>>>
>>>>>>>> The tests in RTEMS are just that tests. They depend on things that
>>>>>>>> shouldn't be installed or used by user applications.
>>>>>>>>
>>>>>>>> I would recommend cloning rtems-examples and going from one of
>>>>>>>> those. There is a directory with variations on ticker and I suspect the
>>>>>>>> base one is a better one to start from.
>>>>>>>>
>>>>>>>> If you want to write POSIX code, one of the POSIX examples there
>>>>>>>> would serve you ok
>>>>>>>>
>>>>>>>> --joel
>>>>>>>>
>>>>>>>>
>>>>>>>>>
>>>>>>>>>
>>>>>>>>> <https://www.avast.com/sig-email?utm_medium=email&utm_source=link&utm_campaign=sig-email&utm_content=webmail> Virenfrei.
>>>>>>>>> www.avast.com
>>>>>>>>> <https://www.avast.com/sig-email?utm_medium=email&utm_source=link&utm_campaign=sig-email&utm_content=webmail>
>>>>>>>>> <#m_-3453968078082772622_m_-4707991134687881431_m_2587329209695249861_m_-6228330996423727151_m_-6868087392309282603_m_-8071420466793372504_m_971219196135651785_m_277508452244861825_m_-8462729502950921950_m_6778778117170402098_DAB4FAD8-2DD7-40BB-A1B8-4E2AA1F9FDF2>
>>>>>>>>>
>>>>>>>>> On Tue, 16 Mar 2021 at 16:29, Vijay Kumar Banerjee <
>>>>>>>>> vijay at rtems.org> wrote:
>>>>>>>>>
>>>>>>>>>> On Tue, Mar 16, 2021 at 4:07 AM Olga Syrbachova <
>>>>>>>>>> syrba4eva28 at gmail.com> wrote:
>>>>>>>>>> >
>>>>>>>>>> > Thank you very much for your reply!
>>>>>>>>>> >
>>>>>>>>>> > I've added
>>>>>>>>>> > includes =
>>>>>>>>>> '/home/olga/development/rtems/rtems-5/testsuites/support/include/tmacros.h',
>>>>>>>>>> >
>>>>>>>>>> It takes the relative address to the directory where the header
>>>>>>>>>> file
>>>>>>>>>> is. For example, if you're building from the
>>>>>>>>>> "/home/olga/development/rtems" directory the includes argument
>>>>>>>>>> would
>>>>>>>>>> be:
>>>>>>>>>>
>>>>>>>>>> `includes = './rtems-5/testsuites/support/include/'`
>>>>>>>>>>
>>>>>>>>>> BTW, your first email at the start of the thread says that you
>>>>>>>>>> just
>>>>>>>>>> want to run the samples, the samples get built as a part of the
>>>>>>>>>> rtems
>>>>>>>>>> and you'll be able to see the *.exe files in the build directory.
>>>>>>>>>> Is
>>>>>>>>>> there any reason that you're trying to build it in a separate
>>>>>>>>>> directory with waf? Experimenting with the build system is a good
>>>>>>>>>> reason though, just making sure that we're not pushing you in the
>>>>>>>>>> wrong direction and your objective is indeed to try waf on your
>>>>>>>>>> own
>>>>>>>>>> and not just running RTEMS hello app.
>>>>>>>>>>
>>>>>>>>>> Best regards,
>>>>>>>>>> Vijay
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>> > it still says "No such file or directory". I'm pretty sure the
>>>>>>>>>> path is write, though there is now another path to "tmacros.h" (the first
>>>>>>>>>> one below), it's a folder named "tmacros.h" and it's empty.
>>>>>>>>>> > olga at olga-H270M-DS3H:~$ locate tmacros.h
>>>>>>>>>> >
>>>>>>>>>> /home/olga/development/app/ticker/build/sparc-rtems5-erc32/$HOME/developement/rtems/rtems-5/testsuites/support/include/tmacros.h
>>>>>>>>>> >
>>>>>>>>>> /home/olga/development/rtems/rtems-5/testsuites/support/include/tmacros.h
>>>>>>>>>> >
>>>>>>>>>> >
>>>>>>>>>> > On Mon, 15 Mar 2021 at 21:00, Vijay Kumar Banerjee <
>>>>>>>>>> vijay at rtems.org> wrote:
>>>>>>>>>> >>
>>>>>>>>>> >> On Mon, Mar 15, 2021 at 1:53 PM Olga Syrbachova <
>>>>>>>>>> syrba4eva28 at gmail.com> wrote:
>>>>>>>>>> >> >
>>>>>>>>>> >> > Sure! https://github.com/syrba4eva/RTEMS/blob/main/wscript
>>>>>>>>>> >>
>>>>>>>>>> >> Thanks. In this line:
>>>>>>>>>> https://github.com/syrba4eva/RTEMS/blob/main/wscript#L33
>>>>>>>>>> >> After cflags parameter, add "includes", for example:
>>>>>>>>>> >>
>>>>>>>>>> >> bld(features = 'c cprogram',
>>>>>>>>>> >>       target = 'ticker.exe',
>>>>>>>>>> >>       cflags = '-g -O2',
>>>>>>>>>> >>       includes='. .. ./original/path/to/tmacros.h',
>>>>>>>>>> >>       source = ['init.c', 'tasks.c'])
>>>>>>>>>> >>
>>>>>>>>>> >> you don't need to copy tmacros.h or any headers from rtems,
>>>>>>>>>> just add
>>>>>>>>>> >> the path to includes.
>>>>>>>>>> >>
>>>>>>>>>> >>
>>>>>>>>>> >> Best regards,
>>>>>>>>>> >> Vijay
>>>>>>>>>> >>
>>>>>>>>>> >> >
>>>>>>>>>> >> > On Mon, 15 Mar 2021 at 20:36, Vijay Kumar Banerjee <
>>>>>>>>>> vijay at rtems.org> wrote:
>>>>>>>>>> >> >>
>>>>>>>>>> >> >> On Mon, Mar 15, 2021 at 1:30 PM Olga Syrbachova <
>>>>>>>>>> syrba4eva28 at gmail.com> wrote:
>>>>>>>>>> >> >> >
>>>>>>>>>> >> >> > Thank you very much for your reply!
>>>>>>>>>> >> >> > Unfortunately I'm still a bit confused and don't quite
>>>>>>>>>> understand what to do. Where do I need to modify the "include" parameter?
>>>>>>>>>> In the wscript file from the "hello" example there is no "include"
>>>>>>>>>> parameter. I also tried to find a tutorial on how to write a wscript, but
>>>>>>>>>> didn't find any (Could you suggest any please?). So I tried to copy the
>>>>>>>>>> file "tmacros.h" from testsuites/support/include to app/ticker. Now after
>>>>>>>>>> running ./waf I get an error, which tells me that "buffer_test_io.h" wasn't
>>>>>>>>>> found. When I copied it to my app/ticker directory it didn't work and I
>>>>>>>>>> still have the same error.
>>>>>>>>>> >> >> >
>>>>>>>>>> >> >> Would it be possible for you to paste your wscript
>>>>>>>>>> somewhere (like
>>>>>>>>>> >> >> gist.github.com) and share it here so that we can have a
>>>>>>>>>> look and help
>>>>>>>>>> >> >> you with that?
>>>>>>>>>> >> >>
>>>>>>>>>> >> >> Best regards,
>>>>>>>>>> >> >> Vijay
>>>>>>>>>> >> >>
>>>>>>>>>> >> >> > Waf: Entering directory
>>>>>>>>>> `/home/olga/development/app/ticker/build/sparc-rtems5-erc32'
>>>>>>>>>> >> >> > [1/3] Compiling tasks.c
>>>>>>>>>> >> >> > [2/3] Compiling init.c
>>>>>>>>>> >> >> > In file included from ../../system.h:17:0,
>>>>>>>>>> >> >> >                  from ../../init.c:15:
>>>>>>>>>> >> >> > ../../tmacros.h:32:10: fatal error: buffer_test_io.h: No
>>>>>>>>>> such file or directory
>>>>>>>>>> >> >> >  #include <buffer_test_io.h>
>>>>>>>>>> >> >> >           ^~~~~~~~~~~~~~~~~~
>>>>>>>>>> >> >> > compilation terminated.
>>>>>>>>>> >> >> >
>>>>>>>>>> >> >> > In file included from ../../system.h:17:0,
>>>>>>>>>> >> >> >                  from ../../tasks.c:22:
>>>>>>>>>> >> >> > ../../tmacros.h:32:10: fatal error: buffer_test_io.h: No
>>>>>>>>>> such file or directory
>>>>>>>>>> >> >> >  #include <buffer_test_io.h>
>>>>>>>>>> >> >> >           ^~~~~~~~~~~~~~~~~~
>>>>>>>>>> >> >> > compilation terminated.
>>>>>>>>>> >> >> >
>>>>>>>>>> >> >> > Waf: Leaving directory
>>>>>>>>>> `/home/olga/development/app/ticker/build/sparc-rtems5-erc32'
>>>>>>>>>> >> >> > Build failed
>>>>>>>>>> >> >> >  -> task in 'ticker.exe' failed with exit status 1 (run
>>>>>>>>>> with -v to display more information)
>>>>>>>>>> >> >> >  -> task in 'ticker.exe' failed with exit status 1 (run
>>>>>>>>>> with -v to display more information)
>>>>>>>>>> >> >> >
>>>>>>>>>> >> >> > On Mon, 15 Mar 2021 at 16:21, Vijay Kumar Banerjee <
>>>>>>>>>> vijay at rtems.org> wrote:
>>>>>>>>>> >> >> >>
>>>>>>>>>> >> >> >> Hi Olga,
>>>>>>>>>> >> >> >>
>>>>>>>>>> >> >> >>
>>>>>>>>>> >> >> >> On Mon, Mar 15, 2021 at 8:29 AM Olga Syrbachova <
>>>>>>>>>> syrba4eva28 at gmail.com> wrote:
>>>>>>>>>> >> >> >> >
>>>>>>>>>> >> >> >> > Thank you very much for your reply!
>>>>>>>>>> >> >> >> >
>>>>>>>>>> >> >> >> > I've built the RTEMS Kernel for erc32. Then I followed
>>>>>>>>>> this tutorial
>>>>>>>>>> https://docs.rtems.org/branches/master/user/start/app.html to
>>>>>>>>>> build a "Hello World" application and it works just fine. Then I've tried
>>>>>>>>>> to create another application following the steps in the tutorial.
>>>>>>>>>> >> >> >> > 1. In $HOME/development/app/ I created a directory
>>>>>>>>>> "ticker".
>>>>>>>>>> >> >> >> > 2. cd ticker
>>>>>>>>>> >> >> >> > 3. curl https://waf.io/waf-2.0.19 > waf
>>>>>>>>>> >> >> >> >     chmod +x waf
>>>>>>>>>> >> >> >> >     git init
>>>>>>>>>> >> >> >> >     git submodule add git://
>>>>>>>>>> git.rtems.org/rtems_waf.git rtems_waf
>>>>>>>>>> >> >> >> > 4. I've copied the files "init.c", "tasks.c",
>>>>>>>>>> "system.h" from testsuites/samples
>>>>>>>>>> >> >> >> > 5. In the "wscript" I've changed the lines 32 and 34
>>>>>>>>>> to target = 'ticker.exe', source = ['init.c', 'tasks.c']
>>>>>>>>>> >> >> >> > 6. ./waf configure --rtems=$HOME/development/rtems/5
>>>>>>>>>> --rtems-bsp=sparc/erc32
>>>>>>>>>> >> >> >> > 7. and running ./waf next, I get an error. It looks
>>>>>>>>>> like the file "tmacros.h", which is included in "system.h", cannot be found.
>>>>>>>>>> >> >> >> >
>>>>>>>>>> >> >> >> You have changed the "target" and "source" parameters in
>>>>>>>>>> your wscript.
>>>>>>>>>> >> >> >> You'd also need to modify the "include" parameter and
>>>>>>>>>> add relative
>>>>>>>>>> >> >> >> path to tmacros.h. For multiple headers, you'll have to
>>>>>>>>>> add the paths
>>>>>>>>>> >> >> >> as a string with space-separated values or a list like
>>>>>>>>>> this:
>>>>>>>>>> >> >> >> `includes='./ ../ ./path/to/include/'`
>>>>>>>>>> >> >> >>
>>>>>>>>>> >> >> >>
>>>>>>>>>> >> >> >> > What am I doing wrong? Is the way to run other
>>>>>>>>>> examples exactly the same as to run a "Hello World" example?
>>>>>>>>>> >> >> >> The other examples will also follow a similar wscript
>>>>>>>>>> structure but
>>>>>>>>>> >> >> >> hello world is the simple one with fewer includes so
>>>>>>>>>> it's a good place
>>>>>>>>>> >> >> >> to start if you're trying to learn how to make a
>>>>>>>>>> separate project with
>>>>>>>>>> >> >> >> RTEMS applications using waf.
>>>>>>>>>> >> >> >>
>>>>>>>>>> >> >> >>
>>>>>>>>>> >> >> >> Best regards,
>>>>>>>>>> >> >> >> Vijay
>>>>>>>>>> >> >> >> > _______________________________________________
>>>>>>>>>> >> >> >> > users mailing list
>>>>>>>>>> >> >> >> > users at rtems.org
>>>>>>>>>> >> >> >> > http://lists.rtems.org/mailman/listinfo/users
>>>>>>>>>>
>>>>>>>>>
>>>>>>>>>
>>>>>>>>> <https://www.avast.com/sig-email?utm_medium=email&utm_source=link&utm_campaign=sig-email&utm_content=webmail> Virenfrei.
>>>>>>>>> www.avast.com
>>>>>>>>> <https://www.avast.com/sig-email?utm_medium=email&utm_source=link&utm_campaign=sig-email&utm_content=webmail>
>>>>>>>>> <#m_-3453968078082772622_m_-4707991134687881431_m_2587329209695249861_m_-6228330996423727151_m_-6868087392309282603_m_-8071420466793372504_m_971219196135651785_m_277508452244861825_m_-8462729502950921950_DAB4FAD8-2DD7-40BB-A1B8-4E2AA1F9FDF2>
>>>>>>>>> _______________________________________________
>>>>>>>>> users mailing list
>>>>>>>>> users at rtems.org
>>>>>>>>> http://lists.rtems.org/mailman/listinfo/users
>>>>>>>>
>>>>>>>> _______________________________________________
>>>>>>> users mailing list
>>>>>>> users at rtems.org
>>>>>>> http://lists.rtems.org/mailman/listinfo/users
>>>>>>
>>>>>>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.rtems.org/pipermail/users/attachments/20210318/65053901/attachment-0001.html>


More information about the users mailing list