Commit Graph

856 Commits (27571bc2d7a682293a0f4a4f2fc201b3fb972158)

Author SHA1 Message Date
Kyle Kearney 5820a3172f Fix typos in comments 2019-08-28 13:12:05 +01:00
Martin Kojtal 4cdca93e99
Merge pull request #11265 from kjbracey-arm/tuple
Add <mstd_tuple> and ARMC5 <tuple>
2019-08-28 10:04:52 +02:00
Kevin Bracey 4b4859cbd0 mstd_iterator: correct comments 2019-08-27 14:37:07 +03:00
Kevin Bracey 3664912acc mstd_utility: add missing integer_sequence helpers 2019-08-27 14:37:07 +03:00
Kevin Bracey d45e3b5e57 Add <mstd_tuple> and ARMC5 <tuple>
tuples will be useful for things like `mbed::Event` and
`mbed::Callback` - storing parameter packs from variadic templates.

Create a C++14(ish) `<tuple>` for ARMC5, and a `<mstd_tuple>` that
adds `apply` and `make_from_tuple` from C++17.
2019-08-27 14:37:07 +03:00
Andrew Chong 9edfad4eea mbed fault handler: changed the 2nd parameter type. 2019-08-21 17:02:34 +08:00
Andrew Chong e90c5674d4 Fixes the bug of having &mbed_fault_context argument instead of mbed_fault_context in mbed_fault_handler. 2019-08-21 16:38:36 +09:00
Martin Kojtal 73d6aa59af
Merge pull request #11211 from kjbracey-arm/mstd
Review follow-up mstd fixes
2019-08-20 09:53:23 +02:00
Anna Bridge 033fffea84
Merge pull request #11208 from kjbracey-arm/atomic_thumb1
Atomics: GCC fix for M23 (again)
2019-08-15 13:01:02 +01:00
Anna Bridge 575cffbc13
Merge pull request #11185 from gpsimenos/move-target-cortexm
Move rtos & platform TARGET directories to source
2019-08-15 12:56:36 +01:00
Evelyne Donnaes 1de64cbb4a Updated minimal-printf README 2019-08-13 13:18:46 +01:00
Kevin Bracey d31879a1d4 Atomics: GCC fix for M23 (again)
Add another missing unified syntax directive. Was previously fixed in
03f1ac3ffd, but the same problem was not addressed in the pending PR that
added the `NEWVAL_2OP` assembler.
2019-08-13 10:46:48 +03:00
Kevin Bracey ff0ce04d11 mstd::not_fn - fix declaration 2019-08-12 16:19:46 +03:00
Kevin Bracey cb5c09ff92 ARMC5 std::reference_wrapper - drop dead code 2019-08-12 16:19:46 +03:00
Kevin Bracey 71a5f857e1 Fix cxxsupport/README.md typo 2019-08-12 16:19:46 +03:00
Martin Kojtal f8dc035ae4
Merge pull request #11139 from sethitow/stm32f413-crash-capture
STM32F413 Crash Capture
2019-08-09 12:49:21 +01:00
Martin Kojtal fafd0a5480
Merge pull request #11051 from evedon/minimal-printf
Minimal printf addition
2019-08-09 09:52:36 +01:00
George Psimenos b37de68c74 Move TARGET directories to source 2019-08-08 11:59:16 +01:00
Hugues Kamba f0f408b2d8 Upstream PR #11073 review request changes (#11135)
* Modify Doxygen grouping of `drivers` Public/Internal APIs
* Correct classification of `mbed_events.h`
* Amend name of Doxygen group containing Device Key API
* Classify `CallChain.h` as public API and relocate file
* Remove Doxygen group from `equeue_platform.h` as it has no Doxygen compliant documentation
* Move USB target specific code back to `usb/device/targets`
2019-08-02 12:32:40 +01:00
Hugues Kamba 20f81e19be Change Doxygen groups structure, splitting first by Public/Internal (#11105)
* Change Doxygen groups structure, splitting first by Public/Internal

This commit also does the following:
* groups the documentation of related API
* moves `events/internal/equeue.h` to `events/equeue.h`
* merges `events/source/README.md` to `events/README.md`
2019-08-02 12:23:47 +01:00
Hugues Kamba 83354e46a7 Platform: Separate internal APIs from public APIs
Also includes:
* rename `mbed_sleep_manager.c` to `mbed_power_mgmt.c` to match its
  header file
* create Doxygen groups for public and internal APIs
* use relative path to include header files where inconsistent
* update references to internal APIs throughout libraries
* update the copyright year for all modified files
2019-08-02 12:23:47 +01:00
Seth Itow 4c4b95e502 platform: enable crash capture for DISCO_F413ZH target 2019-08-01 11:28:36 -07:00
Evelyne Donnaes 050a338771 Addressed review comments, in particular:
* Fixed wrapper functions for IAR
* Fixed and renamed profile to minimal-printf.json
* Moved minimal-printf under platform
* Removed minimal-printf/mbed_lib.json
* Modified exporter template to work with partial profile
* Prevented optimization of printf to avoid compiler function substitution
2019-08-01 12:42:24 +01:00
Evelyne Donnaes 65ab34695e Integrated minimal-printf in mbed-os 2019-08-01 12:41:59 +01:00
Kevin Bracey 940ed6c2b1 ARMC5 <array>: Add tuple interface 2019-07-19 17:24:14 +03:00
Kevin Bracey 0449e6f1a3 ARMC5 <array>: add comparison operators 2019-07-19 17:18:10 +03:00
Kevin Bracey 9f258c4798 ARMC5 <array>: remove not-working constexpr 2019-07-19 17:17:37 +03:00
Kevin Bracey fbf89272cc ARMC5 <array>: permit zero size 2019-07-19 17:17:07 +03:00
Kevin Bracey 85cd3cd9cc Add C++17 uninitialized storage ops 2019-07-18 20:02:07 +03:00
Kevin Bracey f27c7ecb64 Add ARMC5 unique_ptr
Standard library implementation should be fine for other toolchains.
2019-07-18 20:02:07 +03:00
Kevin Bracey b1c35b7a86 Move Atomic.h to <mstd_atomic>
`mbed::Atomic<T>` becomes `mstd::atomic<T>`, alongside the other
standard C++ library lookalikes.
2019-07-18 20:02:07 +03:00
Kevin Bracey da3cd6f053 Add <mstd_mutex>
Add add-standard-as-possible version of C++11 <mutex>.

A lot of the stuff in there is generic, but the actual mutex classes and
call_once need to interface with the OS.

For those, they're not available in ARMC5 or IAR; retargetting would be
necessary for ARMC6 and GCC, and I've yet to investigate how whether
that's possible. So for now I'm using local implementations.

Although `Mutex` in principle could support `timed_mutex` and
`recursive_timed_mutex`, we don't have `chrono` for the time parameters,
so hold off for now.

For the generic stuff like mstd::unique_lock, they are aliased to
std::unique_lock where possible.
2019-07-18 20:02:07 +03:00
Kevin Bracey 0bb4c050b7 SingletonPtr: API extensions, make constexpr
* 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.
2019-07-18 20:02:04 +03:00
Kevin Bracey 0aab1a9ea1 Split mbed_cxxsupport.h up - add namespace mstd
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.
2019-07-18 15:16:08 +03:00
Kevin Bracey 7c849cb664 C++ invoke related stuff
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
2019-07-18 11:50:13 +03:00
Martin Kojtal 3f0a5281e0 SysTimer: irq Cortex A fix C linkage 2019-07-15 10:13:50 +03:00
Kevin Bracey ccf59f8e81 SysTimer: don't always hold deep sleep lock
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.
2019-07-15 10:13:50 +03:00
Kevin Bracey 77321ca79e CPU stats don't require low power ticker 2019-07-15 10:13:50 +03:00
Kevin Bracey fc8e8f67c6 Deprecate wait/wait_ms APIs 2019-07-15 10:13:50 +03:00
Kevin Bracey 04cb39da07 Minimal C thread API 2019-07-15 10:13:50 +03:00
Kevin Bracey 89eba7303f Timed sleep rework 2019-07-15 10:13:49 +03:00
Kevin Bracey a1e1ab61a4 Switch SysTimer license to Apache 2019-07-15 10:13:49 +03:00
Kevin Bracey 20451082c1 Move SysTimer to platform, for non-RTOS use 2019-07-15 10:13:49 +03:00
Kevin Bracey 28b770510c CPU stats: strip more when disabled 2019-07-15 10:13:49 +03:00
Kevin Bracey d53bd6120d
Merge pull request #10274 from kjbracey-arm/atomic_template
Add Atomic<T> template
2019-07-12 14:26:03 +03:00
Kevin Bracey f9f073245b Add Atomic<T> template
Add a C++ `Atomic<T>` template to make atomics even easier. Basically
compatible with C++11 `std::atomic<T>`, but using the underlying
`core_util_atomic_xxx` functions from mbed_atomic.h, so appropriate for
synchronising with interrupts and optimised for uniprocessor.

One extra piece of functionality beyond the `core_util_atomic_xxx`
functions is the ability to have an arbitrary atomic type - eg a small
structure with 2 `uint16_t`s can be stored in a `uint32_t` container.
2019-07-09 19:09:02 +03:00
Kevin Bracey 5d2b37d205 mbed_atomic.h: Improve template type deduction
Avoid template ambiguities using type_identity_t.

Previously the compiler would be unable to figure out whether

     uint8_t x;
     core_util_atomic_store(&x, 0);

should invoke core_util_atomic_store<uint8_t>, matching the pointer
type, or core_util_atomic_store<int>, matching the value, leading to
an ambiguity error.

Templates now select only on the type of the atomic pointer parameter.
2019-07-09 19:09:02 +03:00
Kevin Bracey 3fd7e11595 mbed_atomic templates: add noexcept
Add noexcept for consistency with upcoming Atomic.h
2019-07-09 19:09:02 +03:00
Kevin Bracey f9f887d88e mbed_atomic_impl.h: Add pre-op (xxx_fetch) forms
Even though C/C++11 don't offer pre-op forms (that do the operation then
return the new value) of their freestanding functions, we will be making
them visible via pre-op operators on `Atomic<T>` (++, --, +=, -=, &=,
|=, ^=).

It is easier to do a pre-op than a post-op, as we can use one
fewer register in the assembler, so it's worth optimising for what will
be quite common cases. Make these forms accessible for `Atomic<T>`, but
don't document them for standalone use at this stage.
2019-07-09 19:09:02 +03:00
Arto Kinnunen 28eb39c724
Merge pull request #10885 from kjbracey-arm/callback_variadic
Reduce Callback.h using C++11
2019-07-09 13:54:42 +03:00