Keil Logo

Create New RTX Application

This section describes how to create a new application that uses the RTX kernel.

  1. First, create a new project in the µVision IDE by selecting Project —> New Project.
  2. In the Create New Project window, select a new directory for your project and enter a name for your project.
  3. In the Select Device for Target window, select your target ARM device and click OK. Allow µVision to copy and add the device startup file to your project. This creates a basic µVision project.
  4. Now setup the project to use the RTX kernel. To do this, select Project —> Options for Target. Then select RTX Kernel for the Operating system and click OK.
  5. Copy the RTX configuration file for your target device from the \Keil\ARM\RL\RTX\Config\ directory and rename it to RTX_Config.c:
    • for ARM7™/ARM9™ devices, copy the configuration file for your specific device. If the file does not exist for your specific device, then copy the RTX_Conf_LPC21xx.c as a template and modify it to suit your device.
    • for Cortex-M™ devices, copy RTX_Conf_CM.c configuration file.
  6. Modify the device startup file for ARM7™/ARM9™ devices to enable SWI_Handler function (no change required for Cortex-M™ devices):
    • Comment out the following line from the startup file:
      SWI_Handler    B    SWI_Handler
    • Add the following line to the startup file:
      IMPORT    SWI_Handler
    This change prevents the code from sitting in a loop when a SWI interrupt occurs. The change allows the right function to run when a SWI interrupt occurs.
  7. Copy the retarget.c file from \Keil\ARM\Startup\ to your project directory, and add it to your project. The main purpose of this file is to avoid the use of semihosting SWIs. Thus the file must contain the following:
    #include <rt_misc.h>
    #pragma import(__use_no_semihosting_swi)
    void _ttywrch(int ch) {
      // Not used (No Output)
    void _sys_exit(int return_code) {
    label:  goto label;  /* endless loop */
    Depending on your application, you might have to retarget more functions. For example if you use the RL-FlashFS library, you can obtain retarget.c from the \Keil\ARM\RL\FlashFS\SRC\ directory. Now the project is setup to use the RTX kernel.


    • For MicroLIB runtime library you do not need a retarget.c in your project.
  8. Now you must configure the RTX kernel for the needs of your application by making the required changes in the RTX_Config.c file.
  9. Create the application source files if they do not already exist. Add these source files to the project. You can do this in the project workspace of µVision by right clicking on the Source Group and selecting Add Files to Group.
  10. Build your application using Project —> Build Target.
  11. If you project builds successfully, you can download it to your hardware or run it using the µVision Simulator. You can also debug the application using Debug —> Start Debug Session.

Related Knowledgebase Articles

  Arm logo
Important information

This site uses cookies to store information on your computer. By continuing to use our site, you consent to our cookies.

Change Settings

Privacy Policy Update

Arm’s Privacy Policy has been updated. By continuing to use our site, you consent to Arm’s Privacy Policy. Please review our Privacy Policy to learn more about our collection, use and transfers
of your data.