IAR PowerPac RTOS for ARM Cores, CPU and compiler specifics ...

IAR PowerPac RTOS for ARM Cores, CPU and compiler specifics ... IAR PowerPac RTOS for ARM Cores, CPU and compiler specifics ...

ie.ksu.edu.tw
from ie.ksu.edu.tw More from this publisher

<strong>IAR</strong> <strong>PowerPac</strong> <strong>RTOS</strong><strong>for</strong> <strong>ARM</strong> <strong>Cores</strong><strong>CPU</strong> <strong>and</strong> <strong>compiler</strong> <strong>specifics</strong>using <strong>IAR</strong> Embedded Workbench®PP<strong>ARM</strong>-2


COPYRIGHT NOTICE© Copyright 2006–2007 <strong>IAR</strong> Systems. All rights reserved.No part of this document may be reproduced without the prior written consent of <strong>IAR</strong>Systems. The software described in this document is furnished under a license <strong>and</strong> mayonly be used or copied in accordance with the terms of such a license.DISCLAIMERThe in<strong>for</strong>mation in this document is subject to change without notice <strong>and</strong> does notrepresent a commitment on any part of <strong>IAR</strong> Systems. While the in<strong>for</strong>mation containedherein is assumed to be accurate, <strong>IAR</strong> Systems assumes no responsibility <strong>for</strong> any errorsor omissions.In no event shall <strong>IAR</strong> Systems, its employees, its contractors, or the authors of thisdocument be liable <strong>for</strong> special, direct, indirect, or consequential damage, losses, costs,charges, claims, dem<strong>and</strong>s, claim <strong>for</strong> lost profits, fees, or expenses of any nature or kind.TRADEMARKS<strong>IAR</strong>, <strong>IAR</strong> Systems, <strong>IAR</strong> Embedded Workbench, <strong>IAR</strong> MakeApp, C-SPY, visualSTATE,From Idea To Target, <strong>IAR</strong> KickStart Kit <strong>and</strong> <strong>IAR</strong> <strong>PowerPac</strong> are trademarks or registeredtrademarks owned by <strong>IAR</strong> Systems AB.Microsoft <strong>and</strong> Windows are registered trademarks of Microsoft Corporation.All other product names are trademarks or registered trademarks of their respectiveowners.EDITION NOTICESecond edition: June 2007Part number: PP<strong>ARM</strong>-2Internal reference: 2.10, 3.40A, Rev. 1, ISUD.PP<strong>ARM</strong>-2


ContentsPreface ................................................................................................................................................................ 5Using <strong>IAR</strong> <strong>PowerPac</strong> <strong>RTOS</strong> with <strong>IAR</strong> Embedded Workbench® ...........................................................7First steps ............................................................................................................................................. 7The example application Start_2Tasks.c ..........................................................................................8Stepping through the example application using C-SPY ................................................................ 8Build your own application.......................................................................................................................... 15Required files <strong>for</strong> an <strong>IAR</strong> <strong>PowerPac</strong> <strong>RTOS</strong> application................................................................. 15Change library mode......................................................................................................................... 15Select another <strong>CPU</strong> .......................................................................................................................... 15<strong>ARM</strong> core version <strong>specifics</strong>......................................................................................................................... 17<strong>CPU</strong> modes ........................................................................................................................................ 17Naming conventions <strong>for</strong> prebuilt libraries...................................................................................... 17Naming conventions <strong>for</strong> prebuild libraries compatible to <strong>IAR</strong> Embedded Workbench version 4.4x... 17Naming conventions <strong>for</strong> prebuild libraries compatible with <strong>IAR</strong> Embedded Workbench version 5.x. 19<strong>ARM</strong>7/9 <strong>specifics</strong> ........................................................................................................................................... 23Stacks.................................................................................................................................................. 23Task stack <strong>for</strong> <strong>ARM</strong>7 <strong>and</strong> <strong>ARM</strong>9.......................................................................................................... 23System stack <strong>for</strong> <strong>ARM</strong>7 <strong>and</strong> <strong>ARM</strong>9...................................................................................................... 23Interrupt stack <strong>for</strong> <strong>ARM</strong>7 <strong>and</strong> <strong>ARM</strong>9.................................................................................................... 23Stack <strong>specifics</strong> of the <strong>ARM</strong>7 <strong>and</strong> <strong>ARM</strong>9 family................................................................................... 23Interrupts ........................................................................................................................................... 23What happens when an interrupt occurs? .............................................................................................. 23Defining interrupt h<strong>and</strong>lers in C ............................................................................................................ 24Interrupt h<strong>and</strong>ling without vectored interrupt controller ....................................................................... 24Interrupt h<strong>and</strong>ling with vectored interrupt controller ............................................................................ 25Interrupt-stack switching ....................................................................................................................... 28Fast Interrupt FIQ .................................................................................................................................. 28Cortex-M3 <strong>specifics</strong>...................................................................................................................................... 29Stacks.................................................................................................................................................. 29Task stack <strong>for</strong> Cortex M3 ...................................................................................................................... 29System stack <strong>for</strong> Cortex M3 .................................................................................................................. 29Interrupt stack <strong>for</strong> Cortex M3 ................................................................................................................ 29Interrupts ........................................................................................................................................... 29What happens when an interrupt occurs? .............................................................................................. 29Defining interrupt h<strong>and</strong>lers in C ............................................................................................................ 29Interrupt vector table.............................................................................................................................. 30Interrupt-stack switching ....................................................................................................................... 30Fast interrupts with Cortex M3.............................................................................................................. 30Interrupt priorities.................................................................................................................................. 30Interrupt h<strong>and</strong>ling with vectored interrupt controller ............................................................................ 30High priority non maskable exceptions ................................................................................................. 32PP<strong>ARM</strong>-2 3


Compiler <strong>specifics</strong> ......................................................................................................................................... 33St<strong>and</strong>ard system libraries .................................................................................................................33Thread-safe system libraries.............................................................................................................33OS_INIT_SYS_LOCKS(), thread safe system locking.........................................................................33STOP / WAIT Mode...................................................................................................................................... 35Technical data.................................................................................................................................................. 37Memory requirements ......................................................................................................................37Files shipped with <strong>IAR</strong> <strong>PowerPac</strong> <strong>RTOS</strong> ................................................................................................... 39Index................................................................................................................................................................. 414<strong>IAR</strong> <strong>PowerPac</strong> <strong>RTOS</strong><strong>for</strong> <strong>ARM</strong> <strong>Cores</strong>PP<strong>ARM</strong>-2


PrefaceWelcome to <strong>IAR</strong> <strong>PowerPac</strong> <strong>RTOS</strong> <strong>for</strong> <strong>ARM</strong> <strong>Cores</strong>. This guide describes how to use <strong>IAR</strong> <strong>PowerPac</strong> <strong>RTOS</strong> <strong>for</strong>the <strong>ARM</strong> <strong>Cores</strong> using <strong>IAR</strong> Embedded Workbench®.Who should read this guideYou should read this guide if you plan to develop an embedded system using <strong>IAR</strong> <strong>PowerPac</strong> <strong>RTOS</strong> <strong>and</strong> need to getin<strong>for</strong>mation about the <strong>CPU</strong> <strong>and</strong> <strong>compiler</strong> <strong>specifics</strong> using.How to use this guideThis guide describes all <strong>CPU</strong> <strong>and</strong> <strong>compiler</strong> <strong>specifics</strong> of <strong>IAR</strong> <strong>PowerPac</strong> <strong>RTOS</strong> using <strong>ARM</strong>-based controllers. Be<strong>for</strong>eactually using <strong>IAR</strong> <strong>PowerPac</strong> <strong>RTOS</strong>, you should read or at least glance through this guide to become familiar with thesoftware.The chapter Using <strong>IAR</strong> <strong>PowerPac</strong> <strong>RTOS</strong> with <strong>IAR</strong> Embedded Workbench® gives you a step-by-step introduction, howto use <strong>IAR</strong> <strong>PowerPac</strong> <strong>RTOS</strong> <strong>for</strong> <strong>ARM</strong>. If you have no experience using <strong>IAR</strong> <strong>PowerPac</strong> <strong>RTOS</strong>, you should follow thisintroduction, because it is an easy way to learn how to use <strong>IAR</strong> <strong>PowerPac</strong> <strong>RTOS</strong> in your application.Most of the other chapters in this guide are intended to provide you with important detailed in<strong>for</strong>mation aboutfunctionality <strong>and</strong> fine-tuning of <strong>IAR</strong> <strong>PowerPac</strong> <strong>RTOS</strong> <strong>for</strong> the <strong>ARM</strong>-based controllers.Document conventionsTYPOGRAPHIC CONVENTIONS FOR SYNTAXThis guide uses the following typographic conventions:StyleKeywordParameterSampleReferenceGUIElementEmphasisDescriptionTable 1: Typographic conventionsText that you enter at the comm<strong>and</strong>-prompt or that appears on the display (that is systemfunctions, file- or pathnames).Parameters in API functions.Sample code in program examples.Reference to chapters, tables <strong>and</strong> figures or other documents.Buttons, dialog boxes, menu names, menu comm<strong>and</strong>s.Very important sectionsPP<strong>ARM</strong>-2 5


6<strong>IAR</strong> <strong>PowerPac</strong> <strong>RTOS</strong><strong>for</strong> <strong>ARM</strong> <strong>Cores</strong>PP<strong>ARM</strong>-2


Using <strong>IAR</strong> <strong>PowerPac</strong> <strong>RTOS</strong> with<strong>IAR</strong> Embedded Workbench®This chapter describes how to start with <strong>and</strong> use <strong>IAR</strong> <strong>PowerPac</strong> <strong>RTOS</strong> <strong>for</strong> <strong>ARM</strong> <strong>and</strong> the <strong>IAR</strong> <strong>compiler</strong>. You shouldfollow these steps to become familiar with <strong>IAR</strong> <strong>PowerPac</strong> <strong>RTOS</strong> <strong>for</strong> <strong>ARM</strong> together with <strong>IAR</strong> EmbeddedWorkbench.First stepsAfter installation of <strong>IAR</strong> <strong>PowerPac</strong> <strong>RTOS</strong> you can create your first multitasking application. An example workspace<strong>and</strong> a project are supplied. We recommend to use these as a starting point <strong>for</strong> all your applications.To get your new application running, you should proceed as follows:●●●●●Create a work directory <strong>for</strong> your application, <strong>for</strong> example c:\workIn the <strong>IAR</strong> Embedded Workbench IDE, select Example applications in the Startup dialog box.If the Startup dialog box is deactivated, open the dialog over Help | Startup Screen....Select BoardSupport from the Example Applications listSelect the project which is consistent to your hardware, or start with the <strong>IAR</strong> Simulator project. Choose adestination folder <strong>for</strong> your project, <strong>for</strong> example c:\work. After generating the project of your choice, the screenshould look <strong>for</strong> example like this:● Build the project. It should be build without any error or warning messages.For latest in<strong>for</strong>mation, open the file <strong>ARM</strong>\<strong>PowerPac</strong>\Doc\readme.htm.PP<strong>ARM</strong>-2 7


The example application Start_2Tasks.cThe following is a printout of the example application Start_2Tasks.c. It is a good startingpoint <strong>for</strong> yourapplication. (Note that the file actually shipped with your port of <strong>IAR</strong> <strong>PowerPac</strong> <strong>RTOS</strong> may look slightly different fromthis one.)What happens is easy to see:After initialization of <strong>IAR</strong> <strong>PowerPac</strong> <strong>RTOS</strong>; two tasks are created <strong>and</strong> started.The two tasks are activated <strong>and</strong> execute until they run into the delay, then suspend <strong>for</strong> the specified time <strong>and</strong> continueexecution.#include "<strong>RTOS</strong>.H"OS_STACKPTR int Stack0[128], Stack1[128]; /* Task stacks */OS_TASK TCB0, TCB1; /* Task-control-blocks */void HPTask(void) {while (1) {OS_Delay (10);}}void LPTask(void) {while (1) {OS_Delay (50);}}/************************************************************ main***********************************************************/void main(void) {OS_IncDI(); /* Initially disable interrupts */OS_InitKern(); /* Initialize OS */OS_InitHW(); /* Initialize Hardware <strong>for</strong> OS *//* You need to create at least one task here ! */OS_CREATETASK(&TCB0, "HP Task", HPTask, 100, Stack0);OS_CREATETASK(&TCB1, "LP Task", LPTask, 50, Stack1);OS_Start(); /* Start multitasking */}Stepping through the example application using C-SPYWhen starting the debugger, you will see the main function (see example screenshot below). The main functionappears as long as the C-SPY option Run to main is selected, which it is by default. Now you can step through theprogram. OS_IncDI() initially disables interrupts.OS_InitKern() is part of the <strong>IAR</strong> <strong>PowerPac</strong> <strong>RTOS</strong> library <strong>and</strong> written in assembler; you can there<strong>for</strong>e only step intoit in disassembly mode. It initializes the relevant OS variables. Because of the previous call of OS_IncDI(), interruptsare not enabled during execution of OS_InitKern().OS_InitHW() is part of <strong>RTOS</strong>Init_*.c <strong>and</strong> there<strong>for</strong>e part of your application. Its primary purpose is to initialize thehardware required to generate the timer-tick-interrupt <strong>for</strong> <strong>IAR</strong> <strong>PowerPac</strong> <strong>RTOS</strong>. Step through it to see what is done.8<strong>IAR</strong> <strong>PowerPac</strong> <strong>RTOS</strong><strong>for</strong> <strong>ARM</strong> <strong>Cores</strong>PP<strong>ARM</strong>-2


Using <strong>IAR</strong> <strong>PowerPac</strong> <strong>RTOS</strong> with <strong>IAR</strong> Embedded Workbench®OS_Start() should be the last line in main, because it starts multitasking <strong>and</strong> does not return.PP<strong>ARM</strong>-29


Be<strong>for</strong>e you step into OS_Start(), you should set two breakpoints in the two tasks as shown below.As OS_Start() is part of the <strong>IAR</strong> <strong>PowerPac</strong> <strong>RTOS</strong> library, you can step through it in disassembly mode only.10<strong>IAR</strong> <strong>PowerPac</strong> <strong>RTOS</strong><strong>for</strong> <strong>ARM</strong> <strong>Cores</strong>PP<strong>ARM</strong>-2


Using <strong>IAR</strong> <strong>PowerPac</strong> <strong>RTOS</strong> with <strong>IAR</strong> Embedded Workbench®Click GO, step over OS_Start(), or step into OS_Start() in disassembly mode until you reach the highest prioritytask.PP<strong>ARM</strong>-211


If you continue stepping, you will arrive in the task that has lower priority:Continue to step through the program, there is no other task ready <strong>for</strong> execution. <strong>IAR</strong> <strong>PowerPac</strong> <strong>RTOS</strong> will there<strong>for</strong>estart the idle-loop, which is an endless loop which is always executed if there is nothing else to do (no task is ready, nointerrupt routine or timer executing).12<strong>IAR</strong> <strong>PowerPac</strong> <strong>RTOS</strong><strong>for</strong> <strong>ARM</strong> <strong>Cores</strong>PP<strong>ARM</strong>-2


Using <strong>IAR</strong> <strong>PowerPac</strong> <strong>RTOS</strong> with <strong>IAR</strong> Embedded Workbench®You will arrive there when you step into the OS_Delay() function in disassembly mode. OS_Idle() is part of<strong>RTOS</strong>Init*.c. You may also set a breakpoint there be<strong>for</strong>e you step over the delay in LPTask.If you set a breakpoint in one or both of our tasks, you will see that they continue execution after the given delay.PP<strong>ARM</strong>-213


As can be seen by the value of <strong>IAR</strong> <strong>PowerPac</strong> <strong>RTOS</strong> timer variable OS_Time, shown in the Watch window, HPTaskcontinues operation after expiration of the 10 ms delay.14<strong>IAR</strong> <strong>PowerPac</strong> <strong>RTOS</strong><strong>for</strong> <strong>ARM</strong> <strong>Cores</strong>PP<strong>ARM</strong>-2


Build your own applicationTo build your own application, you should always start with one of the supplied sample workspaces <strong>and</strong> projects.There<strong>for</strong>e, select a workspace as described in First steps on page 7 <strong>and</strong> modify the project to fit your needs. Usinga sample project as starting point has the advantage that all necessary files are included <strong>and</strong> all settings <strong>for</strong> theproject are already done.Required files <strong>for</strong> an <strong>IAR</strong> <strong>PowerPac</strong> <strong>RTOS</strong> applicationTo build an application using <strong>IAR</strong> <strong>PowerPac</strong> <strong>RTOS</strong>, the following files from your <strong>IAR</strong> <strong>PowerPac</strong> <strong>RTOS</strong> distributionare required <strong>and</strong> have to be included in your project:● <strong>RTOS</strong>.h from subfolder Inc\.This header file declares all <strong>IAR</strong> <strong>PowerPac</strong> <strong>RTOS</strong> API functions <strong>and</strong> data types <strong>and</strong> has to be included in anysource file using <strong>IAR</strong> <strong>PowerPac</strong> <strong>RTOS</strong> functions.● <strong>RTOS</strong>Init_*.c from one Setup subfolder.It contains hardware-dependent initialization code <strong>for</strong> <strong>IAR</strong> <strong>PowerPac</strong> <strong>RTOS</strong> timer.● One <strong>IAR</strong> <strong>PowerPac</strong> <strong>RTOS</strong> library from the subfolder Lib\.● OS_Error.c from subfolder Setup\.The error h<strong>and</strong>ler is used if any library other than Release build library is used in your project.● <strong>RTOS</strong>Vect.asm from the subfolder Setup\.It contains the low level interrupt h<strong>and</strong>ler entry <strong>for</strong> <strong>ARM</strong>7/9 <strong>CPU</strong>s running with <strong>IAR</strong> <strong>PowerPac</strong> <strong>RTOS</strong>.● UserIRQ.c from subfolder Src\.It contains the application-specific interrupt h<strong>and</strong>ler function which is called from <strong>IAR</strong> <strong>PowerPac</strong> <strong>RTOS</strong> IRQh<strong>and</strong>ler. This file may not be necessary <strong>for</strong> target <strong>CPU</strong>s with built in vectored interrupt controller.● Additional low level init code may be required according to <strong>CPU</strong>.When you decide to write your own startup code or use a __low_level_init function, ensure that non-initializedvariables are initialized with zero, according to C st<strong>and</strong>ard. This is required <strong>for</strong> some <strong>IAR</strong> <strong>PowerPac</strong> <strong>RTOS</strong> internalvariables.Also ensure, that main() is called with <strong>CPU</strong> running in supervisor or system mode.Your main() function has to initialize <strong>IAR</strong> <strong>PowerPac</strong> <strong>RTOS</strong> by call of OS_InitKern() <strong>and</strong> OS_InitHW() prior anyother <strong>IAR</strong> <strong>PowerPac</strong> <strong>RTOS</strong> functions are called.You should then modify or replace the Start_2Task.c source file in the subfolder Application\.Change library modeFor your application you might want to choose another library. For debugging <strong>and</strong> program development you shoulduse an <strong>IAR</strong> <strong>PowerPac</strong> <strong>RTOS</strong>-debug library. For your final application you may wish to use an <strong>IAR</strong> <strong>PowerPac</strong> <strong>RTOS</strong>releaselibrary or a stack check library.There<strong>for</strong>e you have to select or replace the <strong>IAR</strong> <strong>PowerPac</strong> <strong>RTOS</strong> library in your project or target:●●●If your selected library is already available in your project, just select the appropriate configuration.To add a library, you may add a new Lib group to your project <strong>and</strong> add this library to the new group. Exclude allother library groups from build, delete unused Lib groups or remove them from the configuration.Check <strong>and</strong> set the appropriate OS_LIBMODE_* define as preprocessor option.Select another <strong>CPU</strong><strong>IAR</strong> <strong>PowerPac</strong> <strong>RTOS</strong> <strong>for</strong> <strong>ARM</strong> contains <strong>CPU</strong>-specific code <strong>for</strong> various <strong>ARM</strong> <strong>CPU</strong>s. The folder BoardSupportcontains workspaces <strong>for</strong> different target <strong>CPU</strong>s <strong>and</strong> specific eval boards.PP<strong>ARM</strong>-2 15


Check whether your <strong>CPU</strong> is supported by <strong>IAR</strong> <strong>PowerPac</strong> <strong>RTOS</strong>. <strong>CPU</strong>-specific functions are located in the Setupsubfolder in each board support project folder. To select a <strong>CPU</strong> which is already supported, just select the appropriateproject from the Example application list in the Embedded Workbench Startup dialog box.If your <strong>ARM</strong> <strong>CPU</strong> is currently not supported, examine all <strong>RTOS</strong>Init files in the <strong>CPU</strong>-specific subfolders <strong>and</strong> selectone which almost fits your <strong>CPU</strong>. You may have to modify OS_InitHW(), OS_COM_Init(), <strong>and</strong> the interrupt serviceroutines <strong>for</strong> <strong>IAR</strong> <strong>PowerPac</strong> <strong>RTOS</strong> timer tick.16<strong>IAR</strong> <strong>PowerPac</strong> <strong>RTOS</strong><strong>for</strong> <strong>ARM</strong> <strong>Cores</strong>PP<strong>ARM</strong>-2


<strong>ARM</strong> core version <strong>specifics</strong><strong>CPU</strong> modes<strong>IAR</strong> <strong>PowerPac</strong> <strong>RTOS</strong> supports nearly all memory <strong>and</strong> code model combinations that <strong>IAR</strong> C/C++ Compiler supports.Naming conventions <strong>for</strong> prebuilt librariesThe <strong>IAR</strong> <strong>PowerPac</strong> <strong>RTOS</strong> library naming conventions are derived from the library naming conventions which is usedin the compatible version of <strong>IAR</strong> Embedded Workbench.NAMING CONVENTIONS FOR PREBUILD LIBRARIES COMPATIBLETO <strong>IAR</strong> EMBEDDED WORKBENCH VERSION 4.4X<strong>IAR</strong> <strong>PowerPac</strong> <strong>RTOS</strong> is shipped withdifferent prebuilt libraries with different combinations of the following features:●●●●●●●Architecture - arch<strong>CPU</strong> mode - modeInterworking - interworkVFP - float (all prebuilt libraries are built with software floating-point support)Byte order - endianessStack alignment - stackalign (all prebuilt libraries are built using stack alignment 8, which is also compatiblewith stack alignment 4)Library mode - libmode.The libraries are named as follows:p.r79Parameter Description Valuestype Type of library. os: <strong>IAR</strong> <strong>PowerPac</strong> <strong>RTOS</strong> libraryisa Specifies the architecture. 4t: v4T5t: v5T, v67m: v7-Mp - -mode Specifies the <strong>CPU</strong> mode. a: <strong>ARM</strong>t: Thumb / Thumb2interwork Specifies if interwork option is enabled. i: Enable interworkingn: Do not use interworkingFPU Specifies type of floating-point support. v: VFPv1 floating-point supportn: Software floating-point supportendianess Specifies target byte order. b: Bigl: Littlestackalign Stack alignment used in the library. 8: 8 byte4: 4 bytelibmode Specifies the library mode r: Releases: Stack checkd: DebugTable 2: Library naming conventionsPP<strong>ARM</strong>-2 17


Exampleos4tptinl8r.r79 is the <strong>IAR</strong> <strong>PowerPac</strong> <strong>RTOS</strong> library <strong>for</strong> a project supporting an <strong>ARM</strong> architecture v4T core, usingThumb mode, compiled with the interwork option <strong>and</strong> software floating-point support, <strong>for</strong> little-endian byte order,using 8-byte stack alignment, <strong>and</strong> release build configuration.Available prebuilt librarieslibrary name isa mode interworking float endianess libmodeos4tpannb8r.r79 v4T <strong>ARM</strong> No No Big Releaseos4tpannb8s.r79 v4T <strong>ARM</strong> No No Big Stack checkos4tpannb8d.r79 v4T <strong>ARM</strong> No No Big Debugos4tpannl8r.r79 v4T <strong>ARM</strong> No No Little Releaseos4tpannl8s.r79 v4T <strong>ARM</strong> No No Little Stack checkos4tpannl8d.r79 v4T <strong>ARM</strong> No No Little Debugos4tpainb8r.r79 v4T <strong>ARM</strong> Yes No Big Releaseos4tpainb8s.r79 v4T <strong>ARM</strong> Yes No Big Stack checkos4tpainb8d.r79 v4T <strong>ARM</strong> Yes No Big Debugos4tpainl8r.r79 v4T <strong>ARM</strong> Yes No Little Releaseos4tpainl8s.r79 v4T <strong>ARM</strong> Yes No Little Stack checkos4tpainl8d.r79 v4T <strong>ARM</strong> Yes No Little Debugos4tptnnb8r.r79 v4T Thumb No No Big Releaseos4tptnnb8s.r79 v4T Thumb No No Big Stack checkos4tptnnb8d.r79 v4T Thumb No No Big Debugos4tptnnl8r.r79 v4T Thumb No No Little Releaseos4tptnnl8s.r79 v4T Thumb No No Little Stack checkos4tptnnl8d.r79 v4T Thumb No No Little Debugos4tptinb8r.r79 v4T Thumb Yes No Big Releaseos4tptinb8s.r79 v4T Thumb Yes No Big Stack checkos4tptinb8d.r79 v4T Thumb Yes No Big Debugos4tptinl8r.r79 v4T Thumb Yes No Little Releaseos4tptinl8s.r79 v4T Thumb Yes No Little Stack checkos4tptinl8d.r79 v4T Thumb Yes No Little Debugos5tpannb8r.r79 v5T, v6 <strong>ARM</strong> No No Big Releaseos5tpannb8s.r79 v5T, v6 <strong>ARM</strong> No No Big Stack checkos5tpannb8d.r79 v5T, v6 <strong>ARM</strong> No No Big Debugos5tpannl8r.r79 v5T, v6 <strong>ARM</strong> No No Little Releaseos5tpannl8s.r79 v5T, v6 <strong>ARM</strong> No No Little Stack checkos5tpannl8d.r79 v5T, v6 <strong>ARM</strong> No No Little Debugos5tpainb8r.r79 v5T, v6 <strong>ARM</strong> Yes No Big Releaseos5tpainb8s.r79 v5T, v6 <strong>ARM</strong> Yes No Big Stack checkos5tpainb8d.r79 v5T, v6 <strong>ARM</strong> Yes No Big Debugos5tpainl8r.r79 v5T, v6 <strong>ARM</strong> Yes No Little Releaseos5tpainl8s.r79 v5T, v6 <strong>ARM</strong> Yes No Little Stack checkos5tpainl8d.r79 v5T, v6 <strong>ARM</strong> Yes No Little Debugos5tptnnb8r.r79 v5T, v6 Thumb No No Big Releaseos5tptnnb8s.r79 v5T, v6 Thumb No No Big Stack checkos5tptnnb8d.r79 v5T, v6 Thumb No No Big Debugos5tptnnl8r.r79 v5T, v6 Thumb No No Little Releaseos5tptnnl8s.r79 v5T, v6 Thumb No No Little Stack checkTable 3: Prebuilt libraries18<strong>IAR</strong> <strong>PowerPac</strong> <strong>RTOS</strong><strong>for</strong> <strong>ARM</strong> <strong>Cores</strong>PP<strong>ARM</strong>-2


<strong>ARM</strong> core version <strong>specifics</strong>library name isa mode interworking float endianess libmodeos5tptnnl8d.r79 v5T, v6 Thumb No No Little Debugos5tptinb8r.r79 v5T, v6 Thumb Yes No Big Releaseos5tptinb8s.r79 v5T, v6 Thumb Yes No Big Stack checkos5tptinb8d.r79 v5T, v6 Thumb Yes No Big Debugos5tptinl8r.r79 v5T, v6 Thumb Yes No Little Releaseos5tptinl8s.r79 v5T, v6 Thumb Yes No Little Stack checkos5tptinl8d.r79 v5T, v6 Thumb Yes No Little Debugos7mptnnb8r.r79 v7-M Thumb2 No No Big Releaseos7mptnnb8s.r79 v7-M Thumb2 No No Big Stack checkos7mptnnb8d.r79 v7-M Thumb2 No No Big Debugos7mptnnl8r.r79 v7-M Thumb2 No No Little Releaseos7mptnnl8s.r79 v7-M Thumb2 No No Little Stack checkos7mptnnl8d.r79 v7-M Thumb2 No No Little DebugTable 3: Prebuilt libraries (Continued)NAMING CONVENTIONS FOR PREBUILD LIBRARIES COMPATIBLEWITH <strong>IAR</strong> EMBEDDED WORKBENCH VERSION 5.X<strong>IAR</strong> <strong>PowerPac</strong> <strong>RTOS</strong> is shipped with different prebuilt libraries with different combinations of the following features:●●●●●●Instruction set architecture - isa<strong>CPU</strong> mode - modeFPU (all prebuilt libraries are built with software floating-point support) - floatInterworking - interworkByte order - endianessLibrary mode - libmode.The libraries are named as follows:_.r79Parameter Meaning Valuestype Type of library. os: <strong>IAR</strong> <strong>PowerPac</strong> <strong>RTOS</strong> libraryisa Specifies the instruction set 4t: v4Tarchitecture.5t: v5T, v67m: v7Mmode Specifies the <strong>CPU</strong> mode. a: <strong>ARM</strong>t: Thumb / Thumb2endianess Specifies target endianess. b: Bigl: Littlefloat Specifies type of floating-point _: Software floating-point supportExamplesupport.s: VFP with software parametersv: VFP with VFP parametersinterwork Specifies if interwork option is enabled. i: Enable interworking_: Do not use interworkinglibmode Specifies the library mode r: Releases: Stack checkd: DebugTable 4: Library naming conventionsos4t_tl_ir.a is the <strong>IAR</strong> <strong>PowerPac</strong> <strong>RTOS</strong> library <strong>for</strong> a project supporting an <strong>ARM</strong> architecture v4T core, usingThumb mode, little-endian byte order, software floating-point support, compiled with the interwork option <strong>and</strong> releasebuild configuration.PP<strong>ARM</strong>-219


Available prebuilt librarieslibrary name isa mode endianess float interworking libmodeos4t_ab__r.a v4T <strong>ARM</strong> Big No No Releaseos4t_ab__s.a v4T <strong>ARM</strong> Big No No Stack checkos4t_ab__d.a v4T <strong>ARM</strong> Big No No Debugos4t_al__r.a v4T <strong>ARM</strong> Little No No Releaseos4t_al__s.a v4T <strong>ARM</strong> Little No No Stack checkos4t_al__d.a v4T <strong>ARM</strong> Little No No Debugos4t_ab_ir.a v4T <strong>ARM</strong> Big No Yes Releaseos4t_ab_is.a v4T <strong>ARM</strong> Big No Yes Stack checkos4t_ab_id.a v4T <strong>ARM</strong> Big No Yes Debugos4t_al_ir.a v4T <strong>ARM</strong> Little No Yes Releaseos4t_al_is.a v4T <strong>ARM</strong> Little No Yes Stack checkos4t_al_id.a v4T <strong>ARM</strong> Little No Yes Debugos4t_tb__r.a v4T Thumb Big No No Releaseos4t_tb__s.a v4T Thumb Big No No Stack checkos4t_tb__d.a v4T Thumb Big No No Debugos4t_tl__r.a v4T Thumb Little No No Releaseos4t_tl__s.a v4T Thumb Little No No Stack checkos4t_tl__d.a v4T Thumb Little No No Debugos4t_tb_ir.a v4T Thumb Big No Yes Releaseos4t_tb_is.a v4T Thumb Big No Yes Stack checkos4t_tb_id.a v4T Thumb Big No Yes Debugos4t_tl_ir.a v4T Thumb Little No Yes Releaseos4t_tl_is.a v4T Thumb Little No Yes Stack checkos4t_tl_id.a v4T Thumb Little No Yes Debugos5t_ab__r.a v5T, v6 <strong>ARM</strong> Big No No Releaseos5t_ab__s.a v5T, v6 <strong>ARM</strong> Big No No Stack checkos5t_ab__d.a v5T, v6 <strong>ARM</strong> Big No No Debugos5t_al__r.a v5T, v6 <strong>ARM</strong> Little No No Releaseos5t_al__s.a v5T, v6 <strong>ARM</strong> Little No No Stack checkos5t_al__d.a v5T, v6 <strong>ARM</strong> Little No No Debugos5t_ab_ir.a v5T, v6 <strong>ARM</strong> Big No Yes Releaseos5t_ab_is.a v5T, v6 <strong>ARM</strong> Big No Yes Stack checkos5t_ab_id.a v5T, v6 <strong>ARM</strong> Big No Yes Debugos5t_al_ir.a v5T, v6 <strong>ARM</strong> Little No Yes Releaseos5t_al_is.a v5T, v6 <strong>ARM</strong> Little No Yes Stack checkos5t_al_id.a v5T, v6 <strong>ARM</strong> Little No Yes Debugos5t_tb__r.a v5T, v6 Thumb Big No No Releaseos5t_tb__s.a v5T, v6 Thumb Big No No Stack checkos5t_tb__d.a v5T, v6 Thumb Big No No Debugos5t_tl__r.a v5T, v6 Thumb Little No No Releaseos5t_tl__s.a v5T, v6 Thumb Little No No Stack checkos5t_tl__d.a v5T, v6 Thumb Little No No Debugos5t_tb_ir.a v5T, v6 Thumb Big No Yes Releaseos5t_tb_is.a v5T, v6 Thumb Big No Yes Stack checkos5t_tb_id.a v5T, v6 Thumb Big No Yes Debugos5t_tl_ir.a v5T, v6 Thumb Little No Yes ReleaseTable 5: Prebuilt libraries20<strong>IAR</strong> <strong>PowerPac</strong> <strong>RTOS</strong><strong>for</strong> <strong>ARM</strong> <strong>Cores</strong>PP<strong>ARM</strong>-2


<strong>ARM</strong> core version <strong>specifics</strong>library name isa mode endianess float interworking libmodeos5t_tl_is.a v5T, v6 Thumb Little No Yes Stack checkos5t_tl_id.a v5T, v6 Thumb Little No Yes Debugos7m_tb__r.a v7M Thumb2 Big No No Releaseos7m_tb__s.a v7M Thumb2 Big No No Stack checkos7m_tb__d.a v7M Thumb2 Big No No Debugos7m_tl__r.a v7M Thumb2 Little No No Releaseos7m_tl__s.a v7M Thumb2 Little No No Stack checkos7m_tl__d.a v7M Thumb2 Little No No DebugTable 5: Prebuilt libraries (Continued)PP<strong>ARM</strong>-221


22<strong>IAR</strong> <strong>PowerPac</strong> <strong>RTOS</strong><strong>for</strong> <strong>ARM</strong> <strong>Cores</strong>PP<strong>ARM</strong>-2


<strong>ARM</strong>7/9 <strong>specifics</strong>StacksTASK STACK FOR <strong>ARM</strong>7 AND <strong>ARM</strong>9All <strong>IAR</strong> <strong>PowerPac</strong> <strong>RTOS</strong> tasks execute in system mode. The stack-size required is the sum of the stack-size of allroutines plus basic stack size. The basic stack size is the size of memory required to store the registers of the <strong>CPU</strong> plusthe stack size required by <strong>IAR</strong> <strong>PowerPac</strong> <strong>RTOS</strong>-routines. For the <strong>ARM</strong>7/<strong>ARM</strong>9, the minimum task stack size is about68 bytes.SYSTEM STACK FOR <strong>ARM</strong>7 AND <strong>ARM</strong>9The <strong>IAR</strong> <strong>PowerPac</strong> <strong>RTOS</strong> system executes in supervisor mode. The minimum system stack size required by <strong>IAR</strong><strong>PowerPac</strong> <strong>RTOS</strong> is about 136 bytes (stack check build). However, because the system stack is also used by theapplication be<strong>for</strong>e the start of multitasking (the call to OS_Start()), <strong>and</strong> because software-timers <strong>and</strong> C level interrupth<strong>and</strong>lers also use the system-stack, the actual stack requirements depend on the application.The size of the system stack can be changed by modifying CSTACK in your *.xcl linker comm<strong>and</strong> file.INTERRUPT STACK FOR <strong>ARM</strong>7 AND <strong>ARM</strong>9If a normal hardware exception occurs, the <strong>ARM</strong> core switches to IRQ mode, which has a separate stack pointer. Toenable support <strong>for</strong> nested interrupts, execution of the ISR itself in a different <strong>CPU</strong> mode than IRQ mode is necessary.<strong>IAR</strong> <strong>PowerPac</strong> <strong>RTOS</strong> switches to supervisor mode after saving scratch registers, LR_irq <strong>and</strong> SPSR_irq onto the IRQstack.As a result, only registers mentioned above are saved onto the IRQ stack. For the interrupt routine itself, the supervisorstack is used. The size of the interrupt stack can be changed by modifying IRQ_STACK in your *.xcl linker comm<strong>and</strong>file. We recommend at least 128 bytes.STACK SPECIFICS OF THE <strong>ARM</strong>7 AND <strong>ARM</strong>9 FAMILYExceptions require space on the supervisor <strong>and</strong> interrupt stack. The interrupt stack is used to store contents of scratchregisters, the ISR itself uses supervisor stack.InterruptsWHAT HAPPENS WHEN AN INTERRUPT OCCURS?●●●●●●●●●●●●The <strong>CPU</strong>-core receives an interrupt requestAs soon as the interrupts are enabled, the interrupt is executedThe <strong>CPU</strong> switches to the Interrupt stackThe <strong>CPU</strong> saves PC <strong>and</strong> flags in registers LR_irq <strong>and</strong> SPSR_irqThe <strong>CPU</strong> jumps to the vector address 0x18<strong>IAR</strong> <strong>PowerPac</strong> <strong>RTOS</strong> OS_IRQ_SERVICE(): save scratch registers<strong>IAR</strong> <strong>PowerPac</strong> <strong>RTOS</strong> OS_IRQ_SERVICE(): save LR_irq <strong>and</strong> SPSR_irq<strong>IAR</strong> <strong>PowerPac</strong> <strong>RTOS</strong> OS_IRQ_SERVICE(): switch to supervisor mode<strong>IAR</strong> <strong>PowerPac</strong> <strong>RTOS</strong> OS_IRQ_SERVICE(): execute OS_irq_h<strong>and</strong>ler() (defined in <strong>RTOS</strong>INIT_*.C)<strong>IAR</strong> <strong>PowerPac</strong> <strong>RTOS</strong> OS_irq_h<strong>and</strong>ler(): check <strong>for</strong> interrupt source <strong>and</strong> execute timer interrupt, serialcommunication or user ISR.<strong>IAR</strong> <strong>PowerPac</strong> <strong>RTOS</strong> OS_IRQ_SERVICE(): switch to IRQ mode<strong>IAR</strong> <strong>PowerPac</strong> <strong>RTOS</strong> OS_IRQ_SERVICE(): restore LR_irq <strong>and</strong> SPSR_irqPP<strong>ARM</strong>-2 23


● <strong>IAR</strong> <strong>PowerPac</strong> <strong>RTOS</strong> OS_IRQ_SERVICE(): pop scratch registers● Return from interrupt.When using an <strong>ARM</strong> derivate with vectored interrupt controller, ensure that OS_IRQ_SERVICE() is called from everyinterrupt. The interrupt vector itself may then be examined by the C-level interrupt h<strong>and</strong>ler in <strong>RTOS</strong>Init*.c.DEFINING INTERRUPT HANDLERS IN CInterrupt h<strong>and</strong>lers called from the <strong>IAR</strong> <strong>PowerPac</strong> <strong>RTOS</strong> interrupt h<strong>and</strong>ler in <strong>RTOS</strong>Init*.c are just normal C-functionswhich do not take parameters <strong>and</strong> do not return any value.The default C interrupt h<strong>and</strong>ler OS_irq_h<strong>and</strong>ler() in <strong>RTOS</strong>Init*.c first calls OS_Enterinterrupt() orOS_EnterNestableInterrupt() to in<strong>for</strong>m <strong>IAR</strong> <strong>PowerPac</strong> <strong>RTOS</strong> that interrupt code is running. Then this h<strong>and</strong>lerexamines the source of interrupt <strong>and</strong> calls the related interrupt h<strong>and</strong>ler function.Finally, the default interrupt h<strong>and</strong>ler OS_irq_h<strong>and</strong>ler() in <strong>RTOS</strong>Init*.c calls OS_LeaveInterrupt() orOS_LeaveNestableInterrupt() <strong>and</strong> returns to the primary interrupt h<strong>and</strong>ler OS_IRQ_SERVICE().Depending on the interrupting source, it may be required to reset the interrupt pending condition of the relatedperipherals.ExampleSimple interrupt routine:void Timer_irq_func(void) {if (__INTPND & 0x0800) { // Interrupt pending ?__INTPND = 0x0800; // reset pending conditionOSTEST_X_ISR0();// h<strong>and</strong>le interrupt}}INTERRUPT HANDLING WITHOUT VECTORED INTERRUPTCONTROLLERSt<strong>and</strong>ard <strong>ARM</strong> <strong>CPU</strong>s, without implementation of a vectored interrupt controller, always branch to address 0x18 whenan interrupt occurs. The application is responsible to examine the interrupting source.The reaction to an interrupt is as follows:● <strong>IAR</strong> <strong>PowerPac</strong> <strong>RTOS</strong> OS_IRQ_SERVICE() is called● OS_IRQ_SERVICE() saves registers <strong>and</strong> switches to supervisor mode● OS_IRQ_SERVICE() calls OS_irq_h<strong>and</strong>ler()● OS_irq_h<strong>and</strong>ler() in<strong>for</strong>ms <strong>IAR</strong> <strong>PowerPac</strong> <strong>RTOS</strong> that interrupt code is running by a call● of OS_EnterInterrupt() <strong>and</strong> then calls OS_USER_irq_func() which has to h<strong>and</strong>le all interrupt sources of theapplication● OS_irq_h<strong>and</strong>ler() checks whether <strong>IAR</strong> <strong>PowerPac</strong> <strong>RTOS</strong> timer interrupt has to be h<strong>and</strong>led● OS_irq_h<strong>and</strong>ler() in<strong>for</strong>ms <strong>IAR</strong> <strong>PowerPac</strong> <strong>RTOS</strong> that interrupt h<strong>and</strong>ling ended by a call ofOS_LeaveInterrupt() <strong>and</strong> returns to OS_IRQ_SERVICE()● OS_IRQ_SERVICE() restores registers <strong>and</strong> per<strong>for</strong>ms a return from interrupt● OS_USER_irq_func() (usually defined in module UserIRQ.C) has to examine <strong>and</strong> h<strong>and</strong>le all applicationspecific interrupts.ExampleSimple OS_USER_irq_func() routine:void OS_USER_irq_func(void) {if (__INTPND & 0x0800) { // Interrupt pending ?__INTPND = 0x0800;// Reset pending conditionOSTEST_X_ISR0();// H<strong>and</strong>le interrupt}if (__INTPND & 0x0400) { // Interrupt pending ?__INTPND = 0x0400;// Reset pending conditionOSTEST_X_ISR1();// H<strong>and</strong>le interrupt}}During interrupt processing, you should not re-enable interrupts, as this would lead in recursion.24<strong>IAR</strong> <strong>PowerPac</strong> <strong>RTOS</strong><strong>for</strong> <strong>ARM</strong> <strong>Cores</strong>PP<strong>ARM</strong>-2


<strong>ARM</strong>7/9 <strong>specifics</strong>INTERRUPT HANDLING WITH VECTORED INTERRUPTCONTROLLERFor <strong>ARM</strong> derivates with built in vectored interrupt controller, <strong>IAR</strong> <strong>PowerPac</strong> <strong>RTOS</strong> uses a different interrupt h<strong>and</strong>lingprocedure <strong>and</strong> delivers additional functions to install <strong>and</strong> setup interrupt h<strong>and</strong>ler functions.When using an <strong>ARM</strong> derivate with vectored interrupt controller, ensure that OS_IRQ_SERVICE() is called from everyinterrupt. This is default when startup code <strong>and</strong> hardware initialization delivered with <strong>IAR</strong> <strong>PowerPac</strong> <strong>RTOS</strong> is used.The interrupt vector itself will then be examined by the C-level interrupt h<strong>and</strong>ler OS_irq_h<strong>and</strong>ler() in<strong>RTOS</strong>Init*.c.You should not program the interrupt controller <strong>for</strong> IRQ h<strong>and</strong>ling directly. You should use the functions delivered with<strong>IAR</strong> <strong>PowerPac</strong> <strong>RTOS</strong>.The reaction to an interrupt with vectored interrupt controller is as follows:● <strong>RTOS</strong> OS_IRQ_SERVICE() is called by <strong>CPU</strong> or interrupt controller● OS_IRQ_SERVICE() saves registers <strong>and</strong> switches to supervisor mode● OS_IRQ_SERVICE() calls OS_irq_h<strong>and</strong>ler() (in <strong>RTOS</strong>Init*.c)● OS_irq_h<strong>and</strong>ler() examines the interrupting source by reading the interrupt vector from the interrupt controller● OS_irq_h<strong>and</strong>ler() in<strong>for</strong>ms the <strong>RTOS</strong> that interrupt code is running by a call ofOS_EnterNestableInterrupt() which re-enables interrupts● OS_irq_h<strong>and</strong>ler() calls the interrupt h<strong>and</strong>ler function which is addressed by the interrupt vector● OS_irq_h<strong>and</strong>ler() resets the interrupt controller to re-enable acceptance of new interrupts● OS_irq_h<strong>and</strong>ler() calls OS_LeaveNestableInterrupt() which disables interrupts <strong>and</strong> in<strong>for</strong>ms <strong>IAR</strong><strong>PowerPac</strong> <strong>RTOS</strong> that interrupt h<strong>and</strong>ling has finished● OS_irq_h<strong>and</strong>ler() returns to OS_IRQ_SERVICE● OS_IRQ_SERVICE() restores registers <strong>and</strong> per<strong>for</strong>ms a return from interrupt.Note that different <strong>ARM</strong> <strong>CPU</strong>s may have different versions of vectored interrupt controller hardware, <strong>and</strong> usage of <strong>IAR</strong><strong>PowerPac</strong> <strong>RTOS</strong> supplied functions varies depending on the type of interrupt controller. Refer to the samples deliveredwith <strong>IAR</strong> <strong>PowerPac</strong> <strong>RTOS</strong> which are used in the <strong>CPU</strong> specific <strong>RTOS</strong>Init module.To h<strong>and</strong>le interrupts with vectored interrupt controller, <strong>IAR</strong> <strong>PowerPac</strong> <strong>RTOS</strong> offers the following functions.FunctionOS_<strong>ARM</strong>_InstallISRH<strong>and</strong>ler()OS_<strong>ARM</strong>_EnableISR()OS_<strong>ARM</strong>_DisableISR()OS_<strong>ARM</strong>_ISRSetPrio()OS_<strong>ARM</strong>_AssignISRSource()OS_<strong>ARM</strong>_EnableISRSource()OS_<strong>ARM</strong>_DisableISRSource()OS_<strong>ARM</strong>_InstallISRH<strong>and</strong>ler(): Install an interrupt h<strong>and</strong>lerDescriptionOS_<strong>ARM</strong>_InstallISRH<strong>and</strong>ler() is used to install a specific interrupt vector when <strong>ARM</strong> <strong>CPU</strong>s with vectoredinterrupt controller are used.PrototypeOS_ISR_HANDLER* OS_<strong>ARM</strong>_InstallISRH<strong>and</strong>ler (intISRIndex,OS_ISR_HANDLER* pISRH<strong>and</strong>ler);ParameterDescriptionReturn valueDescriptionInstalls an interrupt h<strong>and</strong>lerEnables a specific interruptDisables a specific interruptSets the priority of a specific interruptAssigns a hardware interrupt channel to an interrupt vectorEnables an interrupt channel of a VIC type interrupt controllerDisables an interrupt channel of a VIC type interrupt controllerTable 6: Interrupt h<strong>and</strong>ler functions <strong>for</strong> <strong>ARM</strong> derivates with built in vectored interrupt controllerISRIndexpISRH<strong>and</strong>lerIndex of the interrupt source, normally the interrupt vector number.Address of the interrupt h<strong>and</strong>ler function.Table 7: OS_<strong>ARM</strong>_InstallSRH<strong>and</strong>ler() parameter listOS_ISR_HANDLER*: The address of the previously installed interrupt function, which was installed at the addressedvector number be<strong>for</strong>e.PP<strong>ARM</strong>-225


Additional In<strong>for</strong>mationThis function just installs the interrupt vector but does not modify the priority <strong>and</strong> does not automatically enable theinterrupt.OS_<strong>ARM</strong>_EnableISR(): Enable a specific interruptDescriptionOS_<strong>ARM</strong>_EnableISR() is used to enable interrupt acceptance of a specific interrupt source in a vectored interruptcontroller.Prototypevoid OS_<strong>ARM</strong>_EnableISR(int ISRIndex);ParameterDescriptionISRIndexTable 8: OS_<strong>ARM</strong>_EnableISR() parameter listAdditional In<strong>for</strong>mationThis function just enables the interrupt inside the interrupt controller. It does not enable the interrupt of any peripherals.This has to be done elsewhere.Note:For <strong>ARM</strong> <strong>CPU</strong>s with VIC type interrupt controller, this function just enables the interrupt vector itself. To enablethe hardware assigned to that vector, you have to call OS_<strong>ARM</strong>_EnableISRSource() also.OS_<strong>ARM</strong>_DisableISR(): Disable a specific interruptDescriptionOS_<strong>ARM</strong>_DisableISR() is used to disable interrupt acceptance of a specific interrupt source in a vectored interruptcontroller which is not of the VIC type.Prototypevoid OS_<strong>ARM</strong>_DisableISR(int ISRIndex);ParameterDescriptionISRIndexpISRH<strong>and</strong>lerTable 9: OS_<strong>ARM</strong>_DisableISR() parameter listAdditional In<strong>for</strong>mationThis function just disables the interrupt controller. It does not disable the interrupt of any peripherals. This has to bedone elsewhere.Note:When using an <strong>ARM</strong> <strong>CPU</strong> with built in interrupt controller of VIC type, use OS_<strong>ARM</strong>_DisableISRSource()to disable a specific interrupt.OS_<strong>ARM</strong>_ISRSetPrio(): Set priority of a specific interruptDescriptionOS_<strong>ARM</strong>_ISRSetPrio() is used to set or modify the priority of a specific interrupt source by programming theinterrupt controller.Prototypeint OS_<strong>ARM</strong>_ISRSetPrio (int ISRIndex,int Prio);ParameterDescriptionISRIndexPrioTable 10: OS_<strong>ARM</strong>_ISRSetPrio() parameter listReturn valueIndex of the interrupt source which should be enabled.Index of the interrupt source which should be disabled.Address of the interrupt h<strong>and</strong>ler function.Index of the interrupt source which should be modified.The priority which should be set <strong>for</strong> the specific interrupt.Previous priority which was assigned be<strong>for</strong>e the call of OS_<strong>ARM</strong>_ISRSetPrio().26<strong>IAR</strong> <strong>PowerPac</strong> <strong>RTOS</strong><strong>for</strong> <strong>ARM</strong> <strong>Cores</strong>PP<strong>ARM</strong>-2


<strong>ARM</strong>7/9 <strong>specifics</strong>Additional In<strong>for</strong>mationThis function sets the priority of an interrupt channel by programming the interrupt controller. Refer to <strong>CPU</strong>-specificmanuals about allowed priority levels.Note:This function cannot be used to modify the interrupt priority <strong>for</strong> interrupt controllers of the VIC type. The interruptpriority with VIC-type controllers depends on the interrupt vector number <strong>and</strong> cannot be changed.OS_<strong>ARM</strong>_AssignISRSource(): Assign a hardware interrupt channel to aninterrupt vectorDescriptionOS_<strong>ARM</strong>_AssignISRSource() is used to assign a hardware interrupt channel to an interrupt vector in an interruptcontroller of VIC type.Prototypevoid OS_<strong>ARM</strong>_AssignISRSource(int ISRIndex,int Source);ParameterDescriptionISRIndexSourceTable 11: OS_<strong>ARM</strong>_AssignISRSource() parameter listAdditional In<strong>for</strong>mationThis function assigns a hardware interrupt line to an interrupt vector of VIC type only. It cannot be used <strong>for</strong> other typesof vectored interrupt controllers. The hardware interrupt channel number of specific peripherals depends on specific<strong>CPU</strong> derivates <strong>and</strong> has to be taken from the hardware manual of the <strong>CPU</strong>.OS_<strong>ARM</strong>_EnableISRSource(): Enable an interrupt channel of a VIC-typeinterrupt controllerDescriptionOS_<strong>ARM</strong>_EnableISRSource() is used to enable an interrupt input channel of an interrupt controller of VIC type.PrototypeOS_<strong>ARM</strong>_DisableISRSource(int SourceIndex);;ParameterDescriptionSourceIndexTable 12: OS_<strong>ARM</strong>_EnableISRSource() parameter listAdditional In<strong>for</strong>mationThis function enables a hardware interrupt input of a VIC-type interrupt controller. It cannot be used <strong>for</strong> other types ofvectored interrupt controllers. The hardware interrupt channel number of specific peripherals depends on specific <strong>CPU</strong>derivates <strong>and</strong> has to be taken from the hardware manual of the <strong>CPU</strong>.OS_<strong>ARM</strong>_DisableISRSource(): Disable an interrupt channel of a VIC-typeinterrupt controllerDescriptionOS_<strong>ARM</strong>_DisableISRSource() is used to disable an interrupt input channel of an interrupt controller of VIC type.PrototypeIndex of the interrupt source which should be modified.The source channel number which should be assigned to the specified interrupt vector.Index of the interrupt channel which should be enabled.OS_<strong>ARM</strong>_DisableISRSource(int SourceIndex);;ParameterDescriptionSourceIndexTable 13: OS_<strong>ARM</strong>_DisableISRSource() parameter listIndex of the interrupt channel which should be disabled.PP<strong>ARM</strong>-227


Additional In<strong>for</strong>mationThis function disables a hardware interrupt input of a VIC-type interrupt controller. It cannot be used <strong>for</strong> other typesof vectored interrupt controllers. The hardware interrupt channel number of specific peripherals depends on specific<strong>CPU</strong> derivates <strong>and</strong> has to be taken from the hardware manual of the <strong>CPU</strong>.Example/* Install UART interrupt h<strong>and</strong>ler */OS_<strong>ARM</strong>_InstallISRH<strong>and</strong>ler(UART_ID, &COM_ISR);OS_<strong>ARM</strong>_ISRSetPrio(UART_ID, UART_PRIO);OS_<strong>ARM</strong>_EnableISR(UART_ID);// UART interrupt vector// UART interrupt priotity// Enable UART interrupt/* Install UART interrupt h<strong>and</strong>ler with VIC type interrupt controller*/OS_<strong>ARM</strong>_InstallISRH<strong>and</strong>ler(UART_INT_INDEX, &COM_ISR); // UART interrupt vectorOS_<strong>ARM</strong>_AssignISRSource(UART_INT_INDEX, UART_INT_SOURCE);OS_<strong>ARM</strong>_EnableISR(UART_INT_INDEX);// Enable UART interrupt vectorOS_<strong>ARM</strong>_EnableISRSource(UART_INT_SOURCE);// Enable UART interrupt sourceINTERRUPT-STACK SWITCHINGBecause <strong>ARM</strong> core based controllers have a separate stack pointer <strong>for</strong> interrupts, there is no need <strong>for</strong> explicit stackswitchingin an interrupt routine. The routines OS_EnterIntStack() <strong>and</strong> OS_LeaveIntStack() are supplied <strong>for</strong>source compatibility to other processors only <strong>and</strong> have no functionality.The <strong>ARM</strong> interrupt stack is used <strong>for</strong> the primary interrupt h<strong>and</strong>ler in <strong>RTOS</strong>Vect.asm only.FAST INTERRUPT FIQThe FIQ interrupt cannot be used with <strong>IAR</strong> <strong>PowerPac</strong> <strong>RTOS</strong> functions, it is reserved <strong>for</strong> high speed user functions.Note the following:● FIQ is never disabled by <strong>IAR</strong> <strong>PowerPac</strong> <strong>RTOS</strong>.● Never call any <strong>IAR</strong> <strong>PowerPac</strong> <strong>RTOS</strong> function from an FIQ h<strong>and</strong>ler.● Do not assign any <strong>IAR</strong> <strong>PowerPac</strong> <strong>RTOS</strong> interrupt h<strong>and</strong>ler to FIQ.Note:When you decide to use FIQ, ensure the FIQ stack is initialized during startup <strong>and</strong> that an interrupt vector <strong>for</strong> FIQh<strong>and</strong>ling is included in your application.28<strong>IAR</strong> <strong>PowerPac</strong> <strong>RTOS</strong><strong>for</strong> <strong>ARM</strong> <strong>Cores</strong>PP<strong>ARM</strong>-2


Cortex-M3 <strong>specifics</strong>StacksTASK STACK FOR CORTEX M3All <strong>IAR</strong> <strong>PowerPac</strong> <strong>RTOS</strong> tasks execute in thread mode using the process stack pointer. The stack-size required is thesum of the stack-size of all routines plus basic stack size plus size used by exceptions. The basic stack size is the sizeof memory required to store the registers of the <strong>CPU</strong> plus the stack size required by <strong>IAR</strong> <strong>PowerPac</strong> <strong>RTOS</strong>-routines. Forthe Cortex M3 <strong>CPU</strong>, this minimum task stack size is about 72 bytes. But because any function call uses some amountof stack <strong>and</strong> every exception also pushes at least 32 bytes onto the current stack, the task stack size has to be largeenough to h<strong>and</strong>le all nested exceptions too. We recommend at least 256 bytes stack as a start.SYSTEM STACK FOR CORTEX M3The <strong>IAR</strong> <strong>PowerPac</strong> <strong>RTOS</strong> system executes in thread mode, the scheduler executes in h<strong>and</strong>ler mode. The minimumsystem stack size required by <strong>IAR</strong> <strong>PowerPac</strong> <strong>RTOS</strong> is about 136 bytes (stack check & profiling build) However, sincethe system stack is also used by the application be<strong>for</strong>e the start of multitasking (the call to OS_Start()), <strong>and</strong> becausesoftware-timers <strong>and</strong> C-level interrupt h<strong>and</strong>lers also use the system-stack, the actual stack requirements depend on theapplication.The size of the system stack can be changed by modifying CSTACK in your *.XCL file.INTERRUPT STACK FOR CORTEX M3If a normal hardware exception occurs, the Cortex M3 core switches to h<strong>and</strong>ler mode mode, which uses the main stackpointer. With <strong>IAR</strong> <strong>PowerPac</strong> <strong>RTOS</strong>, the main stack pointer is initialized to use the CSTACK which is defined in the linkercomm<strong>and</strong> file. A separate IRQ_STACK is not used, interrupts run on the system stack.InterruptsThe Cortex M3 core comes with an built in vectored interrupt controller which supports up to 496 separate interruptsources. The real number of interrupt sources depends on the specific target <strong>CPU</strong>.WHAT HAPPENS WHEN AN INTERRUPT OCCURS?●●●●●●●●●●The <strong>CPU</strong>-core receives an interrupt request <strong>for</strong>m the interrupt controller.As soon as the interrupts are enabled, the interrupt is executedThe <strong>CPU</strong> pushes temporary registers <strong>and</strong> the return address onto the current stack.The <strong>CPU</strong> switches to h<strong>and</strong>ler mode <strong>and</strong> main stack.The <strong>CPU</strong> saves an exception return code <strong>and</strong> current flags onto the main stack.The <strong>CPU</strong> jumps to the vector address delivered by the NVIC.The interrupt h<strong>and</strong>ler is processed.The interrupt h<strong>and</strong>ler ends with a “return from interrupt” by reading the exception return code.The <strong>CPU</strong> switches back to the mode <strong>and</strong> stack which was active be<strong>for</strong>e the exception was called.The <strong>CPU</strong> restores the temporary registers <strong>and</strong> return address from the stack <strong>and</strong> continues the interrupted function.DEFINING INTERRUPT HANDLERS IN CInterrupt h<strong>and</strong>lers <strong>for</strong> Cortex M3 are written as normal C-functions which do not take parameters <strong>and</strong> do not return anyvalue.PP<strong>ARM</strong>-2 29


Example“Simple“ interrupt-routine:static void _Systick(void) {OS_EnterNestableInterrupt(); // In<strong>for</strong>m <strong>IAR</strong> <strong>PowerPac</strong> <strong>RTOS</strong> that interrupt code is runningOS_H<strong>and</strong>leTick();OS_LeaveNestableInterrupt(); // In<strong>for</strong>m <strong>IAR</strong> <strong>PowerPac</strong> <strong>RTOS</strong> that interrupt h<strong>and</strong>ler isleft}INTERRUPT VECTOR TABLEAfter Reset, the <strong>ARM</strong> Cortex M3 <strong>CPU</strong> uses an initial interrupt vector table which is located in ROM at address 0x00.It contains the address <strong>for</strong> the main stack <strong>and</strong> addresses <strong>for</strong> all exceptions.The interrupt vector table is located in the C source file Startup_*.c in the <strong>CPU</strong> specific subfolder. All interrupth<strong>and</strong>ler function addresses have to be inserted in the vector table, as long as a RAM vector table is not used.The vector table may be copied to RAM to enable variable interrupt h<strong>and</strong>ler installation. The compile time switchOS_USE_VARINTTABLE is used to enable usage of a vector table in RAM. To save RAM, the switch is set to zero perdefault in <strong>RTOS</strong>Init_*.c. It may be overwritten by project settings to enable the vector table in RAM. The first callof OS_InstallISRH<strong>and</strong>ler() will then automatically copy the vector table into RAM.INTERRUPT-STACK SWITCHINGSince Cortex M3 core based controllers have a separate stack pointer <strong>for</strong> interrupts, there is no need <strong>for</strong> explicit stackswitchingin an interrupt routine. The routines OS_EnterIntStack() <strong>and</strong> OS_LeaveIntStack() are supplied <strong>for</strong>source compatibility to other processors only <strong>and</strong> have no functionality.FAST INTERRUPTS WITH CORTEX M3Instead of disabling interrupts when <strong>IAR</strong> <strong>PowerPac</strong> <strong>RTOS</strong> does atomic operations, the interrupt level of the <strong>CPU</strong> is setto 128. There<strong>for</strong>e all interrupt priorities higher than 128 can still be processed. Please note, that lower priority numberdefine a higher priority. All interrupts with priority level from 0 to 128 are never disabled.These interrupts are named Fast interrupts. You must not execute any <strong>IAR</strong> <strong>PowerPac</strong> <strong>RTOS</strong> function from within a fastinterrupt function.INTERRUPT PRIORITIESWith introduction of Fast interrupts, interrupt priorities useable <strong>for</strong> interrupts using <strong>IAR</strong> <strong>PowerPac</strong> <strong>RTOS</strong> APIfunctions are limited.● Any interrupt h<strong>and</strong>ler using <strong>IAR</strong> <strong>PowerPac</strong> <strong>RTOS</strong> API functions has to run with interrupt priorities from 128 to255.These <strong>IAR</strong> <strong>PowerPac</strong> <strong>RTOS</strong> interrupt h<strong>and</strong>lers have to start with OS_EnterInterrupt() orOS_EnterNestableInterrupt() <strong>and</strong> must end with OS_LeaveInterrupt() orOS_LeaveNestableInterrupt().● Any Fast interrupt (running at priorities from 0 to 127) must not call any <strong>IAR</strong> <strong>PowerPac</strong> <strong>RTOS</strong> API function. EvenOS_EnterInterrupt() <strong>and</strong> OS_LeaveInterrupt() must not be called.● Interrupt h<strong>and</strong>ler running at low priorities (from 128 to 255) not calling any <strong>IAR</strong> <strong>PowerPac</strong> <strong>RTOS</strong> API function areallowed, but must not re-enable interrupts!The priority limit between <strong>IAR</strong> <strong>PowerPac</strong> <strong>RTOS</strong> interrupts <strong>and</strong> Fast interrupts is fixed to 128 <strong>and</strong> can only be changedby recompiling <strong>IAR</strong> <strong>PowerPac</strong> <strong>RTOS</strong> libraries!INTERRUPT HANDLING WITH VECTORED INTERRUPTCONTROLLERFor Cortex M3, which has a built in vectored interrupt controller, <strong>IAR</strong> <strong>PowerPac</strong> <strong>RTOS</strong> delivers additional functionsto install <strong>and</strong> setup interrupt h<strong>and</strong>ler functions.30<strong>IAR</strong> <strong>PowerPac</strong> <strong>RTOS</strong><strong>for</strong> <strong>ARM</strong> <strong>Cores</strong>PP<strong>ARM</strong>-2


Cortex-M3 <strong>specifics</strong>To h<strong>and</strong>le interrupts with the vectored interrupt controller, <strong>IAR</strong> <strong>PowerPac</strong> <strong>RTOS</strong> offers the following functions:FunctionOS_<strong>ARM</strong>_InstallISRH<strong>and</strong>ler()OS_<strong>ARM</strong>_EnableISR()OS_<strong>ARM</strong>_DisableISR()OS_<strong>ARM</strong>_ISRSetPrio()Table 14: Interrupt h<strong>and</strong>ler functions <strong>for</strong> Cortex M3 coresOS_<strong>ARM</strong>_InstallISRH<strong>and</strong>ler(): Install an interrupt h<strong>and</strong>lerDescriptionOS_<strong>ARM</strong>_InstallISRH<strong>and</strong>ler() is used to install a specific interrupt vector when <strong>ARM</strong> <strong>CPU</strong>s with vectoredinterrupt controller are used.PrototypeOS_ISR_HANDLER* OS_<strong>ARM</strong>_InstallISRH<strong>and</strong>ler (intISRIndex,OS_ISR_HANDLER* pISRH<strong>and</strong>ler);ParameterDescriptionISRIndexpISRH<strong>and</strong>lerReturn valueOS_ISR_HANDLER*: The address of the previously installed interrupt function, which was installed at the addressedvector number be<strong>for</strong>e.Additional In<strong>for</strong>mationThis function just installs the interrupt vector but does not modify the priority <strong>and</strong> does not automatically enable theinterrupt. When the interrupt vector table should be located in RAM, the first call of this function copies the vector tableinto RAM <strong>and</strong> programs the interrupt controller to use the RAM table. When the interrupt vector table should reside inROM, the function does nothing <strong>and</strong> always returns NULL.OS_<strong>ARM</strong>_EnableISR(): Enable a specific interruptDescriptionOS_<strong>ARM</strong>_EnableISR() is used to enable interrupt acceptance of a specific interrupt source in a vectored interruptcontroller.Prototypevoid OS_<strong>ARM</strong>_EnableISR(int ISRIndex);ParameterDescriptionAdditional In<strong>for</strong>mationDescriptionInstalls an interrupt h<strong>and</strong>lerEnables a specific interruptDisables a specific interruptSets the priority of a specific interruptIndex of the interrupt source, normally the interrupt vector number.Address of the interrupt h<strong>and</strong>ler function.Table 15: OS_<strong>ARM</strong>_InstallSRH<strong>and</strong>ler() parameter listISRIndexTable 16: OS_<strong>ARM</strong>_EnableISR() parameter listIndex of the interrupt source which should be enabled.This function just enables the interrupt inside the interrupt controller. It does not enable the interrupt of any peripherals.This has to be done elsewhere.OS_<strong>ARM</strong>_DisableISR(): Disable a specific interruptDescriptionOS_<strong>ARM</strong>_DisableISR() is used to disable interrupt acceptance of a specific interrupt source in a vectored interruptcontroller which is not of the VIC type.PP<strong>ARM</strong>-231


Prototypevoid OS_<strong>ARM</strong>_DisableISR(int ISRIndex);ParameterDescriptionISRIndexIndex of the interrupt source which should be disabled.pISRH<strong>and</strong>ler Address of the interrupt h<strong>and</strong>ler function.Table 17: OS_<strong>ARM</strong>_DisableISR() parameter listAdditional In<strong>for</strong>mationThis function just disables the interrupt controller. It does not disable the interrupt of any peripherals. This has to bedone elsewhere.OS_<strong>ARM</strong>_ISRSetPrio(): Set priority of a specific interruptDescriptionOS_<strong>ARM</strong>_ISRSetPrio() is used to set or modify the priority of a specific interrupt source by programming theinterrupt controller.Prototypeint OS_<strong>ARM</strong>_ISRSetPrio (int ISRIndex,int Prio);ParameterDescriptionISRIndexPrioTable 18: OS_<strong>ARM</strong>_ISRSetPrio() parameter listReturn valuePrevious priority which was assigned be<strong>for</strong>e the call of OS_<strong>ARM</strong>_ISRSetPrio().Additional In<strong>for</strong>mationIndex of the interrupt source which should be modified.The priority which should be set <strong>for</strong> the specific interrupt.This function sets the priority of an interrupt channel by programming the interrupt controller. Refer to <strong>CPU</strong>-specificmanuals about allowed priority levels.HIGH PRIORITY NON MASKABLE EXCEPTIONSHigh priority non maskable exceptions with non configurable priority like Reset, NMI <strong>and</strong> HardFault can not be usedwith <strong>IAR</strong> <strong>PowerPac</strong> <strong>RTOS</strong> functions. These exceptions are never disabled by <strong>IAR</strong> <strong>PowerPac</strong> <strong>RTOS</strong>.Never call any <strong>IAR</strong> <strong>PowerPac</strong> <strong>RTOS</strong> function from an exception h<strong>and</strong>ler of one of these exceptions.32<strong>IAR</strong> <strong>PowerPac</strong> <strong>RTOS</strong><strong>for</strong> <strong>ARM</strong> <strong>Cores</strong>PP<strong>ARM</strong>-2


Compiler <strong>specifics</strong>St<strong>and</strong>ard system libraries<strong>IAR</strong> <strong>PowerPac</strong> <strong>RTOS</strong> <strong>for</strong> <strong>ARM</strong> may be used with <strong>IAR</strong> st<strong>and</strong>ard libraries <strong>for</strong> most of all projects.Heap management <strong>and</strong> file operation functions of st<strong>and</strong>ard system libraries are not reentrant <strong>and</strong> can there<strong>for</strong>e not beused with <strong>IAR</strong> <strong>PowerPac</strong> <strong>RTOS</strong>, if non thread-safe functions are used from different tasks.Thread-safe system librariesUsing embOS with C++ projects <strong>and</strong> file operations or just normal call of heap management functions may requirethread-safe system libraries if these functions are called from different tasks. Thread-safe system libraries require somelocking mechanism which is <strong>RTOS</strong> specific.System libraries delivered with <strong>compiler</strong> version 4.41A or newer already contain a locking mechanism which may beused with <strong>IAR</strong> <strong>PowerPac</strong> <strong>RTOS</strong> if required. The locking has to be initialized once by a call ofOS_INIT_SYS_LOCKS().OS_INIT_SYS_LOCKS(), THREAD SAFE SYSTEM LOCKINGTo use the automatic locking mechanism which is implemented in the system libraries which came with <strong>compiler</strong>version 4.41A or newer, it has to be initialized once by calling OS_INIT_SYS_LOCKS().This function should be called from main() during the initialization, directly after the call of OS_InitKern(). Aftercalling OS_INIT_SYS_LOCKS() all functions which are normally not thread-safe can be used from any task withoutany precaution. OS_INIT_SYS_LOCKS() does not work when the system libraries which came with <strong>compiler</strong> version4.40A or older are used.PP<strong>ARM</strong>-2 33


34<strong>IAR</strong> <strong>PowerPac</strong> <strong>RTOS</strong><strong>for</strong> <strong>ARM</strong> <strong>Cores</strong>PP<strong>ARM</strong>-2


STOP / WAIT ModeIn case your controller does support some kind of power saving mode, it should be possible to use it also with <strong>IAR</strong><strong>PowerPac</strong> <strong>RTOS</strong>, as long as the timer keeps working <strong>and</strong> timer interrupts are processed. To enter that mode, you usuallyhave to implement some special sequence in the function OS_Idle(), which you can find in <strong>IAR</strong> <strong>PowerPac</strong> <strong>RTOS</strong>module <strong>RTOS</strong>Init.c.PP<strong>ARM</strong>-2 35


36<strong>IAR</strong> <strong>PowerPac</strong> <strong>RTOS</strong><strong>for</strong> <strong>ARM</strong> <strong>Cores</strong>PP<strong>ARM</strong>-2


Technical dataMemory requirementsThese values are neither precise nor guaranteed but they give you a good idea of the memory-requirements. They varydepending on the current version of <strong>IAR</strong> <strong>PowerPac</strong> <strong>RTOS</strong>. Using <strong>ARM</strong> mode, the minimum ROM requirement <strong>for</strong> thekernel itself is about 2.500 bytes. In Thumb mode, the kernel itself does have a minimum ROM size of about 1.700bytes.In the table below, which is <strong>for</strong> release build, you can find minimum RAM size requirements <strong>for</strong> <strong>IAR</strong> <strong>PowerPac</strong> <strong>RTOS</strong>resources. Note that the sizes depend on selected <strong>IAR</strong> <strong>PowerPac</strong> <strong>RTOS</strong> library mode.<strong>IAR</strong> <strong>PowerPac</strong> <strong>RTOS</strong> resourceTask control block 32Resource semaphore 8Counting semaphore 4Mailbox 20Software timer 20Table 19: Memory requirementsRAM [bytes]PP<strong>ARM</strong>-2 37


38<strong>IAR</strong> <strong>PowerPac</strong> <strong>RTOS</strong><strong>for</strong> <strong>ARM</strong> <strong>Cores</strong>PP<strong>ARM</strong>-2


Files shipped with <strong>IAR</strong> <strong>PowerPac</strong><strong>RTOS</strong>Directory File Explanation<strong>PowerPac</strong>\Doc*.pdfGeneric API <strong>and</strong> target specific documentation <strong>and</strong> releasereadme.htmnotes.Inc<strong>RTOS</strong>.hBSP.hInclude file <strong>for</strong> <strong>IAR</strong> <strong>PowerPac</strong> <strong>RTOS</strong>, to be included in everyC-file using <strong>IAR</strong> <strong>PowerPac</strong> <strong>RTOS</strong> functions.Lib os*.r79 <strong>IAR</strong> <strong>PowerPac</strong> <strong>RTOS</strong> libraries.Src\*.batBuildLib.ewwBatch files to build the <strong>IAR</strong> <strong>PowerPac</strong> <strong>RTOS</strong> libraries <strong>and</strong>workspace <strong>for</strong> building a library.Src\<strong>CPU</strong> <strong>RTOS</strong>Vect.asm <strong>IAR</strong> <strong>PowerPac</strong> <strong>RTOS</strong> interrupt h<strong>and</strong>ler.Src\<strong>CPU</strong> OS_Priv.h <strong>CPU</strong> <strong>and</strong> <strong>compiler</strong> specific header file.START\GenOSSrc *.* Source <strong>for</strong> <strong>IAR</strong> <strong>PowerPac</strong> <strong>RTOS</strong> libraries.Table 20: Files shipped with <strong>IAR</strong> <strong>PowerPac</strong> <strong>RTOS</strong>PP<strong>ARM</strong>-2 39


40<strong>IAR</strong> <strong>PowerPac</strong> <strong>RTOS</strong><strong>for</strong> <strong>ARM</strong> <strong>Cores</strong>PP<strong>ARM</strong>-2


IndexIndexCcopyright notice . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2CSTACK . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 23Ddisclaimer . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2document conventions. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5Eedition, of this guide . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2Gguidelines, reading. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5IInterrupt stack . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 23interrupts . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 23IRQ_STACK . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 23MMemory requirements. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 37OOS_<strong>ARM</strong>_AssignISRSource() . . . . . . . . . . . . . . . . . . . . . . . . . 27OS_<strong>ARM</strong>_DisableISRSource(). . . . . . . . . . . . . . . . . . . . . . . . . 27OS_<strong>ARM</strong>_DisableISR(). . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 26OS_<strong>ARM</strong>_EnableISRSource() . . . . . . . . . . . . . . . . . . . . . . . . . 27OS_<strong>ARM</strong>_EnableISR() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 26OS_<strong>ARM</strong>_InstallISRH<strong>and</strong>ler() . . . . . . . . . . . . . . . . . . . . . . . . . 25OS_<strong>ARM</strong>_ISRSetPrio() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 26OS_irq_h<strong>and</strong>ler() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 24OS_IRQ_SERVICE() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 24OS_USER_irq_func(). . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 24Ppart number, of this guide. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2publication date, of this guide . . . . . . . . . . . . . . . . . . . . . . . . . . . 2Rreading guidelines . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5registered trademarks . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2SSyntax, conventions used . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5System stack. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 23TTask stack . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 23trademarks . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2Vversion, <strong>IAR</strong> Embedded Workbench . . . . . . . . . . . . . . . . . . . . . 2PP<strong>ARM</strong>-241

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!