REDAC HybridController
Firmware for LUCIDAC/REDAC Teensy
Loading...
Searching...
No Matches
loader::Plugin Struct Reference

A plugin (a synonym could also be "extension" or "module") is a small piece of user-defined code which he can send to the teensy at runtime where it gets executed. More...

#include <plugin.h>

Collaboration diagram for loader::Plugin:

Public Member Functions

bool can_load () const
 

Public Attributes

uint8_t * load_addr =0
 Absolute address in memory where the plugin is loaded to.
 
uint32_t size =0
 Actual size of plugin memory image.
 
Function entry
 entry points ("constructor function"). entry.addr is relative to load_addr.
 
optional< Functionexit
 destructor function. entry.addr is relative to load_addr.
 

Detailed Description

A plugin (a synonym could also be "extension" or "module") is a small piece of user-defined code which he can send to the teensy at runtime where it gets executed.

Plugins are written in C++ and have full access to the firmware API/ABI. This allows to write high level plugins which will feel like Arduino sketches or scripts. Technically, plugins are just compiled and statically linked machine code. That also means this code can do anything it wants on the teensy, such as directly communicating with the LUCIDAC blocks, registering message handlers, doing any kind of network or Serial line access, allocating heap memory, reading and writing the flash, etc. The fact that we use C++ as scripting language makes it very easy to expose the full API available. Since there is nothing between the loaded plugin and the firmware, the user has to be 100% sure that his ABI version matches the one running on the teensy. This is supported with SHA-2 hashes.

This plugin structure is used by Plugin Loaders in order to remember entry and exit point addresses. Plugins are thought like C++ classes, where the entry point is the constructor and the exit point is the destructor. If Plugins want to have further communication with the user, they have to use message handlers on their own.

Definition at line 47 of file plugin.h.

Member Function Documentation

◆ can_load()

bool loader::Plugin::can_load ( ) const
inline

Definition at line 53 of file plugin.h.

References load_addr, and size.

Member Data Documentation

◆ entry

Function loader::Plugin::entry

entry points ("constructor function"). entry.addr is relative to load_addr.

Definition at line 50 of file plugin.h.

Referenced by loader::SinglePluginLoader::load_and_execute().

◆ exit

optional<Function> loader::Plugin::exit

destructor function. entry.addr is relative to load_addr.

Definition at line 51 of file plugin.h.

Referenced by loader::SinglePluginLoader::load_and_execute().

◆ load_addr

uint8_t* loader::Plugin::load_addr =0

Absolute address in memory where the plugin is loaded to.

Definition at line 48 of file plugin.h.

Referenced by can_load(), and loader::SinglePluginLoader::load_and_execute().

◆ size

uint32_t loader::Plugin::size =0

Actual size of plugin memory image.

Definition at line 49 of file plugin.h.

Referenced by can_load(), loader::SinglePluginLoader::load(), and loader::SinglePluginLoader::load_and_execute().


The documentation for this struct was generated from the following file: