Www.ilogix.com Rhapsody V4.2 "Specialist" Tool Training © I-Logix 1999-2003 08/08/20031 Specialist Rhapsody Getting Rhapsody In C generated code to run.

Slides:



Advertisements
Similar presentations
Introducing JavaScript
Advertisements

Creating a Dialog-Based Comet Windows Program Brian Levantine.
Chapter 3: Editing and Debugging SAS Programs. Some useful tips of using Program Editor Add line number: In the Command Box, type num, enter. Save SAS.
Tutorial 8: Developing an Excel Application
The Rhapsody in C++ Tool Training "Essential" © I-Logix v2.3 25/9/2000 Bas-1 Essential Rhapsody in C++ Section 2 Basic Level.
VBA Modules, Functions, Variables, and Constants
Copyright © 2008 Pearson Addison-Wesley. All rights reserved. Chapter 12 Separate Compilation Namespaces Simple Make Files (Ignore all class references.
© I-Logix Rhapsody C++ V /01/2004 E1-1 Exercise 2 : Count Down.
Tutorial 6 & 7 Symbol Table
The Rhapsody in C++ Tool Training "Essential" © I-Logix v2.3 25/9/2000 Adv-1 Essential Rhapsody in C++ Section 4 Advanced Level Modified.
Introduction to C Programming Overview of C Hello World program Unix environment C programming basics.
SUNY Morrisville-Norwich Campus-Week 12 CITA 130 Advanced Computer Applications II Spring 2005 Prof. Tom Smith.
© Copyright 1992–2004 by Deitel & Associates, Inc. and Pearson Education Inc. All Rights Reserved. Chapter 13 - The Preprocessor Outline 13.1Introduction.
Guide To UNIX Using Linux Third Edition
© I-Logix Rhapsody C++ V /01/2004 E1-1 Exercise 3 : Dishwasher.
 2000 Prentice Hall, Inc. All rights reserved. Chapter 13 - The Preprocessor Outline 13.1Introduction 13.2The #include Preprocessor Directive 13.3The.
Fundamentals of Programming in Visual Basic 3.1 Visual basic Objects Visual Basic programs display a Windows style screen (called a form) with boxes into.
Introduction to The Linaro Toolchain Embedded Processors Training Multicore Software Applications Literature Number: SPRPXXX 1.
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.
C How to Program, 6/e © by Pearson Education, Inc. All Rights Reserved.
 2003 Prentice Hall, Inc. All rights reserved. 1 Chapter 19 - The Preprocessor Outline 19.1 Introduction 19.2 The #include Preprocessor Directive 19.3.
CHAPTER 4: INTRODUCTION TO COMPUTER ORGANIZATION AND PROGRAMMING DESIGN Lec. Ghader Kurdi.
1 Chapter One A First Program Using C#. 2 Objectives Learn about programming tasks Learn object-oriented programming concepts Learn about the C# programming.
CIS 451: ASP.NET Debugging and Server-Side Includes Dr. Ralph D. Westfall February, 2009.
1 I-Logix Professional Services Specialist Rhapsody IDF (Interrupt Driven Framework) CPU External Code RTOS OXF Framework Rhapsody Generated.
XP New Perspectives on Microsoft Office Access 2003 Tutorial 11 1 Microsoft Office Access 2003 Tutorial 11 – Using and Writing Visual Basic for Applications.
© 2005 Pearson Education, Inc., Upper Saddle River, NJ. All rights reserved. Data Structures for Java William H. Ford William R. Topp Appendix E The EZJava.
The Java Programming Language
Chapter 06 (Part I) Functions and an Introduction to Recursion.
1 JavaScript in Context. Server-Side Programming.
Introduction to C Programming CE Lecture 7 Compiler options and makefiles.
History of C 1950 – FORTRAN (Formula Translator) 1959 – COBOL (Common Business Oriented Language) 1971 – Pascal Between Ada.
Intro and Review Welcome to Java. Introduction Java application programming Use tools from the JDK to compile and run programs. Videos at
_______________________________________________________________________________________________________________ PHP Bible, 2 nd Edition1  Wiley and the.
C Hints and Tips The preprocessor and other fun toys.
Fundamentals of C and C++ Programming. EEL 3801 – Lotzi Bölöni Sub-Topics  Basic Program Structure  Variables - Types and Declarations  Basic Program.
From Scratch: Open CCS Exit and restart CCS Click Browse to create a new workspace directory.
Compilation & Linking Computer Organization I 1 November 2009 © McQuain, Feng & Ribbens The Preprocessor When a C compiler is invoked, the.
 2003 Prentice Hall, Inc. All rights reserved. 1 IS 0020 Program Design and Software Tools Preprocessing Lecture 12 April 7, 2005.
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.
Chapter 10: Classes and Data Abstraction. Objectives In this chapter, you will: Learn about classes Learn about private, protected, and public members.
8 Chapter Eight Server-side Scripts. 8 Chapter Objectives Create dynamic Web pages that retrieve and display database data using Active Server Pages Process.
© I-Logix Rhapsody C++ V /01/2004E1-1 “Essential” Tool Training Basic Rhapsody Basic Rhapsody Rhapsody in C++ V /01/04.
The Preprocessor Directives Introduction Preprocessing – Occurs before program compiled Inclusion of external files Definition of symbolic constants.
Debugging tools in Flash CIS 126. Debugging Flash provides several tools for testing ActionScript in your SWF files. –The Debugger, lets you find errors.
© Oxford University Press All rights reserved. CHAPTER 10 THE PREPROCESSOR DIRECTIVE.
Chapter 10: Classes and Data Abstraction. Classes Object-oriented design (OOD): a problem solving methodology Objects: components of a solution Class:
Creating FunctionstMyn1 Creating Functions Function can be divided into two groups: –Internal (built in) functions –User-defined functions.
C language + The Preprocessor. + Introduction The preprocessor is a program that processes that source code before it passes through the compiler. It.
© 2008, Renesas Technology America, Inc., All Rights Reserved 1 Introduction Purpose  This training course demonstrates the Project Generator function.
Object Oriented Programming COP3330 / CGS5409.  Compiling with g++  Using Makefiles  Debugging.
L071 Introduction to C Topics Compilation Using the gcc Compiler The Anatomy of a C Program Reading Sections
Some of the utilities associated with the development of programs. These program development tools allow users to write and construct programs that the.
Java IDE Dwight Deugo Nesa Matic
1 Problem Solving  The purpose of writing a program is to solve a problem  The general steps in problem solving are: Understand the problem Dissect the.
Prof: Dr. Shu-Ching Chen TA: Hsin-Yu Ha Fall 2015
Compilation and Debugging
Compilation and Debugging
Chapter 13 - The Preprocessor
Algorithms Problem: Write pseudocode for a program that keeps asking the user to input integers until the user enters zero, and then determines and outputs.
The Selection Structure
14. THE PREPROCESSOR.
Introduction to C Topics Compilation Using the gcc Compiler
Introduction to C Topics Compilation Using the gcc Compiler
Intro to PHP & Variables
C Preprocessor(CPP).
Writing Large Programs
The Role of Command Line Compiler (csc.exe)
SPL – PS1 Introduction to C++.
Presentation transcript:

Rhapsody V4.2 "Specialist" Tool Training © I-Logix /08/20031 Specialist Rhapsody Getting Rhapsody In C generated code to run on your target

Rhapsody V4.2 "Specialist" Tool Training © I-Logix /08/20032 The Three Steps To Success  Step 1:  The simplest way to get Rhapsody in C generated code to run on your target is to run it without using an Operating System or without using the Rhapsody OXF Framework. Since there’s no framework or operating system, we won’t be able to use asynchronous events or timeouts and we won’t of course be able to create threads, mutexes, … All that is needed is just informing Rhapsody how to create a make file and how to compile, link and perhaps even connect to the target and download the executable and run it.  Step 2:  Once the first step has been accomplished, we can then get the Interrupt Driven Framework to run on the target. This will allow asynchronous events and timeouts to be used.  Step 3:  The final step if necessary is to port the Operating System so that we can create threads, mutexes, … and thus use Rhapsody without any limitations.

Rhapsody V4.2 "Specialist" Tool Training © I-Logix /08/20033 Step 1: Getting code to run  First of all we need to add a new environment to Rhapsody specific to your target.  In the Rhapsody\Share\Properties directory, either create a new siteC.prp file or edit an existing one to add a new environment  Name the new environment in the format “framework”_”compiler”_”cpu”  For this example we will use an environment using the GreenHills compiler for a PowerPC. The environment will thus be called NOF_GreenHills_PPC where NOF implies No Framework, GreenHills is the compiler and PPC the cpu

Rhapsody V4.2 "Specialist" Tool Training © I-Logix /08/20034 SiteC.prp  Soon we will create a file containing properties specific to the new environment called siteC_“framework”_”compiler”_”cpu”.prp  Add an Include statement to include this file ex: Default environment Include statement New environment This example shows just two environments, you can of course, specify as many as you need.

Rhapsody V4.2 "Specialist" Tool Training © I-Logix /08/20035 SiteC_NOF_GreenHills_PPC.prp  In order to create the included properties file; we can either copy an existing file (recommended approach) or create a new one and cut and paste the appropriate properties from a suitable environment in the factoryC.prp file  Creating a separate properties file specific for each new environment makes it easier to manage multiple environments. Alternatively instead of creating a separate file and using an Include statement, we could have put all the properties in the SiteC.prp

Rhapsody V4.2 "Specialist" Tool Training © I-Logix /08/20036 Properties  The file should contain the following properties:  All we need to do now is give them appropriate values

Rhapsody V4.2 "Specialist" Tool Training © I-Logix /08/20037 Before we start  When setting the properties, if we need to add characters “ or \ to a property of type String, then we must precede the character by \ ex: \” or \\  If any paths have spaces in them, then the paths must be enclosed in “”

Rhapsody V4.2 "Specialist" Tool Training © I-Logix /08/20038 Property : InvokeExecutable  This property is used to inform Rhapsody how to execute the generated executable.  For example the following calls a batch file called greenhills_ppc_run.bat passing the name of the executable $OMROOT is an environment variable that will be set by Rhapsody to point to the Rhapsody\share directory.

Rhapsody V4.2 "Specialist" Tool Training © I-Logix /08/20039 Property : Invoke Make  This property is used to inform Rhapsody how to invoke the make  For example the following calls a batch file called greenhills_ppc_make.bat passing the name of the make file and make target $OMROOT is an environment variable that will be set by Rhapsody to point to the Rhapsody\share directory.

Rhapsody V4.2 "Specialist" Tool Training © I-Logix /08/ Property : ParseErrorMessage  This property is used to inform Rhapsody how to interpret an error in order to find where the error occurred, so that double-clicking on the error in the output window automatically opens the appropriate diagram or positions the browser to where the error is located.  It is used in combination with the property ErrorMessageTokensFormat Rhapsody interprets just a single line in order to determine the file name and line number. If however the error message is split onto several lines (such as with the Tasking compiler), then double-clicking the error will not work. See annex for examples.

Rhapsody V4.2 "Specialist" Tool Training © I-Logix /08/ Property : Include  This property is used by the makefile to specify the environment-specific command that is generated in the makefile to include other makefiles  ex:

Rhapsody V4.2 "Specialist" Tool Training © I-Logix /08/ Properties : Exe/Obj/Lib Extension  These properties inform the make file of the extensions for executable files, object files and library files.  ex:

Rhapsody V4.2 "Specialist" Tool Training © I-Logix /08/ Property : EntryPoint  This property is generally set to “main” as this is the usual entry point. However sometimes some operating systems use main themselves. In these cases, the Rhapsody entry point can be renamed to something else, ex: with the operating system ThreadX, it is renamed to txmain  ex:

Rhapsody V4.2 "Specialist" Tool Training © I-Logix /08/ Property : UseRemoteHost  Generally this property will be set to “False” and the corresponding property RemoteHost will be left blank. It is only really used when a DLL is present to allow remote connections to IDE’s such as Tornado.  ex:

Rhapsody V4.2 "Specialist" Tool Training © I-Logix /08/ Property : ReactiveVtblKind  When generating code for a reactive object, Rhapsody creates a virtual table so that the reactive object knows how to invoke operations on its owner. With no framework or with the Interrupt Driven Framework, a reduced virtual table can be used saving valuable RAM.  ex:

Rhapsody V4.2 "Specialist" Tool Training © I-Logix /08/ Property : OSFileSystemCaseSensitive  Some operating systems such as Solaris, are case sensitive, if this is the case then set this property to “True” otherwise leave it as “False”  ex:

Rhapsody V4.2 "Specialist" Tool Training © I-Logix /08/ Property : ObjectDirectory  This property can be used if you want the generated objects to be located in a particular sub directory. Leaving it blank means that when compiling all objects will be located in the same directory as the source files.  ex:

Rhapsody V4.2 "Specialist" Tool Training © I-Logix /08/ Property : BuildSet  Generally this property is used to define just two build sets “Debug” and “Release”. However if more build sets are needed, then they can be defined and the make file can make use of them.  ex:

Rhapsody V4.2 "Specialist" Tool Training © I-Logix /08/ Property : Imp/Spec extension  This property sets up the extensions for the generated source and header files.  ex:

Rhapsody V4.2 "Specialist" Tool Training © I-Logix /08/ Property : AdditionalReservedWords  This property allows a list of additional reserved words to be defined that Rhapsody will not allow you to use.  ex:

Rhapsody V4.2 "Specialist" Tool Training © I-Logix /08/ Property : IsFileNameShort  On some older compilers, sometimes the number of characters for filenames must be limited to 8 characters. If this is the case then setting this property to “True” will ensure that all filenames are truncated to the first 8 characters. In most cases this property will be left at “False”  ex:

Rhapsody V4.2 "Specialist" Tool Training © I-Logix /08/ Property : QuoteOMROOT  This property specifies whether to enclose the value of the OMROOT path variable in double quotes in the generated makefile. Most of the time this property will be set to “True”  ex:

Rhapsody V4.2 "Specialist" Tool Training © I-Logix /08/ Property : ObjectName  This property specifies an alternative name for the compiled object file in the generated makefile. Most of the time, it will be left blank.  ex:

Rhapsody V4.2 "Specialist" Tool Training © I-Logix /08/ Property : CPPCompileCommand  This property specifies how to compile a source file. Often it is implemented as two lines: an echo statement indicating that it is compiling a specific file followed by the syntax for compiling. The $(CPP) macro is generally defined in the makefile, the $OMFileCPPCompileSwitches are defined in the property CPPCompileSwitches.  ex:

Rhapsody V4.2 "Specialist" Tool Training © I-Logix /08/ Property : CPPCompileSwitches  This property is used to list all the necessary compilation switches, defines etc that are needed in order to compile a file.  ex: Compiler specific options Additional define

Rhapsody V4.2 "Specialist" Tool Training © I-Logix /08/ Property : CppCompile(BuildSet)  This set of properties (one for each specific build set) is used to specify additional properties to the previously defined property CPPCompileSwitches.  ex:

Rhapsody V4.2 "Specialist" Tool Training © I-Logix /08/ Property : LinkSwitches  This property is used to list all the necessary link switches that are needed in order to do a link.  ex:

Rhapsody V4.2 "Specialist" Tool Training © I-Logix /08/ Property : Link(BuildSet)  This set of properties (one for each specific build set) is used to specify additional properties to the previously defined property LinkSwitches.  ex:

Rhapsody V4.2 "Specialist" Tool Training © I-Logix /08/ Property : DependencyRule  This property specifies how dependencies are generated to the makefile.  ex:

Rhapsody V4.2 "Specialist" Tool Training © I-Logix /08/ Property : ObjCleanCommand  This property specifies the environment-specific command used to clean the object files generated by a previous build.  ex:

Rhapsody V4.2 "Specialist" Tool Training © I-Logix /08/ Property : MakeFileContent : start  This is the most complicated property since we need to specify a template make file  ex: Opening quote

Rhapsody V4.2 "Specialist" Tool Training © I-Logix /08/ MakeFileContent : continued With no Framework or the Interrupt Driven Framework, there is no animation or tracing available.

Rhapsody V4.2 "Specialist" Tool Training © I-Logix /08/ MakeFileContent : End Compiling the main Creating an executable Creating a library Removing generated files End quote

Rhapsody V4.2 "Specialist" Tool Training © I-Logix /08/ Share\etc directory  The first two properties that we modified invoke a couple of batch files in order to execute the executable and also invoke a make.  These files need to be created.  ex:

Rhapsody V4.2 "Specialist" Tool Training © I-Logix /08/ RiC_SignalGenerator Model  The RiC_SignalGenerator Model does not use the Rhapsody framework and can be used to test out our new environment.  Open the model and select the SignalGenerator component  Copy the microsoft_nt environment and rename to the name of your new environment  Select the new environment from the list  If the new environment is missing, then you’ll need to check that the properties are correct. Often a spelling mistake or a missing “ is the cause of the problem. If you modify the siteC.prp or site.prp file, then you don’t need to exit Rhapsody, but you must close the model and then reopen it for Rhapsody to read the modified properties.

Rhapsody V4.2 "Specialist" Tool Training © I-Logix /08/ Generate / Make  If the properties have been correctly configured, then it should be possible to generate and make ex:

Rhapsody V4.2 "Specialist" Tool Training © I-Logix /08/ Run  If you have setup the batch file to correctly invoke the debugger and download the executable, then doing “run” should do exactly this.  ex:

Rhapsody V4.2 "Specialist" Tool Training © I-Logix /08/ Step 2  Once the Signal Generator model runs satisfactorily, it should be pretty straightforward to get the Interrupt Driven Framework to work.  As before a new environment needs to be created ex: IDF_Greenhills_PPC as well as an extra properties file such as siteC_IDF_Greenhills_PPC.prp  Just a few modifications will be needed to convert the NOF_GreenHills_PPC.prp file into the IDF_GreenHills_PPC.prp file. These modifications will mainly be in the CppCompileSwitches and MakeFileContent property

Rhapsody V4.2 "Specialist" Tool Training © I-Logix /08/ Property : CPPCompileSwitches  The property CPPCompileSwitches will need some extra include directives so as to be able to locate the IDF header files  ex: -I$(CIDF_ROOT)/greenhills_ppc -I$(CIDF_ROOT)/greenhills_ppc/oxf The environmental variable CIDF_ROOT will need to be configured to point to the location of the IDF ex: D:\Rhapsody42\Demos\CDemos\RiC_InterruptDrivenFramework\idf

Rhapsody V4.2 "Specialist" Tool Training © I-Logix /08/ Property : MakeFileContent changes  The property MakeFileContent will need to be modified so that when a link is done, it will include the appropriate idf library.  ex:

Rhapsody V4.2 "Specialist" Tool Training © I-Logix /08/ Additional Defines  If your target doesn’t support malloc/free or printf then you should add an extra couple of defines to the property CPPCompileSwitches  ex: NO_MALLOC NO_PRINT

Rhapsody V4.2 "Specialist" Tool Training © I-Logix /08/ IDF  It should now be possible to open the RiC_InterruptDrivenFramework model and select the IDF component  Copy the microsoft_nt environment and rename to the name of your new environment  Select the new environment from the list  If the new environment is missing, then you’ll need to check that the properties are correct. As mentioned previously, often a spelling mistake or a missing “ is the cause of the problem.

Rhapsody V4.2 "Specialist" Tool Training © I-Logix /08/ Generate / Make  If the properties have been correctly configured, then it should be possible to generate and make the IDF library  ex:

Rhapsody V4.2 "Specialist" Tool Training © I-Logix /08/ PingPongTest  Once the idf library has been created, we can now select the PingPongTest (This test doesn’t use timeouts, which we haven’t implemented yet for our new environment)  Once more, copy the microsoft_nt environment and rename and select the new environment  We should now be able to generate / make / run  If there are errors, then it is possible that the CIDF_ROOT is not pointing to the correct location

Rhapsody V4.2 "Specialist" Tool Training © I-Logix /08/ Execution  The output should be: Ping Pong Ping Pong Ping Pong …

Rhapsody V4.2 "Specialist" Tool Training © I-Logix /08/ Using the Timer  In order to use timeouts in statecharts, we must modify the global function RiCInitTimer() in the RiC_IdfP package to initialise a periodic interrupt to call the global interrupt RiCTick() every RIC_MS_PER_TICK  ex:

Proprietary and Confidential Annex Examples of settings for properties: ParseErrorMessage and ErrorMessageTokensFormat used for extracting Line number and file name from errors

Rhapsody V4.2 "Specialist" Tool Training © I-Logix /08/ Annex I CAD-UL Error: CC86-E-FATAL:D:\RhapsodyV301\Demos\CDemos\IDF\idf\cadul\oxf\MemAlloc.h: 20: ParseErrorMessage :[^FATAL:] ([A-Za-z0-9_\]+[.][A-Za-z0-9]+) :([0-9]+)[:] ErrorMessageTokensFormat:ToTalNumberOfTokens=2, FileTokenPosition=1, LineTokenPosition=2 ARM Error:"MainTest.c", line 27: Warning: C2207W: inventing 'extern int RiCOXFInit();' ParseErrorMessage: "^\"(.*)\".*line ([0-9]*): (.*)$" ErrorMessageTokensFormat"ToTalNumberOfTokens=3, FileTokenPosition=1, LineTokenPosition=2" Borland Error:Error Toto.c 27: Undefined symbol 'i' in function Toto_Init ParseErrorMessage :"(Error|Warning) ([A-Za-z0-9_]+[.][A-Za-z0-9]+) ([0-9]+)[:]" ErrorMessageTokensFormat :"ToTalNumberOfTokens=3, FileTokenPosition=2, LineTokenPosition=3" Keil Error:"*** ERROR C67 IN LINE 27 OF TOTO.C: 'i': undefined identifier ParseErrorMessage :"[^LINE]([0-9]*) OF ([A-Za-z0-9_]+[.][A-Za-z0-9]+)[:]" ErrorMessageTokensFormat :ToTalNumberOfTokens=2, FileTokenPosition=2, LineTokenPosition =1

Rhapsody V4.2 "Specialist" Tool Training © I-Logix /08/ Annex II Microsoft Error:Toto.c(27) : error C2065: 'i' : undeclared identifier ParseErrorMessage:"([^(]+)[(]([0-9]+)[)] [:] (error|warning|fatal error)" ErrorMessageTokensFormat:"ToTalNumberOfTokens=3, FileTokenPosition=1, LineTokenPosition=2" Gnu Error:Toto.c:27: `i' undeclared (first use this function) ParseErrorMessage:"([^:]+)[:]([0-9]+)[:]" ErrorMessageTokensFormat:"ToTalNumberOfTokens=2, FileTokenPosition=1, LineTokenPosition=2" Texas Instruments Error:"toto.c", line 27: [F108] 'i' undefined ParseErrorMessage: "^\"(.*)\".*line ([0-9]*): (.*)$" ErrorMessageTokensFormat:"ToTalNumberOfTokens=3, FileTokenPosition=1, LineTokenPosition=2" PanaX Error:RiCIdfPkg.c:263:(E)8313 there is no #endif associated with #if/#ifdef/#ifndef. ParseErrorMessage :"([^:]+)[:]([0-9]+)[:]" ErrorMessageTokensFormat:"ToTalNumberOfTokens=2, FileTokenPosition=1, LineTokenPosition=2"

Rhapsody V4.2 "Specialist" Tool Training © I-Logix /08/ Annex III Hitachi Error:SignalGeneratorPkg.h(32) : C2105 (E) Incomplete tag used in declaration ParseErrorMessage: "([^(]+)[(]([0-9]+)[)[:]" ErrorMessageTokensFormat: "ToTalNumberOfTokens=2,FileTokenPosition=1,LineTokenPosition=2" Metaware ARC Error:w "ReactiveClass.c",L23/C13(#290): rootState_entDef: Static function is not referenced. ParseErrorMessage:"\"([^\"]+)\",L([0-9]+)/" ErrorMessageTokensFormat: "ToTalNumberOfTokens=2,FileTokenPosition=1,LineTokenPosition=2" IAR Error:"idf.h",25 Error[2]: Failed to open #include file 'stdio.h' ParseErrorMessage :"^\"(.*)\", ([0-9]*): (.*)$" ErrorMessageTokensFormat:"ToTalNumberOfTokens=3, FileTokenPosition=1, LineTokenPosition=2"