Download presentation
Presentation is loading. Please wait.
Published byRalf Fitzgerald Modified over 9 years ago
1
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 on your target
2
www.ilogix.com Rhapsody V4.2 "Specialist" Tool Training © I-Logix 1999-2003 08/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.
3
www.ilogix.com Rhapsody V4.2 "Specialist" Tool Training © I-Logix 1999-2003 08/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
4
www.ilogix.com Rhapsody V4.2 "Specialist" Tool Training © I-Logix 1999-2003 08/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.
5
www.ilogix.com Rhapsody V4.2 "Specialist" Tool Training © I-Logix 1999-2003 08/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
6
www.ilogix.com Rhapsody V4.2 "Specialist" Tool Training © I-Logix 1999-2003 08/08/20036 Properties The file should contain the following properties: All we need to do now is give them appropriate values
7
www.ilogix.com Rhapsody V4.2 "Specialist" Tool Training © I-Logix 1999-2003 08/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 “”
8
www.ilogix.com Rhapsody V4.2 "Specialist" Tool Training © I-Logix 1999-2003 08/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.
9
www.ilogix.com Rhapsody V4.2 "Specialist" Tool Training © I-Logix 1999-2003 08/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.
10
www.ilogix.com Rhapsody V4.2 "Specialist" Tool Training © I-Logix 1999-2003 08/08/200310 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.
11
www.ilogix.com Rhapsody V4.2 "Specialist" Tool Training © I-Logix 1999-2003 08/08/200311 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:
12
www.ilogix.com Rhapsody V4.2 "Specialist" Tool Training © I-Logix 1999-2003 08/08/200312 Properties : Exe/Obj/Lib Extension These properties inform the make file of the extensions for executable files, object files and library files. ex:
13
www.ilogix.com Rhapsody V4.2 "Specialist" Tool Training © I-Logix 1999-2003 08/08/200313 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:
14
www.ilogix.com Rhapsody V4.2 "Specialist" Tool Training © I-Logix 1999-2003 08/08/200314 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:
15
www.ilogix.com Rhapsody V4.2 "Specialist" Tool Training © I-Logix 1999-2003 08/08/200315 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:
16
www.ilogix.com Rhapsody V4.2 "Specialist" Tool Training © I-Logix 1999-2003 08/08/200316 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:
17
www.ilogix.com Rhapsody V4.2 "Specialist" Tool Training © I-Logix 1999-2003 08/08/200317 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:
18
www.ilogix.com Rhapsody V4.2 "Specialist" Tool Training © I-Logix 1999-2003 08/08/200318 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:
19
www.ilogix.com Rhapsody V4.2 "Specialist" Tool Training © I-Logix 1999-2003 08/08/200319 Property : Imp/Spec extension This property sets up the extensions for the generated source and header files. ex:
20
www.ilogix.com Rhapsody V4.2 "Specialist" Tool Training © I-Logix 1999-2003 08/08/200320 Property : AdditionalReservedWords This property allows a list of additional reserved words to be defined that Rhapsody will not allow you to use. ex:
21
www.ilogix.com Rhapsody V4.2 "Specialist" Tool Training © I-Logix 1999-2003 08/08/200321 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:
22
www.ilogix.com Rhapsody V4.2 "Specialist" Tool Training © I-Logix 1999-2003 08/08/200322 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:
23
www.ilogix.com Rhapsody V4.2 "Specialist" Tool Training © I-Logix 1999-2003 08/08/200323 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:
24
www.ilogix.com Rhapsody V4.2 "Specialist" Tool Training © I-Logix 1999-2003 08/08/200324 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:
25
www.ilogix.com Rhapsody V4.2 "Specialist" Tool Training © I-Logix 1999-2003 08/08/200325 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
26
www.ilogix.com Rhapsody V4.2 "Specialist" Tool Training © I-Logix 1999-2003 08/08/200326 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:
27
www.ilogix.com Rhapsody V4.2 "Specialist" Tool Training © I-Logix 1999-2003 08/08/200327 Property : LinkSwitches This property is used to list all the necessary link switches that are needed in order to do a link. ex:
28
www.ilogix.com Rhapsody V4.2 "Specialist" Tool Training © I-Logix 1999-2003 08/08/200328 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:
29
www.ilogix.com Rhapsody V4.2 "Specialist" Tool Training © I-Logix 1999-2003 08/08/200329 Property : DependencyRule This property specifies how dependencies are generated to the makefile. ex:
30
www.ilogix.com Rhapsody V4.2 "Specialist" Tool Training © I-Logix 1999-2003 08/08/200330 Property : ObjCleanCommand This property specifies the environment-specific command used to clean the object files generated by a previous build. ex:
31
www.ilogix.com Rhapsody V4.2 "Specialist" Tool Training © I-Logix 1999-2003 08/08/200331 Property : MakeFileContent : start This is the most complicated property since we need to specify a template make file ex: Opening quote
32
www.ilogix.com Rhapsody V4.2 "Specialist" Tool Training © I-Logix 1999-2003 08/08/200332 MakeFileContent : continued With no Framework or the Interrupt Driven Framework, there is no animation or tracing available.
33
www.ilogix.com Rhapsody V4.2 "Specialist" Tool Training © I-Logix 1999-2003 08/08/200333 MakeFileContent : End Compiling the main Creating an executable Creating a library Removing generated files End quote
34
www.ilogix.com Rhapsody V4.2 "Specialist" Tool Training © I-Logix 1999-2003 08/08/200334 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:
35
www.ilogix.com Rhapsody V4.2 "Specialist" Tool Training © I-Logix 1999-2003 08/08/200335 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.
36
www.ilogix.com Rhapsody V4.2 "Specialist" Tool Training © I-Logix 1999-2003 08/08/200336 Generate / Make If the properties have been correctly configured, then it should be possible to generate and make ex:
37
www.ilogix.com Rhapsody V4.2 "Specialist" Tool Training © I-Logix 1999-2003 08/08/200337 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:
38
www.ilogix.com Rhapsody V4.2 "Specialist" Tool Training © I-Logix 1999-2003 08/08/200338 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
39
www.ilogix.com Rhapsody V4.2 "Specialist" Tool Training © I-Logix 1999-2003 08/08/200339 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
40
www.ilogix.com Rhapsody V4.2 "Specialist" Tool Training © I-Logix 1999-2003 08/08/200340 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:
41
www.ilogix.com Rhapsody V4.2 "Specialist" Tool Training © I-Logix 1999-2003 08/08/200341 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
42
www.ilogix.com Rhapsody V4.2 "Specialist" Tool Training © I-Logix 1999-2003 08/08/200342 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.
43
www.ilogix.com Rhapsody V4.2 "Specialist" Tool Training © I-Logix 1999-2003 08/08/200343 Generate / Make If the properties have been correctly configured, then it should be possible to generate and make the IDF library ex:
44
www.ilogix.com Rhapsody V4.2 "Specialist" Tool Training © I-Logix 1999-2003 08/08/200344 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
45
www.ilogix.com Rhapsody V4.2 "Specialist" Tool Training © I-Logix 1999-2003 08/08/200345 Execution The output should be: Ping Pong Ping Pong Ping Pong …
46
www.ilogix.com Rhapsody V4.2 "Specialist" Tool Training © I-Logix 1999-2003 08/08/200346 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:
47
Proprietary and Confidential www.ilogix.com Annex Examples of settings for properties: ParseErrorMessage and ErrorMessageTokensFormat used for extracting Line number and file name from errors
48
www.ilogix.com Rhapsody V4.2 "Specialist" Tool Training © I-Logix 1999-2003 08/08/200348 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
49
www.ilogix.com Rhapsody V4.2 "Specialist" Tool Training © I-Logix 1999-2003 08/08/200349 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"
50
www.ilogix.com Rhapsody V4.2 "Specialist" Tool Training © I-Logix 1999-2003 08/08/200350 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"
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.