Commit Graph

1058 Commits (0b4b2afaf42f6af1fa3a3c12ceffe560aed49bd0)

Author SHA1 Message Date
Marcin Tomczyk 1d3a1b7c6c ATCmdParser: unittests implementation 2019-11-20 22:37:01 -08:00
Marcin Tomczyk 15eb2a6e4f ATCmdParser: merge scanf and recv functions.The goal is to give a configuration parameter for this function which would indicate are we trying to find a match from one line(scanf) or do we might end up processing multiple lines(recv) to find a match. 2019-11-20 22:35:55 -08:00
Martin Kojtal fd22997b60
Merge pull request #11559 from kjbracey-arm/crc
MbedCRC and CRC HAL revisions
2019-11-13 18:24:04 +01:00
Martin Kojtal eab1c2e594
Merge pull request #11796 from hugueskamba/hk-add-minimal-console-to-retarget
mbed_retarget: Add a minimal console implementation to provide basic functionalities
2019-11-13 17:11:27 +01:00
Kevin Bracey 8811972201 Adjust code for MbedCRC changes
* Make mbed_error use bitwise MbedCRC call rather than local
  implementation.
* Remove use of POLY_32BIT_REV_ANSI from LittleFS.
* Move some MbedCRC instances closer to use - construction cost is
  trivial, and visibility aids compiler optimisation.
2019-11-13 14:31:49 +02:00
Hugues Kamba 051991fafb mbed_retarget: Add a minimal console implementation to provide basic functionalities
The retarget code allocates an array of FileHandle* for console and file
handling (filehandles). A tiny target only needs a console (putc/getc).
There is no need for file handling.

The POSIX layer and the array of FileHandle* is not required for small
targets that only need a console ; this code is optionally compiled
out if the configuration parameter platform.stdio-minimal-console-only is
set to `"true"`.
2019-11-11 15:14:00 +00:00
Martin Kojtal 6240335855
Merge pull request #11729 from hugueskamba/hk-fix-minimal-printf-percentage-printing
minimal-printf: Fix handling of the two character sequence %%
2019-10-23 16:19:44 +02:00
Hugues Kamba ceffb6ddeb minimal-printf: Fix handling of the two character sequence %%
The two character sequence %% is used in standard implementations of
printf to print a single %. This is because % is essentially printf's
escape character for format specifiers and as \% cannot work printf
uses %%.
Therefore to be compatible with string buffers containing
%%, minimal-printf also needs to only print a single %.
2019-10-23 11:30:54 +01:00
Hugues Kamba 8d9e0a86a6 minimal_printf: Fix high level C functions that print to the console
Ensure the file descriptor stdout is passed to `fputc` when the high
level C functions to print to the console are referenced.
This issue fixed only affected binaries built with the ARM toolchain.
2019-10-22 14:09:55 +01:00
Martin Kojtal 70f3cf89a0
Merge pull request #11699 from rajkan01/feature-os-cb-section
Fix for missing os_cb_section
2019-10-18 16:07:40 +02:00
Rajkumar Kanagaraj b88b6a5c8b fixed astyle issue 2019-10-18 03:06:19 -07:00
Rajkumar Kanagaraj f3b4eb3b33 Fix for missing os_cb_section
-Added the os_cb_section stub to remove the warnings
Incorporated the below review comment
 -Repharase source code comment
2019-10-17 03:28:28 -07:00
Kevin Bracey 93fbfafedf ARM toolchain: heap setup micro-optimisation
Locating and checking the length of the `ARM_LIB_HEAP` region is an
extra task, when we're just interested in the base and limit. Looking at
only those saves 8 bytes of ROM.

More space could be saved if we ensured all targets had `ARM_LIB_HEAP`,
removing the need for this run-time fallback code.
2019-10-17 12:39:33 +03:00
Alex Elium 4ffa363e63
mbed_rtc_time.h lacks an include guard
This PR adds it
2019-10-09 17:58:23 -05:00
Anna Bridge 8688b183a9
Merge pull request #11572 from kjbracey-arm/sbrk2_fix
Tighten GCC 2-region _sbrk
2019-10-03 11:19:37 +01:00
Dominika Maziec 948bad1ed9 ATCmdParser doxygen header's documentation scanf 2019-09-27 16:02:24 +02:00
Kevin Bracey 046379e629 Tighten GCC 2-region _sbrk
When moving to the second heap region due to overflowing the first
region, the `_sbrk` implementation assumed the allocation would fit in
the second region, and didn't check for that overflowing too.

Problem revealed in `stats_heap` test with GCC 8 on K64F - the allocation
attempt for 1GiB crashed, as `_sbrk` indicated 1GiB was available at the
start of the second region.
second region.

Presumably older versions of newlib fault that allocation attempt before
passing to `_sbrk`.

While there, adjust the code to not use a separate static `bool`, saving
RAM. We can track with just one pointer, as order of the two regions is
fixed, and already relied on by newlib.
2019-09-26 16:12:59 +03:00
Hugues Kamba cc7403457d Fix ARMC6 linker error for the bare metal profile
The ARMC6 compiler inadvertently introduces the `_scanf_mbtowc` symbol
to the build. The commit provides a weak definition of the symbol to
satisfy the linker whenever the symbol is included. This affects ARM
Compiler 6 version 6.12 and earlier.

The compiler error was previously observed when the MICROLIB library is
used with the uARM toolchain. However, the weak definition was put in
`mbed-os/rtos` which is not included when the bare metal profile is used.
2019-09-25 12:20:50 +01:00
Martin Kojtal 07ebd92f7b
Merge pull request #11494 from hugueskamba/hk-fix-coverity-iotcore-1334
Fix Coverity issue: Initialize FlashIAP non-static member in constructor
2019-09-24 14:58:29 +02:00
Laurent Meunier 9858b161d6 SysTimer deep sleep: Add local lock check and update comments
Suggested-by: @kjbracey-arm

Replace the sleep_manager_can_deep_sleep() with !_deep_sleep_locked.
Indeed, if we know we've taken the lock because we're using us_ticker,
no need to do the early wake.

Updated comments accordingly.
2019-09-19 14:25:59 +02:00
Laurent Meunier cd3105bb83 SysTimer should let deep sleep happen
When next SysTimer wake-up is scheduler far enough, always consider
that deep sleep may be entered and program an early wake-up.

So that even if deep sleep is only allowed some time later, it can be
entered. If not doing this, then the deep sleep would be prevented by
SysTimer itself and may not be entered at all.

This has been proved to happen in a simple blinly example.
2019-09-19 10:16:23 +02:00
Hugues Kamba 8ea9acad8e Fix Coverity issue: Initialize FlashIAP non-static member in constructor 2019-09-17 09:55:37 +01:00
Martin Kojtal 3c47010fd3
Merge pull request #11462 from hugueskamba/hk-minimal-printf-update-readme
Minimal-printf: Remove file printing in README and update tables
2019-09-17 09:12:05 +02:00
Hugues Kamba 93f50eef3d Suppress Coverity warnings 2019-09-12 15:44:55 +01:00
Martin Kojtal e090ef26d4
Merge pull request #11453 from hugueskamba/hk-fix-coverity-issues
Fix Coverity issues
2019-09-12 12:00:34 +02:00
Hugues Kamba c4d77b23fc Minimal-printf: Remove file printing in README and update tables 2019-09-11 15:44:07 +01:00
Martin Kojtal 91515fe2da
Merge pull request #11450 from hugueskamba/hk-minimal-printf-default-options-false
Minimal-printf: Set default configurations to false
2019-09-11 13:53:21 +02:00
Hugues Kamba e12400932d Fix Coverity issues
Issues fixed are related to:
* Non-static class member initialization in constructors
* Unused function return value
* Always false statements
2019-09-11 11:27:27 +01:00
Martin Kojtal 5e693778f4
Merge pull request #11441 from gpsimenos/gp-move-source-files
Organize source files and add Doxygen labels
2019-09-11 08:00:03 +02:00
Hugues Kamba 03c484a010 minimal-printf: Disable floating point support by default
Mbed OS should not require floating point in its base configuration.
This provides further code size savings out of the box.
2019-09-11 05:09:09 +01:00
George Psimenos bd95c53a4c Move source files and add Doxygen labels 2019-09-10 14:31:24 +01:00
Hugues Kamba 5933dec3b7 Harmonise Doxygen comments in drivers, events, platform and rtos dirs
When a Doxygen group has been defined (created), all its needed to add
documentation to that group is `\addtogroup`. Since all the information
about the group is preserved, it is not necessary to mention the group
hierarchy again with `\ingroup`. This PR removes unnecessary Doxygen lines
across the `drivers`, `events`, `platform` and `rtos` directories.

It also ensures that new groups are created with `\defgroup` once and
referenced with `\addtogroup` whenever documentation needs to be added to
an existing group.
2019-09-09 10:59:51 +01:00
Andrew Chong c257c5f0c7 mbed_error.c: Fixed another bug of possible stack overflow. 2019-09-06 16:49:09 +08:00
Andrew Chong bd9ec8b6d7 mbed_error.c: fixed the dump core function's bug of possible stack overflow. 2019-09-06 16:33:09 +08:00
Andrew Chong a769b7db43 mbed_error.c: Fixed compile errors with non-RTX targets. 2019-09-05 17:55:31 +08:00
Andrew Chong 76353d5476 mbed_error.c: now dumping MSP/PSP stacks correctly. 2019-09-05 17:55:31 +08:00
Andrew Chong 0da589e6e7 mbed_error.c: handler mode failures will dump MSP/PSP stacks. 2019-09-05 17:55:31 +08:00
Andrew Chong da2f8e5b79 mbed_error.c: reducing RTX restriction. 2019-09-05 17:55:31 +08:00
Andrew Chong 95d2eb83a3 platform: stack-dump-enabled default value to false. 2019-09-05 17:55:31 +08:00
Andrew Chong 5258768bc7 The stack dump of the major should be moved up. 2019-09-05 17:55:31 +08:00
Andrew Chong 7dc53176ae mbed_error.c: Now we can stack dump on all possible threads. 2019-09-05 17:55:31 +08:00
Andrew Chong db1e2d3b24 astyle to mbed_error.c 2019-09-05 17:55:31 +08:00
Andrew Chong 5671416d5e handle_error: Now supports HW exception from handler mode. 2019-09-05 17:55:31 +08:00
Andrew Chong 835a7639a9 print_error_report: Paying extra caution on address alignment. 2019-09-05 17:55:31 +08:00
Andrew Chong 575bd31060 print_error_report: Don't care about osRtxStackFillPattern and dump whole remaining. 2019-09-05 17:55:31 +08:00
Andrew Chong 248746113f Now stack dump is done correctly to the other way around. 2019-09-05 17:55:31 +08:00
Andrew Chong 50daa7e40f platform.stack-dump-enabled feature is added. 2019-09-05 17:55:31 +08:00
Andrew Chong 57ed4f36fa Removed #warning of non-Cortex-M. Minor comment adjustment. 2019-09-05 17:55:31 +08:00
Andrew Chong d69dc4940e Fixed astyle failures on handle_error(). 2019-09-05 17:55:31 +08:00
Andrew Chong 9af7ea58d4 The candidate code to enable correct crash report for HW fault crashes. 2019-09-05 17:55:31 +08:00
Hugues Kamba 8c22bbbbc8 Use PRIu32 to print uint32_t variable
As the variable underlying type size is different depending on the
toolchain used
2019-09-03 09:29:06 +01:00
Evelyne Donnaes d9f32639eb Changed minimal-printf to call fputc so that it does not bypass the retargetting code
Removed minimal-printf-console-output
2019-08-29 11:30:34 +01:00
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
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