Available Languages?:

OSA : Project

Creating a project

To use OSA in your application you need to do the following:

  1. Create a project using IDE. In addition to all your project files add the file osa.c to your project (it contains all system variables and function prototypes);
  2. In your project folder create the file OSAcfg.h. This file is used to specify OSA compilation parameters (like number of tasks, timer type etc). In the simplest case this file can be empty. You can use the program OSAcfg_Tool to create/modify this file;
  3. Insert the line "include <osa.h>" into all files that will use OSA services;
  4. Add two "Include search paths" to project options:
    • the path to OSAcfg.h for your current project
    • the path to osa.h;
  5. At the beginning of function main() insert a call to the OS_Init() service;
  6. At the end of function main() insert a call to the OS_Run() service;

Notes for different IDEs and platforms

MPLAB

  • To add the osa.c file click right button in Workspace window, and select the "Add file…"
  • Include-paths are set through project options: menu "Project/Build options/Project…", tab "Directories".

MPLAB and HT-PICC

  • Old versions of mplab plug-ins for HTPICC did not support the relative paths in Include Directories list, only absolute.
  • for PRO-version: To provide the compiler with the correct information on call tree, all task functions shpuld be declared in main with the service OS_Task_Define()
void main (void)
{
    OS_Init();
    ...
    OS_Task_Define(Task_Buttons);
    OS_Task_Define(Task_LEDs);
    OS_Task_Define(Task_LCD);
    ...
    OS_Task_Create(Task_Buttons);
    OS_Task_Create(Task_LEDs);
    OS_Task_Create(Task_LCD);
 
}

MPLAB and Mplab C18

  • Set the library path: menu "Project/Build options/Progect…", tab "Directories", combo "Library Search Path". Enter the path for library files (e.g. c:\mcc18\lib).
  • In the project options window select the tab "MPLAB C18", category "Optimization" and check off the "Procedural absraction"
  • Don't forget to add the linker script file: right mouse button on "Linker Script" folder in "Workspace" window and select the .lkr file for your controller (see "MCC18\lkr")

MPLAB and Mplab C30

  • In the project options window select the tab "MPLAB C30", category "Optimization" and check off the "Procedural absraction"

CCS

  • don't add the osa.c file into the project
  • To provide the compiler with the correct information on call tree, all task functions shpuld be declared in main with the service OS_Task_Define()
void main (void)
{
    OS_Init();
    ...
    OS_Task_Define(Task_Buttons);
    OS_Task_Define(Task_LEDs);
    OS_Task_Define(Task_LCD);
    ...
    OS_Task_Create(Task_Buttons);
    OS_Task_Create(Task_LEDs);
    OS_Task_Create(Task_LCD);
 
}

mikroC PRO IDE

  • To add the osa.c file select menu "Project/Add File To Project…"
  • Include-path arre set througth menu "Project/Edit Search Paths…". In dialog box there are two path lists: Source Files and Header Files. We need the "Header files". Press "green plus" icon to add include-paths.
  • The linker must be informed about functions that will be used as tasks:
#pragma funcall main Task_Buttons       // Tell linker that function will be
                                        // called indirectly
 
void Task_Buttons (void)
{
    ...
}

AVR Studio and WinAVR

  • to add the osa.c file into project do right-click in Workspace window (AVR GCC) on "Source Files" folder and select "Add Existing Source File(s)…"
  • include-path are set througth menu "Project/Configuration options", tab "Include Directories"

IAR

  • To add the osa.c file select menu "Project/Add files…"
  • include-path are set througth menu "Project/Options", category "C/C++ compiler", tab "preprocessor", field "Additional include directories"
  • Than in tab "Optimization" check off "Cross call"

IAR and STM8

  • In addition to all requirements described before, add the file "osa\port\stm8\osa_stm_iar.s" into the project

STVD and STM8

  • to add the osa.c file into project do right-click in Workspace window on the "Source" folder and select "Add Files To Folder…"
  • include-path are set througth menu "Project/Options", category "C compiler", tab "preprocessor", field "Additional include directories"

Raisonance and STM8

  • to add the osa.c file select menu "Project/Add Item…"
  • include-path are set througth menu "Project/Properties", folder "Application Optios", sub-folder "Directories"
 
en/osa/ref/description/project.txt · Last modified: 09.03.2011 17:36 by osa_chief
 
Creative Commons License Powered by PHP Valid XHTML 1.0 Valid CSS Driven by DokuWiki