Book a Demo

Author Topic: Embedded C and Code Generation  (Read 4954 times)

Aergin

  • EA Novice
  • *
  • Posts: 2
  • Karma: +0/-0
    • View Profile
Embedded C and Code Generation
« on: February 23, 2011, 01:34:23 am »
We have used EA for a while in our office but to this point it was mostly to draw diagrams to include in documentation.  We are investigating if it is worth going further with the program to actually generate embedded C code.  I have been tasked with looking into this.  The biggest problem that I have encountered is a lack of examples with C code.  Being very new to this system, I am wondering where I can go to find some examples to play with and learn from.  The ones that I have found so far have done little to help with C code.

The other big problem I am having occurs when I attempt to generate code from state charts.  I get header and source files that are basically empty.  I am assuming that I am doing something wrong in this regard.  I set up state charts with entry/exit and do operations.  I then set up transitions based on signals.  But, I get nothing in the generated code.   How do I generate signals in the system?  For example, if I have two state charts that are running concurrently and I would like them to trigger transitions in the other by generating signals, is this possible?

Kevin G. Watson

  • EA User
  • **
  • Posts: 217
  • Karma: +0/-0
  • I love EVERYTHING including Microsoft
    • View Profile
Re: Embedded C and Code Generation
« Reply #1 on: February 25, 2011, 02:15:24 am »
Does EA generate 'C'?

Aaron B

  • EA Administrator
  • EA User
  • *****
  • Posts: 941
  • Karma: +18/-0
    • View Profile
Re: Embedded C and Code Generation
« Reply #2 on: February 25, 2011, 09:31:46 am »
See the notes at the top of the following user guide page:
http://www.sparxsystems.com/enterprise_architect_user_guide/8.0/software_development/code_generation_from_behaviora.html

Open Tools | Options, select the Source Code Engineering | C options page.  Make sure you have set Object Oriented Support to True.

Please also confirm which edition of Enterprise Architect you are currently running.  Software code generation from behavioral models is only available in the Business and Software Engineering, Systems Engineering and Ultimate editions of Enterprise Architect.

Kevin G. Watson

  • EA User
  • **
  • Posts: 217
  • Karma: +0/-0
  • I love EVERYTHING including Microsoft
    • View Profile
Re: Embedded C and Code Generation
« Reply #3 on: February 26, 2011, 06:35:09 am »
Aergin.... seemingly so....  you might want to peek at amuse, a simulation tool highlighted in this thread http://www.sparxsystems.com/cgi-bin/yabb/YaBB.cgi?num=1298549431

Remember everything has to be inside a class, even though C code hasn't got that concept at all... embedded sounds so cool till then.

Kevin [smiley=2vrolijk_08.gif]

Aergin

  • EA Novice
  • *
  • Posts: 2
  • Karma: +0/-0
    • View Profile
Re: Embedded C and Code Generation
« Reply #4 on: March 01, 2011, 11:22:56 pm »
Thanks for the replies.  It was definitely the Object Oriented Support option that was keeping the code from generating.  When the code generates now, like Martin P said, it seems to only be half there.  The only thing that seems to make it more complete is to add Guards onto each transistion.  Then it creates a complete if/else statement.  If this system is going to be feasible for our needs, we have to be able to have concurrent state machines that trigger from signals.  I have found very little information on this.  I can take a transition and set it to a signal.  I can use this same signals to trigger in the other state machines as well.  So to this point everything seems very good.  The state machines are linked together waiting for a signal.  But when I generate the code, it ignores the signals completely.  All that it seems able to do is evaluate a guard statement.  Is there something I need to do in order to trigger from the signals?  As a furthur question to this point, I don't see a way to generate a signal unless it is done as a behavior of an operation in a state.