Commit Graph

1206 Commits (a07c00e6c3b65b880088f21bb120c5736047e700)

Author SHA1 Message Date
Martin Kojtal b611de8b6b
Merge pull request #12550 from rajkan01/mbedint_remove_deprecated
Remove mbed interface deprecated API
2020-03-04 08:22:27 +00:00
Martin Kojtal 40fb45e4da
Merge pull request #12549 from rajkan01/fh_remove_deprecated
Remove FileHandle deprecated APIs
2020-03-04 08:21:52 +00:00
Martin Kojtal 6e6603f97d
Merge pull request #12534 from rajkan01/callchain_remove_deprecated
Remove the deprecated CallChain class and its APIs
2020-03-03 14:57:59 +00:00
Martin Kojtal 2dc5520c2b
Merge pull request #12553 from rajkan01/dh_remove_deprecated
Remove DirHandle deprecated APIs
2020-03-03 14:57:16 +00:00
Martin Kojtal d94965f38d
Merge pull request #12508 from evedon/ed-mprintf-stack-overflow
Fix minimal-printf stack overflow
2020-03-03 14:39:11 +00:00
Rajkumar Kanagaraj 2a1c641ad3 Remove FileSystemLike deprecated APIs 2020-03-02 16:20:02 -08:00
Rajkumar Kanagaraj dd9afdf77c Remove DirHandle deprecated APIs 2020-03-02 15:42:31 -08:00
Rajkumar Kanagaraj 35f1b4ab53 Remove mbed power management deprecated API 2020-03-02 15:06:26 -08:00
Evelyne Donnaes 5016fa1a10
Merge branch 'master' into minimal_printf_default 2020-03-02 17:31:37 +00:00
Evelyne Donnaes 0f2b0d1be5 Fixed greentea tests 2020-03-02 17:27:17 +00:00
Rajkumar Kanagaraj 5d0aab847e Remove mbed interface deprecated API 2020-03-02 09:00:01 -08:00
Rajkumar Kanagaraj 13a1130697 Remove the deprecated FileHandle APIs 2020-03-02 06:45:01 -08:00
Rajkumar Kanagaraj 6e969ec5ab Remove the deprecated CallChain class and its APIs. 2020-02-28 07:41:44 -08:00
Rajkumar Kanagaraj b3ba0905ac Remove the deprecated CriticalSectionLock APIs 2020-02-28 07:19:19 -08:00
Martin Kojtal 272c42d0fe
Merge pull request #12527 from rajkan01/atcmd_remove_deprecated
Remove the deprecated ATCmdParser APIs.
2020-02-28 09:48:05 +00:00
Martin Kojtal fc5f3259de
Merge pull request #12458 from GaborAbonyi/add_musca_b1_platform
Add Musca B1 target
2020-02-27 13:53:58 +00:00
Rajkumar Kanagaraj 72d2f40bff Remove the deprecated ATCmdParser APIs. 2020-02-27 04:51:36 -08:00
Martin Kojtal 32f615e420
Merge pull request #12495 from kjbracey-arm/override_serial
C++11-ify virtualisation in FileHandle + Serials
2020-02-25 16:00:43 +00:00
Evelyne Donnaes a02f4b4856 Fix minimal-printf stack overflow 2020-02-25 10:44:11 +00:00
Kevin Bracey c39959ca8b C++11-ify virtualisation in FileHandle + Serials
Use `override` and `final` where appropriate, and eliminate unnecessary
`virtual`.
2020-02-24 10:37:17 +02:00
Anna Bridge 8c17270306
Merge pull request #12480 from 0xc0170/fix_spdx
Fix SPDX identifiers and licenses (excluding features and targets)
2020-02-21 16:34:30 +00:00
Tamas Kaman 551c3c553c Add ARM_MUSCA_B1 as a new target platform
Musca-B1 is a Cortex-M33 based target with security extension enabled.

- ARM_MUSCA_B1 is the non-secure target running mbed-os.
- ARM_MUSCA_B1_S is the secure target running TF-M.
- TF-M sources were imported and patched in previous commits.
- TF-M secure bootloader (McuBoot) for MUSCA_B1 is submitted by a
  pre-built binary.
- A post-build hook concatenates The secure and non-secure binaries,
  signs it and then concatenates the bootloader with the signed binary.

Change-Id: I4b36290941b5f0bb7aa7c12dda2f38b5c1e39ae2
Signed-off-by: Tamas Kaman <tamas.kaman@arm.com>
Signed-off-by: Gabor Abonyi <gabor.abonyi@arm.com>
2020-02-21 14:34:39 +01:00
Martin Kojtal 9cb8a12cc2 fix SPDX identifier typos 2020-02-21 07:01:55 +00:00
Martin Kojtal 21ad8af815 platform: fix SPDX identifiers 2020-02-21 07:00:58 +00:00
Bartek Szatkowski 954f22bb52 minimal-printf: Disable float by default 2020-02-19 15:29:39 +00:00
Bartek Szatkowski f9be9dc5be minimal-printf: Explicitly print %ll[diuxX] when 64b disabled 2020-02-19 15:29:38 +00:00
Bartek Szatkowski 554a04ba5f minimal-printf: README updates 2020-02-19 15:29:38 +00:00
Bartek Szatkowski 30c947efbb Enable minimal-printf by default for all builds
Also reenable floating point by default.
2020-02-19 15:29:38 +00:00
David Lin d725b13906
Fixed typo: 'lenght' in minimal-printf
Note that the word 'lenght' is wrong,
so that 'lenght' should been replaced with 'length'.
2020-02-16 18:11:18 +08:00
Evelyne Donnaes ae57b4303e Fix thread_sleep_for zero 2020-02-06 15:19:18 +00:00
Maciej Bocianski 63d14f3af4 add dummy SUPER_REALLOC/CALLOC calls to alloc wrappers
This code prevents the ARMC6 compiler/linker from removing
SUB_REALLOC/CALLOC symbols from image when LTO is enabled

Fixes below error:
L6137E: Symbol $Sub$$calloc was not preserved by the LTO codegen but is needed by the image.
2020-02-04 12:29:53 +01:00
Maciej Bocianski 783953e5dc ARMC6 keep __user_setup_stackheap symbol when LTO enabled
Fix for the error L6915E: Library reports error: Heap was used, but no heap region was defined
2020-02-04 12:29:53 +01:00
Martin Kojtal 250e58134f
Merge pull request #12286 from pea-pod/target-nucleo_l452re-p
Add new target: NUCLEO_L452RE-P
2020-02-03 16:34:36 +00:00
Kevin Bracey d063902ee8
Merge pull request #12336 from SeppoTakalo/disable_writebuf
Disable write buffering on debug builds.
2020-01-31 16:24:04 +02:00
Kevin Bracey 65a5d1b682
Merge pull request #12326 from kjbracey-arm/systimer_abs_fix
Correct SysTimer absolute time calculations
2020-01-31 15:01:36 +02:00
Seppo Takalo c352488412 Disable write buffering on debug builds.
In mbed_start_application() there was a code that was supposed to
set DISDEFWBUF to one when running a debug build. However, this code
was in the wrong place, as this function is only called from
bootloader.

Move the code to correct place so that standalone applications use it
as well.

For the reference of DISDEFWBUF bit, see
http://infocenter.arm.com/help/index.jsp?topic=/com.arm.doc.dui0552a/CHDCBHEE.html
2020-01-30 16:19:28 +02:00
Kevin Bracey de915a034b Correct SysTimer absolute time calculations
`SysTimer::set_wake_time` incorrectly assumed that the `SysTimer`s tick
count and the underlying HAL timer had the same zero base. This normally
holds, at least approximately, in RTOS builds where the HAL timer starts
from zero at the same time the SysTimer is initialised.

But in bare metal builds, the HAL timer could be started some time
before the SysTimer, giving a significant discrepancy.

Beyond that, there's no requirement for HAL timers to start from zero in
the spec.

Record the HAL timer start time to get the conversion right.
2020-01-29 15:28:20 +02:00
Rajkumar Kanagaraj 16fcdaa56f minimal-printf: README correction
- Updated the README with "target.printf_lib"
2020-01-28 06:56:12 -08:00
pea-pod f7c4693747 Add new target: NUCLEO_L452RE-P 2020-01-27 18:41:18 -06:00
Rajkumar Kanagaraj f1e1375685 Fix for the missing retrieve error context function call.
- Add the function to retrieve error context after a fatal error is called at
   system initialisation for the bare metal profile.
2020-01-23 07:39:29 -08:00
Anna Bridge 706625a982
Merge pull request #12297 from evedon/ed-update-mprintf-doc
Corrected minimal-printf README
2020-01-23 12:12:37 +00:00
PARKJIHOON 8ab00df7b4 Adding Samsung Exynos i S111 target code.
Adding a new target of HW development kit using [Samsung Exynos i S111](https://www.samsung.com/semiconductor/minisite/exynos/products/iot/exynos-i-s111/) module to Mbed-OS.
This will widen the HW choices of Mbed-OS enabled NB-IoT, GNSS and Security (eFuse, AES, SHA-2, PKA, Secure Storage, Security Sub-System, [PUF](https://en.wikipedia.org/wiki/Physical_unclonable_function)) modules.
Target Name: S5JS100

Co-authored-by: Ivan Galkin <ivan.galkin@samsung.com>
Co-authored-by: Seokwon Lee <swon.lee@samsung.com>
Co-authored-by: Zhizhe Zhu <zhizhe.zhu@samsung.com>
Co-authored-by: Xinyi Zhao <xinyi.zhao@samsung.com>
2020-01-22 14:40:50 +09:00
Anna Bridge 40a0b28068
Merge pull request #12225 from evedon/ed-heap-stack-test
Fix baremetal heap and stack initialisation
2020-01-21 16:27:37 +00:00
Evelyne Donnaes 7205b73ada Corrected minimal-printf README 2020-01-21 16:21:05 +00:00
Anna Bridge 80fe861f1d
Merge pull request #12035 from kjbracey-arm/callback_prep
Preparation for Callback changes
2020-01-21 11:50:43 +00:00
Evelyne Donnaes 3e3af70afc Fixed baremetal heap and stack initialisation.
Enabled heap_and_stack test for baremetal.
Added a test to check that global variables are initialised.

In mbed_sdk_boot:
- Added initialisation for mbed_stack_isr_start/size and mbed_heap_start/size for all toolchains.
- ARM toolchain:
   - Added call to mbed_toolchain_init() to initialise global variables.
   - Moved microlib initialisation code from mbed_retarget.cpp to mbed_sdk_boot.c.
- IAR toolchain: there is no equivalent to a software init hook that can be called. __low_level_init() was used but since this function is called before RAM initialisation, it cannot be used to initialize global variables. Defined a new __mbed_init() function called from IAR startup file instead.
2020-01-21 10:13:16 +00:00
Martin Kojtal 18c941cc84
Merge pull request #12207 from hugueskamba/hk-add-buffered_serial
Add BufferedSerial class to replace UARTSerial
2020-01-16 10:06:22 +00:00
Hugues Kamba a74ffacf81 Remove usage of UARTSerial in Mbed OS Core diretories
Replace with BufferedSerial as UARTSerial has been deprecated.
2020-01-13 13:20:57 +00:00
Hugues Kamba 3b59f6ce4d Minimal-printf: Fix wrapping of printf functions for the ARM compiler
As the ARM compiler is in GNU compatible mode, it defines __GNU__ which
(based on pre-processor condition in  mbed_printf_implentation.h)
causes the printf functions to be wrapped using _wrap_* instead of
$Sub$$*.

This commit modifies the pre-processor
conditions to check for __GNUC__last in order to correctly
substitute the printf functions depending on the toolchain in use.

It also gets rid of $Super$$* substitution as it is not needed. $Super$$
is used to identify the original unpatched functions.

Missing substitutions for ARM compiler internal optimized "printfs" are
also added.
2020-01-13 11:24:57 +00:00
Kevin Bracey d6a48b5124 Turn NULLs into nullptr
Avoids overload problems with Callback(nullptr) versus Callback(fnptr).
2020-01-09 14:52:54 +02:00
Kevin Bracey 9577b0853b Add mstd_new for mstd::launder
Increasingly clever compilers can hit funny aliasing problems with
object stores like mbed::Callback. Add access to the C++17 launder
facility.
2020-01-09 14:52:50 +02:00
Martin Kojtal 8c4ed4a6cb
Merge pull request #11897 from kjbracey-arm/crc
MbedCRC: improve init value handling and tests
2020-01-09 13:31:30 +01:00
Martin Kojtal 222d31c2b6
Merge pull request #12037 from kjbracey-arm/sharedptr_move
SharedPtr: add move operations
2020-01-09 12:03:45 +01:00
Kevin Bracey 07d43b72d2 Add mstd::is_constant_evaluated
GCC 9 and sufficiently-new Clang (including ARM Compiler 6.13) give us
access to the C++20 (draft) `is_constant_evaluated` test. Allows us to
restrict code to compile-time only.

This is particularly useful when using assembler intrinsics, which the
compiler cannot optimise or compile-time evaluate. It allows us to write
something like

    constexpr uint32_t reverse_bits(uint32_t x)
    {
        if (is_constant_evaluated(x)) {
            // C code to do calculation here
            return x;
        } else {
            // an assembler intrinsic that cannot be optimised
            return __RBIT(x);
        }
    }

This can then be totally compile-time given a constant input.

(In this example, ultimately it would be a good idea to include this
functionality in CMSIS's GCC `__RBIT`, which needs it because GCC
requires use of assembler. Clang implements `__RBIT` as a built-in,
meaning it can already compute it at compile-time, so does not benefit.).
2020-01-08 13:36:17 +02:00
ccli8 ad80ed17fc [M2351] Change default stdio-baud-rate to 115200 2020-01-06 15:55:00 +08:00
Martin Kojtal fc2a71064d
Merge pull request #12068 from rajkan01/feature_bare_metal
Enabling small C library option and deprecating uARM toolchain
2020-01-03 11:35:48 +00:00
Martin Kojtal a7b312d687
Merge pull request #12175 from hugueskamba/hk-minimal-printf-fix-readme
Minimal-printf: Fix documentation as floating point is disabled by default
2020-01-02 10:11:47 +00:00
Hugues Kamba d3d1b74e79 Minimal-printf: Fix documentation as floating point is disabled by default 2019-12-30 11:28:16 +00:00
Heath Petersen a6b0909794 namespace and extern C don't need semicolon 2019-12-26 16:08:22 -06:00
Rajkumar Kanagaraj 957dca2082 Enabling small C library option and deprecating uARM toolchain
- By default, Mbed OS build tools use standard C library for all supported toolchains.
   It is possible to use smaller C libraries by overriding the "target.default_lib" option
   with "small". This option is only currently supported for the GCC_ARM toolchain.
   This override config option is now extended in the build tool for ARM toolchain.
 - Add configuration option to specify libraries supported for each toolchain per targets.
 - Move __aeabi_assert function from rtos to retarget code so it’s available for bare metal.
 - Use 2 memory region model for ARM toolchain scatter file for the following targets:
   NUCLEO_F207ZG, STM32F411xE, STM32F429xI, NUCLEO_L073RZ, STM32F303xE
 - Add a warning message in the build tools to deprecate uARM toolchain.
 - NewLib-Nano C library is not supporting floating-point and printf with %hhd,%hhu,%hhX,%lld,%llu,%llX
   format specifier so skipping those green tea test cases.
2019-12-19 10:05:11 -08:00
Anna Bridge fb8bbb83e4
Merge pull request #11997 from kjbracey-arm/rm_fp
Remove deprecated FunctionPointer class
2019-12-19 16:32:46 +00:00
Anna Bridge 806ad39648
Merge pull request #12101 from rajkan01/feature_crash_report_fix
Bare metal: Retrieve error context after crash
2019-12-17 16:27:59 +00:00
Anna Bridge 0770798bd2
Merge pull request #12048 from kjbracey-arm/sharedptr_nullptr
SharedPtr: add nullptr constructor
2019-12-17 16:21:54 +00:00
Anna Bridge 6b4262f7a0
Merge pull request #12032 from kjbracey-arm/fallthrough
Add MBED_FALLTHROUGH attribute
2019-12-17 16:20:35 +00:00
Anna Bridge d128ff4882
Merge pull request #11961 from hugueskamba/hk-add-unbuffered-serial-class
UnbufferedSerial: Introduce the class to replace RawSerial
2019-12-13 15:54:40 +00:00
Hugues Kamba 7b845409a0 UnbufferedSerial: Introduce the class to replace RawSerial
* Deprecate RawSerial.
* Introduce UnbufferedSerial to provide unbuffered I/O by implementing
  with a FileHandle interface for I/O	streams.
* Add Greentea test for the UnbufferedSerial class.
2019-12-12 08:44:09 +00:00
Antti Kauppila d5fdcfdab8 busy s... fix (ONME-4352)
oob handling added for OK in busy scenario

Fixed spellcheck error

trace added for ok
2019-12-12 09:36:34 +02:00
Rajkumar Kanagaraj f6a7f6587a Fixing the Mbed OS crash reporting and enable green tea test for bare metal.
Added missing mbed_error_initialize function call in bare metal boot code which is used
to retrieve the crash report from RAM in case of any previous abnormal re-boot but this function call is present in RTOS boot code.
2019-12-11 04:28:42 -08:00
Hugues Kamba 431f6cb604 Minimal Console: Use static pin map 2019-12-10 15:32:15 +00:00
Kevin Bracey 2b4b7232b7 SharedPtr: add nullptr constructor
For consistency with `std::shared_ptr`, and `mbed::Callback`, and as a
potential optimisation aid, give `SharedPtr` a distinct constructor for
`nullptr`.
2019-12-09 11:37:06 +02:00
Kevin Bracey 678ec0f3fb SharedPtr: add move operations
Optimise SharedPtr by giving it move constructor and assignment
operator.
2019-12-09 10:10:44 +02:00
Martin Kojtal 2536e9291d
Merge pull request #12034 from kjbracey-arm/systimer_warning
SysTimer: Suppress implicit virtual warning
2019-12-06 13:35:08 +01:00
Kevin Bracey a1bbbb8845 SysTimer: Suppress implicit virtual warning 2019-12-05 15:48:36 +02:00
Kevin Bracey d97460f8bb Add MBED_FALLTHROUGH attribute
C++17 standardised `[[fallthrough]]` for `switch` statements to suppress
compiler warnings. Provide access to it, or compiler-specific
alternatives.
2019-12-05 12:08:26 +02:00
Martin Kojtal 28caa43a91
Merge pull request #12025 from fkjagodzinski/fix-platform-unused_file
Platform: Delete an unused astyle output file
2019-12-04 12:37:26 +01:00
Filip Jagodzinski 001731c5af Platform: Delete an unused astyle output file 2019-12-04 10:16:24 +01:00
Martin Kojtal 2cf56b8f6d
Merge pull request #11891 from hugueskamba/hk-enable-minimal-printf-in-tools
minimal-printf: Enable using a target configuration parameter
2019-12-04 10:14:54 +01:00
Martin Kojtal 64d172c3bd
Merge pull request #11970 from kjbracey-arm/fault_crash
Avoid crashes during fault handler
2019-12-04 10:13:54 +01:00
Hugues Kamba d5aef28145 minimal-printf: Enable using a target configuration parameter 2019-12-03 12:31:51 +00:00
Martin Kojtal ad3647c191
Merge pull request #11957 from kjbracey-arm/crc-redo
MbedCRC and CRC HAL revisions (6.0 redo)
2019-12-03 13:21:36 +01:00
Martin Kojtal 25ca5d2a72
Merge pull request #11880 from kjbracey-arm/callback_variadic
Remove deprecated Callback methods
2019-12-03 09:04:55 +01:00
Martin Kojtal 111d1ca15e
Merge pull request #11962 from evva-sfw/feature/Bug_in_mbed_alloc_wrappers.cpp
Bug in mbed_alloc_wrappers.cpp
2019-12-02 16:16:16 +01:00
Kevin Bracey 60e07ef8d6 Remove deprecated FunctionPointer class 2019-12-02 15:53:47 +02:00
Kevin Bracey 0b28553ac2 Remove deprecated Callback methods 2019-12-02 15:27:10 +02:00
Kevin Bracey c67816b5ff 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-12-02 14:45:37 +02:00
Martin Kojtal d58e9d6e76
Merge pull request #11959 from hugueskamba/hk-fix-minimal-console
Minimal Console: Fix compilation error
2019-11-28 15:47:20 +01:00
Kevin Bracey fc05d51bcd Avoid crashes during fault handler
If the fault handler was hit before the stdio console was used and
initialised, the initialisation code caused a "mutex in ISR" trap,
stopping the register dump from happening.

Temporarily set the `error_in_progress` flag at the top of the fault
handler, and restore it before calling `mbed_error`. Take the
opportunity to suppress fault dumps on recursive crashes, much as is
done inside `mbed_error`.
2019-11-28 15:03:26 +02:00
Przemyslaw Stekiel b2dad08387 Change explicit pinmap to static pinmap 2019-11-28 08:32:12 +01:00
Przemyslaw Stekiel ba12228556 Explicit pinmap: Fix build failures reported by CI 2019-11-28 08:32:03 +01:00
Przemyslaw Stekiel d75cc97d80 Explicit pinmap - fix style 2019-11-28 08:32:02 +01:00
Przemyslaw Stekiel a7b298f353 mstd_cstddef: add C support and macros for C++11 2019-11-28 08:32:00 +01:00
Przemyslaw Stekiel 3d719f7e35 K64F, NUCLEO_F429ZI: Use explicit pinmap for console 2019-11-28 08:32:00 +01:00
Philipp Steiner 0b36529cfa replace #ifdef MBED_MEM_TRACING_ENABLED and #ifdef MBED_HEAP_STATS_ENABLED with #if MBED_MEM_TRACING_ENABLED and #if MBED_HEAP_STATS_ENABLED 2019-11-27 15:54:22 +01:00
Hugues Kamba 240758db42 Minimal Console: Fix compilation error
Build successfully when `platform.stdio-convert-tty-newlines` or
`platform.stdio-convert-newlines` are set to `true` by ensuring
`isatty()` is also included when `platform.stdio-minimal-console-only`
is set to `true`.
2019-11-27 12:17:03 +00:00
Martin Kojtal 394cf7a0eb
Merge pull request #11947 from hugueskamba/hk-fix-minimal-console
Minimal Console: Fix syntax errors
2019-11-27 11:30:08 +01:00
Hugues Kamba 72d5b51762 Minimal Console: Fix syntax errors 2019-11-26 14:09:01 +00:00
Martin Kojtal 5f7ecea00b
Revert "MbedCRC and CRC HAL revisions" 2019-11-26 13:45:37 +00:00
Martin Kojtal 2bde6581a6
Merge pull request #11720 from mtomczykmobica/ONME-4405
ATCmdParser: merge scanf and recv functions
2019-11-21 15:29:29 +01:00
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