This commit new configuration option `enable-multiple-instances` and
its corresponding option `OPENTHREAD_ENABLE_MULTIPLE_INSTANCES`. When
enabled OpenThread supports handling of multiple instances. By default
this is disabled.
This commit also adds two optimizations for single instance case to
simplify the code and also help reduce memory/RAM usage:
(1) OpenThread objects/classes typically keep a reference to a higher
level object (e.g., many classes keep track of owning `ThreadNetif`)
to be able to access other objects/methods within OpenThread class
hierarchy. In single instance mode, the reference member variables are
removed and instead global functions are used to access the singleton
objects from one class to the other. To implement this, a group of
`<Object>Locator` classes are defined (e.g., `ThreadNetifLocator`,
etc.) which are then used as base class of other OpenThread classes.
(2) OpenThread objects which provide a callback/handler (e.g.,
`Timer`, `Tasklet`, etc.) have `void *mContext` member variable which
is used to keep track of the owner of the object. In single instance
mode the `mConext` member variables are removed since the owner is
expected to be a singleton and can be uniquely determined from the
callback function.
To implement this, two changes are made: First the handler methods are
modified to provide a reference to the object (e.g., `Timer` handler
will provide a `Timer &aTimer` as a parameter of its handler
callback). Second, a new base class `Context` is introduced which
hides the implementation providing an arbitrary context information. A
new static method `GetOwner(aContext)` is added to classes which own a
callback providing objects. This method help convert a `Context` to
the reference of the owner class object.
* Added platform/toolchain.h toolchain abstraction layer via macros:
OT_TOOL_PACKED_BEGIN
OT_TOOL_PACKED_END
OT_TOOL_DEPRECATED(symbol)
* Make pretty. Rekick travis-ci.
* Added doxygen. Resolved review comments.
* Fixed doxygen sample for OT_TOOL_PACKED to include type name.
* Renamed OT_TOOL_PACKED_FIELD to simplify code searches for usage. Fixed all nested instances to use new naming.
* Fixed OT_TOOL_PACKED_FIELD renaming in doxygen.
* Make pretty.
* Documentation clarifications.
* Moved example into overview section.
* Fixed sdcc comment.
* Revised sdcc comment.
* Fix code style in toolchain packed doxygen example.
* Fixed example. Moved toolchain test to better match code style.
* Added test for OT_TOOL_PACKED_FIELD.
* Added support for clang. Just routes to gcc __attributes__. Verified by running unit test through clang on macos.