1 I-Logix Professional Services www.ilogix.com Specialist Rhapsody IDF (Interrupt Driven Framework) CPU External Code RTOS OXF Framework Rhapsody Generated.

Slides:



Advertisements
Similar presentations
System Integration and Performance
Advertisements

CS 11 C track: lecture 7 Last week: structs, typedef, linked lists This week: hash tables more on the C preprocessor extern const.
More on Processes Chapter 3. Process image _the physical representation of a process in the OS _an address space consisting of code, data and stack segments.
Memory Protection: Kernel and User Address Spaces  Background  Address binding  How memory protection is achieved.
Computer System Organization Computer-system operation – One or more CPUs, device controllers connect through common bus providing access to shared memory.
Contiki A Lightweight and Flexible Operating System for Tiny Networked Sensors Presented by: Jeremy Schiff.
Rhapsody in C++ Tool Training "Essential" © I-Logix v3.0 1/29/2001 Adv-1 Section 4 Advanced Level Concurrency.
Chapter 13 Embedded Systems
© I-Logix Rhapsody C++ V /01/2004 E1-1 Exercise 3 : Dishwasher.
Threads CS 416: Operating Systems Design, Spring 2001 Department of Computer Science Rutgers University
Silberschatz, Galvin and Gagne ©2009 Operating System Concepts – 8 th Edition Chapter 2: Operating-System Structures Modified from the text book.
1 Introduction to Tool chains. 2 Tool chain for the Sitara Family (but it is true for other ARM based devices as well) A tool chain is a collection of.
Operating Systems CSE 411 CPU Management Sept Lecture 11 Instructor: Bhuvan Urgaonkar.
System Calls 1.
Introduction to Graphical User Interfaces. Objectives * Students should understand what a procedural program is. * Students should understand what an.
1 Lecture 4: Threads Operating System Fall Contents Overview: Processes & Threads Benefits of Threads Thread State and Operations User Thread.
Nachos Phase 1 Code -Hints and Comments
CS1550 Assignment 5 Multiprogramming Implementation notes Matt Craven.
1-1 Embedded Network Interface (ENI) API Concepts Shared RAM vs. FIFO modes ENI API’s.
Chapter 41 Processes Chapter 4. 2 Processes  Multiprogramming operating systems are built around the concept of process (also called task).  A process.
Recall: Three I/O Methods Synchronous: Wait for I/O operation to complete. Asynchronous: Post I/O request and switch to other work. DMA (Direct Memory.
Chapter 8 – Main Memory (Pgs ). Overview  Everything to do with memory is complicated by the fact that more than 1 program can be in memory.
Rhapsody V4.2 "Specialist" Tool Training © I-Logix /08/20031 Specialist Rhapsody Getting Rhapsody In C generated code to run.
CE Operating Systems Lecture 3 Overview of OS functions and structure.
© Janice Regan, CMPT 300, May CMPT 300 Introduction to Operating Systems Memory: Relocation.
Chapter 2 Processes and Threads Introduction 2.2 Processes A Process is the execution of a Program More specifically… – A process is a program.
Chapter 4 – Threads (Pgs 153 – 174). Threads  A "Basic Unit of CPU Utilization"  A technique that assists in performing parallel computation by setting.
Writing a Run Time DLL The application loads the DLL using LoadLibrary() or LoadLibraryEx(). The standard search sequence is used by the operating system.
I-Logix Proprietary and Confidential CPU External Code RTOS OXF Framework Rhapsody Generated Code CPU External Code IDF Framework Rhapsody Generated Code.
Operating Systems CSE 411 CPU Management Sept Lecture 10 Instructor: Bhuvan Urgaonkar.
1 VxWorks 5.4 Group A3: Wafa’ Jaffal Kathryn Bean.
Processes, Threads, and Process States. Programs and Processes  Program: an executable file (before/after compilation)  Process: an instance of a program.
Copyright © Curt Hill Operating Systems An Introductory Overview.
Implementation of Embedded OS Lab3 Porting μC/OS-II.
© I-Logix Rhapsody C++ V /01/2004E1-1 “Essential” Tool Training Basic Rhapsody Basic Rhapsody Rhapsody in C++ V /01/04.
Cs431-cotter1 Processes and Threads Tanenbaum 2.1, 2.2 Crowley Chapters 3, 5 Stallings Chapter 3, 4 Silberschaz & Galvin 3, 4.
Slides created by: Professor Ian G. Harris Operating Systems  Allow the processor to perform several tasks at virtually the same time Ex. Web Controlled.
Introduction Contain two or more CPU share common memory and peripherals. Provide greater system throughput. Multiple processor executing simultaneous.
MINIX Presented by: Clinton Morse, Joseph Paetz, Theresa Sullivan, and Angela Volk.
Operating System Concepts
Interrupts and Exception Handling. Execution We are quite aware of the Fetch, Execute process of the control unit of the CPU –Fetch and instruction as.
Copyright © Curt Hill More on Operating Systems Continuation of Introduction.
Lecture 4 Page 1 CS 111 Online Modularity and Memory Clearly, programs must have access to memory We need abstractions that give them the required access.
OCR A Level F453: The function and purpose of translators Translators a. describe the need for, and use of, translators to convert source code.
Embedded Real-Time Systems Processing interrupts Lecturer Department University.
Chapter 6 Limited Direct Execution Chien-Chung Shen CIS/UD
Advanced Operating Systems CS6025 Spring 2016 Processes and Threads (Chapter 2)
System SOFTWARE.
Computer System Structures
SQL Database Management
Memory Management.
Processes and threads.
Process concept.
Current Generation Hypervisor Type 1 Type 2.
CS501 Advanced Computer Architecture
Process Management Process Concept Why only the global variables?
CS 6560: Operating Systems Design
Topics Covered What is Real Time Operating System (RTOS)
OPERATING SYSTEMS CS3502 Fall 2017
Mechanism: Limited Direct Execution
Threads CSSE 332 Operating Systems Rose-Hulman Institute of Technology
Introduction to Operating System (OS)
Swapping Segmented paging allows us to have non-contiguous allocations
Threads and Data Sharing
Page Replacement.
Chapter 2: System Structures
Memory Management Tasks
Process Description and Control
CS510 Operating System Foundations
COMP755 Advanced Operating Systems
Presentation transcript:

1 I-Logix Professional Services Specialist Rhapsody IDF (Interrupt Driven Framework) CPU External Code RTOS OXF Framework Rhapsody Generated Code CPU External Code IDF Framework Rhapsody Generated Code M.W.Richardson 27/01/2004

2 I-Logix Professional Services Frameworks In order to use Rhapsody in C and C++, it is necessary to have an Operating System. Rhapsody provides a Framework known as the OXF (Object eXecution Framework) that contains an OSAL (Operating System Adapter Layer) allowing the same model to run on a multitude of Operating Systems. Rhapsody in C and C++ both come with a number of adapters for a wide range of Operating Systems. However there will always be cases where a particular Operating System is not yet supported or cases where there is no operating System or even perhaps cases where the RAM and ROM requirements are such that there is no space for a framework.

3 I-Logix Professional Services Non supported OS When the OS that is needed is not yet supported, the obvious solution is to port the OS, however this generally takes between two and four weeks and requires OS knowledge An intermediate step is to first of all get a Rhapsody model to execute on the target without the OS. This can generally be achieved in about one day and doing so gives the user confidence in the generated code and Rhapsody In order to do this there are two approaches that can be used Interrupt Driven Framework (IDF) No Framework (NOF) Both of these solutions can either be used without an OS or even in conjunction with an OS where they can run inside a single thread. This approach makes it easy to get some Rhapsody generated code to run in an existing product!

4 I-Logix Professional Services Interrupt Driven Framework The IDF (Interrupt Driven Framework) is a framework that exists for C and C++ that can be used in place of the OXF The advantage of the IDF is that it does not require an OS, the disadvantage is that since there is no OS, it is not allowed in the model to create active classes, guard operations, … The IDF is of course a Rhapsody model that is documented and is relatively easy to understand and customise The IDF has already been integrated with a large number of compilers and CPU’s The IDF is suited for 16 and 32 bit CPU’s The IDF can be used with/without dynamic memory allocation Getting the IDF to run on almost any environment typically takes just a day

5 I-Logix Professional Services Interrupt Driven Framework Porting the IDF to a new environment requires creating a new properties file and also setting up a periodic interrupt (so that the tm function can be used in statecharts). This generally takes about one day. The IDF is designed to be customised by the user. For example some users decide that they never need to use the containers in which case they can be removed from the IDF library. In most cases, users should configure the size of the pre-allocated buffers for events/timeouts/etc. Depending on the CPU, the size of the framework library can be reduced to about 5k ROM. Animation can still be done on the host by using the OXF framework with animation

6 I-Logix Professional Services SiteC.prp / SiteC++.prp The first step is to add the new environment to Rhapsody. This is done using a specific properties file ex: siteC_IDF_Tasking_C166.prp SiteC++_NOF_GreenHills_Arm.prp This properties file describes how to invoke the compiler, how to create a makefile, which compilation options are to used, which libraries are to be linked, … There will also be a couple of batch files that let Rhapsody know how to invoke the make and to execute the code

7 I-Logix Professional Services Using the IDF with Rhapsody in C To try out the IDF, first of all an environmental variable called CIDF_ROOT must be added to point to the idf directory below where the model is located. Ex: If the model is located in C:\work\InterruptDrivenFramework, then CIDF_ROOT must be set to : C:\ work\InterruptDrivenFramework\idf The Rhapsody\Share\Properties\siteC.prp must be modified to incorporate the new environments ex: IDF_Microsoft_NT, IDF_Tasking_C166, …

8 I-Logix Professional Services Generating the IDF libraries The simplest way to try out the IDF is to use the IDF_Microsoft_NT environment. This environment uses the Microsoft Visual C++ compiler and uses the Windows OS just to create a timer. This environment also has the advantage that the generated executable will run on the Windows pc. Once the InterruptDrivenFramework model has been loaded into Rhapsody, select the IDF component and the “microsoft_nt” environment. Generate / Make to create the library idf.lib

9 I-Logix Professional Services Using the IDF Once the library IDF.lib has been created, a new project can be created. In order to use the IDF, we need several properties to be set, the simplest way to achieve this in a new project is to “add to model” as reference the IDF profile. This can be done by using “Add To Model” and then locating the IDFProfile.sbs file

10 I-Logix Professional Services IDFProfile This profile will set the following properties:

11 I-Logix Professional Services Ping We can create a simple Ping program as follows: Create a component Test that has a configuration Debug that uses the “Microsoft” environment and “Animation”. We should be able to debug the model in the usual way.

12 I-Logix Professional Services Using the IDF_Microsoft_NT environment Once the model works with the “Microsoft” environment, we can copy the configuration, select the IDF_Microsoft_NT environment and switch off the animation. (The IDF cannot work with animation). This environment should successfully compile / link and run

13 I-Logix Professional Services IDF_Greenhills_PPC In a similar way, the same model can run in different environments, ex: GreenHills compiler and PPC

14 I-Logix Professional Services The IDF model The IDF contains two main packages: RiC_IdfP This package contains all the classes from which the idf library will be created RiCTestP This package contains many tests that can be used to check the IDF. The names are all less that 8 characters since some 8 and 16 bit compilers can’t handle long file names :-(

15 I-Logix Professional Services RiC_IdfP Inside this package there are some global functions and three main packages: RiC_ContainersPkg This package is optional and can be selected in the IDF component. It contains the RiCString, RiCList, RiCCollection and RiCMap classes. For most applications, this package will probably not be selected. RiC_MemoryAllocationPkg The IDF has changed the way that memory allocation is done by using static pools of memory to avoid the use of malloc & free. RiC_RPkg This is the principal package that contains the main framework classes such as RiCReactive and RiCTask

16 I-Logix Professional Services RiC_ContainersPkg This package contains exactly the same classes as those found in the OXF framework. If the containers are required, then simply check the appropriate box so that they get generated. You don’t need to tick the Memory Allocation Package, it will get included automatically

17 I-Logix Professional Services Memory Allocation The memory allocation is done by the class RiCAllocator that pre-allocates three pools of memory. The size of each pool can be predetermined by setting the following type:

18 I-Logix Professional Services RiCAllocator The property CG:Event:BaseNumberOfInstances must be set to be > 0 (This is done by the profile) so that Rhapsody automatically adds a macro to allocate/free memory. The IDF redefines this macro so that whenever memory is to be created/released, the RiCAllocator is called to manage this. If there is no more memory available then malloc will be used to reallocate more memory which will be added to the appropriate pool. However if the define NO_MALLOC is set then a message is sent to the Error Handler class to alert the user.

19 I-Logix Professional Services RiC_RPkg The same classes that are in the standard OXF framework such as RiCReactive and RiCTask are in this package.

20 I-Logix Professional Services RiCErrorManager This is a new class, that manages all errors. It uses printf to send a message to standard out informing the user of any errors that occur. If the define NO_PRINT is set then the error manager does nothing. It is recommend that this class be modified to take appropriate action in case of an error.

21 I-Logix Professional Services RiCReactive This class has basically the same behaviour as for the standard OXF framework. It has the following main operations: startBehavior gen takeEvent This class uses a smaller virtual table than for the standard oxf, allowing just three operations to be defined: dispatchEvent, enterDefault & delete

22 I-Logix Professional Services RiCTask This class should really be a singleton, since in the IDF, only a single task can be created, however it must have the same interface as the RiCTask in the OXF framework so it is a class. In most cases, the execute operation sits in a loop calling RiCTask_schedule RiCTask_schedule, basically tests to see if any events are in the event queue and if they are, then it handles all of them in a similar way to how the OXF handles events. When an event is consumed, then the event/timeout is put back onto the appropriate pool.

23 I-Logix Professional Services Timeouts When a reactive class calls a tm() function on a statechart, then that class calls schedTm on the RiCTask. This causes a Timeout to be created and put onto a linked list that is managed by the RiCTmManager. The RiCTask class has an operation tick() that gets called periodically to check to see if any timeouts have expired. This code could be rewritten to be more optimised. Whenever a timeout expires, it is promoted to an event and put onto the event queue. A pool of timeouts are initially created statically and when a timeout is consumed, it is returned to the pool.

24 I-Logix Professional Services Sending an event

25 I-Logix Professional Services Receiving an event

26 I-Logix Professional Services Scheduling a timeout

27 I-Logix Professional Services Periodic Interrupt In order to allow the tm() function to be used on statecharts, a periodic interrupt must be set up so that the global function RiCTick() gets called every RIC_MS_PER_TICK. The function RiCInitTimer must be modified to setup the periodic interrupt for each new environment.

28 I-Logix Professional Services Extra files There are some extra files that get generated such as Ricppc.s Irq_ven.s … These files are for specific environments and can be removed if those environments are not being used.

29 I-Logix Professional Services Limitations Active classes and guarded operations are not allowed Animation is not allowed Simulated time model is not implemented Maximum number of consecutive null transitions has been reduced from 100 to 7 (this saves RAM)

30 I-Logix Professional Services Managing Interrupts If an ISR routine needs to send an event to a reactive class, then it needs to do something similar to how the timeouts are handled. ie: it should simply set a flag, that will be checked by RiCTask_execute. RiCTask_execute should be modified so that it checks these flags and automatically adds events to the event queue.

31 I-Logix Professional Services Future Directions It should be possible to modify the IDF so that multiple tasks are allowed, this then basically becomes a lightweight OXF and could be used for a more efficient way to adapt to small efficient OS’s on small targets.