The Storyboard Engine has been designed to provide features through a plugin interface. This means that features can be removed or added dynamically at compile time. In an MCU environment, the process that is used to add in the plugins involves telling the engine which plugins are loaded using a structure in a header file and by making sure that the correct libraries are compiled into the binary that is going to be deployed to the target hardware.
The header file that controls which plugins are going to be loaded by the Storyboard Engine is called static_plugins.h and it is responsible for providing the engine with a list of plugins to iterate through and initialize. Here is an example of the static_plugins.h header file:
/*
* Copyright 2013, Crank Software Inc. All Rights Reserved.
*
* For more information email info@cranksoftware.com.
*/
#include <gre/sdk/plugin.h>
/*
* This is a list of the available plugins. Add the functions to the plugin list
* below to make the features available to your application
*/
// gre plugins
extern int gre_plugin_animate(gr_plugin_state_t *);
extern int gre_plugin_script_lua(gr_plugin_state_t *);
extern int gre_plugin_greio(gr_plugin_state_t *);
extern int gre_plugin_logger(gr_plugin_state_t *);
extern int gre_plugin_timer(gr_plugin_state_t *);
// Render extension plugins
extern int gre_plugin_circle(gr_plugin_state_t *);
extern int gre_plugin_poly(gr_plugin_state_t *);
const gr_plugin_create_func_t sb_plugins[] = {
gre_plugin_animate,
gre_plugin_script_lua,
gre_plugin_greio,
gre_plugin_circle,
gre_plugin_logger,
gre_plugin_poly,
gre_plugin_timer,
NULL,
};
If the gradient plugin was to be added to the engine, then the following declaration would need to be added:
extern int gre_plugin_gradient (gr_plugin_state_t *);
and the following would need to be added to the sb_plugins array:
gre_plugin_gradient,
The resulting header file would look like this:
/*
* Copyright 2013, Crank Software Inc. All Rights Reserved.
*
* For more information email info@cranksoftware.com.
*/
#include <gre/sdk/plugin.h>
/*
* This is a list of the available plugins. Add the functions to the plugin list
* below to make the features available to your application
*/
// gre plugins
extern int gre_plugin_animate(gr_plugin_state_t *);
extern int gre_plugin_script_lua(gr_plugin_state_t *);
extern int gre_plugin_greio(gr_plugin_state_t *);
extern int gre_plugin_logger(gr_plugin_state_t *);
extern int gre_plugin_timer(gr_plugin_state_t *);
extern int gre_plugin_gradient(gr_plugin_state_t *);
// Render extension plugins
extern int gre_plugin_circle(gr_plugin_state_t *);
extern int gre_plugin_poly(gr_plugin_state_t *);
const gr_plugin_create_func_t sb_plugins[] = {
gre_plugin_animate,
gre_plugin_script_lua,
gre_plugin_greio,
gre_plugin_circle,
gre_plugin_logger,
gre_plugin_poly,
gre_plugin_timer,
gre_plugin_gradient,
NULL,
};
In order for the functionality to be included in the binary that is being deployed to the target, the plugin library needs to be added to the list of libraries that are referenced in the tooling that is being used to create the binary for the target.
To continue along with this example, if the gradient plugin was the functionality that was being added, here are the steps to follow.
The gradient functionality is included in the library libgre-plugin-gradient.a. Below are the steps to include this library based on which IDE might be used.
To add the libgre-plugin-gradient library to an IAR project, click “Project->Options” and select the “Category: Linker with Library” entry from the list on the left hand side. Beside “Additional libraries” Click the ‘ellipsis’ button to display an “Edit Additional Libraries” dialog. Move to the end of the list and <Click to add> following libraries and add in the libgre-plugin-gradient.a. Typically this will need to include the path to the library, and if the setup that has been recommend from the integration guides has been followed this will be:
$PROJ_DIR$/../../../../../../<RUNTIME_NAME>/plugins/libgre-plugin-gradient.a
Where <RUNTIME_NAME> is the name of the runtime that is being used.
To add the gradient plugin to the compiler libraries, right click on the project and select “Properties”. In the properties pane expand the “C/C++Build” tree item in the pane that is on the left hand side of the screen. From the expended tree item, select “Settings”. In the settings pane on the right hand side, expand the tree item “MCU Linker” and select ”Libraries”. Add gre-plugin-gradient to the pane labelled “Libraries (-l)”
To add the gradient plugin to the compiler libraries, right click on the project and select “Properties”. In the properties pane expand the “C/C++Build” tree item in the pane that is on the left hand side of the screen. From the expended tree item, select “Settings”. In the settings pane on the right hand side, expand the tree item “MCU GCC Linker” and select ”Libraries”. Add gre-plugin-gradient to the pane labelled “Libraries (-l)”
| ||||||||||
---|---|---|---|---|---|---|---|---|---|---|
| ||||||||||
| ||||||||||
| ||||||||||
| ||||||||||
| ||||||||||
| ||||||||||
| ||||||||||
| ||||||||||
| ||||||||||
| ||||||||||
| ||||||||||
| ||||||||||
| ||||||||||
| ||||||||||
| ||||||||||
| ||||||||||
| ||||||||||
| ||||||||||
| ||||||||||
| ||||||||||
| ||||||||||