Commit Graph

951 Commits (83a9606140aabe6ab0276c85539d187e3dec7ca2)

Author SHA1 Message Date
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
Martin Kojtal a415dfae2d
Merge pull request #10964 from c1728p9/greentea_error
Add newline after mbed error so greentea shows it
2019-07-05 13:17:55 +01:00
Martin Kojtal efb84f062b
Merge pull request #10868 from kjbracey-arm/cxxsupport
Add C++11/14 support utility file
2019-07-05 13:15:16 +01:00
Russ Butler 130d5f1e11 Add newline after mbed error so greentea shows it
When the function `error` is called without ending in a newline
greentea will not display the error. This is because greentea is
performing line buffering.

This patch ensures that all calls to `error` end with a newline. This
is done by adding an additional newline to end end of the string.

Example code exhibiting this problem:
error("This function is not supported.");

Greentea output before this change:
++ MbedOS Error Info ++​
Error Status: 0x80FF0100 Code: 256 Module: 255​
Error Message: Fatal Run-time error​
Location: 0x1001766D​
Error Value: 0x0​
Current Thread: main  Id: 0x8003FD8 Entry: 0x1000E64F StackSize: 0x1000 StackMem: 0x8004AE8 SP: 0x8005898​
For more info, visit: https://mbed.com/s/error?error=0x80FF0100&tgt=target​
-- MbedOS Error Info --​
test suite run finished after 240.50 sec...

Greentea output after this change:
++ MbedOS Error Info ++​
Error Status: 0x80FF0100 Code: 256 Module: 255​
Error Message: Fatal Run-time error​
Location: 0x1001766D​
Error Value: 0x0​
Current Thread: main  Id: 0x8003FD8 Entry: 0x1000E64F StackSize: 0x1000 StackMem: 0x8004AE8 SP: 0x8005898​
For more info, visit: https://mbed.com/s/error?error=0x80FF0100&tgt=target​
-- MbedOS Error Info --​
This function is not supported.
test suite run finished after 240.50 sec...
2019-07-04 14:07:57 -05:00
Martin Kojtal e4b4539d27
Merge pull request #10837 from kjbracey-arm/toolchain11
Toolchain attributes - use C++11/C11
2019-07-04 15:35:29 +01:00
Martin Kojtal 34db82ead2
Merge pull request #10932 from tymoteuszblochmobica/allign16
Internal delay loop code alignment to 16
2019-07-03 11:59:41 +01:00
Martin Kojtal ccb63d771e
Merge pull request #10857 from ARMmbed/feature-watchdog
Add Watchdog and ResetReason
2019-07-03 11:43:52 +01:00
Martin Kojtal 400a7e4b77 error: add watchdog driver error 2019-07-02 12:46:23 +01:00
Martin Kojtal 737335c357 Remove watchdog manager
Use VirtualWatchdog instead
2019-07-02 12:46:23 +01:00
Tymoteusz Bloch 035221bdb1 Wait_ns () internal delay loop code alignment to 16 for decreasing execution time. 2019-07-01 14:34:43 +02:00
Martin Kojtal 85c477c1dc
Merge pull request #10609 from kjbracey-arm/us_ticker_optimise
wait_us optimization
2019-06-28 14:29:00 +01:00
Martin Kojtal a2c9152441
Merge pull request #10700 from LMESTM/hal_sleep_manager_test_update
Update HAL Sleep manager test to cope with STM32 LPTIM HW
2019-06-28 13:19:10 +01:00
Kevin Bracey c5b9779858 Remote "static" from MBED_FORCEINLINE
Static keyword causes problems when trying to use force-inlined
functions from normal inlined functions. This is not legal:

    static inline void forced() { }

    inline void normal() { forced(); }

You cannot reference internal-linkage things from external-linkage
inline functions.

Removal of the static implies that in C there would need to be a
non-inline definition in case anyone calls it non-inlined, but if the
force attribute is doing its job, that should not happen.

Only significant in-tree user of the MBED_FORCEINLINE macro is
the atomic operations - making this change permits atomic operations
from non-static inline functions.
2019-06-27 16:12:30 +03:00
Kevin Bracey 80afc3a169 Add C++11/14 support utility file
As we start trying to use new facilities, we're likely to need some more
helpers.

In particular, ARM C 5 has no C++11 support in its library at all, so
to avoid totally breaking it we need some backup.

For the other toolchains, we can add a few C++17/C++20/TS extensions
into namespace mbed to make life a little easier.

* For ARM C 5: C++14 type_traits subset, std::move, std::forward,
  std::array, std::initializer_list, std::begin, std::end,
  std::align, std::maxalign_t, std::aligned_storage,
  alignof + alignas macro replacements.
* For ARM C 5: MBED_CONSTEXPR_FN_14 and MBED_CONSTEXPR_OBJ_14 to
  mark things that can only be constexpr in C++14 or later.
* For other compilers: mbed::void_t, mbed::type_identity,
  mbed::conjunction, mbed::disjunction, mbed::negation,
  mbed::experimental::nonesuch, mbed::experimental::is_detected family,
  mbed::remove_cvref, mbed::as_const.
2019-06-27 14:03:56 +03:00
Martin Kojtal e40a76575f watchdog: fix copyright 2019-06-26 09:43:21 +01:00
Kevin Bracey a9453201fe Reduce Callback.h using C++11
The bulk of Callback.h was auto-generated as 6 specialisations, handling
zero to five arguments.

This can now be handled without specialisation using C++11 variadic
templates, reducing the file from 4,900 lines to 900 lines.

This should reduce compilation time, and offset potential increases from
use of `<type_traits>` or a local `mbed_cxxsupport.h` equivalent.

Several other improvents to `Callback` are possible and/or desirable
with C++11, such as the ability to store lambdas, but this commit is
purely the variadic simplification.
2019-06-24 13:06:37 +03:00
Przemyslaw Stekiel c4cb3de0a9 sleep_manager_can_deep_sleep_test_check(): do not use ticker common layer to count elapsed time. 2019-06-18 18:06:17 +02:00
Kevin Bracey 703af8df06 mbed_toolchain: Use C++11/C11 attributes
Newer language standards have standard forms for `MBED_NORETURN` and
`MBED_ALIGN` attributes. Use them when available.

C++14 also adds `[[deprecated]]`, but as it needs to go in the middle of
structure definitions as `class [[deprecated]] MyClass`, it's not a
total drop-in-replacemend for `MBED_DEPRECATED`, so that is not
attempted here.

Using standard forms increases the chances that code analysis tools such
Coverity will recognise them - particularly important for "no return".
2019-06-14 14:56:28 +03:00
Kevin Bracey 56a043cbd1 MBED_STRUCT_STATIC_ASSERT: Use standard C++11/C11
If available, we can use standard static_assert.
2019-06-14 14:56:12 +03:00
Kevin Bracey 700410049c MBED_STRUCT_STATIC_ASSERT - avoid alignment problem
The `int : 0` bitfield this produced could force integer alignment onto
the structure it was placed in, making a structure that should be 1 byte
be 4 bytes.

Change `int` to `bool` to minimise alignment impact - should be to
nothing.

Alignment/size problem was revealed in a `sizeof` check in an
`Atomic<uint8_t>` test.
2019-06-14 14:52:40 +03:00
Chun-Chieh Li 97dd30227d M23: Fix compile error with mbed fault handler
M23 doesn't implement Main Extension. So like M0/M0+, these registers HFSR/
MMFSR/BFSR/UFSR/DFSR are not present on M23. Remove access to them in mbed
fault handler for M23 targets.
2019-06-14 18:07:57 +08:00
Kevin Bracey a65b1a76ac wait_ns micro-optimisation
Use `+ 1` to set the "Thumb" indicator on the `delay_loop` routine
address, rather than `| 1`. That makes it something that can be done
by the linker, rather than needing to be done at run-time.

Saves one instruction and one cycle.
2019-06-14 10:22:08 +03:00
Kevin Bracey 57310729d4 wait_us optimization
As the timer code became more generic, coping with initialization on
demand, and variable width and speed us_ticker_api implementations,
wait_us has gradually gotten slower and slower.

Some platforms have reportedly seen overhead of wait_us() increase from
10µs to 30µs. These changes should fully reverse that drop, and even
make it better than ever.

Add fast paths for platforms that provide compile-time information about
us_ticker. Speed and code size is improved further if:

* Timer has >= 2^32 microsecond range, or better still is 32-bit 1MHz.
* Platform implements us_ticker_read() as a macro
* Timer is initialised at boot, rather than first use

The latter initialisation option is the default for STM, as this has
always been the case.
2019-06-14 10:22:08 +03:00
Anna Bridge fc645bc3ed
Merge pull request #10805 from kjbracey-arm/armc5_blinky
Fix ARMC5 compilation
2019-06-11 15:07:43 +01:00
Kevin Bracey 6df6decdfc Fix ARMC5 compilation
Minor tweaks to fix ARM C 5 compatibility.

Pushing "ns_list.h" include to first makes sure "ns_types.h" is included
first, meaning it gets to define `__STDC_LIMIT_MACROS` before the first
include of <stdint.h>, which ensures that UINT8_MAX etc are defined.
2019-06-11 13:00:14 +03:00
Martin Kojtal e7bc177b20
Merge pull request #10707 from kjbracey-arm/sized_delete
Add C++14 sized delete operators
2019-06-09 18:58:33 +01:00
Martin Kojtal eb12029215
Merge pull request #10742 from teijokinnunen/cthunk_free_fix
CThunk: Fix assertion when CThunk object is destroyed
2019-06-09 18:16:56 +01:00
Martin Kojtal 1e61f53544
Merge pull request #10705 from kjbracey-arm/atomic_thumb1
Atomics: GCC fix for M23 (ARMv8-M baseline)
2019-06-09 18:08:50 +01:00
Rajkumar Kanagaraj dc9fbfa6fb Fix for Problem copying the instance from BSS to stack
-Created global instance of either LowPowerTicker or Ticker
2019-06-03 16:32:14 +02:00
Rajkumar Kanagaraj 33793e710d Added the ticker support
-Modified the device dont have support of lp ticker will ticker for watchdog callback register
2019-06-03 16:32:14 +02:00
Rajkumar Kanagaraj dfe4b533c3 Update Watchdog
- Changed the process into static method
 - used the singletonptr for creating the low power ticker instance
 - Added the mbed stub into cmake build for cellularnonipsocket,loramacrypto
2019-06-03 15:31:20 +02:00
Rajkumar Kanagaraj cd26a74efb fix for astyle 2019-06-03 15:24:02 +02:00
Rajkumar Kanagaraj f94eb3cf13 Fix for the Ci build issue 2019-06-03 15:24:01 +02:00
Rajkumar Kanagaraj 43c2647be7 fix: Fixing rebased created bugs 2019-06-03 15:24:00 +02:00
Rajkumar Kanagaraj 47030cd23f SW watchdog unittest cases
-Added the mock class function to mock mbed_assert_internal
  -Added the unit test case to test start,kick,stop
  -Modified the interface api name from is_alive to process
  -added the unit test cases for process
2019-06-03 15:23:59 +02:00
Rajkumar Kanagaraj 3ea9521408 HW Watchdog and SW watchdog interface
- Added Hw watchdog periodic kick calls software watchdog is_alive check
2019-06-03 15:23:58 +02:00
Rajkumar Kanagaraj bcea865db2 Add SW Watchdog
-SW watchdog has interface name start(),stop(),kick()	Sw watchdog internally has static list and shared across multiple instance of SW watchdog
	- Sw watchdog initialize timeout value,unique string via constructor whenever threads created sw watchdog object
	-Threads make sure pass proper timeout value,Unique string while creating the instance.
	-start() called by components(BLE,WIFI etc.,),it adds the entry into static list with few details current count ,etc.,
	-kick() called by registered components(BLE,WIFI etc.) to reset current count to zero.
        -is_alive - interface API to mbed_watchdog_manager
        -implementation optimization
2019-06-03 15:23:57 +02:00
Rajkumar Kanagaraj 400b2ee8a7 Add HwWatchdog
- mbed_watchdog_mgr has interface name mbed_wdog_manager_start(),mbed_wdog_manager_stop(),mbed_wdog_manager_kick()
    - HwWatchdog is going to attach with LowPowerTIcker for periodic callback functionality
    - mbed_wdog_manager_start() will either get start either by BL/RTOS Aps,it reads the timeout value specified via macro and macro gets defined in target.json file.
    - mbed_wdog_manager_start() internally configure below HAL hw watchdog with timeout specified via target.json
    - mbed_wdog_manager_start() internally divide the timeout(specified in target.json) by the 2 and attach LowPowerTicker with periodic callback of hw_kick()
    - mbed_wdog_manager_start() internally create one instance of sw watchdog class,to access the static list data structure of sw watchdog class
    - mbed_wdog_manager_kick() function periodically get called and refresh the hw watchdog to avoid watchdog reset
    - converted C++ code into C based APIs
    - added boolean to control watchdog start and stop
    - Added detach from ticker on stop API
2019-06-03 15:23:56 +02:00
Teijo Kinnunen aade299c62 CThunk: Fix assertion when CThunk object is destroyed
In case the CThunk object is deleted without having called the
entry() function (and thus _entry is NULL), cthunk_free_real()
will fail with an assertion.
2019-06-03 13:11:07 +03:00
Kevin Bracey f88cd3fbca Add C++14 sized delete operators
Correct C++14 operation of the alloc wrappers requires us to define
custom sized delete operators.

Their presence won't cause any problem for people compiling as C++03 or
C++11.
2019-05-30 10:07:21 +03:00
Kevin Bracey 03f1ac3ffd Atomics: GCC fix for M23 (ARMv8-M baseline)
Add unified syntax directives to make the atomic assembler work when GCC
is building for M23.

GCC actually uses unified syntax when compiling C code, but puts
`.syntax divided` before each piece of inline assembly when targetting
Thumb-1 type devices like M0 and M23 for backwards compatibility. We can
overcome this with our own `.syntax unified`.  The command-line option
`-masm-syntax-unified` intended to override this globally has been
broken from GCC 6 to 8.0.
2019-05-29 16:48:41 +03:00
Chun-Chieh Li e9885feb20 Export wait_ns to be overridable
Some targets may not provide zero-wait-state flash performance. Export this function
to be overridable for targets to provide more accurate implementation like locating
'delay_loop_code' in SRAM.
2019-05-28 16:26:42 +08:00
Steven Cartmell 366893ae71 Add independent watchdog reference implementation for STM32 2019-05-24 11:20:25 +02:00
Steven Cartmell 6b3d790fc1 Add function to fetch platform specific reset reason register values 2019-05-24 11:20:24 +02:00
Steven Cartmell 41878bc3de Add Reset Reason platform API 2019-05-24 11:20:23 +02:00
Martin Kojtal 541dee4531
Merge pull request #10553 from korjaa/semihosting_docs
Add semihosting and SWO examples to mbed_override_console().
2019-05-23 21:40:37 +01:00
Jaakko Korhonen 9fb4437003 Update mbed_retarget.h coding style, star binds to the right. 2019-05-23 09:27:05 +03:00
Gabor Kertesz 40627a5220 Fix last issues
Imports working McuBoot for reset.
Updates microsec ticker driver.
Default baudrate is set to 115200 to see TF-M boot messages.
Stack top is set to scatter file dependent and not hard-coded.
2019-05-22 17:17:26 +03:00
Martin Kojtal 5be51a5b86
Merge pull request #9960 from marcuschangarm/fix-no-rtos-wait
Use LP tickers for waiting in no RTOS builds when available
2019-05-21 09:13:27 +01:00
Marcus Chang 6aca51fc17 Use LP tickers for waiting in no RTOS builds when available
For bare metal builds, use the lp_ticker for calls to wait_ms.
2019-05-16 07:02:06 -07:00
Kevin Bracey c799dc3332 ARMC5: fix mbed_atomic_impl.h assembly 2019-05-16 13:06:16 +03:00
Martin Kojtal 3ea1c56124
Merge pull request #10147 from kjbracey-arm/atomic_bitwise
Assembler atomics
2019-05-13 14:18:05 +01:00
Jaakko Korhonen a48d12683f Add semihosting and SWO examples to mbed_override_console(). 2019-05-10 10:05:06 +03:00
M. Rahimi d30bdbe08b Enabled crash reporting for DISCO_F407VG target 2019-05-07 19:25:46 +04:30
Martin Kojtal 1de0712272
Merge pull request #9944 from deepikabhavnani/stm32_splitheap
GCC - Add support to split heap across 2-RAM banks
2019-04-30 11:02:51 +01:00
Anna Bridge 23af842715
Merge pull request #10078 from OpenNuvoton/nuvoton_fix-heap-in-rtosless
Fix heap init error in rtos-less code
2019-04-26 13:31:10 +01:00
Kevin Bracey 2bb40450ec Add non-volatile atomic loads and stores
Volatile makes no real difference when we're using assembler, or locked
functions, but leaving it off could be more efficient for the basic
loads and stores. So add non-volatile overloads in C++ for them.
2019-04-26 13:12:35 +03:00
Kevin Bracey 87396e0bf6 Assembler atomics
Reimplement atomic code in inline assembly. This can improve
optimisation, and avoids potential architectural problems with using
LDREX/STREX intrinsics.

API further extended:
* Bitwise operations (fetch_and/fetch_or/fetch_xor)
* fetch_add and fetch_sub (like incr/decr, but returning old value -
  aligning with C++11)
* compare_exchange_weak
* Explicit memory order specification
* Basic freestanding template overloads for C++

This gives our existing C implementation essentially all the functionality
needed by C++11.

An actual Atomic<T> template based upon these C functions could follow.
2019-04-26 13:12:35 +03:00
Martin Kojtal 94898a12ab
Merge pull request #10358 from kjbracey-arm/error_print_improvements
Error print improvements
2019-04-17 08:04:15 +01:00
Martin Kojtal 237bf04507
Merge pull request #10395 from kjbracey-arm/mbed_error_warnings
mbed_error: Avoid negative left shift
2019-04-16 08:23:45 +01:00
Deepika 20a341d55f Add more information and comments 2019-04-15 12:00:19 -05:00
Kevin Bracey b8e80dd2fb Don't trap RTX errors or mutex errors during errors
Once a fatal error is in progress, it's not useful to trap RTX errors
or mutex problems, so short-circuit the checks.

This makes it more likely that we may be able to get the console
initialised if it is being written to for the first time by `mbed_error`
in a difficult context - such as an RTX error callback from inside an
SVCall.

For example, the one-line program

   osMutexAcquire(NULL, 0);

will generate an RTX error trap, then `mbed_error` will try to call
`write(STDERR_FILENO)` to print the error, which will prompt mbed_retarget to
construct a singleton `UARTSerial`. This would trap in the mutex
for the singleton or the construction of the UARTSerial itself, if
we didn't allow this leniency. If we clear the mutex checks, then
`UARTSerial::write_unbuffered` will work.
2019-04-15 11:29:04 +03:00
Kevin Bracey a4010942eb mbed_error: Avoid negative left shift
User uses of `MBED_MAKE_ERROR` assemble a new error that gets its bottom
16 bits from an existing negative 32-bit error code. This lead to
undefined behaviour when `<<` was used on it - even though it was a
shift by zero!

Avoid the undefined behaviour warning from Clang by masking before
shifting.
2019-04-12 17:31:46 +03:00
Martin Kojtal 4d56b94686
Merge pull request #10349 from studavekar/fix-nuvonton-crash-data
Fix crash capture feature for nuvoton
2019-04-12 14:13:58 +01:00
ccli8 64515c063f Fix heap init error in rtos-less code
In rtos-less code, heap is defined by assuming one-region. Through weak-reference to
ARM_LIB_HEAP, heap definition is fixed if ARM_LIB_HEAP is defined.
2019-04-12 14:34:37 +08:00
Cruz Monrreal 582edf503a
Merge pull request #10366 from kjbracey-arm/feature_CMSIS_5_ca812421
Update CMSIS to 5.5.1
2019-04-11 20:34:00 -05:00
Kevin Bracey 020f0e580d Astyle format mbed_fault_handler.[ch] 2019-04-10 16:04:43 +03:00
Kevin Bracey 07a2ca381b Move fault handlers to platform directory
Having them in cmsis causes grief when attempting to update CMSIS with
the importer script.
2019-04-10 14:36:52 +03:00
Deepika 3593444e93 Add support of heap memory split between 2-RAM banks.
Please note the heap address of the both the banks must not be contigious else
GCC considers it to be single memory bank and does allocation across the banks,
which might result into hard-fault
2019-04-09 12:08:49 -05:00
Kevin Bracey aa0e86475c mbed_error_puts: Prime STDERR_FILENO before writing
Prime the console outside the critical section, improving the chances of
nice initialisation.
2019-04-09 16:15:17 +03:00
Kevin Bracey f2a13a85a1 mbed_assert_failure: Don't take critical section
Assert failure took a critical section before calling `mbed_error`.

There's no need to take a critical section on assert failure -
mbed_error does not do this, and is designed to operate from normal
contexts.

Avoiding the critical section will improve the chances of console
initialisation due to assert failure working nicely.
2019-04-09 16:15:09 +03:00
Shrikant Tudavekar d810b85094 remove unused __CRASH_DATA_RAM_SIZE__ 2019-04-08 15:47:18 -05:00
Shrikant Tudavekar 4b182b92f1 enable crash capture for NUMAKER_PFM_NUC472 2019-04-08 15:36:28 -05:00
Kevin Bracey f6456d8c81 Add option to disable default UART console
New `target.console-uart` option added to indicate whether a target has
a console UART on STDIO_UART_TX/RX/RTS/CTS pins. (The existing option
`target.console-uart-flow-control` indicates whether RTS and or CTS is
available in addition to TX and RX).

The option defaults to true, and is currently true on all platforms. It
only applies if DEVICE_SERIAL is true, so no need to go through and mark
it false for non-SERIAL platforms.

An application can turn off target.console-uart to save ROM/power/etc if
they don't want to use the serial console.  If this is turned off, the
console won't be activated for stdin/stdout, but the application is
still free to open `UARTSerial(STDIO_UART_TX, STDIO_UART_RX)`
themselves.
2019-04-08 15:56:44 +03:00
Cruz Monrreal 8614382fe2
Merge pull request #10151 from kjbracey-arm/sleepmgr_optimise
Sleep manager: optimise counter
2019-03-28 17:09:42 -05:00
d-kato 090fcb007f Changed LOOP_SCALER of "wait_ns()" 2019-03-26 19:02:46 +09:00
Kevin Bracey b81cefb48c Sleep manager: optimise counter
No need for a critical section - can just use atomic ops.
2019-03-18 18:10:17 +02:00
Cruz Monrreal e417ad2a3a
Merge pull request #10122 from kjbracey-arm/mbed_error_warnings
mbed_error.c: fix warnings
2019-03-16 23:01:49 -05:00
David Saada eb5cef84fd Add bootloader support for the LPC55S69 board
bla
2019-03-16 00:13:40 +02:00
Kevin Bracey d40347f81e mbed_error.c: fix warnings
Correct printf formats, and avoid an unused static function warning.
2019-03-15 14:10:49 +02:00
Martin Kojtal 943254c78c
Merge pull request #9896 from kfnta/wait_us_no_usticker
wait_us without usticker
2019-03-14 09:44:25 +01:00
Mahesh Mahadevan 0aa8dc2383 Updated LOOP_SCALER value for Cortex-M33
Signed-off-by: Mahesh Mahadevan <mahesh.mahadevan@nxp.com>
2019-03-08 07:33:48 -06:00
Martin Kojtal e75794ec6e
Merge pull request #9888 from ARMmbed/feature-armc6
ARM Toolchain update to ARM Compiler 6.11(ARMC6)
2019-03-04 12:23:38 +01:00
Martin Kojtal f559d03ae2
Merge pull request #9766 from deepikabhavnani/uarm_fixes
Update Toolchain Arm Micro scatter files
2019-03-01 16:54:27 +01:00
Martin Kojtal 596b9f740e
Merge pull request #9797 from ARMmbed/fh_enable
API to temporarily enable/disable FileHandles
2019-03-01 14:26:18 +01:00
Michael Schwarcz 276ef91bb6 wait_us using wait_ns 2019-03-01 11:11:19 +00:00
deepikabhavnani 1182d640d3 Update retarget file for microlib 2019-02-28 19:54:38 -06:00
Cruz Monrreal e6caa122cb
Merge pull request #9812 from kjbracey-arm/wait_ns
Add wait_ns API
2019-02-28 18:21:46 -06:00
Cruz Monrreal eff8b1dbd1
Merge pull request #9800 from theotherjimmy/bm-lib
Bare-metal profile
2019-02-28 18:21:32 -06:00
Senthil Ramakrishnan 378a70ca62 Fixes for test fails and code style update 2019-02-28 12:00:10 -06:00
Senthil Ramakrishnan 7490b1c87f Api tests modification and uLib related fixes 2019-02-28 11:55:21 -06:00
Jimmy Brisson d1de429f82 Create the bare-metal library 2019-02-27 12:14:02 -06:00
Cruz Monrreal e1736cd06f
Merge pull request #9571 from mprse/fix_9523_rtos_less_issue
Update to 2-region model for HEAP and Stack Memory
2019-02-26 22:50:19 -06:00
Kevin Bracey 91b22f8bf3 Hand assemble to get alignment 2019-02-26 17:30:52 +02:00
Kevin Bracey 7215515880 Add wait_ns API
This provides the ability to generate really small delays - it's often
the case that wait_us() takes multiple microseconds to set up, so
having an alternative suitable for <10us delays is useful.

There have been a few local implementations - it makes sense to
centralise them as they need retuning for each new ARM core.

Based on the local implementation inside the Atmel 802.15.4 driver.
2019-02-26 17:30:51 +02:00
Martin Kojtal 5f38878f3a
Merge pull request #9791 from sarahmarshy/m0-start-app
Support mbed_start_application for Cortex-M0+
2019-02-25 09:40:37 +01:00
Sarah Marsh 3b98ebc5be Change to MOVS for all targets 2019-02-22 14:35:21 +00:00
Sarah Marsh 3c51257524 Change MOV to MOVS for M0+ 2019-02-22 13:22:12 +00:00
Kevin Bracey f91d044b6c Add mbed_file_handle lookup function
Add a necessary helper to allow FileHandle objects to be obtained
from POSIX file descriptors.

Primary envisaged use case is to act on STDIN_FILENO etc, eg to
set it non-blocking or use sigio, or to use the enable API.
2019-02-22 11:01:02 +02:00
deepikabhavnani 387e4ca9f4 New heap can be equal to heap limit for last chunk 2019-02-21 17:20:49 -06:00
Senthil Ramakrishnan 3fb8224237 Update mbed_stats.c to use __ARMCC_VERSION flag to be compatible with AC6 2019-02-21 17:12:09 -06:00
Sarah Marsh 15b573d83e Reuse nvic powerdown code block for M0+ 2019-02-21 16:07:26 +00:00
Kevin Bracey e96d6581db Add enable API to FileHandle
Add API to dynamically enable/disable input and output on FileHandles.
Aim is to allow power saving by indicating that we permanently or
temporarily do not require input, so that for example serial Rx
interrupts can be released, and deep sleep permitted.
2019-02-21 16:53:22 +02:00
Sarah Marsh 7201cab3c4 Support mbed_start_application for Cortex-M0+ 2019-02-21 11:17:51 +00:00
deepikabhavnani 1a1c74c38b mbed_rtx.h not to include in platform 2019-02-19 15:49:49 -06:00
Deepika f13a3e32b6 Fix GCC _sbrk allocation 2019-02-19 15:49:49 -06:00