Topic
  • 4 replies
  • Latest Post - ‏2013-06-29T19:36:59Z by Yevo
LookItsMe
LookItsMe
1 Post

Pinned topic Dynamic allocation of events

‏2013-04-24T08:26:12Z |

If found that for each event there are functions for create, destroy and cleanup generated. At least for my target they have a significant impact on the code size.

Is there a way to have those events statically defined? I found a property for Events, called "EnableDynamicAllocation". When I disable it some functions disappear, there is still a call to the cleanup function resulting in a compiler error.

Does anyone know if events can be statically defined and how to use this property correctly?

Thanks, Sebastian

  • shanz9903
    shanz9903
    277 Posts

    Re: Dynamic allocation of events

    ‏2013-04-24T09:00:10Z  

    Yes I reckon there are two ways to play this.

    1) Use BaseNumberOfInstances so events are dynamically created only during initialisation (on local heaps).

    or

    2a) Create events as <<static>> evEventX

    2b) Create the <<static>> stereotype just with CG::Event::DeleteAfterConsumption overidden to False and obviously applicable to Event.

        Stereotype description could read - Implies that an event is static and should not be deleted when consumed

    2c) Create attributes theEvEventX of type evEventX

    2d) Use itsClass->send(&theEvEventX) rather than GEN(theEvent)

       

     

    Updated on 2013-04-24T09:04:47Z at 2013-04-24T09:04:47Z by shanz9903
  • P1NK_Rhap
    P1NK_Rhap
    4 Posts

    Re: Dynamic allocation of events

    ‏2013-06-03T07:54:36Z  
    • shanz9903
    • ‏2013-04-24T09:00:10Z

    Yes I reckon there are two ways to play this.

    1) Use BaseNumberOfInstances so events are dynamically created only during initialisation (on local heaps).

    or

    2a) Create events as <<static>> evEventX

    2b) Create the <<static>> stereotype just with CG::Event::DeleteAfterConsumption overidden to False and obviously applicable to Event.

        Stereotype description could read - Implies that an event is static and should not be deleted when consumed

    2c) Create attributes theEvEventX of type evEventX

    2d) Use itsClass->send(&theEvEventX) rather than GEN(theEvent)

       

     

    Hello,

    This does work with Rhapsody in C++, but I'm trying to use this feature with Rhapsody in C, especially with the MicroC profile to target embedded systems.

    Attributes of type 'EventX' don't work this way because Rhapsody makes it as a EventX_t undefined struct

    Use of BaseNumberOfInstances also doesn't solve the problem since Event_Create methods are still declared in the resulting code but not defined

    Anyone ever used it with Rhapsody in C?

    Thanks, Jerome

  • P1NK_Rhap
    P1NK_Rhap
    4 Posts

    Re: Dynamic allocation of events

    ‏2013-06-27T14:11:02Z  

    bump

  • Yevo
    Yevo
    280 Posts

    Re: Dynamic allocation of events

    ‏2013-06-29T19:36:59Z  
    • P1NK_Rhap
    • ‏2013-06-03T07:54:36Z

    Hello,

    This does work with Rhapsody in C++, but I'm trying to use this feature with Rhapsody in C, especially with the MicroC profile to target embedded systems.

    Attributes of type 'EventX' don't work this way because Rhapsody makes it as a EventX_t undefined struct

    Use of BaseNumberOfInstances also doesn't solve the problem since Event_Create methods are still declared in the resulting code but not defined

    Anyone ever used it with Rhapsody in C?

    Thanks, Jerome

    It should work. EventX_t struct is defined in package. Probably you define an attribute of EventX type somewhere in the place, where there is no include of this package header file. 

    You can also take a look on Samples/CSamples/SMXF/Dishwasher model, which uses SMXF farmework (static framework for safety critical applications). This model (and framework itself) uses static event memory pool (BasenumberOfInstances) for event  allocation.

    May be usage of SMXF will meet your needs.