Blinky example

The example Blinky is found in <ARXF_CP_V8.0.1 installation folder>\ARXF_CP_V8.0.1\Samples\Autosar\Model\Blinky

The example Blinky is in fact extending the BlinkySimple example to show a few topics:

Open the Rhapsody project Blinky:

The ArPackage RXFApplicationLayer contains:

The ArPackage CompositionPackage contains:

SW-Cs

The SW-Cs contain a few AUTOSAR specific details:

The symbols for the runnables are public symbols, but instead of having any declaration generated by Rhapsody, we rely on the RTE generated contracts. The Rhapsody generated code for an SW-C must include the contract generated by the RTE: SwcA.c must include Rte_Swca.h and so forth. Such contract may not be included twice in the same source, nor is it allowed that sources of an SW-C include a contract of another SW-C. So SwcB.c may not include Rte_Swca.h and/or Rte_Swcc.h - only Rte_Swcb.h

Using properties at the SW-C and runnable level, we get exactly what we want. The profile ArUML_ARXF_CP contains these properties and some StandardContent as well.

You can inspect the code for a runnable by double-clicking on it, to show its Features. The Implementation tab shows the code to generate:

An SW-C is represented by a structured class. It contains parts, to enforce static allocation of the objects which build up a particular SW-C. SwcA contains ControllerA and LED_SwcA. LED_SwcA is inherited from LED, because we want to re-use the LED class in multiple SW-Cs, but AUTOSAR does not allow LED.c to include generated RTE contracts of multiple SW-Cs.

When the timer of the controller elapses, it sends an event to the LED

AUTOSAR Tasks


In AUTOSAR, OS tasks are created statically and do not terminate. The tasks are configured in an AUTOSAR authoring tool. The RTE configuration specifies the relation between OS tasks and runnables. In the Rhapsody model, the tasks used actually refer to the OS tasks configured in the Basic Software.
The ArUML_ARXF_CP supports a TaskAllocationDiagram which we use to show the relation between classes and tasks and runnables and tasks.

Deployer

The Deployer will deploy Rhapsody generated source files and some generated configuration files into your IDE. If the combination of Rhapsody Component and Configuration has not been deployed yet, a Deployment Configuration dialogbox is shown.

Configuration Target

The Configuration Target is for AUTOSAR with configured Basic Software and RTE to build and run the three generated SWCs.

In the section Adaptation to AUTOSAR Authoring Tool is described which AUTOSAR details must be specified to get this example running in an AUTOSAR environment.

Please inspect some ArText files at <ARXF_CP_V8.0.1 installation folder>\ARXF_CP_V8.0.1\Samples\Autosar\ArText\RXF-artext which come with this product for informational purposes only. These will help you understand what to configure in your AUTOSAR tools:

Configuration Simulation

The Configuration Simulation can be used to build and run Blinky within Visual Studio.
If Visual Studio is not launched, do so and browse to the folder <ARXF_CP_V8.0.1 installation folder>\ARXF_CP_V8.0.1\Samples\Autosar\Model\Blinky\IDEProjects\Autosar\Simulation and select the solution file Blinky.sln

The Visual Studio project Blinky will automatically be updated and show the folders GeneratedModel, Library and RXF.

The folder Library is used for a mini-RTE using Windows threads to call your runnables.

Select Build | Build Solution which will result in a Blinky.exe which you can debug.

Select Debug | Start Debugging. Watch the breakpoints being hit and also inspect the Threads window.
Notice the two instances of SwcA: swca1 and swca2. These are both triggered by the mini-RTE.

The LED being switched on and off is simulated using printf() statements in LED_SwcA.c and LED_SwcB.c which are shown in a command window.

Please continue to the BlinkyPlusLegacy example