This includes a generic critical section implementation. This
implementation also allow a user to start a critical section while
interrupts are already disabled.
per @c1728p9
Update the Callback class to handle a NULL thunk by returning 0
rather than trying to call the thunk. This fixes a crash that occurs
on some targets when the TX uart handler is not attached.
Background:
The K64F HAL uart implementation calls the TX interrupt handler
every time a uart interrupt occurs while the TX register is empty.
It does not check to see if the TX interrupt has been enabled.
This means that the TX interrupt can and typically does get
run on RX events. This causes a crash with the newer callback
code which did not (prior to this patch) support a NULL thunk.
- Adopt C++11 style template arguments, requires rename to Callback
- Add constructor for C style callback functions
- Add constructor for Callbacks
- Add static function for passing to C style callbacks
This was causing errors at my machine (for programs like MBED_10, RTOS_1):
Error[Li005]: no definition for "__semihost" [referenced from
semihost_api.o(mbed.a)]
[ERROR] Error[Li005]: no definition for "__semihost" [referenced from
semihost_api.o(mbed.a)]