IceWalkers.com - Linux Software downloads and news
Name : Password :
Linux SoftwareLinux RPMLinux HowtosLink UsAboutAdvertise

RTLinux HOWTO

Search Howtos :Match :
Next Previous Contents

5. Compiling and Executing

In order to execute the program, hello.c, (after booting rtlinux, ofcourse) you must do the following :

  1. Compile the source code and create a module using the GCC compiler. To simplify things, however, it is better to create a Makefile. Then you only need to type 'make' to compile the code. Makefile can be created by typing in the following lines in a file named 'Makefile'.
         include rtl.mk
         all: hello.o
         clean:
             rm -f *.o
         hello.o: hello.c
             $(CC) ${INCLUDE} ${CFLAGS} -c hello.c
    
  2. Locate and copy the rtl.mk file into the same directory as your hello.c and Makefile. The rtl.mk file is an include file which contains all the flags needed to compile the code. You can copy it from the RTLinux source tree and place it alongside of the hello.c file.
  3. For compiling the code, use the command 'make'.
            $ make 
    
  4. The resulting object binary must be inserted into the kernel, where it will be executed by RTLinux. Use the command 'rtlinux' (you need to be the 'root' to do so).
            $ rtlinux start hello
    

You should now be able to see your hello.o program printing its message every second. Depending on the configuration of your machine, you should either be able to see it directly in your console, or by typing:

        $ dmesg

To stop the program, you need to remove it from the kernel. To do so, type:

        $ rtlinux stop hello

Alternate ways for inserting and removing the module is to use insmod and rmmod respectively.

Here, we have made our example program too simple. Contrary to what we have seen, there may be multiple threads in a program. Priority can be set at thread creation or modified later. Also, we can select the scheduling algorithm that should be used. In fact, we can write our own scheduling algorithms!

In our example, we can set priority of the thread as 1, and select FIFO scheduling by inserting the following lines in the beginning of the function, thread_code() :

        struct sched_param p;
        p . sched_priority = 1;
        pthread_setschedparam (pthread_self(), SCHED_FIFO, &p);

Next Previous Contents
Search Howtos :Match :
PhpMyAdmin 3.1.2 rc1
Php front-end to MySQL administration
Xine 1.1.6
Free video player
Glade 3.5.5
User interface builder for GTK+ and Gnome
Evolution 2.25.4
GNOME mailer, calendar, contact manager and communications tool
GEdit 2.25.4
Small but powerful text editor
Mutt 1.5.19
Small but very powerful text-based mail client.
Galculator 1.3.2
GTK 2 based scientific calculator
GTK2 2.14.7
GUI Toolkit
WebGUI 7.5.38
A fully featured content management system.
Brasero 0.9.0
Application to burn CD/DVD
Free IT Magazines, White Papers, eBooks, and more !
Dr. Dobb's Journal

Dr. Dobb's Journal enables programmers to write the most efficient and sophisticated programs and help in daily programming quandaries.

The 7 Things that IT Security Professionals MUST KNOW!

Gain key insight into security problem and find the safest means to protect your technological assets.

Database Trends and Applications

Provides timely coverage of the technology, intelligence and insight needed to plan, implement and manage information-rich projects.

Linux Software Map
Find Linux RPM
Best Rated Linux Software
Most Rated Linux Software
Linux Distributions
Linux Howtos
Quick Survey

Please take our survey and help us improve our website to serve you better.

Thank you.
Linux Software
Linux / IT Resources
Site Resources
Google
Privacy Policy
Contact Us
Submit Software
Advertising info