* Adjust definition to make the default constructor `constexpr`.
This permits use in classes that want lazy initialization and their
own `constexpr` constructor, such as `mstd::mutex`.
* Add `get_no_init()` method to allow an explicit optimisation for
paths that know they won be the first call (such as
`mstd::mutex::unlock`).
* Add `destroy()` method to permit destruction of the contained object.
(`SingletonPtr`'s destructor does not call its destructor - a cheat
to omit destructors of static objects). Needed if using in a class
that needs proper destruction.
Regularise the C++ support glue, adding `<mstd_type_traits>` etc.
These include the base toolchain file, backfill `namespace std` as much
as possible for ARM C 5, and then arrange to create unified
`namespace mstd`, which can incorporate toolchain bypasses
(eg `mstd::swap` for ARM C 5, or `mstd::atomic`), and include local
implementations of post-ARM C++14 stuff.
All APIs in `namespace mstd` are intended to function as their
`namespace std` equivalent, and their presence there indicates they
are functional on all toolchains, and should be safe to use in
an Mbed OS build (including not unreasonable memory footprint).
See README.md for more info.
As something of a cheat, exclude platform/cxxsupport from astyle.
astyle really can't process the sort of template metaprogramming going
on in there; treat it as a "black box" like the toolchains' own
libraries.
For all compilers add post-C++14 stuff to namespace mbed:
* invoke, invoke_result, is_invocable, is_invocable_r,
is_nothrow_invocable, is_nothrow_invocable_r, unwrap_reference,
unwrap_ref_decay
For ARM C 5, add C++11 bits based on above to namespace std:
* result_of, reference_wrapper, ref, cref, mem_fn
Previous fix assumed OsTimer is in use - it is for tickless RTOS builds
and non-RTOS builds, but non-tickless RTOS builds avoid it altogether
and use the SysTick peripheral.
Restore previous behaviour for those builds, and just always read the
tick count - there is no downside to this when ticking.
While in the code, make equeue_tick initialisation explicit. This was
problem if the OsTimer is not yet initialised when th
done while debugging - turns out not to be part of the fix, but it
speeds up the runtime code.
1. Update the clock divider setting
2. ADC resolution is 12-bits, update the API return value
to return 16-bit result
3. Update IOMUX setup
Signed-off-by: Mahesh Mahadevan <mahesh.mahadevan@nxp.com>
Kernel::get_ms_count is documented as not working from IRQ.
In RTOS builds it can return misleading answers - see
https://github.com/ARM-software/CMSIS_5/issues/625
In non-RTOS builds, it can trigger an assert, as it upsets the
sleep logic.
Modified code is still not ideal - could be improved further if
there was a fast path for "post now" that didn't bother looking
at timers (both at post time and dispatch time).
Revert back to older behaviour where we hold deep sleep lock only while
timing a sleep. Previous version was a speed optimisation, but broke
some tests.
Provide partial RTOS API for bare metal builds - things that
can be done in a single threaded environment.
Allows more code to work in both RTOS and bare metal builds without
change, and in particular gives easy access to the ability to
efficiently wait for something occurring in interrupt.
Available in bare-metal:
* ThisThread
* osThreadFlagsSet to set flags on main thread (can be set from IRQ)
* EventFlags (can be set from IRQ)
* Semaphores (can be released from IRQ)
* Mutex (dummy implementation)
Not useful:
* ConditionVariable (could only be signalled from 2nd thread)
* RtosTimer (calls in a second thread context)
* Thread
Unimplemented:
* Mail, Queue, MemoryPool
Possible future work:
* ConditionVariableCS to act as IRQ signalled ConditionVariable