Use a Different Target


If you want to use a different target, you must deal with three levels of dependancies:
Please refer to RXFDeployerGuide.pdf to learn how you can use your own instances of these files.

The compiler options  are specific for the RXF being used, and their values are translated into #define's in the file  RxfDimensions.h which is normally generated in Rhapsody. In the CreateRXFLibrary you may need to modify the static RxfDimensions.h


When you modify existing files, you must enclose sections between #ifdef WST_TARGET_xx and #endif constructions, using existing constants or defining a new one. After you have implemented the following interface,

Files Description
WSTTarget.h This file must define the following functions:
  • WSTTarget_Init
This function is called as first call in RiCOXFInit(), which is the first call generated by Rhapsody in WST_RXF_Main(). So this is the place to hook code into when your target is not already initialized by your startup code, prior to calling main().

Its prototype is:

void     WSTTarget_Init( void );
  • WSTTarget_Cleanup
This function is not called by the RXF.
You must implement it and call it in your <Rhapsody component>__Cleanup() if you need it.

Its prototype is:

void     WSTTarget_Cleanup( void ); 
  • WSTTarget_enterCriticalRegion
This function is called by the RXF on entering a critical region.

Its prototype is:

void     WSTTarget_enterCriticalRegion( void );

In some cases an interrupt mask must be stored. In that case, you must set the constant WST_TARGET_SAVEISRMASK, in which case the prototype of the function is:

isrmask_t WSTRTOS_enterCriticalRegion( void );

For ARM, you can use the constant WST_TARGET_ARM_USE_SWI_FOR_CRITICAL_REGIONS if you want to use SWI handlers for this critical region function.
  • WSTTarget_exitCriticalRegion
This function is called by the RXF on exit of a critical region.

Its prototype is:


void     WSTTarget_exitCriticalRegion( void );

In some cases an interrupt mask must be restored. In that case, you must set the constant WST_TARGET_SAVEISRMASK, in which case the prototype of the function is:

void WSTTarget_enterCriticalRegion( isrmask_t mask );

For ARM, you can use the constant WST_TARGET_ARM_USE_SWI_FOR_CRITICAL_REGIONS if you want to use SWI handlers for this critical region function.
         
WSTTarget.c This file must implement the following functions:
  • WSTTarget_Init
See its description for WSTTarget.h.
  • WSTTarget_Cleanup
Optional, see its description for WSTTarget.h.
  • WSTTarget_enterCriticalRegion
See its description for WSTTarget.h.
  • WSTTarget_exitCriticalRegion
See its description for WSTTarget.h.

WSTRTOS.h This file must define the following macro:

  • RIC_MS_PER_TICK
The number of  ticks per milisecond.

This file must define the following functions:

  • WSTRTOS_Init
This function is called as second call in RiCOXFINit(), which is the first call generated by Rhapsody in WST_RXF_Main().
If you need to initialize a timer, you could also use RIC_MS_PER_TICK in here.

Its prototype is:

void    WSTRTOS_Init( void );
  • WSTRTOS_Cleanup
This function is not called by the RXF.
You must implement it and call it in your <Rhapsody component>_Cleanup() if you need it.

Its prototype is:

void    WSTRTOS_Cleanup( void );
  • WSTRTOS_incrementRxfTicks
This function is not called by the RXF.
You must implement it and call it as the heartbeat of your RXF, typically from within an Interrupt Service Routine.

Its prototype is:

void        WSTRTOS_incrementRxfTicks( void );
  • WSTRTOS_getRxfTicks
This function is called by the RXF.

Its prototype is:

timeUnit WSTRTOS_getRxfTicks( void );
  • WSTRTOS_sleep
This function is called by the RXF when no events are found in an event queue (timeouts also result in a event).

Its prototype is:

void             WSTRTOS_sleep( timeUnit aTime );
WSTRTOS.c This file must implement the following functions:

  • WSTRTOS_Init
See its description for WSTRTOS.h.
  • WSTRTOS_Cleanup
See its description for WSTRTOS.h.
  • WSTRTOS_incrementRxfTicks
See its description for WSTRTOS.h.

If you provide the heartbeat via a ISR, it is good practice to name this ISR WSTRTOS_timerInterrupt
  • WSTRTOS_getRxfTicks
See its description for WSTRTOS.h.
  • WSTRTOS_sleep
See its description for WSTRTOS.h.




Copyright (c) Willert Software Tools GmbH. All rights reserved.