Home

Kernel User's Guide

image

Contents

1. 1 3 4 27 H Hardware ca ee ee ee 4 6 Hard Titer pit Ra 4 7 Ter 2 20 SCIOPTA Kernel User s Guide Manual Version 1 7 6 2 6 Index SCIOPTA e I Jor 4 27 nim E E 4 6 Init DEOCSS reese eg etre reri rte ia etie ree ai 2 6 3 7 4 4 4 10 Init Process Stack SIS eiii eet en T e C i a eR e e eit dea Eds 3 40 Input Output management MM 1 3 Installation mformation Jie ai te Rr ee eel i a eee eR 1 1 Internet protocols cia indi da 1 1 Interprocess COMMUNICATION ence teer ene e P er eer re PH EH e Eee dd 1 2 1 3 2 8 4 14 A TL Ee EE 3 20 Interrupt level i ne nre i 3 20 Interrupt process doeet ia 2 5 2 7 4 4 4 6 4 12 Interrupt Process configuration ici eer rb e eie eee E HT ta eee 3 40 Interrupt process declaration syntax ooooocconnnccncnoccononnnononnonnnnnonnono nac non nennen nntn nenne tet treten tnnt ee ennen enne te nnne nnne 4 7 Interrupt process function a 3 41 Interrupt process Tate es eere EE eng et stet eo add as 3 40 Interrupt process stack size rincon RP ERR EE GT 3 41 Interrupt process template mensura eno reest 4 8 InterrUpt PrOCESS DO M 3 41 Intertupt service TOUTE sine putet tide teste e 4 6 Interrupt stack size aisi menie ote e e er e He C HERE et Ro rs Pe a eis 3
2. Figure 2 4 SCIOPTA Priority Diagram SCIOPTA Kernel User s Guide Manual Version 1 7 2 7 2 SCIOPTA Technology and Methods SCIOPTA e 2 4 Messages 2 4 1 Introduction SCIOPTA is a so called Message Based Real Time Operating System Interprocess communication and co ordi nation is done by messages Message passing is a very fast secure easy to use and good to debug method 2 4 2 Message Structure Every SCIOPTA message has a message identity and a range reserved for message data which can be freely ac cessed by the user Additionally there are some hidden data structure which will be used by the kernel The user can access these message information by specific SCIOPTA system calls The following message system informa tion are stored in the message header Process ID of message owner e Message size Process ID of transmitting process Process ID of addressed process owner size transmitter addressee internal use message ID user accessible end mark Figure 2 5 SCIOPTA Message Structure When a process is allocating a message it will be the owner of the message If the process is transmitting the mes sage to another process the other process will become owner After transmitting the sending process cannot access the message any more This message ownership feature eliminates access conflicts in a clean and efficient way Every process has a message queue where all ow
3. Compiler Select the C C Cross compiler which you are using for this SCIOPTA system SCIOPTA Kernel User s Guide Manual Version 1 7 3 8 3 Configuration SC OPTA e Maximum Buffer Sizes If a process allocates a message there is also the size to be given The user just gives the number of bytes needed SCIOPTA is not returning the exact amount of bytes requested but will select one of a list of buffer sizes which is large enough to contain the requested number This list can contain 4 8 or 16 sizes which is configured here in the maximum buffer sizes entry Maximum Modules Here you can define a maximum number of modules which can be created in this system The maximum value is 127 modules It is important that you give here a realistic value of maximum number of modules for your system as SCIOPTA is initializing some memory statically at system start for the number of modules given here Maximum Connectors CONNECTORS are specific SCIOPTA processes and responsible for linking a number of SCIOPTA systems The maximum number of connectors in a system may not exceed 127 which correspond to the maximum number of systems Maximum Int Vectors Enter here the maximum number of interrupt vector in you ARM system The default value is 128 Kernel Stack Size Currently not used Entered values are not considered Interrupt Stack Size Currently not used Entered values are not considered Inter Module Selects the m
4. 2 11 Observation Communication channels between processes in SCIOPTA can be observed no matter if the processes are local or distributed over remote systems The process calls sc procObserve which includes the pointer to a return mes sage and the process ID of the process which should be observed If the observed process dies the kernel will send the defined message back to the requesting process to inform it This observation works also with remote process lists in connectors This means that not only remote processes can be observed but also connection problems in communication links if the connectors includes the necessary func tionality Please Note Observation is not supported in the SCIOPTA Compact Kernel Registration of observation of process B requesting the mes Kernel sage B killed as returned in formation process B process A B killed Message B killed is returned sc procObserve by the kernel to inform process A of the killing of process B gt Tree Observedlink awe Figure 2 12 SCIOPTA Observation SCIOPTA Kernel User s Guide Manual Version 1 7 2 1 9 2 SCIOPTA Technology and Methods SCIOPTA e 2 12 Hooks 2 12 1 Introduction Hooks are user written functions which are called by the kernel at different location They are only called if the user defined them at configuration User hooks are used for a number of different purposes and are target system de
5. EN Priority 0 e Process State started SCIOPTA Kernel User s Guide Manual Version 1 7 3 39 3 Configuration Stack Size Enter the stack size for the init process Applying Init Process Configuration Click on the Apply button to accept the init process configuration settings 3 14 Interrupt Process Configuration u Sciopta System Configuration C P tcs xml File Edit InterruptProcess Help v SCIOPTA e Apply ini x ID s ua Configuration Tree Structure B i e syspool HE Chamber A Zi reference i e ChamberPool Interrupt Process Name keyboard Interrupt Process Function NewintProcesst Stack Size nao Vector IER Interrupt Process Type Sciopta zl Interrupt Processes Apply Cancel Interrupt Process Name Enter the name of the interrupt process SCIOPTA Kernel User s Guide Manual Version 1 7 3 40 3 Configuration SC OPTA gt Interrupt Process Function Function name of the interrupt process function This is the address where the created process will start execution Stack Size Stacksize of the created process in bytes Vector Enter the interrupt vector connected to the interrupt process Please consult the target manuals for more information about interrupt handling and vectors Interrupt Process Type Select the type of the interrupt process Interrupt processes
6. gt Stack Size Stacksize of the created process in bytes Priority Enter the process priority For process scheduling SCIOPTA uses a combination of the module priority and process priority called effective priority Process State Enter the state which the process should have after creation started The process will be on READY state It is ready to run and will be swapped in if it has the highest priority of all READY processes stopped The process is stopped Use the se_procStart system call to start the process FPU Usage This checkbox exists only for CPU s which have a Floating Point Unit Enter your selection if you want to use the floating point unit FPU of the processor Applying the Priority Process Configuration Click on the Apply button to accept the priority process configuration settings Apply SCIOPTA Kernel User s Guide Manual Version 1 7 3 45 3 Configuration 3 17 Pool Configuration Ci Sciopta System Configuration D P ARM tcs xml File Edit Pool Help b SCIOPTA gt l0 x D as u ag Pool Name syspool Pool Size 2000 Buffer Sizes 8 C 16 4 8 1024 2048 16 4036 32 8132 64 16384 128 256 32768 65536 512 131072 ME reference i 9 pool Pool Name Enter the name of the pool Pool Size Enter the size of the message pool The
7. 212 2 Error Hook mono ae ie hie ected ee ee 2 20 SE NR ee 2 20 2 124 Pool EE 2 20 2 12 53 PROCESS HOOK conce nein e a irt tn E EE EHE IEEE RDU DER EE tE IEEE ROLE 2 20 3 CONSI MO E 3 1 Introductiot EE 3 1 3 2 TEE EE 3 1 3 3 Preference File se Gorthg efg e tias totali 3 2 3 4 Project File animan iio ota erica 3 2 3 5 SCONF Windows co 3 3 3 5 1 Parameter Window P e 3 3 3 5 2 Browser WIndOW 5 eere et e aia 3 4 3 6 Creating a New Project iai eden ritiene teinte ier eee eb Fee eerte ipee Dee dee bdo 3 5 3 7 Configure the Project esie ici 3 5 3 8 Creating Systems oiii t E C E rri iai a Hed epe eH etes ei Ar rie est 3 6 3 9 Configuring Target Systainer e ei e i Rn EES 3 8 3 9 1 Configuring ARM Target Systems sse nnne ener enne 3 8 3 9 1 1 General Configuration eee e n RE E EU RE E ECHTE un din E 3 8 3 9 1 2 Configuring Hooks ennr nire nnn nne re eene nan etre n nennen enean 3 10 3 9 1 3 Debug Configuration ici nto mre eee p e eher te Pre Ee e eee de 3 11 3 9 2 Configuring Coldfire Target Systems sess enne enne nennen nnne 3 13 3 9 2 General Configuration iei ei RO HERE A enn Ee HERREN UHR annie 3 13 3 9 2 2 Configuring Hooks ite eee calidad c Her bia e i EE DERE Ee aisla 3 15 3 9 2 3 Debug Configuration p eei eee EERSTEN ee 3 16 3 9 3 Configuring PowerPC Target Systems sessssssssssssesseee eene nee 3 18 3 9 3 1 General Configura did
8. 3 Configuration SC OPTA e 3 18 Build The SCONF will generate three files which need to be included into your SCIOPTA project sciopta cnf This is the configured part of the kernel which will be included when the SCIOPTA kernel sciopta s is assembled sconf h This is a header file which contains some configuration settings sconf c This is a C source file which contains the system initialization code Please consult system building chapter of the target manuals for more information about system building 3 18 1 Build System To build the three files click on the system and right click the mouse Select the menu Build System The files sciopta cnf sconf h and sconf c will be generated into your defined build directory Zus Sciopta System Configuration D P ARM Ecs xm File Edit ArmSystem Help say Configuration Tree Structure Arm S sci pTA TCS SMS ER TCS Create Module E ME Chamber A Delete System Change Build Directory SCIOPTA Kernel User s Guide Manual Version 1 7 3 48 3 Configuration SC OPTA e 3 18 2 Change Build Directory When you are creating a new system SCONF ask you to give the directory where the three generated files will be stored You can modify this build directory for each system individually by clicking to the system which you want to build and right click the mouse d Sciopta System Configuration DX4PXARM ECs xml File Edit ArmSystem Help ID c a
9. 4 3 6 3 Timer EE 4 12 4 6 e EE 4 13 4 6 1 Introduce HT ere 4 13 4 6 2 Get Process IDs of Static Processes eee eene rennen enne nre tnennn 4 13 4 6 3 Get Process IDs of Dynamic Processes oie eire ii nnde iniciaran acotaci n dadas 4 13 4 7 Interprocess Communication sess ener enne rentrer netten eren nnne 4 14 4 7 1 Introduction 4 14 4 7 2 SERA ollas 4 14 4 7 2 1 Description zie eee er ERE DEDERE GR HEURE E pi eer RR ER dS 4 14 4 7 2 Message Declaration sss ener enne iodi ei aE aa ia nennen 4 14 4 7 2 Message Number eiie e sugue EH ERE a 4 15 41 2 4 M SSage SirUuCt te RO 4 15 4 7 2 5 Message Union nescio cendo nee f RE ED EC HUI ER CH DER anre n RE ee T EE 4 16 MEAT ON En 4 17 4 7 3 SCIOPTA Ee TEE 4 18 47 3 1 Ee le EE 4 18 47 32 E D e EE 4 18 4 8 SCIOPTA Memory Manager Message Pool 4 19 SCIOPTA Kernel User s Guide Manual Version 1 7 II Table of Contents SC IOPTA e 4 8 1 Message Pool ui en iom eit ren e e e eive n Rd Ue e e cane 4 19 4 8 2 Message Poll S126 O 4 19 4 8 3 Message IZ ii ae 4 20 4 8 4 Example id dia ia ii 4 20 4 8 5 Message Administration Block 55 cie eiii cones eec EE tein ee oer eere 4 20 4 9 SCIOPTA Daein tls c ceret teet ec Pee bet tte reete E Ee ec oet e etri des oen tpud ede ue odes 4 21 4 9 1 Process DAM 4 21 4 9 2 Kernel Dic naaa tds 4 22 4 10 Error Hook ORO COPA OCIO O CT 4 23 4 10 1 ege e EE 4 23 4 10 2 Error Information 1 erret
10. MV CLine Apply Cancel Message Check If you are selecting this check box some test functions on messages will be included in the kernel Stack Check If you are selecting this check box some test functions on process stacks will be included in the kernel Process Parameter Check If you are selecting this check box the kernel will do some testing on the parameters of the process system calls Message Parameter Check If you are selecting this check box the kernel will do some testing on the parameters of the message system calls Pool Parameter Check If you are selecting this check box the kernel will do some testing on the parameters of the pool system calls SCIOPTA Kernel User s Guide Manual Version 1 7 3 1 1 3 Configuration SC OPTA C Line If you are selecting this check box the kernel will include line number information which can be used by the SCIOPTA DRUID Debug System or an error hook Line number and file of the last system call is recorded in the per process data Process Statistics If you are selecting this check box the kernel will maintain a process statistics data field where information such as number of process swaps can be read Message Statistics If you are selecting this check box the kernel will maintain a message statistics data field in the pool control block where information such as number of message allocation can be read Applying Target Configuration Cli
11. 2 2 SCIOPTA Technology and Methods SCIOPTA e 2 6 Trigger The trigger in SCIOPTA is a method which allows to synchronise processes even faster as it would be possible with messages With a trigger a process will be notified and woken up by another process Trigger are used only for process co ordination and synchronisation and cannot carry data Each process has one trigger available A trigger is basically a integer variable owned by the process At process creation the value of the trigger is initialized to one There are four system calls available to work with triggers The sc triggerWait call decrements the value of the trigger and the calling process will be blocked and swapped out if the value gets negative or equal zero Only the owner process of the trigger can wait for it An interrupt process cannot wait on its trigger The process waiting on the trigger will become ready when another process triggers it by issuing asc trigger call which will make the value of the trigger non negative The process which is waiting on a trigger can define a time out value If the time out has elapsed it will be triggered become non negative by the operating system actually The previous state of the trigger is restored If the now ready process has a higher priority than the actual running process the operating system will pre empt the running process and execute the triggered process Thesc triggerSet system calls allows to sets the v
12. 3 20 TAMER PTOCESS sui dde 2 5 2 7 4 4 4 9 4 12 Timer process configuration cccccccsccessessesscesseeseeseecsecseecaeceaessecascaeceseeseseeeeseeeaeeaeecaecaeesaecaaeaaeceseesereeaeeneeeaes 3 42 Timer process declaration syntax noie eH iii 4 9 Timer PrOCESS TUNC ON EPIRI 3 42 Tamer process imtialidel y E 3 43 Timer PROCESS EE 3 42 Timet process Period iii a 3 43 SCIOPTA Kernel User s Guide Manual Version 1 7 6 6 gt 6 Index SCIOPTA po Timet ee 3 42 A NS 3 20 Timer tic EE 3 20 Transmitting process 3 eret iin cere rete TIC pe Er ERE ER dte inte di iesu tiet De red Caes 2 8 4 20 Transparent communicatio eii e 2 18 WPS BST 2 13 4 6 4 7 4 18 U Unified IRQ Stack Checkbox euro eege eegene eet eere eh tris 3 25 3 30 Dre setas 4 24 W WALING EE 2 3 brine 4 26 A arning state ecco aora 3 2 X XML ia Bee 3 2 AMET ata aos 3 51 SCIOPTA Kernel User s Guide Manual Version 1 7 6 7
13. 3 4 5 Supervisor Process i SCIOPTA allows you to group processes together into modules Modules can be created and killed dynamically during run time But there is one static module in each SCIOPTA system This module is called system module please consult chapter 2 5 Modules on page 2 11 for more information about the SCIOPTA module concept Processes placed in the system module are called supervisor processes Supervisor processes have full access rights to system resources Typical supervisor processes are found in device drivers 2 3 4 6 Daemons Daemons are internal processes in a SCIOPTA system They are running on kernel level and are taking over spe cific tasks which are better done in a process rather than in a pure kernel function The Process Daemon sc_procd is identifying processes by name and supervises created and killed processes The Kernel Daemon sc_kerneld is creating and killing modules and processes SCIOPTA Kernel User s Guide Manual Version 1 7 2 6 2 SCIOPTA Technology and Methods SCIOPTA e 2 3 5 Priorities Each SCIOPTA process and module has a specific priority The user defines the priorities at system configuration or when creating the module or the process Process and module priorities can be modified during run time For process scheduling SCIOPTA uses a combination of the module priority and process priority called effective priority The kernel determines the effective priority as follows
14. 3 Configuration SC OPTA gt 3 9 6 3 Debug Configuration M16C Settings Build Directory DAP mi d ts el General Hooks Debug r Debug m Statistic V Message Check v Process Stack Check V Message IV Process Parameter Check JV Message Parameter Check v Pool Parameter Check Cine Apply Cancel Message Check If you are selecting this check box some test functions on messages will be included in the kernel Stack Check Stack check is currently not available in SCIOPTA M16C Process Parameter Check If you are selecting this check box the kernel will do some testing on the parameters of the process system calls Message Parameter Check If you are selecting this check box the kernel will do some testing on the parameters of the message system calls Pool Parameter Check If you are selecting this check box the kernel will do some testing on the parameters of the pool system calls SCIOPTA Kernel User s Guide Manual Version 1 7 3 32 3 Configuration SC OPTA C Line C Line check is currently not available in SCIOPTA M16C Process Statistics If you are selecting this check box the kernel will maintain a process statistics data field where information such as number of process swaps can be read Message Statistics If you are selecting this check box the kernel will maintain a message statistics data field in the pool control block where information such as num
15. 8 3 13 3 18 3 24 3 29 Change build directory 5 21 enne ii 3 49 CENE scene a nen eres I IUE DE 3 12 3 17 3 23 3 28 3 33 vulc aie seed eed 4 1 ior E 4 26 Command line Versi n Hoc 3 51 Suv EM 4 27 ubi cm H H B PE 3 1 nicum 3 1 Configure the project iine RHET dadas 3 5 Configuring ARM Target Systems cooocccocnoonnoncoononnnnnnonncnnnonncon non nn eene nn tenent erinnern enne enne 3 8 Configuring Coldfire Target Systems orinal dic e e i eit ee ee dedo 3 13 Configuring HCS12 Target Systems eene enne ennt n rennen enne 3 24 Configuring hooks n REPRE E EE HE ERR MEME de 3 10 3 15 3 21 3 26 3 31 Configuring M16C Target Systems essssssssseseseeeen eene enne nnntn trennen inneren nne nn nennen nennen 3 29 Configuring modules rnb ote eee o rb e Pi RE e e e retta eer ee ea Reda 3 35 Configuring PowerPC Target Systems sess enne ener inrer 3 18 Configuring target systems 2 5 enr is 3 8 Comm urine e EE 3 12 Configuring the iit Process rnc rte erm n t EE Pe Pe HR Dat n etie ero RES 3 39 CONNECTOR ES 1 1 Connector E R 2 17 Connector process com cete tete aos 4 14 CPU type m 3 8 3 13 3 18 3 24 3 29 SCI
16. Ae ones esses ASA AE ENEE 4 23 4 10 3 Error Hook Registering MM 4 24 4 10 4 Error Hook Declaration Syntax eet niente rere reed Peter todo 4 24 PM MEN cing E eer 4 25 4 11 System QE EE 4 26 4 11 1 Reset Hook ee itenim dione iniit 4 26 4 11 2 excu 4 26 4 11 3 PP baste det tuadeedsdgedaboddedessdcelacesteneatesetvaniastes 4 26 4 12 SCIOPTA Design Rules cum lic 4 27 5 Manual Revision AAA SA A 78 5 1 Manual Version ET airis 5 1 5 2 Manual Version E 5 1 5 3 Manual Version 1 3 ue Gee cri cascades ts ats one artt Ert Te E YR t tenseso ers ras enois ieseni sis 5 1 5 4 Manual Version 1 4 iecit ie E iaa 5 1 5 5 MEDIANA A Aa 5 2 5 6 Manual Version Ll nidad dt di 5 3 5 7 Manual Version 1 rtt tri terree RUE CREER ERREUR E laica 5 4 5 8 Manual Version Oil MERE liege 5 4 6 linis qe Cl SCIOPTA Kernel User s Guide Manual Version 1 7 IV 1 Introduction SC OPTA e 1 Introduction 1 1 SCIOPTA Real Time Operating System SCIOPTA is a high performance real time operating system for a variety of target processors The operating sys tem environment includes e Pre emptive multi tasking real time kernel BSP Board support packages IPS Internet protocols SFS File system CONNECTOR support for distributed multi CPU systems SMMS support for Memory Management Units and system protection DRUID sys
17. Chapter 6 41 sc procDaemonRegister last paragraph of the description rewritten e Chapters 6 45 sc procIntCreate 6 46 sc procKill 6 51 sc procPrioCreate 6 60 sc procTimCreate and 6 62 sc procUsrIntCreate information about sc kerneld are given e Chapter 4 10 5 Example added SCIOPTA Kernel User s Guide Manual Version 1 7 5 1 5 Manual Revision SC IOPTA e 5 5 Manual Version 1 3 e Chapter 6 26 sc msgPoolIdGet return value SC DEFAULT POOL defined e Chapter 6 33 sc poolCreate pool size formula added e Chapter 2 4 4 Message Pool maximum number of pools for compact kernel added e Chapter 4 8 SCIOPTA Memory Manager Message Pools added e Chapter 6 9 sc moduleCreate modul size calculation modified e Chapter 6 40 sc procCreate 6 45 sc procIntCreate 6 51 sc procPrioCreate and 6 60 sc procTim Create stacksize calculation modified SCIOPTA Kernel User s Guide Manual Version 1 7 5 2 5 Manual Revision SC OPTA 5 6 Manual Version 1 2 Top cover back side Address of SCIOPTA France added e Chapter 2 6 Trigger second paragraph At process creation the value of the trigger is initialized to one e Chapter 2 6 Trigger third paragraph The se_triggerWait call decrements the value of the trigger and the calling process will be blocked and swapped out if the value gets negative or equal zero Chapter 2 7 Process Variables second paragraph The tag and the process variable have a fixed size large enoug
18. Help ID ausa Configuration Tree Structure chte S ciopta Create PowerPC System Create Arm System Create x86 System Create Coldfire System Create HC12 System Create M16C System A pop up menu appears and allows you to select a system out of all SCIOPTA supported target CPUs The same selection can be made by selecting the Project menu from the menu bar SCONF asks you to enter a directory where the generated files sconf h sciopta cnf and sconf c will be stored Choose the directory where the generated files sconf h sciopta cnf and sconf c will be stored D Piprjo0s BP 3 ARM prjoo1 prjoo2 prjoo3 23 prjoo4 o prjoos prjoo prjoos C3 prjoo9 SCIOPTA Kernel User s Guide Manual Version 1 7 3 6 3 Configuration SCIOPTA e A new system for your selected CPU with the default name New System 1 the system module module id 0 with the same name as the new target and a init process will be created Ci Sciopta System Configuration D XPARMXnew xml File Edit ArmSystem Help O x Aa aw Configuration Tree Structure HE NewSystem1 igk init Arm Settings General Hooks Debug System Name NewSystemt CPU Type aRMvaT x Compiler GNU I Maximum Buffer Sizes le y Maximum Modules fa Maximum Connectors o Maximum Int Vectors hao Kemel Stack Size ez Interrupt Stack
19. Process Hooks JW Message Hooks JW Pool Hooks v Error Hook IV Create IV MsgRx IV Create IV Kill IV MsaTx IV Kill Y Swap Apply Cancel v SCIOPTA c Hooks are user written functions which are called by the kernel at different locations They are only called if the user defined them at configuration User hooks are used for a number of different purposes and are system depend ent You can enable all existing hooks separately by selecting the corresponding check box SCIOPTA Kernel User s Guide Ma nual Version 1 7 3 15 3 Configuration SC OPTA e 3 9 2 3 Debug Configuration Coldfire Settings Build Directory El General Hooks Debug Debug Statistic V Message Check IV Process Jv Stack Check JV Message V Process Parameter Check V Message Parameter Check Jh Pool Parameter Check Y Cline Apply Cancel Message Check If you are selecting this check box some test functions on messages will be included in the kernel Process Parameter Check If you are selecting this check box the kernel will do some testing on the parameters of the process system calls Message Parameter Check If you are selecting this check box the kernel will do some testing on the parameters of the message system calls Pool Parameter Check If you are selecting this check box the kernel will do some testing on the parameters of the pool system calls SCIOPTA Kernel Us
20. SC OPTA e 3 19 Command Line Version 3 19 1 Introduction The SCONF configuration utility can also be used from a command line This is useful if you want to modify or create the XML configuration file manually or if the XML configuration file will be generated by a tool automatically and you want to integrate the configuration process in a makefile The best way to become familiar with the structure of the XML file is to use the graphic SCONF tool once and save the XML file 3 19 2 Syntax By calling the SCONF utility with a e switch the command line version will be used automatically install dir gt bin win32 sconf exe c lt XML File You need to give also the extension of the XML file SCIOPTA Kernel User s Guide Manual Version 1 7 3 51 4 System Design SC OPTA e 4 System Design 4 1 Introduction System design includes all phase from system analysis through specification to system design coding and testing In this chapter we will give you some useful information of what methods techniques and structures are available in SCIOPTA to fulfil your real time requirements for your embedded system 4 2 System Partition When you are analysing a real time system you need to partition a large and complex real time system into smaller components and you need to design system structures and interfaces carefully This will not only help in the ana lysing and design phase it will also help you maintaining and upgr
21. Systems France 3 boulevard de l Europe F 68100 Mulhouse France Tel 33 3 89 36 33 91 Fax 33 3 89 45 57 10 email sales sciopta com www sciopta com Table of Contents Table of Contents 1 AAA A E 1 1 SCIOPTA Real Time Operating System sese enne 1 1 1 2 About Ke EE ET 1 1 1 3 Real Time Operating System Overview cccceccescsseescesseescesceseecsecseecaecaaesaecaeceaeceeseseseseseseeeeneeneeenes 1 2 1 3 1 Management Duties ne e E EHE a 1 2 ESLL CPU Management bietet lides 1 3 1 3 1 2 Memory Management A sues DEENEN GEESS hd eee eye dE deng 1 3 1 3 1 3 Input Output Management 1 3 1 3 14 Time Management iia dd EE 1 3 1 3 1 5 Interprocess Communication cccccecceesesseesseesecseesecseceaeceecsesseceseeseceseeeeeaeeaeecaeeaeecsecsaeeeeeeeereneeeas 1 3 2 SCIOPTA Technology and Methods seosseossesesooesoosssosssosssoesssosssoossosseosesssessse 2 2 1 Tia GU COD ee egene eege asias 2 1 2 2 SCIOP Xov unio 2 2 2 3 PROCESSES LEER 2 3 2 3 1 tele eege riori irte naui on 2 3 2 3 2 Process tales ciuda aiii rato e Hte tt aki pert ter ee Dre EAREN 2 3 KS Ee MEE tiui io EP 2 3 2322 A tueatur ML LIU Red 2 3 KK WEE 2 3 2 3 3 Process Calero aii nico 2 4 2331 Static Processes an 2 4 2 3 3 2 IEN 2 4 2 3 4 Process EE 2 5 2 3 4 1 Priotitized Processor 2 5 234 2 IEPS ra 2 5 2343 Timer Processes PP ONPE O OE o ata cee eect estas 2 5 2 3 4 4 Imit PEOCeSS
22. User s Guide Manual Version 1 7 Dynamic processes can be created and killed during run time Often dynamic processes are used to run multiple instances of common code The number of instances is only limited by system resources and does not to be known before running the system Another advantage of dynamic processes is that the resources such as stack space will be given back to the 2 SCIOPTA Technology and Methods SCIOPTA e 2 3 4 Process Types 2 3 4 1 Prioritized Process Inatypical SCIOPTA system prioritized processes are the most common used process types Each prioritized proc ess has a priority and the SCIOPTA scheduler is running ready processes according to these priorities The process with higher priority before the process with lower priority Ifa process has terminated its job for the moment by for example waiting on a message which has not yet been sent or by calling the kernel sleep function the process is put into the waiting state and 1s not any longer ready 2 3 4 2 Interrupt Process bh A An interrupt is a system event generated by a hardware device The CPU will suspend the actually running program and activate an interrupt service routine assigned to that interrupt The programs which handle interrupts are called interrupt processes in SCIOPTA SCIOPTA is channelling inter rupts internally and calls the appropriate interrupt process The priority of an interrupt process is assigned by hardware
23. all others 0 Please consult the configuration chapter of the target manual for more information about statistics SCIOPTA Kernel User s Guide Manual Version 1 7 4 19 4 System Design SC OPTA e 4 8 3 Message Sizes If a process allocates a message there is also the size to be given The user just gives the number of bytes needed SCIOPTA is not returning the exact amount of bytes requested but will select one of a list of buffer sizes which is large enough to contain the requested number This list can contain 4 8 or 16 sizes which will be defined when a message pool is created The difference of requested bytes and returned bytes can not be accessed by the user and will be unused It is there fore very important to select the buffer sizes to match as close as possible those needed by your application to waste as little memory as possible This pool buffer manager used by SCIOPTA is a very well known technique in message based systems The SCIOPTA memory manager is very fast and deterministic Memory fragmentation is completely avoided But the user has to select the buffer sizes very carefully otherwise there can be unused memory in the system As you can have more than one message pool in a SCIOPTA system and you can create and kill pools at every moment the user can adapt message sizes very well to system requirements at different system states because each pool can have a different set of buffer sizes By analysing a pool af
24. created and configured by the sc moduleCreate system call during run time In dynamic modules the init process is created and started automatically The code of the init process must be written by the user The entry point of the init process is given as parameter of the sc moduleCreate system call At start up the init process gets the highest priority 0 Template of a minimal init process of a dynamic module SC PROCESS dymod init Important init work on priority level 0 can be included here sc_procPrioSet 32 for ASM NOP init is now the idle process SCIOPTA Kernel User s Guide Manual Version 1 7 4 11 4 System Design SC OPTA e 4 5 6 Selecting Process Type SCIOPTA provides different types of processes to help the system designer to realize real time applications more efficiently Every process type is designed to perform specific duties in a real time system 4 5 6 1 Prioritized Process Prioritized process are the most used process types in a system Most of the time in a SCIOPTA real time system is spent in prioritized processes It is where collected data is analysed and complicated control structures are exe cuted Prioritized processes respond much slower than interrupt processes but they can spend a relatively long time to work with data Prioritized process have a specific priority The real time system designer assigns priority to processes or group of processes in order to gua
25. hes12 Gel General Hooks Debug Debug Statistic v Message Check Iv Process Stack Check IV Message V Process Parameter Check v Message Parameter Check v Pool Parameter Check Cline Message Check If you are selecting this check box some test functions on messages will be included in the kernel Process Parameter Check If you are selecting this check box the kernel will do some testing on the parameters of the process system calls Message Parameter Check If you are selecting this check box the kernel will do some testing on the parameters of the message system calls Pool Parameter Check If you are selecting this check box the kernel will do some testing on the parameters of the pool system calls SCIOPTA Kernel User s Guide Manual Version 1 7 3 27 3 Configuration SC OPTA C Line If you are selecting this check box the kernel will include line number information which can be used by the SCIOPTA DRUID Debug System or an error hook Line number and file of the last system call is recorded in the per process data Process Statistics If you are selecting this check box the kernel will maintain a process statistics data field where information such as number of process swaps can be read Message Statistics If you are selecting this check box the kernel will maintain a message statistics data field in the pool control block where information such as number of message
26. id Ai 2 6 2 3 4 5 Supervisor 2d 40 O iesus etes RE SEENEN ER ETIES AEA ER REES EES METH SE Eed 2 6 DIA Daemeng 2 6 2 3 5 A petam EI M rere rer eer ttre D EU ME Dr PETS 2 7 23 1 Prioritized Processes node tite a ieee 2 7 2 3 5 2 Interr pt PEOCeSSES seo e tee Rt PEEL EERE AREE ENSE E EERE HERES E EROS EE EHE CR EIE EE MEER ERE Re FRE RARE 2 7 2 3 5 9 Timer PrOCeSses A da 2 7 2 4 Messages EE 2 8 2 4 1 Introduction tr ttes piede E 2 8 2 4 2 MERA AAA O AA EEEN EEEE eege 2 8 2 4 3 leegen 2 9 2431 Example oco uoo nde oia LE SEEMS 2 9 2 4 4 Message Poole tei A teni tees hat A A a e dub iR reed 2 9 2 4 5 ES ESI EE 2 10 2 5 Mod le Scree oa 2 11 2 5 1 SCIOPTA Module Friend Concept 2 11 2 5 2 Sirmium 2 11 2 5 3 ESTETICA 2 12 2 5 4 System Pr ias 2 12 2 6 Eeer 2 13 2 7 Process Variables iaa da hein arses cox eth gs etek 2 14 2 8 Error Handling 5o etre neret e o rie ie reegen Ee T 2 15 SCIOPTA Kernel User s Guide Manual Version 1 7 Table of Contents SC IOPTA e 2 8 1 General ieseni L 2 15 2 8 2 OR Ee EE 2 15 2 9 SCIOPTA Schedule ones ten o 2 16 2 10 Distributed RE 2 17 2 10 1 Tint AUC ea 2 17 2 10 2 CONNECTORS vise esos X HR 2 17 2 10 3 Transparent Communication e ere ee ee YR EEN 2 18 2 11 HEEL E See 2 19 2 12 HOOK C dad 2 20 2121 A e AN 2 20
27. of the interrupt source Whenever an interrupt occurs the assigned interrupt process is called assuming that no other interrupt of higher priority is running If the interrupt process with higher priority has completed his work the interrupt process of lower priority can continue 2 3 4 3 Timer Process A timer process in SCIOPTA is a specific interrupt process connected to the tick timer of the operating system SCIOPTA is calling each timer process periodically derived from the operating system tick counter When config uring or creating a timer process the user defines the number of system ticks to expire from one call to the other individually for each process SCIOPTA Kernel User s Guide Manual Version 1 7 2 5 2 SCIOPTA Technology and Methods SCIOPTA e 2 3 4 4 Init Process A Zei The init process is the first process in a module please consult chapter 2 5 Modules on page 2 11 for an intro duction in SCIOPTA modules Each module has at least one process and this is the init process At module start the init process gets automatically the highest priority 0 After the init process has done some important work it will change its priority to the lowest level 32 and enter an endless loop Priority 32 is only allowed for the init process All other processes are using priority 0 31 The init process acts therefore also as idle process which will run when all other processes of a module are in the waiting state 2
28. of type Sciopta are handled by the kernel and may use not blocking system calls while interrupt processes of type User are handled outside the kernel and may not use system calls Applying the Interrupt Process Configuration Click on the Apply button to accept the interrupt process configuration settings Apply SCIOPTA Kernel User s Guide Manual Version 1 7 3 41 3 Configuration v SCIOPTA e 3 15 Timer Process Configuration Cu Sciopta System Configuration D P ARM tcs xml File Edit TimerProcess Help iBl x Configuration Tree Structure Timer Process Name Timer Process Function s Stack Size hotplug syscontrol Period amp display Initial Delay E P Se Process State H amber_ init hh sensor e oven Y driver controller YE reference a 9 A pool mmo mmo E Keess m stated y Timer Processes tick y J tick y Apply Cancel Timer Process Name Enter the name of the timer process Timer Process Function Enter the function name of the timer process function This is the address where the created process will start exe cution Stack Size Stacksize of the created process in bytes SCIOPTA Kernel User s Guide Manual Version 1 7 3 42 3 Configuration SC OPTA gt Period Period of time between calls to the timer process in ticks
29. sess enne eene 3 11 3 16 3 22 3 27 3 32 Process Priority ona EE 2 7 Process States ii M 2 3 3 43 A ARENS 3 12 3 17 3 23 3 28 3 33 Process synchronisation sess ener ener enne trennen nennen trennen entente nere n rennen nennen 4 18 Process variable iia EERE IH REEF ewe 2 14 PrOCESSES eerie hie DPI EMI M rerit LA 2 3 4 4 jud 4 4 Project leyel M T 3 3 3 4 Project MENU ua doi A 3 6 PLO SCE MANNS att da 3 2 R READY it sed vce sein beet eas Riel eR eee a ets de ee ama Ree 2 3 Real time TEQUITEMEN S cuina aaa ada 4 1 PRCA oi 4 27 e 1 1 Remote 00 ri ide En 2 18 Reply Messages urna di ss 4 27 Reset EE 4 26 e EE e GEET 1 2 4 3 RUNNING ii EE 2 3 S e TE 3 2 CR EE 4 7 4 8 4 9 Seege id A Eesen 2 6 4 22 sc miscErrorHookRegister ccceccesseesecsceesecsseeseceecseeseceseeecesseceeeseeeeecaesseecaeceaecaeceaeeseseesseeseseseeseneeaeeeaecseeeaees 4 24 Mu M P EN 4 15 4 16 A nt rte Eege 4 13 Bod dr A A e 2 6 4 21 SC PROCESS instalada lane Eed 4 5 Semet RR 4 13 4 21 se procrear cdi 4 13 SO PIOCPMOCTEALE De 4 13 SC morc Wain CLS A H 4 13 e A iaa 2 16 SGIOPTA COBDACE 2t teen ene ere od to I oou Dri ta e aa 3 34 SCIOPTA Kernel User s Guide Manual
30. system and configure system specific settings In SCIOPTA you can group processes into modules On the Module Level you can configure the module pa rameters and create static processes and message pools The parameters of processes and message pools can be configured in the Process Level SCIOPTA Kernel User s Guide Manual Version 1 7 3 Configuration SC OPTA e 3 6 Creating a New Project To create a new project select the New button in the tool bar New AN E Project Button You also can create a new project from the file menu or by the Ctrl N keystroke i Sciopta System Configuration File Edit Project Help New Ctrl N Ctrl O Save Ctrl 5 Open Save Bs Exit 3 7 Configure the Project You can define and modify the project name Click on the project name on the right side of the SCIOPTA logo and enter the project name in the parameter window y Sciopta System Configuration C P tcs xml File Edit Project Help May Configuration Tree Structure Sciopta Project Name Sciopta Enter the project name Click on the Apply button to accept the name of the project SCIOPTA Kernel User s Guide Manual Version 1 7 3 5 3 Configuration SC OPTA e 3 8 Creating Systems From the project level you can create new systems Move the mouse pointer over the project and right click the mouse Ci Sciopta System Configuration DXPXARMAE File Edit Project
31. valid for timer processes 4 5 4 1 Timer Process Declaration Syntax Description All timer processes in SCIOPTA must contain the following declaration Syntax SC INT PROCESS proc name irq src Code for timer process proc name gt Parameter Same as for interrupt processes Please consult chapter 4 5 3 1 Interrupt Process Declaration Syntax on page 4 7 4 5 4 2 Timer Process Template You can use the same template as for interrupt processes see chapter 4 5 3 2 Interrupt Process Template on page 4 8 SCIOPTA Kernel User s Guide Manual Version 1 7 4 9 4 System Design SC OPTA e 4 5 5 Init Process The init process is the first process in a module Each module has at least one process and this is the init process At module start the init process gets automatically the highest priority 0 After the init process has done some important work it will change its priority to the lowest level 32 and enter an endless loop Priority 32 is only al lowed for the init process All other processes are using priority 0 31 The init process acts therefore also as idle process which will run when all other processes of a module are in the waiting state 4 5 5 1 Init Process in Static Modules Static modules are defined and configured in the SCONF configuration utility In static modules the init process is created and started automatically The code of the init process is generated automatically by
32. 3 Messages and Modules third paragraph rewritten e Chapter 6 31 sc msgTx fifth paragraph rewritten SCIOPTA Kernel User s Guide Manual Version 1 7 5 3 E gt 5 Manual Revision SCIOPTA 5 7 Manual Version 1 1 System call sc modulelInfo has now a return parameter New system call sc procPathGet System call sc moduleCreate formula to calculate the size of the module parameter size added e Chapter 4 12 SCIOPTA Design Rules moved at the end of chapter System Design New chapter 4 6 Addressing Processes e Chapter 7 Kernel Error Codes new sequence of sub chapters Smaller font used e Chapter 4 10 Error Hook completely rewritten New chapter 4 11 System Start 5 8 Manual Version 1 0 Initial version SCIOPTA Kernel User s Guide Manual Version 1 7 5 4 gt 6 Index SCIOPTA Ch 6 Index Symbols NN 4 13 A INS 2 8 4 20 Addressing A e 4 13 enee eege eebe 2 9 4 20 Asynchronous Timeout animacion nda 3 25 3 30 Asynchronous timeout A MM 3 9 3 14 3 19 B Banked Checkbox ii 3 25 Browser WNdOW E 3 4 BP a dee EE EE eee 1 1 usi ati ee EE 3 47 UE 3 48 IES Cal hea erm 3 50 Build directory EE 3 49 Buildtatget EE 3 48 Build temporary file 5 erret ri reete Re HY He B o PE v E EE ERR ERE 3 48 C C enyironmelt tii tUe obrem tet entes tue Lp EM S EI 4 26 ura d 3 51 C C cross compiler scere siensa eie eee e etie ster Ee ie degen 3
33. 9 3 14 3 19 Interrupt Vector cou stet tite Erie E Ober E ONES EE ONIS SEXE EP Eie euet sate feat ill 3 41 IPS cree er A 1 1 oM CR P H R RD 4 7 K Kernel daemon este oda Pp OK eta idas 2 6 4 22 Kernel Stack Size tr aa ek ee tei ees 3 25 3 30 Kernel stack size cccccceccccessccsssecsseceseecsscecseceeesesaeceseeceeeecsseeessessecessecseecsseseaeceusecsueseseeceeseesesensecsas 3 9 3 14 3 19 M Manual TESIS 5 1 Manual version KU cua aio rai 5 4 ME CIE Merc 5 4 Mantal Version de PAS AN PUES 5 3 Manual version LA a betreibt Aa 5 2 Manual version LA 5 1 Maximum buffer SIZ68 a e E 3 9 3 14 3 19 3 25 3 30 Maximum connectors ccecsccesceessecescecsececsecesecessecessecseecsuecestesseeesseceeecsaeeesseeneeeess 3 9 3 14 3 19 3 25 3 30 Mauger Shades 3 9 Maximum modules oo cccccsccsssccssscsscccsscecseceeecesaeceseeceeecsseeeesessecessecseeecsseseaseeeeecueseseeceessesseeneeesas 3 9 3 14 3 19 Maximum pools A EEES 3 35 Maxinun proyec ono ictu EAE e fad o RAAR eE RE RAEAN tee 3 24 3 29 Maxim m e 3 35 luu EE 4 3 Memory management Unit a 1 1 Messi EEUU 2 8 Message based iia A A io 2 8 Me ssageC heck suia attese eres ibi 3 11 3 16 3 22 3 27 3 32 Message declaration EE M 4 14 Message oo o cheer Ue eege 2 20 SCIOPTA Kernel User s Guide Manual Ve
34. Compact Kernel All features described in this chap ter 2 5 Modules are not available in the SCIOPTA Compact Kernel The SCIOPTA Compact Kernel has only one module the system module and MMU is not supported 2 5 1 SCIOPTA Module Friend Concept SCIOPTA supports also the friend concept Modules can be friends of other modules This has mainly conse quences on whether message will be copied or not at message passing Please consult chapter 2 5 3 Messages and Modules on page 2 12 for more information A module can be declared as friend by the se_moduleFriendAdd system call The friendship is only in one di rection If module A declares module B as a friend module A is not automatically also friend of Module B Module B would also need to declare Module A as friend by the se_moduleFriendAdd system call Each module maintains a 128 bit wide bit field for the declared friends For each friend a bit is set which corre sponds to its module ID 2 5 2 System Module There is always one static system module in a SCIOPTA system This module is called system module sometimes also named module 0 and is the only static module in a system SCIOPTA Kernel User s Guide Manual Version 1 7 2 1 1 2 SCIOPTA Technology and Methods SCIOPTA e 2 5 3 Messages and Modules A process can only allocate a message from a pool inside the same module Messages transmitted and received within a module are not copied only th
35. Dynamic Processes Dynamic processes can be created and killed during run time Often dynamic processes are used to run multiple instances of common code The process IDs of dynamic processes can be retrieved by using the system call se procIdGet The process creation system calls such as sc procCreate sc procIntCreate sc procPrioCreate and sc procTimCreate will also return the process IDs which can be used for further addressing SCIOPTA Kernel User s Guide Manual Version 1 7 4 13 4 System Design SC OPTA e 4 7 Interprocess Communication 4 7 1 Introduction Interprocess communication needs to be designed carefully in a real time system In SCIOPTA there are a view different ways to design interprocess communication which are presented in the fol lowing chapters 4 7 2 SCIOPTA Messages 4 7 2 1 Description Please consult chapter 2 4 Messages on page 2 8 for a introduction into SCIOPTA messages Messages are the preferred tool for interprocess communication in SCIOPTA SCIOPTA is specifically designed to have a very high message passing performance Messages can also be used for interprocess coordination or syn chronization duties to initiate different actions in processes For this purposes messages can but do not need to carry data A message buffer the data area of a message can only be accessed by one process at a time which is the owner of the message A process becomes owner of a message when it allocates the
36. Effective Priority Module Priority Process Priority This technique assures that the process with highest process priority 0 cannot disturb processes in modules with lower module priority module protection highest interrupt priority 2 3 5 1 Prioritized Processes By assigning a priority to prioritized processes including init and supervisor processes as well as daemons the user designs groups of processes or parts of systems according to response time requirements Ready processes with high priority are always interrupting processes with lower prior ity Systems and modules with high priority processes have therefore faster response time Interrupt priority of timer inter rupt which drives SCIOPTA tick Timer Interrupt L timer All timer processes run on this interrupt level 4 o 0 0 o O o D i D a 5 25 i o Priority values for prioritized processes in SCIOPTA can be from 0 to 31 0 is the highest and 31 the lowest priority level Lowest interrupt priority Priority O 2 3 5 2 Interrupt Processes The priority of an interrupt process is assigned by hardware of the interrupt source 2 3 5 3 Timer Processes Timer processes are specific interrupt processes which all are running on the same interrupt priority level of the timer hardware which generates the SCIOPTA tick o o o o o O o n Uo o N A o n Priority 31
37. IOPTA Kernel User s Guide Manual Version 1 7 3 23 3 Configuration SC OPTA amp 3 9 5 Configuring HCS12 Target Systems The system configuration for HCS12 target systems is divided into 3 tabs General Hooks and Debug 3 9 5 1 General Configuration HC12 Settings Build Directory D P hes12 el General Hooks Debug System Name s CPU Type Hci27HCs12 v Compiler GNU Maximum Priority 31 Maximum Buffer Sizes s y Maximum Connectors o Kernel Stack Size 64 Unified IRQ Stack Size ea Banked Asynchronous Timeout System Name Enter the name of your system Please note that the system module module 0 in this system will use the same name CPU Type Give the name of you specific target processor derivative Compiler Select the C C Cross compiler which you are using for this SCIOPTA system Maximum Priority Select the maximum priority level in the HCS12 system The process priorities can then have priority levels be tween 0 highest to the values set inside this field lowest SCIOPTA Kernel User s Guide Manual Version 1 7 3 24 3 Configuration SC OPTA e Maximum Buffer Sizes If a process allocates a message there is also the size to be given The user just gives the number of bytes needed SCIOPTA is not returning the exact amount of bytes requested but will select one of a list of buffer sizes which is large enough to contain the requested number Th
38. Message number which should be unique for each message class 4 7 2 4 Message Structure Description Immediately after the message number declaration usually the message structure declaration follows We recom mend to write the message structure name in lower case letters in order to avoid mixing up with message number declaration The id item must be the first declaration in the message structure It is used by the SCIOPTA kernel to identify SCIOPTA messages After the message ID or message number all structure members can be declared There is no limit in structure complexity for SCIOPTA messages It is only limited by the message size which you are se lecting at message allocation Syntax struct message name sc msgid t id member type member j Parameter message_name Message name id This the place where the message number or message ID will be stored member Message data member SCIOPTA Kernel User s Guide Manual Version 1 7 4 15 4 System Design SC OPTA e 4 7 2 5 Message Union Description All processes which are using SCIOPTA messages should include the following message union declaration The union sc msg is used to standardize a message declaration for files using SCIOPTA messages Syntax union sc msg sc msgid t id lt message type l lt message name 1 message type 2 lt message name 2 gt message type 3 lt message name 3 n Parameter id Must be included in th
39. OPTA Kernel User s Guide Manual Version 1 7 6 1 gt 6 Index SCIOPTA y Creating a Mew Project cri di 3 5 Creating modules sirisser iet iaa lidia 3 34 Creating Pools ni ae 3 39 Creating processes miii a 3 39 Creating systems iia EENEG EA 3 6 CY CIC NN 2 16 D D mon EE 2 6 4 21 Debug configuration sss ener ener ener nnne 3 11 3 16 3 22 3 27 3 32 Dispatcher RT A a ieee een teas Gea 4 26 Distributed BEE 2 17 DRUIDA a 1 1 Dynaimic Procesan antics ese FUE racial ici 2 4 4 13 E GTS CUR VS tee EE 2 7 3 36 Embedded system pe 4 1 Enable Mend EE 3 9 3 14 3 19 Encapsulate amaia 4 3 Eircode es tua caida 4 24 4 26 O A 2 15 EnO CHECK eege 2 15 Eror Code p EE 4 23 4 24 Iusto guest PPE 4 23 4 24 Error handling 2 15 Eror 11 610 d Ems 2 15 2 20 4 23 4 24 4 27 Error hook declaration Syntax intet eb a to deed e 4 24 Erroi hook example corona 4 25 Error hook registering P 4 24 Error Informat O reitera e etr HORDE ico 4 23 ene e ig bees 4 23 4 24 Eiro Word EUER 4 23 Md aa 4 6 oq A a eege EEN eg 4 24 F lul ig iii idad 1 1 Prend MEER 2 11 rt EE 1 3 G General configuration nennen nnn nnne 3 8 3 13 3 18 3 24 3 29 Global error Book PA e eerie rr eere e Ee EE iva Ce EE E EXER REY EESE 2 15 4 23 Global variables Mu
40. RE 4 4 hne 2 9 4 19 4 20 Pool CONFI PUTA OM i iicet ette str isa 3 46 Pool hook JS O 2 20 Pool ANS C O 3 46 Pool parameter check 2 nete rec eee eie eio 3 11 3 16 3 22 3 27 3 32 Pool SIZE 3 46 Preemptive ii a 2 16 PTV OUT EE 2 16 SCIOPTA Kernel User s Guide Manual Version 1 7 6 4 6 Index SCIOPTA e Prioritized process i5 eerie en hio eei dere ete diri 2 5 2 7 4 4 4 12 Prioritized process configuration ssesssssseseseeeereen eene eren enne nennen enne entire ern en rne nn nr nin 3 44 Prioritized process stack size conidios nen eden canes 3 45 Prioritized process state eie ase tetris tice i e qua Pe i Le reete Pe orte ee ti eet c hu rei i ei ended 3 45 e ee 3 45 Priority levels ROME 4 27 Priority process function 2 2 pin D RE ios 3 44 Priority process NAME 25 rece etie tede VE ia 3 44 Process Categories suicide IR rte en OI P er uate ei eer a Pe o ec dd ici 2 4 Process E EE 2 6 4 21 Process declaration syntax i d mee e e RR RH HH TR PER E THE PERTH ERE ERE C ENTRO E SA 4 5 Process A d 2 8 4 13 4 20 Process level sis 3 3 3 4 Process parameter check
41. SCIOPTA Compact is mainly available for 8 16 bit target processors The full featured SCIOPTA kernel is aimed at 32 bit processor applications By removing the module and observation support it was possible to reduce the size and complexity of the kernel considerably The typical size of a SCIOPTA Compact kernel is around 6 kbytes whereas the full featured SCIOPTA kernel has a size of about 25 kbytes The precise sizes are processor dependent Please note that most of the SCIOPTA kernels including the SCIOPTA Compact kernel are completely written in assembler language That s why the SCIOPTA kernels distinguish themselves by a very high performance The features and system calls which are not supported by SCIOPTA Compact are market with a frame similar to the following example Please Note The system call sc moduleCreate is not supported in the SCIOPTA Compact Kernel SCIOPTA Kernel User s Guide Manual Version 1 7 2 2 2 SCIOPTA Technology and Methods SCIOPTA e 2 3 Processes 2 3 1 Introduction An independent instance of a program running under the control of SCIOPTA is called process SCIOPTA is as signing CPU time by the use of processes and guarantees that at every instant of time the most important process ready to run is executing The system interrupts processes if other processes with higher priority must execute be come ready 2 3 2 Process States A process running under SCIOPTA is always in the RUNNING READY or
42. SCIOPTA only a few priority levels When designing a sys M NN tem avoid to control it with priorities A system should be controlled by message passing and mes NS sage flow Priorities should be used to guarantee fast response time to external events If you identify work which is concurrent do not try to place the code in one process Simul taneous work should be placed Avoid to send a lot of messages from a in different processes process without waiting for reply mes sages The receiving process might not be activated until the sender process be comes not ready Methods and functions which will be accessed from more than one process must be re entrant while executing There are sys tem call to handle per process local data se procVar To simplify the calcu lation of stack require ments try to avoid using of large auto ar I O ports must be encap As itis true for all well designed systems rays in processes writ sulated in a SCIOPTA it is strongly recommended to not using ten in C Rather process Otherwise they global variables If it cannot be avoided allocate a buffer from a must be treated the same you must disable interrupts or lock the message pool way as global variables scheduler while accessing them Always include an Error hook in your system Setting Do not modify message data buffers after you have sent it a breakpoint there allows you to track down syst
43. Size j2 Inter Module friends y JV Asynchronous Timeout Apply Build Directory D P ARM Gel Cancel You can create up to 128 systems inside a SCIOPTA project The targets do not need to be of the same processor CPU type You can mix any types or use the same types to configure a distributed system within the same SCIOPTA project You are now ready to configure the individual targets SCIOPTA Kernel User s Guide Manual Version 1 7 3 7 3 Configuration 3 9 Configuring Target Systems v SCIOPTA c After selecting a system with your mouse the corresponding parameter window on the right side will show the parameters for the selected target CPU system 3 9 1 Configuring ARM Target Systems The system configuration for ARM target systems is divided into 3 tabs General Hooks and Debug 3 9 1 1 General Configuration Arm Settings General Hooks Debug System Name TCS CPU Type ARMv4T y Compiler GNU M Maximum Buffer Sizes S sf Maximum Modules la Maximum Connectors o Maximum Int Vectors 128 Kernel Stack Size ez Interrupt Stack Size 512 Inter Module friends bad JW Asynchronous Timeout Build Directoy D P ARM ul Apply Cancel System Name Enter the name of your system Please note that the system module module 0 in this system will use the same name CPU Type Give the name of you specific target processor derivative
44. Time System Definition Figure 1 1 shows a typical part of a real time system An external interrupt is activating an interrupt process which allocates a message and transmits the message to a prioritized process The time t between the occurrence of the interrupt and the processing of the interrupt in process B must not exceed a specified maximum time under any circumstances This maximum time must not depend on system resources such as number of processes or number of messages 1 3 1 Management Duties A real time operating system fulfils many different tasks such as resource management CPU Memory and I O time management interprocess communication management SCIOPTA Kernel User s Guide Manual Version 1 7 1 2 1 Introduction SC OPTA e 1 3 1 1 CPU Management As auser of a real time operating system you will divide your program into a number of small program parts These parts are called processes and will normally operate independently of each other and be connected through some interprocess communication connections It is obvious that only one process can use the CPU at a time One important task of the real time operating system is to activate the various processes according to their importance The user can control this by assigning priorities to the processes The real time operating system guarantees the execution of the most important part of a program at any particular moment 1 3 1 2 Memory Management The r
45. Version 1 7 6 5 6 Index SCIOPTA e SCIOPTA design TEE 4 27 e EREM 4 18 SCIOPLAsCNE EE 3 6 3 48 SOCIO Ptah lat aia adria 4 5 4 8 SCONE so 3 1 3 49 3 51 e E 3 6 3 48 SOM 3 6 3 48 O E 2 12 Selecting Process type mmm a ada 4 12 airoso iris 1 1 SMMS sun A Ra 1 1 en e 4 1 e 3 11 Stack requirements encarceladas iii 4 27 Start hook cui i 4 26 Stane d a lol a 3 45 Starting SCONE M is adan 3 1 e Ieren EE 4 10 Static Process ii ad 2 4 4 13 Stopped quita SR 3 45 ee 4 1 SUPerVISOF E 2 6 4 4 System MAS dass 4 1 System TEE 4 1 System ne UE 2 11 SN ENS 3 8 3 18 3 24 3 29 System partition id 4 1 System protection eec edet taie ii ER Iba ia 2 12 MR unl 4 26 DV SCCIU SLATE OE ETE 4 26 System ticks iii 4 9 T Target level S Y 3 3 3 4 Target manual ui idas 1 1 MIF AR CU TAGs merena ciedad EE 3 13 Technical specification eric eei o T DER ERE RE HE e D aet d eid 1 1 Techniques acies titi eet ti oer ede AO ESQ IR DE ERE EE EH Exi Freies eive testigo He EH caida 4 1 M dudum a 2 1 Hu TM 4 1 lite Jp EEE EEn 2 5 ER ee TEE 1 2 1 3 Timer and interrupt configuration ci die tadas 3 20 Timer PEGQUEM CY anal o la di aa
46. WAITING state 2 3 2 1 Running If the process is in the running state it ex ecutes on the CPU Only one process can be in running state in a single CPU sys tem 2 3 2 2 Ready tx transmit Ifa process is in the ready state it is ready to run meaning the process needs the CPU but another process with higher pri ority is running 2 3 2 3 Waiting stop process If a process is in the waiting state it is waiting for events to happen and does not need the CPU meanwhile The reasons to be in the waiting state can be sleep tx transmit rx receive start process higher priority WAITING Figure 2 1 State Diagram of SCIOPTA Kernel The process tried to receive a mes sage which has not yet arrived start process lower or same priority The process called the sleep system call and waits for the delay to expire The process waits on a SCIOPTA trigger The Process waits on a start system call if it was previously stopped SCIOPTA Kernel User s Guide Manual Version 1 7 2 3 2 SCIOPTA Technology and Methods 2 3 3 Process Categories gt SCIOPTA e In SCIOPTA processes are divided into two main groups namely static and dynamic processes They mainly differ in the way they are created and in their dynamic behaviour during run time All SCIOPTA processes have system wide unique process identities A SCIOPTA process is always part of a SCIOPTA module Please
47. ading the system Ina SCIOPTA controlled real time system you have different structure elements available to decompose the whole system into smaller parts The following chapters describe the possibilities which is offered by SCIOPTA 4 3 Modules SCIOPTA allows you to group tasks into functional units called modules Very often you want to decompose a complex application into smaller units which you can realize in SCIOPTA by using modules A typical example would be to encapsulate a whole communication stack into one module and to protect it against other function modules in a system Modules can be moved and copied between CPU s and systems You can define modules from the SCIOPTA configuration tool SCONF These modules are created automatically by the operating system at startup When creating and defining modules the maximum number of pools and processes must be defined There is a maximum number of 128 modules per SCIOPTA system possible There is always one static system module in a SCIOPTA system This module is called system module sometimes also named module 0 and is the only static module in a system A module can be declared as friend by the sc moduleFriendAdd system call The friendship is only in one di rection If module A declares module B as a friend module A is not automatically also friend of Module B Module B would also need to declare Module A as friend by the sc moduleFriendAdd system call Please Note The mo
48. ag and the proc ess variable have a fixed size large enough to hold a pointer Itis the user s responsibility to allocate a big enough message buffer to hold the maximum needed number of proc ess variables The message buffer holding the variable array will be removed from the process The process may no longer access this buffer directly But it can retrieve the buffer if for instance the number of variables must be changed SCIOPTA Kernel User s Guide Manual Version 1 7 2 1 4 2 SCIOPTA Technology and Methods SCIOPTA e 2 8 Error Handling 2 8 1 General SCIOPTA has many built in error check functions The following list shows some examples e When allocating a message it is checked if the requested buffer size is available and if there is still enough mem ory in the message pool Process identities are verified in different kernel functions Ownership of messages are checked Parameters and sources of system calls are validated s The kernel will detect if messages and stacks have been over written beyond its length Contrary to most conventional real time operating systems SCIOPTA uses a centralized mechanism for error re porting called Error Hooks In traditional real time operating systems the user needs to check return values of sys tem calls for a possible error condition In SCIOPTA all error conditions will end up in an Error Hook This guarantees that all errors are treated and that the error handling does n
49. allocation can be read Applying Target Configuration Click on the Apply button to accept the target configuration settings Apply SCIOPTA Kernel User s Guide Manual Version 1 7 3 28 3 Configuration SC OPTA amp 3 9 6 Configuring M16C Target Systems The system configuration for M16C target systems is divided into 3 tabs General Hooks and Debug 3 9 6 1 General Configuration M16C Settings Build Directory D P mi 6d El General Hooks Debug System Name res CPU Type Iwer xy Compiler Taskin zl Maximum Priority 31 y Maximum Buffer Sizes le y Maximum Connectors p Kernel Stack Size a Unified IRQ Stack Sie bk Asynchronous Timeout Apply Cancel System Name Enter the name of your system Please note that the system module module 0 in this system will use the same name CPU Type Give the name of you specific target processor derivative Compiler Select the C C Cross compiler which you are using for this SCIOPTA system Maximum Priority Select the maximum priority level in the M16C system The process priorities can then have priority levels between 0 highest to the values set inside this field lowest SCIOPTA Kernel User s Guide Manual Version 1 7 3 29 3 Configuration SC OPTA e Maximum Buffer Sizes If a process allocates a message there is also the size to be given The user just gives the number of bytes needed SCIOPTA i
50. alue of a trigger Only the owner of the trigger can set the val ue Processes can also read the values of trigger by the sc triggerGet call Also interrupt processes have a trigger but they cannot wait on it If a process is triggering an interrupt process the interrupt process gets a software event This is the same as if an interrupt occurs The user can investigate a flag which informs if the interrupt process was activated by a real interrupt or woken up by such a trigger event Process waiting on the trigger Trigger Process issuing a trigger event sc triggerWait Figure 2 8 SCIOPTA Trigger SCIOPTA Kernel User s Guide Manual Version 1 7 2 1 3 2 SCIOPTA Technology and Methods SCIOPTA e 2 7 Process Variables Each process can store local variables inside a protected data area The process variable are usually maintained in side a SCIOPTA message and managed by the kernel The user can access the process variable by specific system calls Process Control Block PCB Process Variable Message Pointer Message ID LJ Reserved by the kernel TAG 1 Variable 1 TAG 2 Variable 2 Process Variables Figure 2 9 SCIOPTA Process Variables There can be one process variable data area per process The user needs to allocate a message to hold the process variables Each variable is preceded by a user defined tag which is used to access the variable The t
51. and reading A good practice in SCIOPTA to realize such a mutual exclusion is to encapsulate the shared resources inside a SCIOPTA process User processes can communicate with the shared resource by sending and receiving SCIOPTA message to and from the encapsulating process Process A UO Process Message RX TX 1 0 UO Device Message RX TX Process B Message RX TX Figure 4 3 Resource Encapsulation Please consult also the manual SCIOPTA Board Support Package User s Guide where detailed information about the SCIOPTA device driver concept can be found SCIOPTA Kernel User s Guide Manual Version 1 7 4 3 4 System Design SC OPTA e 4 5 Processes 4 5 1 Introduction In SCIOPTA a process can be seen as an independent program which executes as if it has the whole CPU available The operating systems guarantees that always the most important process at a certain moment is executing If a more important process with a higher priority wants to run SCIOPTA will swap out the actual running process and swap in the new process and allow the execution This is called a process switch There are different type of processes available in SCIOPTA which differ mainly in the way they are activated and running prioritized process interrupt process timer process init process Each process has a unique process identity process ID which is used in SCIOPTA system calls whe
52. are stored and maintained in this file 1 Project name of the last saved project 2 Location of the last saved project file 3 Warming state enabled disabled The sc config cfg file is located in the home directory of the user The location cannot be modified Every time SCONF is started the file sc config cfg is scanned and the latest saved project is entered At every project save the file sc config cfg is updated 3 4 Project File The project can be saved in an external XML file project name ml All configuration settings of the project are stored in this file SCIOPTA Kernel User s Guide Manual Version 1 7 3 2 3 Configuration SC OPTA e 3 5 SCONF Windows To configure a SCIOPTA system with SCONF you will work mainly in two windows Ci Sciopta System Configuration D P ARM tcs xml loj xj File Edit ArmSystem Help Aa aw Arm Settings Build Directory D P ARM E General Hooks Debug x System Name rcs hh keyboard O hotplug CPU Type ARMv4T y d et Compiler GNU isplay qp syspool Maximum Buffer Sizes 8 y pe D Chamber Maximum Modules fa er init hh sensor Maximum Connectors o oven Maximum Int Vectors fi 28 YE driver 46 controller Kemel Stack Size 51 2 Pb reference Interrupt Stack Size 51 2 i 4 A pool EP Inter Module friends bad IV Asynchronous Timeout Browser Window Parameter Window Figu
53. as 3 18 3 9 4 Timer and Interrupt Configuration eene enne eene nennen 3 20 3 9 4 1 Configuring Hooks ecce em nemen m en m ed P CHER P eria 3 21 3 9 4 2 Debug Confeurapnon nennen nennen nennen nennen itinere e rne nn nennt nete nnn 3 22 3 9 5 Configuring HCS12 Target Systems eiie chive tiet ee HE I e ER Prec erae ee eden 3 24 3 9 5 1 General Confeurapon eene enne ener nnne trennen nennen eerte non nter nnne 3 24 3 9 5 2 Configuring HOOKS eiecti n t n ERE E DRE THERE AREE EHE d Ea TR 3 26 3 9 5 3 Debug Confeurapnon nnne nennen nennen Ran Ran eren non on entere nennen nere nnn 3 27 3 9 6 Configuring M16C Target Systems cui t eid rH e HE ER RE AREE UR Fee eta 3 29 3 9 6 1 General Confeurapon enne enne enne eren nne en etre nnn nennen nnne 3 29 3 9 62 Configuring Hooks eec iem ero m e in e as idad 3 31 3 9 6 3 Debug Confeurapnon nennen nennen irent eirata dried ria inean irisi 3 32 3 10 Creating Modules seen ERU ese Hec i eet i re EE P anions 3 34 3 11 Configuring Modules ERR 3 35 3 12 Creating Processes and Pools eme ne eo eH ER e Reed 3 39 3 13 Configuring the Init Process 3 39 SCIOPTA Kernel User s Guide Manual Version 1 7 ll Table of Contents SC IOPTA e 3 14 Interrupt Process Configuration nece rt reed ee eei e reed e deseen 3 40 3 15 Timer Process Configuration coooonccnoniccnononconnononanononnononncnnnnncn enne nne enntnetnen etre nnne nennen erret 3 42 3 16 Prioritized Process Configuration sseni eere eee t
54. as also a priority which can range between 0 highest to 31 lowest priority For process scheduling SCIOPTA uses a combination of the module priority and process priority called effective priority Please consult the SCIOPTA Kernel User s Guide and Reference Manual for more information about module and process priority Start Address This entry is only available for SCIOPTA 32 Bit systems This is the start address of the module in RAM Best is to specify a label which will be resolved at link time e g module name mod The specified label will be used in the linker script Therefore all memory allocation for all modules is controlled by the linker script You may specify an absolute address but you need to be very carefully check with the linker script to avoid over lapping Memory Size This entry is only available for SCIOPTA 32 Bit systems Size of the module in bytes RAM Best is to specify a label which will be resolved at link time e g module name size The specified label will be used in the linker script Therefore all memory allocation for all modules is controlled by the linker script You may specify an absolute address but you need to be very carefully check with the linker script to avoid over lapping The minimum module size can be calculated according to the following formula bytes size mod p 128 stack pools mcb textsize where p Number of static processes stack Sum of stack siz
55. be written in assembler Syntax int reset hook void Parameter none Return Value The kernel will jump to the C startup function This will initiate a cold start 0 The kernel will immediately call the dispatcher This will initiate a warm start 4 11 2 C Startup After a cold start the kernel will call the C startup function to initialize the C environment This is target and com piler specific 4 11 3 Start Hook Description The start hook must always be present and must have the name start hook The start hook must be written by the user If a start hook is declared the kernel will jump into it after the C environment is initialized The start hook is mainly used to do chip board and system initialization As the C environment is initialized it can be written in C After the start hook has executed the kernel will call the dispatcher and the system will start Syntax void start hook void SCIOPTA Kernel User s Guide Manual Version 1 7 4 26 4 System Design SC OPTA e 4 12 SCIOPTA Design Rules As already stated in this document SCIOPTA is a message based real time operating system Interprocess com munication and synchronization is done by way of message passing This is a very performant and strong design technology Nevertheless the SCIOPTA user has to follow some rules to design message based systems efficiently and easy to debug qu Correct designed SCIOPTA systems should use
56. because each pool can have a different set of buffer sizes By analysing a pool after a system run you can find out unused memory and optimize the buffer sizes 2 4 3 1 Example A message pool is created with 8 buffer sizes with the following sizes 4 10 20 80 200 1000 4048 16000 If a message is allocated from that pool which requests 300 bytes the system will return a buffer with 1000 bytes The difference of 700 bytes is not accessible by the user and is wasted memory 1 300 bytes buffer are used more often it would be good design to modify the buffer sizes for this pool by changing the size 200 to 300 24 4 Message Pool Messages are the main data object in SCIOPTA Messages are allocated by processes from message pools If a process does not need the messages any longer it will be given back freed by the owner process There can be up to 127 pools per module for a standard kernel 32 bit and up to 15 pools for a compact kernel 16 bit Please consult chapter 2 5 Modules on page 2 11 for more information about the SCIOPTA module con cept The maximum number of pools will be defined at module creation A message pool always belongs to the module from where it was created The size of a pool will be defined when the pool will be created By killing a module the corresponding pool will also be deleted Pools can be created killed and reset freely and at any time The SCIOPTA kernel is managing all existing pools i
57. ber of message allocation can be read Applying Target Configuration Click on the Apply button to accept the target configuration settings Apply SCIOPTA Kernel User s Guide Manual Version 1 7 3 33 3 Configuration 3 10 Creating Modules From the system level you can create new modules Move the mouse pointer over the system and right click the mouse y Sciopta System Configuration D P ARM tcs File Edit ArmSystem Help D s m a Delete System Build System Change Build Directory Modules can only be created for SCIOPTA 32 Bit systems In SCIOPTA 16 Bit systems SCIOPTA Com pact there is only one module the system module A pop up menu appears and allows you to create a new module The same selection can be made by selecting the Target System from the menu bar A new module for your selected target with a default name and an init process in the module will be created i Sciopta System Configuration D APXAR File Edit Module Help D s a a Configuration Tree Structure scra Sciopta B X NewSysteml Z init 3 88 NewModulel LS init You can create up to 127 modules inside a SCIOPTA 32 Bit system You are now ready to configure the individual modules SCIOPTA Kernel User s Guide Manual Version 1 7 3 34 3 Configuration SC OPTA Eee e 3 11 Configuring Modules After selecting a module with your mouse the corresponding parameter window on the right side wi
58. ck on the Apply button to accept the target configuration settings Apply SCIOPTA Kernel User s Guide Manual Version 1 7 3 1 2 3 Configuration 3 9 2 Configuring Coldfire Target Systems v SCIOPTA c The system configuration for Coldfire target systems is divided into 3 tabs General Hooks and Debug 3 9 2 1 General Configuration Coldfire Settings Build Directory D P coldfire General Hooks Debug System Name fr cs CPU Type Compiler GNU he Maximum Buffer Sizes le Maximum Modules la Maximum Connectors lo Kerel Stack Size 2 SCti lt lt i lt C CO Interrupt Stack Size 2 Inter Module fiends zl IV Asynchronous Timeout Apply Cancel System Name Enter the name of your system Please note that the system module module 0 in this system will use the same name CPU Type Give the name of you specific target processor derivative Compiler Select the C C Cross compiler which you are using for this SCIOPTA system SCIOPTA Kernel User s Guide Manual Version 1 7 3 13 3 Configuration SC OPTA e Maximum Buffer Sizes If a process allocates a message there is also the size to be given The user just gives the number of bytes needed SCIOPTA is not returning the exact amount of bytes requested but will select one of a list of buffer sizes which is large enough to contain the requested number This list can contain 4 8 or 16 sizes which is co
59. configured before you can generated the whole system In the SCIOPTA configuration utility SCONF sconf exe you will define the parameters for SCIOPTA systems such as name of systems static modules processes and pools etc The SCONF program is a graphical tool which will save all settings in an external XML file If the setting are sat isfactory for your system SCONF will generate three source files containing the configurable part of the kernel These files must be included when the SCIOPTA system is generated A SCIOPTA project can contain different SCIOPTA Systems which can also be in different CPUs For each SCIOPTA System defined in SCONF a set of source files will be generated 3 2 Starting SCONF The SCIOPTA configuration utility SCONF config exe can be launched from the SCONF short cut of the Win dows Start menu or the windows workspace After starting the welcome screen will appear The latest saved project will be loaded or an empty screen if the tool was launched for the first time Ey Sciopta System Configuration C P multixml 3 E loj xj File Edit Help D ea w Configuration Tree Structure Figure 3 1 SCIOPTA Configuration Utility Start Screen SCIOPTA Kernel User s Guide Manual Version 1 7 3 1 3 Configuration SC OPTA e 3 3 Preference File sc config cfg The SCIOPTA Configuration Utility SCONF is storing some preference setting in the file sc config cfg Actually there are only three settings which
60. consult chapter 2 5 Modules on page 2 11 for more information about the SCIOPTA module concept 2 3 3 1 Static Processes Static processes are created by the kernel at start up They are designed inside a configuration utility by defining the name and all other process parameters such as priority and process stack sizes At start up the kernel puts all static created processes into READY or WAITING stopped state Static process are supposed to stay alive as long as the whole system is alive But nevertheless in SCIOPTA static processes can be killed at run time but they will not return their used memory Ey Sciopta System Configuration C P tcs xml Ele Edit PriorityProcess Help D e um a Configuration Tree Structure ini xi sere TCS ER TCS Priority Process Name syscontrol a TCs sni Ah keyboard Stack Size 128 p Priority he 3 XE display Process State syspool Er BE Chamber A init Ah sensor Qoven HK diver 3E controller Mreference d ChamberPool Priority Process Function NewPrioProcessl started y Figure 2 2 Process Configuration Window for Static Processes 2 3 3 2 Dynamic Processes sc pid t Sc procPrioCreate const char name void entry void Sc bufsize t stacksize Sc ticks t slice Sc prio t prio int state sc poolid t plid system after a dynamic process is killed Figure 2 3 Create Process System Call SCIOPTA Kernel
61. d out by SCIOPTA when another process with higher priority becomes ready and wants the CPU SCIOPTA is a pre emptive kernel Therefore processes can be interrupted any time even inside any C instruction or between almost any two assembler instructions Prioritized processes can use all SCIOPTA system calls They must never end and should be written in such a way to loop back and the beginning and waiting for another system event Prioritized process can be created and killed dynamically with the sc procPrioCreate and sc procKill system calls SCIOPTA Kernel User s Guide Manual Version 1 7 4 4 4 System Design SC OPTA e 4 5 2 1 Process Declaration Syntax Description All prioritized processes in SCIOPTA must contain the following declaration Syntax SC PROCESS proc name for 77 Code for process lt proc_name gt Parameter roc name Name of the prioritized process proc_ p p 4 5 2 2 Process Template In this chapter a template for a prioritized process in SCIOPTA is provided include lt sciopta h gt SCIOPTA standard prototypes and definitions SC_PROCESS proc_name Declaration for prioritized process proc_name Local variables Process initialization code for 557 for ever loop declaration A SCIOPTA prioritized process may never return It is an error to terminate a prioritized process If a prioritized process terminates and
62. dule concept is not supported in the SCIOPTA Compact Kernel The SCIOPTA Compact Kernel has only one module the system module SCIOPTA Kernel User s Guide Manual Version 1 7 4 1 4 System Design v SCIOPTA e File Edit PowerPcTarget Help y Sciopta System Configuration C P titi xml De ma ei E N ewT 4 E HE New arge Create Module Delete Target Build Temporary File Change Build Directory Figure 4 1 Module Creation by SCONF Please consult the SCIOPTA Target Manual of your processor for more information about module creation by the SCOMF tool Another way is to create modules dynamically by the se_moduleCreate system call sc_moduleid_t sc_moduleCreate const char name void init void sc_bufsize t stacksize SC prio t prio char start Sc modulesize t size Sc modulesize t textsize unsigned int max pools unsigned int max procs name of module init process stack size of init process module priority Figure 4 2 Module Creation by sc moduleCreate System Call SCIOPTA Kernel User s Guide Manual Version 1 7 4 System Design SC OPTA e 4 4 Resource Management Typical resources in a real time operating system such as peripheral devices or memory must usually be shared between different clients The system must be designed in a way to ensure mutual exclusion while accessing the resource for writing
63. duling Sequence Example SCIOPTA Kernel User s Guide Manual Version 1 7 2 1 6 2 SCIOPTA Technology and Methods SCIOPTA e 2 10 Distributed Systems 2 10 1 Introduction SCIOPTA is a message based real time operating system and therefore very well adapted for designing distributed multi CPU systems Message based operating systems where initially designed to fulfil the requirements of dis tributed systems In this manual we will use the term SCIOPTA System to designate a whole target environment on one CPU 2 10 2 CONNECTORS CONNECTORS are specific SCIOPTA processes and responsible for linking a number of SCIOPTA Systems There may be more than one CONNECTOR process in a system or module CONNECTOR processes can be seen globally inside a SCIOPTA system by other processes The name of a CONNECTOR process must be identical to the name of the remote target system SCIOPTA System B SCIOPTA System A leds CONNECTOR List Process Process B 02 B01 Process B 03 Remote CONNECTOR Process List Process A01 Process B 04 Process A 02 Process A03 Process B01 Process B02 Process Process Process A11 A21 B03 Process A12 Process Process A22 A13 Figure 2 11 SCIOPTA Distributed System A connector process can be defined as default connector process There can be only one default connec
64. e and init size The labels module name mod module name size and module name initsize will be used by the linker script and resolved at link time Therefore all memory allocation for all modules is controlled by the linker script Applying Module Configuration Click on the Apply button to accept the module configuration settings Apply SCIOPTA Kernel User s Guide Manual Version 1 7 3 38 3 Configuration SC OPTA e 3 12 Creating Processes and Pools From the module level you can create new processes and pools Move the mouse pointer over the module and right click the mouse y Sciopta System Configuration C P titi xml File Edit Module Help ID a u a Configuration Tree Structure Create Pool Create Interrupt Process Create Timer Process Create Priority Process Delete Module A pop up menu appears and allows you to create pools interrupt processes timer processes and prioritized proc esses The same selection can be made by selecting the Module menu from the menu bar 3 13 Configuring the Init Process After selecting the init process with your mouse the parameter window on the right side will show the configuration parameters for the init process There is always one init process per module and this process has the highest priority Only the stack size of the init process can be configured Priority Process Name finit Priority Process Function r CS init Stack Size h 28
65. e pointer to the message is transferred Messages which are transmitted across modules boundaries are always copied except if the modules are friends To copy such a message the kernel will allocate a buffer from the pool of the module where the receiving process resides big enough to fit the message and copy the whole message Message buffer copying depends on the friend ship settings of the module where the buffer was originally allocated A module can be declared as friend of another module The message which was transmitted from the module to its declared friend will not be copied But in return if the friend sends back a message it will be copied To avoid this the receiver needs to declare the sender also as friend System Module l MMU Segment A MMU Segment B E Figure 2 7 SCIOPTA Module Structure 2 5 4 System Protection In bigger systems it is often necessary to protect certain system areas to be accesses by others In SCIOPTA the user can achieve such protection by grouping processes into modules creating sub systems which can be protected Full protection is achieved if memory segments are isolated by a hardware Memory Management Unit MMU In SCIOPTA such protected memory segments would be layed down at module boundaries System protection and MMU support is optional in SCIOPTA and should only be used and configured 1f you need this feature SCIOPTA Kernel User s Guide Manual Version 1 7 2 1
66. eal time operating system will control the memory needs and accesses of a system and always guarantee the real time behaviour of the system Specific functions and techniques are offered by a real time operating system to protect memory from writing by processes that should have no access to them Thus allocating freeing and protecting of memory buffers used by processes are one of the main duties of the memory management part of a real time operating system 1 3 1 3 Input Output Management Another important task of a real time operating system is to support the user in designing the interfaces for various hardware such as input output ports displays communication equipment storage devices etc 1 3 1 4 Time Management In a real time system it is very important to manage time dependent applications and functions appropriately There are many timing demands in a real time system such as notifying the user after a certain time activating par ticular tasks cyclically or running a function for a specified time A real time operating system must be able to man age these timing requirements by scheduling activities at or after a certain specified time 1 3 1 5 Interprocess Communication The designer of a real time system will divide the whole system into processes One design goal of a real time sys tem is to keep the processes as isolated as possible Even so it is often necessary to exchange data between proc esses Interprocess relatio
67. em er rors easily SCIOPTA Kernel User s Guide Manual Version 1 7 4 27 5 Manual Revision SC OPTA 5 Manual Revision 5 1 Manual Version 1 7 Chapter 3 9 1 Configuring ARM Target Systems Inter Module settings added e Chapter 3 9 2 Configuring Coldfire Target Systems Inter Module settings added e Chapter 3 9 3 Configuring PowerPC Target Systems Inter Module settings added 5 2 Manual Version 1 6 Configuration chapter added moved from the target manuals 5 3 Manual Version 1 5 All union sc msg changed to sc msg t to support SCIOPTA 16 Bit systems NEAR pointer Allunion sc msg changed to sc msgptr t to support SCIOPTA 16 Bit systems NEAR pointer e Manual now splitted into a User s Guide and Reference Manual 5 4 Manual Version 1 4 Chapter 4 7 3 2 Example OS INT PROCESS changed into correct SC INT PROCESS Chapter 2 3 4 4 Init Process rewritten Chapter 4 5 Processes former chapters 4 5 6 Idle Process and 4 5 7 Supervisor Process removed e Chapter 4 5 1 Introduction last paragraph about supervisor processes added e Chapter 4 5 5 Init Process rewritten Chapter 6 8 sc miscErrorHookRegister syntax corrected Chapter 6 21 sc mscAlloc time out parameter tmo better specified e Chapter 6 27 sc msgRx time out parameter tmo better specified e Chapter 4 10 4 Error Hook Declaration Syntax user 0 user error Chapter 4 9 SCIOPTA Daemons moved from chapter 2 9 and rewritten e
68. er s Guide Manual Version 1 7 3 1 6 3 Configuration SC OPTA C Line If you are selecting this check box the kernel will include line number information which can be used by the SCIOPTA DRUID Debug System or an error hook Line number and file of the last system call is recorded in the per process data Process Statistics If you are selecting this check box the kernel will maintain a process statistics data field where information such as number of process swaps can be read Message Statistics If you are selecting this check box the kernel will maintain a message statistics data field in the pool control block where information such as number of message allocation can be read Applying Target Configuration Click on the Apply button to accept the target configuration settings Apply SCIOPTA Kernel User s Guide Manual Version 1 7 3 1 7 3 Configuration 3 9 3 Configuring PowerPC Target Systems v SCIOPTA c The system configuration for PowerPC target systems is divided into 4 tabs General Timer Interrupt Hooks and Debug 3 9 3 1 General Configuration PowerPC Settings General Timer Interrupt Hooks Debug System Name TCS CPU Type MPC5xx y Compiler GNU I Maximum Buffer Sizes le x Maximum Modules la Maximum Connectors fo Maximum Int Vectors Ge Kemel Stack Size ez tst Interrupt Stack Size ez Inter Module friends I Y Asynchronous Timeout Build Directo
69. es of all static processes pools Sum of sizes of all message pools mcb module control block see below textsize Init size see below SCIOPTA Kernel User s Guide Manual Version 1 7 3 36 3 Configuration SC OPTA gt The size of the module control block mcb can be calculated according to the following formula bytes size mcb 96 friends hooks 4 c where friends if friends are not used 0 if friends are used 16 bytes hooks number of hooks configured c For ARM and PowerPC c 8 For Coldfire c 0 Please consult chapter 3 9 1 1 General Configuration on page 3 8 and 3 9 1 2 Configuring Hooks on page 3 10 for information about friend and hook settings Init Size This entry is only available for SCIOPTA 32 Bit systems Size of the memory which is initialized by the C startup function cstartup S Best is to specify a label which will be resolved at link time e g module name initsize The specified label will be used in the linker script Therefore all memory allocation for all modules is controlled by the linker script You may specify an absolute address but you need to be very carefully check with the linker script to avoid over lapping SCIOPTA Kernel User s Guide Manual Version 1 7 3 37 3 Configuration SC OPTA Symbolic Values You need to select this checkbox if you want to specify labels instead of absolute values for the module addresses and module size start address memory siz
70. esult of a message transfer Besides data and some control structures messages contain also an identity number This can be used by a process for selecting specific messages to receive at a certain moment All other messages are kept back in the message queue of the receiving process Messages are dynamically allocated from a mes sage pool Messages in SCIOPTA include also ownership Only messages owned by a process can be accessed by the process Therefore only one process at a time may access a message the owner This automatically excludes access con flicts by a simple and elegant method SCIOPTA Process SCIOPTA Message SCIOPTA Process Timing jobs registered by processes are managed by SCIOPTA Processes which want to suspend execution for a specified time or processes which want to receive messages and declaring specified time out can all use the timing support of the SCIOPTA system calls SCIOPTA Kernel User s Guide Manual Version 1 7 2 1 2 SCIOPTA Technology and Methods SCIOPTA e 2 2 SCIOPTA Compact For applications which require a smaller footprint the SCIOPTA Compact kernel is available The SCIOPTA Compact kernel does not support the module concept see chapter 2 5 Modules on page 2 11 and observation see chapter 2 11 Observation on page 2 19 Modules and observation are features which are not needed in all systems mainly in 8 bit and 16 bit embedded systems This is the reason why
71. h to hold a pointer e Chapter 2 7 Process Variables third paragraph Last sentence rewritten e Chapter 4 5 3 1 Interrupt Process Declaration Syntax irg_src is of type int added e Chapter 4 5 6 Idle Process added e Chapter 4 10 4 Error Hook Declaration Syntax Parameter user user 0 User error System call se_procRegisterDaemon changed to sc_DaemonRegister and sc procUnregisterDaemon changed to sc procDaemonUnregister System call sc miscErrorHookRegister return values better specified System call sc moduleCreate parameter size value code added in Formula e System call sc moduleNameGet return value NULL added e System call sc msgAcquire condition modified e System Call sc msgAlloc SC DEFAULT POOL better specified e Systme Call sc msgHookRegister description modified and return value better specified e System call sc msgRx parameters better specified System call sc poolHookRegister return value better specified e System call sc procHookRegister return value better specified e System call sc procIdGet last paragraph in Description added System calls sc procVarDel sc procVarGet and procVarSet return value 0 introduced e Chapter 7 3 Function Codes errors 0x38 to 0x3d added System call sc procUnobserve added e Chapters 2 5 2 System Module and 4 3 Modules the following sentence was removed The system module runs always on supervisor level and has all access rights e Chapter 2 5
72. he interrupt process SCIOPTA interrupt processes may never suspend itself and become not ready It must run from the beginning to the end each time it is called Therefore SCIOPTA interrupt processes may not use blocking system calls such as waiting for a message with time out or sleeping SCIOPTA Kernel User s Guide Manual Version 1 7 4 6 4 System Design SC OPTA e 4 5 3 1 Interrupt Process Declaration Syntax Description All interrupt processes in SCIOPTA must contain the following declaration Syntax SC INT PROCESS proc name irq src Code for interrupt process proc name Parameter proc name Name of the interrupt process irq src Interrupt source Depending of this value the interrupt process can exe cute different code for different interrupt sources The following values are defined 0 The interrupt process is activated by a real hardware interrupt 1 The interrupt process is activated by a message sent to the interrupt process 2 The interrupt process is activated by a trigger event 1 The interrupt process is activated when the process is created This allows the interrupt process to execute some initialization code 2 The interrupt process is activated when the process is killed This allows the interrupt process to execute some exit code irg src is of type int SCIOPTA Kernel User s Guide Manual Version 1 7 4 7 4 System Design SC OPTA e 4 5 3 2 Inte
73. he process which gener ated the error Return Value 1 0 Continue resume if error was not fatal Jumps to infinite loop at label SC_ERRROR SCIOPTA Kernel User s Guide Manual Version 1 7 4 24 4 System Design SC OPTA HEN e 4 10 5 Example include sconf h finclude sciopta h finclude lt ossys errtxt h gt if SC ERR HOOK int error hook sc errcode t err void ptr int user sc pcb t pcb kprintf 9 Error n 081x s line d in Sai 081x 81x 081x 081x n int pcb gt 1 pcb pid 0 int pcb gt 1 pcb name xx int pcb gt 1 pcb cline 0 int pcb gt 1 pcb cfile xx pcb err ptr user if user 1 amp amp err gt gt 12 amp 0xfff lt SC MAXERR amp amp err gt gt 24 lt SC MAXFUNC kprintf 0 Function s nError s n func_txt err gt gt 24 err txt err gt gt 12 amp 0xfff return 0 fendif SCIOPTA Kernel User s Guide Manual Version 1 7 4 25 4 System Design SC OPTA e 4 411 System Start 4 11 1 Reset Hook Description In SCIOPTA a reset hook must always be present and must have the name reset_hook The reset hook must be written by the user After system reset the SCIOPTA kernel initializes a small stack and jumps directly into the reset hook The reset hook is mainly used to do some basic chip and board settings The C environment is not yet initialized when the reset hook executes Therefore the reset hook must
74. information about message check For the standard kernels 32 bit the size of the end mark is 4 bytes For the compact kernels 16 bit the size of the end mark is 1 byte SCIOPTA Kernel User s Guide Manual Version 1 7 4 20 4 System Design SC OPTA e 4 9 SCIOPTA Daemons Daemons are internal processes in SCIOPTA and are structured the same way as ordinary processes They have a process control block pcb a process stack and a priority Not all SCIOPTA daemons are part of the standard SCIOPTA delivery 4 9 1 Process Daemon The process daemon sc procd is identifying processes by name and supervises created and killed processes Whenever you are using the sc procIdGet system call you need to start the process daemon The process daemon is part of the kernel But to use it you need to define and declare it in the SCONF configuration utility The process daemon should be placed in the system module Configuration Tree Structure Bert HelloSciopta HelloSciopta HelloSciopta ae init Priority Process Name Jsc_procd Priority Process Function sc_procd Stack Size 512 e default Ah SCl_sysTick Priority 2 started Y Process State Y SCP rcsman Y SCP_devman Process Daemon Figure 4 4 Process Daemon Declaration in SCONF Please Note There is no process daemon to declare and to define in the SCIOPTA Compact Kernel This function is de fi
75. is list can contain 4 or 8 sizes which is configured here in the maximum buffer sizes entry Maximum Connectors CONNECTORS are specific SCIOPTA processes and responsible for linking a number of SCIOPTA systems You can configure a maximum number of 15 CONNECTORS Kernel Stack Size Stack size for kernel usage Unified IRQ Stack Checkbox When this checkbox is selected all interrupt processes share the same stack The size of the stack can be defined Banked Checkbox Enables bankswitching support in the kernel Asynchronous Timeout When checked the SCIOPTA HCS12 kernel includes timeout server functionality SCIOPTA Kernel User s Guide Manual Version 1 7 3 25 3 Configuration SC OPTA e 3 9 5 2 Configuring Hooks mice Settings Build Directory p APAhcs12 E General Hooks Debug IV Process Hooks v MessageHooks V PoolHooks IV Error Hook v Create v MsgRx IV Create Iv Kill v MsaTx Iv Kill v Swap es Hooks are user written functions which are called by the kernel at different locations They are only called if the user defined them at configuration User hooks are used for a number of different purposes and are system depend ent You can enable all existing hooks separately by selecting the corresponding check box SCIOPTA Kernel User s Guide Manual Version 1 7 3 26 3 Configuration SC OPTA gt 3 9 5 3 Debug Configuration HC12 Settings Build Directory DAP
76. is union declaration It is used by the SCIOPTA kernel to identify SCIOPTA messages message name n Messages which the process will use SCIOPTA Kernel User s Guide Manual Version 1 7 4 16 4 System Design SC OPTA e 4 7 2 6 Example This is a very small example showing how to handle messages in a SCIOPTA process The process keyboard just allocates a messages fills it with a character and sends it to a process display define CHAR MSG 5 typedef struct char msg s sc msgid t id char character char msg t union sc msg sc msgid t id char msg t char msg SC_PROCESS keyboard sc msg t msg Process message pointer sc pid t to Receiving process ID to sc procIdGet display SC DEFAULT POOL Get process ID for process display for msg msgAlloc sizeof char msg t CHAR MSG SC ENDLESS TMO SC NO TMO Allocates the message msg char msg character 0x40 Loads 0x40 sc msgTx amp msg to 0 Sends message to process display sc sleep 1000 Waits 1000 ticks SCIOPTA Kernel User s Guide Manual Version 1 7 4 17 4 System Design SC OPTA e 4 7 3 SCIOPTA Trigger 4 7 3 1 Description Please consult chapter 2 6 Trigger on page 2 13 for a introduction into SCIOPTA Trigger SCIOPTA triggers are sometimes used to synchronize two processes and can be used in place of SCIOPTA mes sages Triggers shou
77. ld only be used ifthe designer has severe timing problems and are intended for these rare cases where message passing would be to slow Please note that SCIOPTA triggers can only be used for process synchronisation as they cannot carry data 4 7 3 2 Example This is a very small example how triggers can be used in SCIOPTA processes A prioritized process is waiting on its trigger and will be executed when another process in this case an interrupt process is activating the trigger This is the interrupt process activating the trigger of process trigproc extern sc pid t trigproc pid OS INT PROCESS myint 0 sc trigger trigproc pid This call makes process trigproc ready This is the prioritized process trigproc which waits on its trigger SC PROCESS trigproc At process creation the value of the trigger is initialized ZS to zero If this is not the case you have to initialize it with the sc triggerValueSet system call for sc triggerWait 1 SC ENDLESS TMO Process waits on the trigger Trigger was activated by process myint SCIOPTA Kernel User s Guide Manual Version 1 7 4 18 4 System Design SC OPTA e 4 8 SCIOPTA Memory Manager Message Pools 4 8 1 Message Pool Messages are the main data object in SCIOPTA Messages are allocated by processes from message pools If a process does not need the messages any longer it will be given back f
78. ll show the module parameters Module Name Chamber a Maximum Processes he Maximum Pools 2 Priority 0 IV Symbolic Values Start Address Chamber A mod stat Memory Size Chamber A mod size Init Size Chamber_4_mod initsize Apply Cancel Module Name Enter the name of the module If you have selected the system module the first module or the module with the id 0 you cannot give or modify the name as it will have the same name as the target system For SCIOPTA 16 Bit systems SCIOPTA Compact there is only one module the module name gets the name from the system and cannot be modified here on the module level Maximum Processes Maximum number of processes in the module The kernel will not allow to create more processes inside the module than stated here For SCIOPTA 32 Bit systems the maximum value is 16383 For SCIOPTA 16 Bit systems SCIOPTA Compact the maximum value is 255 Maximum Pools Maximum number of pools in the module The kernel will not allow to create more pools inside the module than stated here For SCIOPTA 32 Bit systems the maximum value is 128 For SCIOPTA 16 Bit systems SCIOPTA Compact the maximum value is 15 A SCIOPTA 16 Bit system must have at least two pools SCIOPTA Kernel User s Guide Manual Version 1 7 3 35 3 Configuration SC OPTA e Priority This entry is only available for SCIOPTA 32 Bit systems Enter the priority of the module Each module h
79. me operating systems SCIOPTA uses a centralized mechanism for error re porting called Error Hooks In traditional real time operating system the user needs to check return values of sys tem calls for a possible error condition In SCIOPTA all error conditions will end up in an Error Hook This guarantees that all errors are treated and that the error handling does not depend on individual error strategies which might vary from user to user There are two error hooks available A Module Error Hook B Global Error Hook If the kernel detect an error condition it will first call the module error hook and if it is not available call the global error hook Error hooks are normal error handling functions and must be written by the user Depending on the type of error fatal or non fatal it will not be possible to return from an error hook If there are no error hooks present the kernel will enter an infinite loop at label SC ERROR and all interrupts are disabled 4 10 2 Error Information When the error hook is called from the kernel all information about the error are transferred in 32 bit error word parameter errcode Function Code Error Code Error Type m 8 Bits ae 12 Bits ld 12 Bits Le 32 Bits 2 Figure 4 6 32 bit Error Word Parameter errcode The Function Code defines from which SCIOPTA system call the error was initiated The Error Code contains the specific error information and the Error Ty
80. message by the sc msgAlloc system call or when it receives the message by the sc msgRXY system call Message passing 1s also possible between processes on different CPUs In this case specific communication proc ess types on each side will be needed called SCIOPTA Connector Processes 4 7 2 2 Message Declaration The following method for declaring accessing and writing message buffers minimizes the risk for bad message accesses and provides standardized code which is easy to read and to reuse Very often designers of message passing real time systems are using for each message type a separate message file as include file Every process can use specific messages by just using a simple include statement for this message You could use the extension msg for such include files The SCIOPTA message declaration syntax can be divided into three parts Message number definition Message structure definition Message union declaration SCIOPTA Kernel User s Guide Manual Version 1 7 4 14 4 System Design SC OPTA e 4 7 2 3 Message Number Description The declaration of the message number is usually the first line in a message declaration file The message number can also be described as message class Each message class should have a unique message number for identification purposes We recommend to write the message name in upper case letters Syntax define MESSAGE NAME lt msg_nr gt Parameter msg nr
81. minimum size must be the size ofthe maximum number of messages which ever are allocated at the same time plus the pool control block pool cb For SCIOPTA 32 Bit systems the size of the pool control block pool cb can be calculated according to the fol lowing formula pool cb 2 68 n 20 stat n 20 where n buffer sizes 4 8 or 16 stat process statistics see chapter Process Statistics on page 3 12 or message statistics see chapter Message Statistics on page 3 12 are used 1 or not used 0 SCIOPTA Kernel User s Guide Manual Version 1 7 3 46 3 Configuration SC OPTA ch For SCIOPTA 16 Bit systems SCIOPTA Compact the size of the pool control block pool cb can be calculated according to the following formula pool cb 15 n 6 stat n 10 where n buffer sizes 4 or 8 stat process statistics see chapter Process Statistics on page 3 12 or message statistics see chapter Message Statistics on page 3 12 are used 1 or not used 0 Buffer Sizes For SCIOPTA 32 Bit systems select 4 8 or 16 fixed buffer sizes for the pool Define the different buffer sizes for your selection For SCIOPTA 16 Bit systems SCIOPTA Compact select 4 or 8 fixed buffer sizes for the pool Define the differ ent buffer sizes for your selection Applying the Pool Configuration Click on the Apply button to accept the pool configuration settings Apply SCIOPTA Kernel User s Guide Manual Version 1 7 3 47
82. n a system Messages are maintained by double linked list in the pool and SCIOPTA controls all message lists in a very efficient way therefore minimizing system latency SCIOPTA Kernel User s Guide Manual Version 1 7 2 9 2 SCIOPTA Technology and Methods SCIOPTA e 2 4 5 Message Passing Message passing is the favourite method for interprocess communication in SCIOPTA Contrary to mailbox inter process communication in traditional real time operating systems SCIOPTA is passing messages directly from process to process Only messages owned by the process can be transmitted A process will become owner if the message is allocated from the message pool or if the process has received the message When allocating a message by the sc msgAlloc system call the user has to define the message ID and the size The size is given in bytes and the sc msgAlloc function of SCIOPTA chooses an internal size out of a number of 4 8 or 16 fixed sizes see also chapter 2 4 3 Message Sizes on page 2 9 The sc msgAlloc or the sc msgRx call returns a pointer to the allocated message The pointer allows the user to access the message data to initialize or modify it The sending process transmits the message by calling the se msgTx system call SCIOPTA changes the owner of the message to the receiving process and puts the message in the queue of the receiver process In reality it is a linked list of all messages in the pool transmitted to this proces
83. n processes need to be addressed The process ID will be allocated by the operating system for all processes which you have entered during SCIOPTA configuration static processes or will be returned when you are creating processes dy namically The kernel maintains a list with all process names and their process IDs The user can get Process IDs by using a procIdGet system call including the process name SCIOPTA allows you to group processes together into modules Modules can be created and killed dynamically during run time But there is one static module in each SCIOPTA system This module is called system module Processes placed in the system module are called supervisor processes Supervisor processes have full access rights to system resources Typical supervisor processes are found in device drivers 4 5 2 Prioritized Processes Inatypical SCIOPTA system prioritized processes are the most common used process types Each prioritized proc ess has a priority and the SCIOPTA scheduler is running ready processes according to these priorities The process with higher priority before the process with lower priority If a process has completed its work it becomes not ready and will be swapped out by the operating system The not ready state is entered if a process is waiting for a message sc msgRx receive system call requesting a delay sc sleep sleep system call or call other blocking SCIOPTA system calls A process can also be swappe
84. ned allocated or received messages are stored This message queue is not a own physically separate allocated memory area It consists rather of a double linked list inside mes sage pools SCIOPTA Kernel User s Guide Manual Version 1 7 2 8 2 SCIOPTA Technology and Methods SCIOPTA e 2 4 3 Message Sizes If a process allocates a message there is also the size to be given The user just gives the number of bytes needed SCIOPTA is not returning the exact amount of bytes requested but will select one of a list of buffer sizes which is large enough to contain the requested number This list can contain 4 8 or 16 sizes which will be defined when a message pool is created The difference of requested bytes and returned bytes can not be accessed by the user and will be unused It is there fore very important to select the buffer sizes to match as close as possible those needed by your application to waste as little memory as possible This pool buffer manager used by SCIOPTA is a very well known technique in message based systems The SCIOPTA memory manager is very fast and deterministic Memory fragmentation is completely avoided But the user has to select the buffer sizes very carefully otherwise there can be unused memory in the system As you can have more than one message pool in a SCIOPTA system and you can create and kill pools at every moment the user can adapt message sizes very well to system requirements at different system states
85. ned and started automatically by the kernel SCIOPTA Kernel User s Guide Manual Version 1 7 4 21 4 System Design SC OPTA GEEMM NE e 4 9 2 Kernel Daemon The Kernel Daemon sc kerneld is creating and killing modules and processes Some time consuming system work of the kernel such as module and process killing returns to the caller without having finished all related work The Kernel Daemon is doing such work at appropriate level Whenever you are using process or module create or kill system call you need to start the kernel daemon The kernel daemon is part of the kernel But to use it you need to define and declare it in the SCONF configuration utility The kernel daemon should be placed in the system module Configuration Tree Structure sci pra HelloSciopta HE HelloSciopta E HelloSciopta Priority Process Name Jsc_kemeld Priority Process Function Jsc_kemeld Stack Size 1 2 a Priority 2 started 7 Process State 30 SCP_devman 3 SCP_netman Kernel Daemon Figure 4 5 Kernel Daemon Declaration in SCONF Please Note There is no kernel daemon to declare and to define in the SCIOPTA Compact Kernel This function is de fined and started automatically by the kernel SCIOPTA Kernel User s Guide Manual Version 1 7 4 22 4 System Design SC OPTA e 4 10 Error Hook 4 10 1 Introduction Contrary to most conventional real ti
86. need to enter the clock frequency of the processor which is used by the timer source The value can only be entered if you have not selected none as the timer source Interrupt Enter your selected interrupt level for the PowerPC CPM Please consult the PowerPC User s Manual for more information about the CPM Please Note This setting does not exist for the PowerPC MPC500 processors SCIOPTA Kernel User s Guide Manual Version 1 7 3 20 3 Configuration 3 9 4 1 Configuring Hooks PowerPC Settings IV Process Hooks JW Message v MsgRx V Create Iv Kill IV MsgTx M Swap Build Directory D P E Genera Timer Interrupt Hooks Debug Hooks IV Pool Hooks Y Error Hook V Create Iv Kill Apply Cancel a gt SCIOPTA ce Hooks are user written functions which are called by the kernel at different locations They are only called if the user defined them at configuration User hooks are used for a number of different purposes and are system depend ent You can enable all existing hooks separately by SCIOPTA Kernel User s Guide Manual Version 1 7 selecting the corresponding check box 3 21 3 Configuration SC OPTA gt 3 9 4 2 Debug Configuration PowerPC Settings Build Directoy DAP uz General Timer Interrupt Hooks Debug Debug Statistic IV Message Check lV Process Stack Check IV Message IV Process Parameter Check JV Message Pa
87. nfigured here in the maximum buffer sizes entry Maximum Modules Here you can define a maximum number of modules which can be created in this system The maximum value is 127 modules It is important that you give here a realistic value of maximum number of modules for your system as SCIOPTA is initializing some memory statically at system start for the number of modules given here Maximum Connectors CONNECTORS are specific SCIOPTA processes and responsible for linking a number of SCIOPTA systems The maximum number of connectors in a system may not exceed 127 which correspond to the maximum number of systems Kernel Stack Size Currently not used Entered values are not considered Interrupt Stack Size Currently not used Entered values are not considered Inter Module Selects the module relations and defines the message copy behaviour never copy Messages between modules are never copied always copy Messages between modules are always copied friends The message copy behaviour is defined by the friendship setting be tween the modules Please consult chapter 2 5 1 SCIOPTA Module Friend Concept on page 2 11 for more information Asynchronous Timeout When checked the SCIOPTA Coldfire kernel includes timeout server functionality SCIOPTA Kernel User s Guide Manual Version 1 7 3 1 4 3 Configuration 3 9 2 2 Configur ing Hooks Coldfire Settings Build Directory 5 General Hooks Debug v
88. ns can occur in many different forms such as global variables function calls timing interac tions priority relationships interrupt enabling disabling semaphore message passing One of the duties of a real time operating system is to manage interprocess communication and to control exchange of data between processes SCIOPTA Kernel User s Guide Manual Version 1 7 1 3 2 SCIOPTA Technology and Methods SCIOPTA e 2 SCIOPTA Technology and Methods 2 1 Introduction SCIOPTA is a pre emptive multi tasking high performance real time operating system rtos for using in embed ded systems SCIOPTA is a so called message based rtos that is interprocess communication and coordination are realized by messages A typical system controlled by SCIOPTA consists of a number of more or less independent programs called processes Each process can be seen as if it had the whole CPU for its own use SCIOPTA controls the system by activating the correct proc esses according to their priority assigned by the user Occurred events trigger SCIOPTA to imme diately switch to a process with higher priority This ensures a fast response time and guarantees the compliance with the real time specifications of the system In SCIOPTA processes communicate and cooper ate by exchanging messages Messages can have a content to move data from one process to the other or can be empty just to coordinate processes Of ten process switches can occur as a r
89. nsidered Interrupt Stack Size Currently not used Entered values are not considered Inter Module Selects the module relations and defines the message copy behaviour never copy Messages between modules are never copied always copy Messages between modules are always copied friends The message copy behaviour is defined by the friendship setting be tween the modules Please consult chapter 2 5 1 SCIOPTA Module Friend Concept on page 2 11 for more information Asynchronous Timeout When checked the SCIOPTA PowerPC kernel includes timeout server functionality SCIOPTA Kernel User s Guide Manual Version 1 7 3 1 9 3 Configuration SC OPTA gt 3 94 Timer and Interrupt Configuration PowerPC Settings Build Directoy DAP el General Timer Interrupt Hooks Debug m Timer Source Decrementer y Tick in us h 000 Frequency in Hz j 0000 r Interrupt CPM Interrupt Level la 2 Apply Cancel Timer Source The SCIOPTA real time kernel uses an internal tick timer to manage and control all timing tasks Here you can select which timer you want to use to generate the tick If you are selecting lt none gt you need to write your own tick function usually a user interrupt service routine which will call se_tick explicitly Timer Tick Enter here the tick interval in micro seconds The value can only be entered if you have not selected none as the timer source Timer Frequency You
90. odule relations and defines the message copy behaviour never copy Messages between modules are never copied always copy Messages between modules are always copied friends The message copy behaviour is defined by the friendship setting be tween the modules Please consult chapter 2 5 1 SCIOPTA Module Friend Concept on page 2 11 for more information Asynchronous Timeout When checked the SCIOPTA ARM kernel includes timeout server functionality SCIOPTA Kernel User s Guide Manual Version 1 7 3 9 3 Configuration SC OPTA e 3 9 1 2 Configuring Hooks Arm Settings Build Directory D P ARM E General Hooks Debug JV Process Hooks V Message Hooks JM PoolHooks IV Error Hook IV Create Jh MsgRx V Create Iv Kill Iv MsgTx v Kil M Swap Apply Cancel Hooks are user written functions which are called by the kernel at different locations They are only called if the user defined them at configuration User hooks are used for a number of different purposes and are system depend ent You can enable all existing hooks separately by selecting the corresponding check box SCIOPTA Kernel User s Guide Manual Version 1 7 3 1 0 3 Configuration SC OPTA e 3 9 1 3 Debug Configuration Arm Settings Build Directory Dapp Gel General Hooks Debug Debug Statistic v Message Check IV Process V Stack Check IV Message V Process Parameter Check v Pool Parameter Check
91. or in milliseconds Initial Delay Initial delay in ticks before the first time call to the timer process in ticks or milliseconds Process State Enter the state which the process should have after creation started The process will be on READY state It is ready to run and will be swapped in if it has the highest priority of all READY processes stopped The process is stopped Use the se_procStart system call to start the process Applying the Timer Process Configuration Click on the Apply button to accept the timer process configuration settings Apply SCIOPTA Kernel User s Guide Manual Version 1 7 3 43 3 Configuration 3 16 Prioritized Process Configuration v SCIOPTA gt y Sciopta System Configuration D P mpc500 tcs xml m ni sl File Edit PriorityProcess Help ID a ua Configuration Tree Structure Priority Process Name syscontrol Priority Process Function syscontrol Stack Size 51 2 Priority fie Process State started y FPU usage no FPU y ME driver 3E controller i RE reference Prioritized Processes o A pool Apply Cance Priority Process Name Enter the name of the prioritized process Priority Process Function Enter the function name of the prioritized process function This is the address where the created process will start execution SCIOPTA Kernel User s Guide Manual Version 1 7 3 44 3 Configuration SC OPTA
92. ot depend on individual error strategies which might vary from user to user There are two error hooks available A Module Error Hook B Global Error Hook If the kernel detect an error condition it will first call the module error hook and if it is not available call the global error hook Error hooks must be written by the user Depending on the type of error fatal or non fatal it will not be possible to return from an error hook If there are no error hooks present the kernel will enter an infinite loop 2 8 2 The errno Variable Each SCIOPTA process has an errno variable This variable is used mainly by library functions to set the errno variable The errno variable can only be accessed by some specific SCIOPTA system calls The errno variable will be copied into the observe messages if the process dies SCIOPTA Kernel User s Guide Manual Version 1 7 2 1 5 2 SCIOPTA Technology and Methods SCIOPTA e 2 9 SCIOPTA Scheduling SCIOPTA uses the pre emptive prioritized scheduling for all prioritized process types Timer process are sched uled on a cyclic base at well defined time intervals The prioritized process with the highest priority is running owning the CPU SCIOPTA is maintaining a list of all prioritized processes which are ready If the running process becomes not ready 1 e waiting on at a message receive which has not yet arrived SCIOPTA will activate the next prioritized process with the highest priority If the
93. pe informs about the source and type of error There is also an additional 32 bit extra word parameter extra available to the user Please consult the SCIOPTA Kernel Reference Manual the for a detailed description of the error codes SCIOPTA Kernel User s Guide Manual Version 1 7 4 23 4 System Design SC OPTA e 4 10 3 Error Hook Registering An error hook is registered by using the sc miscErrorHookRegister system call by giving the error hook s name as parameter If the error hook is registered from within the system module it is registered as a global error hook Ifthe error hook is registered from within a module which is not the system module it will be registered as a module error hook 4 10 4 Error Hook Declaration Syntax Description For each registered error hook there must be declared error hook function Syntax int err hook name sc errcode t errcode sc extra t extra int user sc pcb t pcb error hook code D Parameter errcode Error word containing The Function Code which defines from which SCIOPTA system call the error was initiated the Error Code which contains the specific error information and the Error Type which in forms about the source and type of error See chapter 4 10 2 Error In formation on page 4 23 extra Gives additional information depending on the error code user user 0 User error user System error pcb Pointer to the Process Control Block PCB of t
94. pendent 2 12 2 Error Hook The error hook is the most important user hook function and will normally be included in most of the systems An error hook can be used to log the error and additional data on a logging device if the kernel has detected an error condition Please consult also chapter 2 8 Error Handling on page 2 15 for additional information 2 12 3 Message Hooks In SCIOPTA you can configure Message Transmit Hooks and Message Receive Hooks These hooks are called each time a message is transmitted to any process or received by any process Transmit and Receive Hooks are mainly used by user written debugger to trace messages 2 12 4 Pool Hooks Pool Create Hooks and Pool Kill Hooks are available in SCIOPTA mainly for debugging purposes Each time a pool is created or killed the kernel is calling these hooks provided that the user has configured the system accord ingly 2 12 5 Process Hooks Ifthe user has configured Process Create Hooks and Process Kill Hooks into the kernel these hooks will be called each time if the kernel creates or kills a process SCIOPTA allows to configure a Process Swap Hook The Process Swap Hook is called by the kernel each time a new process is about to be swapped in This hook is also called if the kernel is entering idle mode SCIOPTA Kernel User s Guide Manual Version 1 7 2 20 3 Configuration SC OPTA e 3 Configuration 3 1 Introduction The kernel of a SCIOPTA system needs to be
95. rameter Check IV Pool Parameter Check Y CLine Apply Cancel Message Check If you are selecting this check box some test functions on messages will be included in the kernel Process Parameter Check If you are selecting this check box the kernel will do some testing on the parameters of the process system calls Message Parameter Check If you are selecting this check box the kernel will do some testing on the parameters of the message system calls Pool Parameter Check If you are selecting this check box the kernel will do some testing on the parameters of the pool system calls SCIOPTA Kernel User s Guide Manual Version 1 7 3 22 3 Configuration SC OPTA C Line If you are selecting this check box the kernel will include line number information which can be used by the SCIOPTA DRUID Debug System or an error hook Line number and file of the last system call is recorded in the per process data Process Statistics If you are selecting this check box the kernel will maintain a process statistics data field where information such as number of process swaps can be read Message Statistics If you are selecting this check box the kernel will maintain a message statistics data field in the pool control block where information such as number of message allocation can be read Applying Target Configuration Click on the Apply button to accept the target configuration settings Apply SC
96. rantee the real time behaviour of the system 4 5 6 2 Interrupt Process Interrupt process is the fastest process type in SCIOPTA and will respond almost immediately to events As the system is blocked during interrupt handling interrupt processes must perform their task in the shortest time possi ble A typical example is the control of a serial line Receiving incoming characters might be handled by an interrupt process by storing the incoming arrived characters in a local buffer returning after each storage of a character If this takes too long characters will be lost If a defined number of characters of a message have been received the whole message will be transferred to a prioritized process which has more time to analyse the data 4 5 6 3 Timer Process Timer processes will be used for tasks which need to be executed at precise cyclic intervals For instance checking a status bit or byte at well defined moments in time can be performed by timer processes Another example is to measure a voltage at regular intervals As timer processes execute on the interrupt level of the timer interrupt it is assured that no voltage measurement samples are lost As the timer process runs on interrupt level it is as important as for normal interrupt processes to return as fast as possible SCIOPTA Kernel User s Guide Manual Version 1 7 4 12 4 System Design SC OPTA e 4 6 Addressing Processes 4 6 1 Introduction In a typical SCIOPTA de
97. re 3 2 SCONF Windows 3 5 1 Parameter Window For every level in the browser window process level module level system level and project level the layout of the parameter window change and you can enter the configuration parameter for the specific item of that level e g parameters for a specific process To open a specific parameter window just click on the item in the browser win dow SCIOPTA Kernel User s Guide Manual Version 1 7 3 3 3 Configuration 3 5 2 Browser Window v SCIOPTA c The browser window allows you to browse through a whole SCIOPTA project and select specific items to config ure Configuration Tree Structure scra TCS Project Level System TCs q Level Module A 53 005 A ba gt init Level Process e e syspool Process Level Module Level System Level Project Level Level Figure 3 3 Browser Windows The browser shows four configuration levels and every level can expand into a next lower level To activate a level you just need to point and click on it On the right parameter window the configuration settings for this level can be viewed and modified The uppermost level is the Project Level where all project configurations will be done The project name can be defined and you can create new systems for the project In the System Level you are configuring the system for one CPU You can create the static modules for the
98. re are more than one processes on the same priority ready SCIOPTA will activate the process which became ready in a first in first out methodology Interrupt and timer process will always pre empt prioritized processes The intercepted prioritized process will be swapped in again when the interrupting system on the higher priority has terminated Timer processes run on the tick level of the operating system The SCIOPTA kernel will do a re scheduling at every receive call transmit call process yield call trigger wait call sleep call and all system time out which have elapsed Prioritized Prioritized Prioritized Timer Interrupt Process 1 Process 2 Process 3 Process Process priority 10 priority 11 priority 12 interrupt interrupt priority 8 priority 6 Will be activated sc msgRx every third tick Message not in input queue Process now sc_sleep 3 swapped out and waiting Sleeping for 3 ticks Process Bow swapped out and on PP NN NN Y sahaa ahem isa oY tick return interrupt E __ gt tick 1 Sleeping of three tick expired Message _nghw arrived Process ready and swapped in z tick 2 and received Process _______ lt PIETEI E oe See EE ready and swapped in en u interrupt gt EE tick 3 Soo to omm to __ Figure 2 10 Sche
99. reed by the owner process There can be up to 127 pools per module for a standard kernel 32 bit and up to 15 pools for a compact kernel 16 bit Please consult chapter 2 5 Modules on page 2 11 for more information about the SCIOPTA module con cept The maximum number of pools will be defined at module creation A message pool always belongs to the module from where it was created The size of a pool will be defined when the pool will be created By killing a module the corresponding pool will also be deleted Pools can be created killed and reset freely and at any time The SCIOPTA kernel is managing all existing pools in a system Messages are maintained by double linked list in the pool and SCIOPTA controls all message lists in a very efficient way therefore minimizing system latency 4 8 2 Message Pool size The minumum message pool size is the size of the maximum number of messages which ever are allocated at the same time plus the pool control block pool_cb The pool control block pool_cb can be calculated according to the following formula Standard 32 Bit kernel pool cb 68 n 20 stat n 20 where n buffer sizes 4 8 or 16 stat process statistics or message statistics are used 1 or not used 0 Compact 16 Bit kernel pool cb 15 n 6 stat n 10 P where n buffer sizes 4 or 8 stat process statistics or message statistics are used 1 or not used 0 P processor dependent For MSP430 1 for
100. returns S the SCIOPTA kernel will produce an error condition and call the SCIOPTA error hook Code for process proc_name SCIOPTA Kernel User s Guide Manual Version 1 7 4 5 4 System Design SC OPTA e 4 5 3 Interrupt Processes An interrupt is a system event generated by a hardware device The CPU will suspend the actually running program and activate an interrupt service routine assigned to that interrupt The program handling interrupts are called interrupt processes in SCIOPTA SCIOPTA is channelling interrupts internally and calls the appropriate interrupt process The priority of an interrupt process is assigned by hardware of the interrupt source Whenever an interrupt occurs the assigned interrupt process is called assuming that no other interrupt of higher priority is running If the interrupt process with higher priority has completed his work the interrupt process of lower priority can continue In traditional real time operating systems an interrupt process is a function which executes exclusively by a hard ware event In SCIOPTA there is an additional parameter introduced which allows the execution of the interrupt process by other events such as init defined when the process is created exit defined when process is killed hardware defined if a hardware event occurs msg defined if a message is sent to the interrupt process trigger defined if a trigger event should activate t
101. rrupt Process Template In this chapter a template for an interrupt process in SCIOPTA is provided include lt sciopta h gt SCIOPTA standard prototypes and definitions SC INT PROCESS proc name irq src Declaration for interrupt process proc name Local variables if irq sro 0 Generated by hardware 1 Code for hardware interrupt handling else if irq src 1 Generated when process created Initialization code else if irq src 2 Generated when process killed Exit code else if irq src 1 Generated by a message sent to this interrupt process Code for receiving a message else if irg src 2 Generated by a SCIOPTA trigger event Code for trigger event handling SCIOPTA Kernel User s Guide Manual Version 1 7 4 8 4 System Design SC OPTA e 4 5 4 Timer Process A timer process in SCIOPTA is a specific interrupt process connected to the tick timer of the operating system SCIOPTA is calling each timer process periodically derived from the operating system tick counter When config uring or creating a timer process the user defines the number of system ticks to expire from one call to the other individually for each process Timer processes behaves and are designed the same way as interrupt processes All information given in chapter 4 5 3 Interrupt Processes on page 4 6 are also
102. rsion 1 7 6 3 6 Index SCIOPTA y Message number ici en e or d rb e S e EET HT E E E d D Pe o Reds 4 15 Message number definition AA 4 14 MEAN O TREE 2 8 4 20 Message parameter check sse 3 11 3 16 3 22 3 27 3 32 Message Dassmpg cii rn rH DC UR in RED HORN RE ET eE EE a cit exe RERE EES 2 10 luELCeTu NODO NN 2 9 4 19 Message SIZE 2 8 2 9 4 19 4 20 Message statistics ssserrsisseisiossrissrrssinissessnserisseisirenresissseror seson seton irisi enosis soi sini ii sies 3 12 3 17 3 23 3 28 3 33 Message AA OO 4 15 Message structure definition A 4 14 Message UniOn a 4 16 Message union declaration AA 4 14 MESSAGE NAME n ettet einer REPRE UR E pt e eR her Reda te ae este nth aot REP Ee He IHRER 4 15 A E E 4 15 message name EE 4 16 TEE 2 1 4 14 Messages and modules rie eer e a e Ine Pe E D reete ien eR Th da 2 12 WT EE 2 1 4 1 MMU et eege a ail iii gin ee eh 2 12 e EE 2 6 2 11 4 10 Module error hook E 2 15 4 23 Module friend concept i cde ita 2 11 Module init EE 3 37 Te EEN 3 3 3 4 Module memory size i rene io 3 36 el VE 3 35 Module priority ai 2 7 3 36 Module start address sica da aaa 3 36 Modules iii and Em 4 1 O EE 4 6 MSE EE 4 15 Mutual exclusion tad a ais 4 3 N New button ii idas 3 5 O Observation A a 2 19 P Parameter WIndOW 5 eii ce acre lad Fred tee ei rlisus 3 3 Peripheral devices die HERRERA tdi iia 4 3 PID E
103. ry Gel Apply Cancel System Name Enter the name of your system Please note that the system module module 0 in this system will use the same name CPU Type Give the name of you specific target processor derivative Compiler Select the C C Cross compiler which you are using for this SCIOPTA system SCIOPTA Kernel User s Guide Manual Version 1 7 3 18 3 Configuration SC OPTA e Maximum Buffer Sizes If a process allocates a message there is also the size to be given The user just gives the number of bytes needed SCIOPTA is not returning the exact amount of bytes requested but will select one of a list of buffer sizes which is large enough to contain the requested number This list can contain 4 8 or 16 sizes which is configured here in the maximum buffer sizes entry Maximum Modules Here you can define a maximum number of modules which can be created in this system The maximum value is 127 modules It is important that you give here a realistic value of maximum number of modules for your system as SCIOPTA is initializing some memory statically at system start for the number of modules given here Maximum Connectors CONNECTORS are specific SCIOPTA processes and responsible for linking a number of SCIOPTA systems The maximum number of connectors in a system may not exceed 127 which correspond to the maximum number of systems Kernel Stack Size Currently not used Entered values are not co
104. s If the receiving process is blocked at the se msgRx system call and is waiting on the transmitted message the kernel is performing a process swap and activates the receiving process As owner of the message the receiving process can now get the message data by pointer access The se msgRx call in SCIOPTA supports selective re ceiving as every message includes a message ID and sender If the received message is not needed any longer or will not be forwarded to another process it can be returned to the system by the sc msgFree and the message will be available for other allocations Process TX Process RX sc msgAlloc sc msgTx sc msgRx sc msgFree Figure 2 6 Message Sequence Chart of a SCIOPTA Message Passing SCIOPTA Kernel User s Guide Manual Version 1 7 2 1 0 2 SCIOPTA Technology and Methods SCIOPTA e 2 5 Modules Processes can be grouped into modules to improve system structure A process can only be created from within a module When creating a module the maximum number of pools and processes must be defined There is a maximum number of 128 modules per SCIOPTA system possible Modules can be created and killed at system start or dy namically during run time If a module is killed all processes in the module will be killed and therefore all messages freed and afterwards all pools deleted Please Note The module concept is not supported in the SCIOPTA
105. s not returning the exact amount of bytes requested but will select one of a list of buffer sizes which is large enough to contain the requested number This list can contain 4 or 8 sizes which is configured here in the maximum buffer sizes entry Maximum Connectors CONNECTORS are specific SCIOPTA processes and responsible for linking a number of SCIOPTA systems You can configure a maximum number of 15 CONNECTORS Kernel Stack Size Stack size for kernel usage Unified IRQ Stack Checkbox When this checkbox is selected all interrupt processes share the same stack The size of the stack can be defined Asynchronous Timeout When checked the SCIOPTA M16C kernel includes timeout server functionality SCIOPTA Kernel User s Guide Manual Version 1 7 3 30 3 Configuration SC OPTA e 3 9 6 2 Configuring Hooks M16C Settings Build Directory DAP amp d General Hooks Debug IV Process Hooks JW Message Hooks V PoolHooks Je Error Hook IV Create IV MsgRx IV Create Iv Kill IV MsgTx IV Kill M Swap Apply Cancel Hooks are user written functions which are called by the kernel at different locations They are only called if the user defined them at configuration User hooks are used for a number of different purposes and are system depend ent You can enable all existing hooks separately by selecting the corresponding check box SCIOPTA Kernel User s Guide Manual Version 1 7 3 31
106. sign you need to address processes For example you want to send SCIOPTA messages to a process killa process geta stored name of a process Observe a process e get or set the priority of a process Start and stop processes In SCIOPTA you are addressing processes by using their process ID pid There are two methods to get process IDs depending if you have to do with static or dynamic processes 4 6 2 Get Process IDs of Static Processes Static processes are created by the kernel at start up They are designed with the SCIOPTA SCONF configuration utility by defining the name and all other process parameters such as priority and process stack sizes You can address static process by appending the string _pid to the process name if the process resides in the system module If the static process resides inside another module than the system module you need to precede the process name with the module name and an underscore in be tween For instance if you have a static process defined in the system module with the name controller you can address it by giving controller_pid To send a message to that process you can use Sc msgTx mymsg controller pid myflags If you have a static process in the module tes which is not the system module with the name display you can address it by giving tes display pid To send a message to that process you can use sc msgTx mymsg tcs display pid myflags 4 6 3 Get Process IDs of
107. te Here tenete to eren ere eade 3 44 3 17 Pool COMPU M EE 3 46 3 18 unm 3 48 38 17 c ur Oe 3 48 3 182 Change Build Directory eee ia 3 49 IES OO 3 50 3 19 Command Line Version one seio id 3 51 3 197 Introduction desnatada eras 3 51 3 19 2 Mes a 3 51 4 System Design E AA 4 1 AVRO CAUCE EE 4 1 4 2 e EE Te 4 1 4 3 Modules T tes 4 1 4 4 Resource Management iii a venae inicia 4 3 4 5 PrOCESSES aeoe 4 4 4 5 1 o O 4 4 4 5 2 eo 4 4 4 5 2 1 Process Declaration Syntax iesean eiii 4 5 4 3 2 2 Process Template ciao lid reni ete E te edes Fu eiie ees 4 5 4 5 3 ONO 4 6 4 5 3 1 Interrupt Process Declaration Syntax cccceccecscesseeseesceseecseeseecsecseceseseeceseeseceseeeeeeaeeseeaeceesaeenseneeeas 4 7 4 5 3 2 Interrupt Process Template ene rece eH He e e or iras 4 8 4 5 4 Trier Process eege eege dde lato eet ici 4 9 4 5 41 Timer Process Declaration Syntax aiii tec imet eii rh ded e re rd d ond 4 9 4 5 4 2 Timer AA 4 9 4 5 5 Int Process ie osi ie A ias 4 10 4 5 5 1 Init Process in Static Modules esses eene netten enne nenne nennen tnter ent 4 10 4 5 5 2 Init Process in Dynamic Modules mine irent e e n de der are 4 11 4 5 6 Selecting Process Type cuna hee tre e P C EC EN VE Er RP 4 12 45 6 1 Prontized reegen dE ie eI PORE OR R 4 12 43 02 Interrupt Process NN 4 12
108. tem level debug suite 1 2 About This Manual The purpose ofthis SCIOPTA Kernel User s Guide is to give all needed information how to use the SCIOPTA real time kernel in an embedded project Please consult the SCIOPTA Kernel Reference Manual for a complete description of all system calls and error messages After a short introduction into real time operating systems detailed information about the technologies and meth ods used in the SCIOPTA kernels are given Furthermore you will find useful information about system design and configuration Other target specific information can be found in the SCIOPTA Target Manual which is different for each SCIOPTA supported processor family and includes Installation Information Getting started examples Information about the system building procedures Description of the board support packages BSP List of distributed files Release notes and version history SCIOPTA Kernel User s Guide Manual Version 1 7 1 1 1 Introduction SC OPTA e 1 3 Real Time Operating System Overview A real time operating system RTOS is the core control software in a real time system In a real time system it must be guaranteed that specific tasks respond to external events within a limited and spec ified time Interrupt Interrupt Process A allocate message transmit message Time t receive message Process B free message Figure 1 1 Real
109. ter a system run you can find out unused memory and optimize the buffer sizes 4 8 4 Example A message pool is created with 8 buffer sizes with the following sizes 4 10 20 80 200 1000 4048 16000 If a message is allocated from that pool which requests 300 bytes the system will return a buffer with 1000 bytes The difference of 700 bytes is not accessible by the user and is wasted memory 1 300 bytes buffer are used more often it would be good design to modify the buffer sizes for this pool by changing the size 200 to 300 4 8 5 Message Administration Block Each SCIOPTA message contains a hidden data structure which will be used by the kernel The user can access these message information only by specific SCIOPTA system calls Information such as the process ID of the mes sage owner the message size the process ID of the transmitting process and the process ID of the addressed proc ess are included in the message header adminstration block Please consult chapter 2 4 Messages on page 2 8 for more information about SCIOPTA messages For the standard kernels 32 bit the size of the message header is 32 bytes For the compact kernels 16 bit the size of the message header is 10 bytes Each SCIOPTA message can contain an end mark This end mark is used for the kernel message check if the mes sage check option is enabled at kernel configuration Please consult the configuration chapter of the SCIOPTA tar get manual for more
110. the SCONF config uration tool and included in the file sconf c At start up the init process gets the highest priority 0 The user can write a function with the name of the module which will be called by the init process This function can include late start up code for a SCIOPTA system The function executes on the highest priority level of the init process The init process will create all static SCIOPTA objects such as processes and pools At the end the init process sets its priority level to 32 This is a code fragment of a typical sconf c file which was automatically generated module name HelloSciopta SC PROCESS HelloSciopta init extern void HelloSciopta void Sc procSchedLock static const sc bufsize t bufsizes 4 8 12 16 32 y default plid sc _sysPoolCreate 0 0x1000 4 sc bufsize t bufsizes default 0 SCI sysTick pid sc_sysProcCreate SCI_sysTick void void SCI_sysTick 256 127 0 1 0 0 0 SC_PROCUSRINTCREATESTATIC hello pid sc_sysProcCreate hello hello 512 0 16 1 0 0 0 SC_PROCPRIOCREATESTATIC display pid sc sysProcCreate display display 512 0 17 1 0 0 0 SC PROCPRIOCREATESTATIC Sc procSchedUnlock HelloSciopta Sc procPrioSet 32 for ASM NOP SCIOPTA Kernel User s Guide Manual Version 1 7 4 10 4 System Design SC OPTA e 4 5 5 2 Init Process in Dynamic Modules Dynamic modules are
111. tor process in a system and it can have any name SCIOPTA Kernel User s Guide Manual Version 1 7 2 1 T 2 SCIOPTA Technology and Methods SCIOPTA e 2 10 3 Transparent Communication If a process in one system CPU wants to communicate with a process in another system CPU it first will search for the remote process by using the se procIdGet system call The parameter of this call includes the process name and the path to where to find it in the form system module procname The kernel transmits a message to the connector including the inquiry All connectors start communicating to search for the process If the process is found in the remote system the con nector will assign a free process ID for the system add it in a remote process list and transmits a message back to the kernel including the assigned process ID The kernel returns the process ID to the caller process The process can now transmit and receive messages to the remote process ID as if the process is local A similar remote process list is created in the connector of the remote system Therefore the receiving process in the remote system can work with remote systems the same way as if these processes where local If a message is sent to a process on a target system which does not exist any more the message will be forwarded to the default connector process SCIOPTA Kernel User s Guide Manual Version 1 7 2 1 8 2 SCIOPTA Technology and Methods SCIOPTA e
112. uy SCIOPTA e High Performance Real Time Operating Systems Kernel User s Guide Copyright Copyright C 2005 by Litronic AG All rights reserved No part of this publication may be reproduced transmitted stored in a retrieval system or translated into any language or computer language in any form or by any means electronic mechanical optical chemical or otherwise without the prior written permis sion of Litronic AG The Software described in this document is licensed under a software license agree ment and maybe used only in accordance with the terms of this agreement Disclaimer Litronic AG makes no representations or warranties with respect to the contents hereof and specifically dis claims any implied warranties of merchantability of fitness for any particular purpose Further Litronic AG reserves the right to revise this publication and to make changes from time to time in the contents hereof without obligation to Litronic AG to notify any person of such revision or changes Trademark SCIOPTA is a registered trademark of Litronic AG Headquarters Litronic AG Gartenstrasse 76 CH 4052 Basel Switzerland Tel 41 61 276 90 90 Fax 41 61 276 90 99 email sales sciopta com www sciopta com Document No S05014RL1 Germany Sciopta Systems GmbH Hauptstrasse 293 D 79576 Weil am Rhein Germany Tel 49 7621 940 9190 Fax 49 7621 940 919 19 email sales sciopta com www sciopta com France Sciopta
113. w Configuration Tree Structure Arm S septa TCS E TCS s TCS Create Module ra B HE Chamber A Delete System Build System Change Build Directory Select the last item in the menu for changing the build directory The actual Build Directory is shown in the System Settings Window Arm Settings Build Directory D APRARM gt General Hooks Debug You can change the Build Directory also from the System Settings Window Click on the Browse But ton and select the new directory You can change the Build Direc tory also from the System Set tings Window by entering directly the Build Directory Path SCIOPTA Kernel User s Guide Manual Version 1 7 3 49 3 Configuration SC OPTA e 3 18 3 Build All If you have more than one system in your project you can build all systems at once by clicking on the Build All button Select the Build All button from the button bar to generate the set of three files for each system mau Build All The files sciopta cnf sconf h and sconf c will be generated for every target into the defined build directories of each target which exists in the project SCONF will prompt for generating the files for each system Please note You need to have different build directories for each system as the names of the three generated files are the same for each system SCIOPTA Kernel User s Guide Manual Version 1 7 3 50 3 Configuration

Download Pdf Manuals

image

Related Search

Related Contents

Mod. 1595  4. デジタルストーリーテリングで映像作品を作ろう  AOC I2470PWQU LED display  Lejeud`évasion débarqueàOrléans  UNO-1019 User Manual  Fujitsu SCENIC ESPRIMO P1510  FOTOPROTECCIÓN - Cosmetica de Hoy  Android Kitkat 4.4 Tablet PC User Manual  

Copyright © All rights reserved.
Failed to retrieve file