Thread - stack methods are not available for now, as tcb pointer was removed from
internal structure. To obtain it, we could get it from the kernel, but this should be
reconsidered. Either RTOS should provide it, or these methods will become deprecated.
Changes to the original kernel:
Cortex-M requires to define __CMSIS_OS_RTX, and __MBED_CMSIS_RTOS_CM. The macro __MBED_CMSIS_RTOS_CM
is mbed specific macro, to track changes to the kernel. This should keep us aware what has changed. For instance,
one breaking change was thread adding instances variable, which were not in mbed. This can be find as
it's protected via __MBED_CMSIS_RTOS_CM ifdef.
```
// added for mbed compatibility
// original RTX code
```
Startup for toolchains - mbed defines own stack pointer (set_main_stack()), therefore it should be called in the startup.
IAR added low level init calls and dynamic intialization to the IAR startup. All defined in RTX_CM_lib.h.
The timer thread has task id 0x01, main task 0x02. There are exception for main task not to check for
overflows. This is mbed specific, was reapplied from mbed code base.
IAR fixed SVC calls, this fix had to be reapplied (repo mbed PR 736 for more information).
FuncPtr provides a more flexible templated function class as a
replacement for FunctionPointer.
FuncPtr provides an intuitive template interface:
void doit(int, char *);
FuncPtr<void(int, char *)> doit_ptr(doit);
doit_ptr(10, "hi!");
FuncPtr places memory management on the user, only supporting
storing an extra pointer for pointers to externally stored objects
that can be passed to the function. Additional binding can be
supplied by an external class.
FuncPtr<void(int)> hello(&object, &Object::method);
Additionally FuncPtr provides a copy constructor, allowing FuncPtrs
themselves to be passed to existing interfaces.
FuncPtr<void()> hello(doit); ticker.attach(hello, 1000);
Exporters should provide additional information - what templates
are they using. For progen, it should be version, and we might add more
information later.
When a ticker is scheduled to run so fast that it is pending again
before the previous event has been processed then this next event
is processed (recursively) by calling into us_ticker_irq_handle().
This can lead to a stack overflow.
This patch prevents this recursion by replacing the call to
us_ticker_irq_handler() with a call to set the interrupt to pending
again. This allows the next timer event to be processed without
making the stack deeper.