Using the eRTOS Application Template
eRTOS provides two templates in the Templates/Visual C++ branch in the supported versions of Microsoft Visual Studio:
- eRTOS Application – creates a project and solution for the development of eRTOS applications.
- eRTOS RTDLL – creates a project and solution for the development of eRTOS Real-Time Dynamic-Link Library (RTDLLs). For more information on this template, see Using the eRTOS RTDLL Template.
The eRTOS project contains two build configurations: eRTOSRelease, and eRTOSDebug. The eRTOS Application Template sets the project settings for each configuration according to the program and project options that you specify. The template can also provide a basic C/C++ program framework with which to work. This program framework can include eRTOS program elements, which contain C/C++ code to create eRTOS objects and demonstrate their use.
Note: eRTOS only supports absolute pathnames.
Sections in this Topic:
Creating an eRTOS Application
The eRTOS Application template provides the structure for creating eRTOS applications. Use the following procedure to create an eRTOS project using the eRTOS Application template in Microsoft Visual Studio.
To create an eRTOS application project:
- Create a new project in Visual Studio.
- Select C or C++ as the template type.
- Select the eRTOS Application template. This template is a single-page dialog that displays the default project settings and provides optional application and program settings.
- To accept the current settings, click Finish. Optionally, you can specify other options and libraries that you want to include in your eRTOS application project:
- Project Type – You can create a project in C or C++. Select the type of project source you want to create. This causes the generation of either .C or .CPP files and determines which compiler to use when building your application.
- Supported String Convention – Specify Unicode, MultiByte, or Ansi. This determines if the associated pre-processor definitions will be included in the project settings.
- Add additional headers and libraries:
- TCP/IP support – Adds support for the TCP/IP Stack component within Process configurations and Windows socket libraries for Windows configurations.
- Network Link Layer support – Adds support for the Network Link Layer (NL2) component.
- Microsoft C Runtime support – Adds C/C++ Runtime support. Most programs need support for C Runtime functions.
- If these are all the options needed, click Finish to create the project. Otherwise, continue editing program settings for this application.
- Provide a program framework – The eRTOS Application template can build a basic program framework consisting of source and header files, or it can build an empty project. When the Provide a program framework box is cleared, the eRTOS Application template sets only the project settings and does not include any header or C/C++ files, and all program elements become grayed-out. When the Provide a program framework box is selected, the eRTOS Application template inserts into the project C/C++ source files that contain basic program functionality and header files that contain include and define statements.
When the Provide a program framework box is selected, you can optionally add elements to the program framework. These code segments show proper usage of Real-time API function calls and can serve as examples of how to set up these elements. Areas in the element code that need to be customized by the user are indicated by "TO DO" comments. You can select more than one type of programming element for a single project. The following table provides the available program elements.
Note: When the Provide a program framework box is cleared, these options are grayed out.
- Click Finish. This generates the eRTOS solution and project according to the options you selected.
Element | Description |
---|---|
Event server thread |
Inserts a code segment into the program framework that creates a child thread function shell, a named event and a child thread, and sets thread priorities and resumes/suspends threads. The user should supply the child thread function code, the event name and exception code. |
Periodic timer thread |
Creates a periodic timer function shell and inserts a code segment into the program framework that creates and sets a periodic timer. The user should supply the timer period, the periodic timer function code, and exception code. |
Interrupt Service Routine (ISR) |
Creates a basic Interrupt Service Routine template that can be used to determine the interrupt owner when an interrupt is shared. Inserts code segments into the program framework to support interrupt sharing. |
Interrupt Service Thread (IST) |
Creates a basic Interrupt Service Thread template that can be called when an interrupt occurs. Inserts code segments into the program framework to support interrupts. |
Basic Port I/O |
Inserts a code segment into the program framework that supports Port I/O. Enables/disables Port I/O and demonstrates basic reading and writing to an I/O Port. |
Basic mapped memory |
Inserts a code segment into the program framework that supports Memory Mapping. |
eRTOS Custom Macro
eRTOS utilizes a custom macro, $(eRTOSPlatform)
, that is used to find the correct library directory for projects. This custom macro requires two property files, which are installed with the eRTOS SDK:
- eRTOS.cpp.x64.user.props
All projects import these property files. If they are edited in any way, projects will not load correctly.
Resulting Configurations
Four configurations for creating applications are generated in Visual Studio when you create a project using the eRTOS Application template:
x64
- eRTOSDebug – Real-time application that has debug flags enabled
- eRTOSRelease – Optimized Real-time application that does not contain additional debug information