====== OSA : Introduction ====== ===== What is OSA? ====== **//OSA//** is a cooperative multitasking real-time operating system (RTOS) for Microchip PIC-controllers **PIC10**, **PIC12**, **PIC16**, **PIC18**, **PIC24**, **dsPIC**, for Atmel **AVR 8-bit** controllers, and for STMicroelectronics **STM8**. RTOS allows the programmer to focus on problem-oriented tasks (algorithmic, mathematical etc.) and not have to worry about secondary tasks. All secondary tasks are performed by OSA's kernel: * switching between parallel processes (e.g. keyboard scanning, output data to LCD, switching relays); * checking timeouts, counting delays; * finding the ready task with the highest priority and executing it; * data exchange between different tasks using semaphores, messages, queues etc. A task in OSA is a C-function. This function must contain an infinite loop which has inside it at least one service that switches task context. A simple task can look like this: void SimpleTask (void) { for (;;) // Infinite loop { OS_Yield(); // Unconditional context switching } } ===== Compilers ===== ==== PIC ==== ^ ^ PIC10/12 ^ PIC16/12 ^ PIC16F1xxx ^ PIC18 ^ PIC24/dsPIC ^ | {{:osa:ref:picc_std.png|HT-PICC STD}} | {{yes.png}} | {{yes.png}} | | {{yes.png}} | | | {{:osa:ref:picc_pro.png|HT-PICC PRO}} | {{no.png}} | {{no.png}} | {{yes.png}} | {{no.png}} | | | {{:osa:ref:mplabc.png|Microchip C}} | | | | {{yes.png}} | {{yes.png}} | | {{:osa:ref:mikroc_pro.png|mikroC PRO}} | | {{yes.png}} | | {{yes.png}} | {{process.png}} | | {{:osa:ref:ccs.png|CCS PICC}} | | {{yes.png}} | | {{yes.png}} | | ==== AVR ==== ^ ^ AVR 8-bit ^ | {{:osa:ref:winavr.png|WinAVR}} | {{yes.png}} | | {{:osa:ref:iar.png|IAR}} | {{yes.png}} | | {{:osa:ref:cvavr.png|Code Vision AVR}} | {{process.png}} | ==== STM8 ==== ^ ^ STM8 ^ | {{:osa:ref:cosmic.png|Cosmic}} | {{yes.png}} | | {{:osa:ref:iar.png|IAR}} | {{yes.png}} | | {{:osa:ref:raisonance.png|Raisonance}} | {{yes.png}} | ===== Limitations ===== ==== HT-PICC HT-PIC18 ==== * You should use the services ##[[en:osa:ref:allservices:OS_EnterInt|OS_EnterInt]]## (saves FSR) and ##[[en:osa:ref:allservices:OS_LeaveInt|OS_LeaveInt]]## (restores saved FSR) when entering and leaving an interrupt routine. ##[[en:osa:ref:allservices:OS_EnterInt|OS_EnterInt]]## must be placed at the beginning of the ISR function, and ##[[en:osa:ref:allservices:OS_LeaveInt|OS_LeaveInt]]## at the end. void interrupt int_routine (void) { char var1, var2; int var3; // After definition of local variables we need to save FSR: OS_EnterInt(); /*...*/ /* Interrupt flags checking */ /*...*/ // At the end of ISR we need to restore FSR: OS_LeaveInt(); } These services save and restore the FSR value (FSR0 for htpicc18), since HT-PICC sometimes does not do it. ==== Microchip C18 ==== * You can't use procedural abstraction optimization * You can't use Stack Model: Multi-bank ==== Microchip C30 ==== * You can't use procedural abstraction optimization (compiler command "-mpa"). ==== 12-bit chips ==== * When using 12-bit controllers (PIC10 and PIC12), the size of pointers to message, simple messages and counting semaphores must be equal to 1 byte. ==== mikroC PRO for PIC16 ==== * Version 2.50 PRO or higher required for PIC18 * Version 3.00 PRO or higher required for PIC12 and PIC16 * **Dynamic timers**, **messages** and **queues of messages** cannot be allocated in bank2 and bank3 of RAM. The problem is that mikroC PRO can allocate there itself. In this case you should to change the locations of definitions of listed variables. (Soon this limitation will be solved) ==== CCS PICC ==== * Since version 4.104 the compiler has an [[http://www.ccsinfo.com/forum/viewtopic.php?t=41180|error]]. Due to this error, the compiler can't build a program that uses OSA. Please, use other versions (OSA was checked with: 4.023, 4.069, 4.084, 4.099, 4.102, 4.105) ==== IAR (AVR and STM8) ==== * Works in C-mode only (not C++). * Optimization cross-call should be switched OFF. ==== WinAVR ==== * OSA foulder and project foulder should be allocated on same logical drive (for example both on "C:\..."). ==== STM8 ==== * Only chips with ROM 64K and less are supported ~~UP~~ ===== Thanks to ===== **Thanks to all who took part in identifying and correcting bugs. Most thanks to ##Vadim Frank## and to ##D. Ivanov## who was a most active assistant and showed patience and perseverance.** **Special thanks to ##Roger Burrows## who corrected a lot of my errors in the English documentation.** **Also thanks to ##Alex B.## who provided the site for documentation and assistance in its placement on the site.** ~~UP~~