This is a simple example of how to use the RKH framework together with Yakindu Statechart Tool, since it provides a RKH specific C code generator for statecharts.
The behavior of blinky is defined by a simple statechart that looks as follows.
RKH is a flexible, efficient, highly portable, and freely available open-source state machine framework providing the infrastructure for quickly and safely developing reactive applications for real-time embedded systems.
RKH provides not only an unusual, efficient and straightforward method for implementing and executing state machines, but also the needed infrastructure to build reactive applications in embedded systems. It is composed of modules, procedures, and supporting tools; such as a method for implementing and executing flat state machines and statecharts, asynchronous messaging, cross-platform abstraction, run time tracing, time management, dynamic memory mechanism to deal with fragmentation, unit-test harness, plus others.
RKH allows developers to verify and validate a reactive application’s behaviour at runtime by means of the framework’s built-in tracer. It can utilize any traditional OS/RTOS or work without one. It also encourages the embedded software community to apply best principles and practices of software engineering for building flexible, maintainable and reusable software.
RKH is open source and licensed under the GNU v3.0. You can find the source code on GitHub.
If you want to learn more about the benefits of this flexible, efficient and highly portable state machine framework read on here.
In order to run and verify this example you have to download the RKH framework, install both Trazer tool and RKH code generator.
RKH can be obtained from its official repository by using the following Git commands:
git clone https://github.com/vortexmakes/RKH.git
RKH allows developers to verify and validate a reactive application’s behaviour at runtime by means of its built-in tracer. In addition, RKH provides a very simple but powerful console application, called Trazer, to visualize the trace events’ output in a legible manner. It can be downloaded and installed as follows.
If code generation does not work and Yakindu shows error markers on the model/Blinky.sgen file then you likely have to install the Yakindu RKH code generator. This can be done in the example wizard or in the SGen wizard.
./trazer -t 6602
The embedded Eclipse console shows up and the application starts
In order to debug the example
./trazer -t 6602
You will now see the debug perspective with the blinky application window open. The C/C++ editor repositions in the perspective.
While the application is running, you can validate and verify its
behaviour through the trace events showed on the Trazer output. Each
trace event includes a time stamp and additional information associated
with it. A capture of Trazer output is shown below. It shows the trace
records when the state machine processes a
after 1 sec
trigger. Since RKH can generate more than 100 different trace events
during its execution, its trace module allow you to filter one or more
of them in runtime, so you can choose the traces that you need.