===== OSA : Project ===== ===== Creating a project ===== To use OSA in your application you need to do the following: - 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); - In your project folder create the file ##[[en:osa:ref:appendix:configuration|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 [[en:osa:ref:download:intro#Tools|OSAcfg_Tool]] to create/modify this file; - Insert the line "include " into all files that will use OSA services; - Add two "Include search paths" to project options: * the path to ##[[en:osa:ref:appendix:configuration|OSAcfg.h]]## for your current project * the path to osa.h; - At the beginning of function main() insert a call to the ##[[en:osa:ref:allservices:OS_Init|OS_Init]]##() service; - At the end of function main() insert a call to the ##[[en:osa:ref:allservices:OS_Run|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 ##[[en:osa:ref:allservices:OS_Task_Define|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 ##[[en:osa:ref:allservices:OS_Task_Define|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" ~~UP~~