Topic
8 replies Latest Post - ‏2013-01-23T09:21:49Z by SystemAdmin
SystemAdmin
SystemAdmin
1305 Posts
ACCEPTED ANSWER

Pinned topic Real Time Embedded System Code Generation Tutorial?

‏2013-01-11T10:29:23Z |
Hello all
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!
Updated on 2013-01-23T09:21:49Z at 2013-01-23T09:21:49Z by SystemAdmin
  • SystemAdmin
    SystemAdmin
    1305 Posts
    ACCEPTED ANSWER

    Re: Real Time Embedded System Code Generation Tutorial?

    ‏2013-01-11T10:56:32Z  in response to SystemAdmin
    Hello,

    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.
    • SystemAdmin
      SystemAdmin
      1305 Posts
      ACCEPTED ANSWER

      Re: Real Time Embedded System Code Generation Tutorial?

      ‏2013-01-11T13:37:49Z  in response to SystemAdmin
      Thanks 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?
      • SystemAdmin
        SystemAdmin
        1305 Posts
        ACCEPTED ANSWER

        Re: Real Time Embedded System Code Generation Tutorial?

        ‏2013-01-11T14:25:09Z  in response to SystemAdmin
        I 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...
        • SystemAdmin
          SystemAdmin
          1305 Posts
          ACCEPTED ANSWER

          Re: Real Time Embedded System Code Generation Tutorial?

          ‏2013-01-11T14:59:57Z  in response to SystemAdmin
          Thanks!

          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.