I am currently using Rhapsody 7.6.1 to generate code for a small embedded system.
I have a legacy hand written code.
My task is to do a project in rhapsody to generate a code, using the same elements (variables, functions, enumerations, structures and statecharts) as in the legacy code.
This is to test whether rhapsdoy can generate a better code or atleast same code as the handwriten one.
I have already read the Rhapsody Code Generation Guide, but it does not tell you how to do things in GUI in Rhapsody and also there is no actual coding example in that.
Is there a tutorial available or anyone with experience in such a thing?
Any help is appreciated!
This topic has been locked.
8 replies Latest Post - 2013-01-23T09:21:49Z by SystemAdmin
Pinned topic Real Time Embedded System Code Generation Tutorial?
Answered question This question has been answered.
Unanswered question This question has not been answered yet.
Updated on 2013-01-23T09:21:49Z at 2013-01-23T09:21:49Z by SystemAdmin
Re: Real Time Embedded System Code Generation Tutorial?2013-01-11T10:56:32Z in response to SystemAdminHello,
from my point of view you should discuss your project goal with your management. It makes no sense to check if Rhapsody can generate the same code or better than your legacy code. If you use the re-engineering functionality you can import all your old code into Rhapsody. So it will create all files and functions you have today in Rhapsody. If you generate code afterwards it will be nearly identical to what you have today. The question is: Is this an improvement for your company?
You can use Rhapsody the same way you did during manual coding. Just use files and functions and avoid classes. So you will have exactly the same code like handwritten.
The benefit of Rhapsody is to use graphical modeling, statecharts, to see the active state during the animation,... to have a better documentation to make your project more understandable for other people.
If you want this - you need to uses classes and implement behavior in statecharts. This will create an overhead of course and the files will no longer look like manual coded - even if there are a lot of options to configure the generated code.
So before you continue you must decide what kind of model you want (or need, depending on your memory/ perfomance restrictions). You will find also some newsletters at willert.de which could be helpful.
Re: Real Time Embedded System Code Generation Tutorial?2013-01-11T13:37:49Z in response to SystemAdminThanks LookItsMe!
The aim of the project is to see if Rhapsody can generate a code which has less memory footprint, better RAM/ROM usage than the handwritten code so that in future the developers can use Rhapsody for Code Generation rather than write the code by hand!
Any advice on how i should proceed?
Re: Real Time Embedded System Code Generation Tutorial?2013-01-11T14:25:09Z in response to SystemAdminI understood that you are using a C compiler, not C++. I don't have experience of generating code in C++, but I guess it is pretty much the same.
Generating code always means that you will have an overhead in code size. You will never be better than manual coding - this is not the aim of the tool. For instance you need a framework to run the UML model, for event handling, for implementation of ports,...
If you don't want to use all this you could use the minimal framework and implement your software just using files and functions - as you did before. But the only benefit will be that you can implement the functions using flow charts instead of directly coding. For me it's not worth to pay for Rhapsody license to do this.
Other possibility is to use classes, statecharts, ports to decouple you software components, events,... you will improve the documentation and allow better maintenance of your software. It will be easier to develop and share standard components because you do can avoid direct dependencies using ports. It will be possible to reduce development time maybe, because e.g. event handling is already implemented in the framework. This is where Rhapsody will support you. The price you need to pay is the increased code size...
Re: Real Time Embedded System Code Generation Tutorial?2013-01-11T14:59:57Z in response to SystemAdminThanks!
I am ofcourse ready to use framework. Infact the more new stuff I try, that much better my understanding will become.
So do you have experience on rhapsody framework? Any advice on how to start. I mean I know there is documentation on online help of rhapsody (here: http://publib.boulder.ibm.com/infocenter/rhaphlp/v7r6/index.jsp)
Would that be a good starting point or is there any tutorial or any documentation you know that can help me. I have never worked with the framework before.
purban 270001P4BH59 PostsACCEPTED ANSWER
Re: Real Time Embedded System Code Generation Tutorial?2013-01-11T15:09:02Z in response to SystemAdminSince you are using C++ you may want to use the Simplified Execution Framework (SXF). It is an optimized version of the framework and was designed for use in safety related applications. More information on it can be found in this help location:
Re: Real Time Embedded System Code Generation Tutorial?2013-01-11T15:15:52Z in response to purbanHi purban,
i am using C not C++.
If my previous post confused you, then, the link of documentation that i posted in my previous post is i think a generalized help of Rhapsody irrespective of language.
So any advice for Rhapsody in C ?
purban 270001P4BH59 PostsACCEPTED ANSWER
Re: Real Time Embedded System Code Generation Tutorial?2013-01-11T15:29:45Z in response to SystemAdminSorry, read the last posts wrong.
For C there is also a Simplified MicroC Framework ( AKA SMXF or MicroC Framework ) that could be used.
Here is a pointer in the help for it.
There is a video located here that may help.
Safety Critical Support SXF and SMXF frameworks
These frameworks are built as Rhapsody models and generated from Rhapsody. The models are found in the Share/LangC/smxf/model folder.