Commit Graph

913 Commits (240758db42aaa42b2abd50daea5033c3cc7e80dc)

Author SHA1 Message Date
Steven Cartmell 41878bc3de Add Reset Reason platform API 2019-05-24 11:20:23 +02:00
Martin Kojtal 541dee4531
Merge pull request #10553 from korjaa/semihosting_docs
Add semihosting and SWO examples to mbed_override_console().
2019-05-23 21:40:37 +01:00
Jaakko Korhonen 9fb4437003 Update mbed_retarget.h coding style, star binds to the right. 2019-05-23 09:27:05 +03:00
Gabor Kertesz 40627a5220 Fix last issues
Imports working McuBoot for reset.
Updates microsec ticker driver.
Default baudrate is set to 115200 to see TF-M boot messages.
Stack top is set to scatter file dependent and not hard-coded.
2019-05-22 17:17:26 +03:00
Martin Kojtal 5be51a5b86
Merge pull request #9960 from marcuschangarm/fix-no-rtos-wait
Use LP tickers for waiting in no RTOS builds when available
2019-05-21 09:13:27 +01:00
Marcus Chang 6aca51fc17 Use LP tickers for waiting in no RTOS builds when available
For bare metal builds, use the lp_ticker for calls to wait_ms.
2019-05-16 07:02:06 -07:00
Kevin Bracey c799dc3332 ARMC5: fix mbed_atomic_impl.h assembly 2019-05-16 13:06:16 +03:00
Martin Kojtal 3ea1c56124
Merge pull request #10147 from kjbracey-arm/atomic_bitwise
Assembler atomics
2019-05-13 14:18:05 +01:00
Jaakko Korhonen a48d12683f Add semihosting and SWO examples to mbed_override_console(). 2019-05-10 10:05:06 +03:00
M. Rahimi d30bdbe08b Enabled crash reporting for DISCO_F407VG target 2019-05-07 19:25:46 +04:30
Martin Kojtal 1de0712272
Merge pull request #9944 from deepikabhavnani/stm32_splitheap
GCC - Add support to split heap across 2-RAM banks
2019-04-30 11:02:51 +01:00
Anna Bridge 23af842715
Merge pull request #10078 from OpenNuvoton/nuvoton_fix-heap-in-rtosless
Fix heap init error in rtos-less code
2019-04-26 13:31:10 +01:00
Kevin Bracey 2bb40450ec Add non-volatile atomic loads and stores
Volatile makes no real difference when we're using assembler, or locked
functions, but leaving it off could be more efficient for the basic
loads and stores. So add non-volatile overloads in C++ for them.
2019-04-26 13:12:35 +03:00
Kevin Bracey 87396e0bf6 Assembler atomics
Reimplement atomic code in inline assembly. This can improve
optimisation, and avoids potential architectural problems with using
LDREX/STREX intrinsics.

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

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

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

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

For example, the one-line program

   osMutexAcquire(NULL, 0);

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

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

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

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

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

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

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

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

Primary envisaged use case is to act on STDIN_FILENO etc, eg to
set it non-blocking or use sigio, or to use the enable API.
2019-02-22 11:01:02 +02:00
deepikabhavnani 387e4ca9f4 New heap can be equal to heap limit for last chunk 2019-02-21 17:20:49 -06:00
Senthil Ramakrishnan 3fb8224237 Update mbed_stats.c to use __ARMCC_VERSION flag to be compatible with AC6 2019-02-21 17:12:09 -06:00
Sarah Marsh 15b573d83e Reuse nvic powerdown code block for M0+ 2019-02-21 16:07:26 +00:00
Kevin Bracey e96d6581db Add enable API to FileHandle
Add API to dynamically enable/disable input and output on FileHandles.
Aim is to allow power saving by indicating that we permanently or
temporarily do not require input, so that for example serial Rx
interrupts can be released, and deep sleep permitted.
2019-02-21 16:53:22 +02:00
Sarah Marsh 7201cab3c4 Support mbed_start_application for Cortex-M0+ 2019-02-21 11:17:51 +00:00
deepikabhavnani 1a1c74c38b mbed_rtx.h not to include in platform 2019-02-19 15:49:49 -06:00
Deepika f13a3e32b6 Fix GCC _sbrk allocation 2019-02-19 15:49:49 -06:00
deepikabhavnani b36147fbe9 ISR_Stack_start/size defines are not needed, use linker file defines 2019-02-19 15:49:49 -06:00
deepikabhavnani 9d1ce66b14 ISR_STACK_START/ HEAP_START defines not used by GCC_ARM toolchain 2019-02-19 15:49:49 -06:00
Deepika 537b3646d3 Resolve build/type cast errors 2019-02-19 15:49:49 -06:00
Deepika 41eaefeeb4 Update memory model for stack and heap memory
Memory model for RTOS and No RTOS was initially single stack and heap,
only few targets implemented 2-region RAM model.

2-region RAM model is applied for all toolchains and targets.

GCC: __wrap__sbrk was implemented for 2-region ram model, with switch to 2-region
for all targets, we do not need target specific implementation of this API
Also _sbrk is WEAK function, hence can be over written in target folder for
special cases
2019-02-19 15:49:45 -06:00
Przemyslaw Stekiel 9c11288eb1 mbed_retarget.cpp: Fixed style 2019-02-19 15:46:32 -06:00
Przemyslaw Stekiel a3223275c2 Use 2-region memory model in ARM rtos-less builds.
The following commits: #8039, #9092 added Boot/ISR stack definition to all scatter files (ARM_LIB_STACK).

This has changed memory model for RTOS-less builds to 2-region memory model and caused failure in case of rtos less builds.
This PR defines valid heap/stack regions for rtos-less builds.
2019-02-19 15:46:21 -06:00
Michael Schwarcz 1db4e4634f mbed_retarget changes
- Avoid compiling user_setup_stackheap for TF-M secure targets
- Align sbrk for TF-M
2019-02-19 15:19:04 +02:00
Cruz Monrreal 5701c94384
Merge pull request #9714 from deepikabhavnani/cleanup_linker_files
Only GCC_ARM toolchain is supported, removing legacy code
2019-02-14 20:26:05 -06:00
Martin Kojtal 1492dc1e2a
Merge pull request #9685 from scartmell-arm/fix-sleep-tracer-lookup-failing
Fix sleep tracing not finding matching driver during unlock.
2019-02-14 13:16:11 +01:00
deepikabhavnani 818d38b6ae Only GCC_ARM toolchain is supported, removing legacy code 2019-02-13 16:26:22 -06:00
Steve Cartmell 3f12c19adf revert: "Refactor sleep tracing driver identifier to be pointer to the driver filepath."
This reverts commit 9a0e8797b9.
2019-02-13 11:27:22 +00:00
Martin Kojtal a477354292
Merge pull request #9693 from naveenkaje/mbed_error_warning_fix
platform: fix build warning in mbed_error
2019-02-13 11:40:46 +01:00
Cruz Monrreal 709e6ff795
Merge pull request #9600 from kjbracey-arm/atomic_exchange_64
Atomic extensions: 64-bit, bool, exchange
2019-02-12 20:28:00 -06:00
Naveen Kaje de271d4ba8 platform: fix build warning in mbed_error
Fix the following build warning

Compile [ 83.4%]: mbed_error.c
[Warning] mbed_error.c@71,21: 'compute_crc32' defined but not used [-Wunused-function]

compute_crc32 usage is guraded with #define, but not the definition.
Use the same #define around the definition of compute_crc32()
2019-02-12 16:20:25 -06:00
Martin Kojtal 10bb66a053
Merge pull request #9424 from SeppoTakalo/ONME-4125
Allows multiple network status listeners
2019-02-11 10:41:35 +01:00
Veijo Pesonen 8bf6c6b9bf platform: includes string.h needed by memcpy and strlen 2019-02-07 12:17:08 +02:00
Kevin Bracey 9e7c65925d Add signed atomics
All signed implementations are inline - either directly or as inline
calls to out-of-line unsigned definitions.
2019-02-05 10:57:23 +02:00
Kevin Bracey 694adaae8b Add atomic exchange 2019-02-05 10:53:30 +02:00
Kevin Bracey a71984093a Add bool atomics 2019-02-05 10:46:40 +02:00
Kevin Bracey f8e3f5dc2c Add 64-bit atomics 2019-02-05 10:45:40 +02:00
Martin Kojtal 6684570dea
Merge pull request #9580 from kjbracey-arm/sharedptr_reset
Fix SharedPtr::reset
2019-02-04 14:41:34 +01:00
Kevin Bracey 94f5646303 Atomics: make barrier placement uniform 2019-02-04 15:08:53 +02:00
Kevin Bracey 52aac4c756 SharedPtr: use atomic load
Use atomic load to read use count.
2019-02-01 12:31:41 +02:00
Kevin Bracey 0b27c9149e Fix SharedPtr::reset
SharedPtr::reset did not actually set the stored pointer value.
Correct this, with other minor tidies:

* Ensure counter is set to NULL if pointer is reset to NULL
* Be consistent about not clearing pointers in decrement_counter().
2019-02-01 10:34:34 +02:00
Cruz Monrreal 0fb2870cfc
Merge pull request #9530 from kjbracey-arm/atomic_singletonptr
Use atomics for double-checked locks (SingletonPtr + __cxa_guard)
2019-01-31 10:22:39 -06:00
Seppo Takalo 207eddc321 Fix copy constructors of Callback objects
->move() operator was not touching unused data fields, therefore
leaving uninitialised data and failing the comparison.
Fixed by initialising all fields to zero before moving.
2019-01-31 15:04:24 +02:00
Cruz Monrreal cc94690363
Merge pull request #9544 from kjbracey-arm/reboot_limit_fix
Halt to enforce reboot limit once only
2019-01-30 17:32:55 -06:00
Kevin Bracey 3056ba730c mbed_die: Use wait_us not wait_ms
mbed_die was calling wait_ms in a critical section - this is deprecated
behaviour, and caused a fatal error in debug builds, potentially leading
to an infinite reboot loop if this was caused due to a reboot limit
halt.

Switch to using wait_us - this is safe in a critical section. This does
trigger a call to mbed_warning, due to the large parameter, but that is
harmless - it doesn't output anything to the console, and won't
overwrite the error context if it already contains something.
2019-01-30 13:29:13 +02:00
Kevin Bracey d55640340d Halt to enforce reboot limit once only
The pre-main check of error_reboot_count was applied repeatedly on
every boot, meaning that once the reboot limit was hit, every subsequent
reset would halt before main, until something managed to clear
or corrupt the error context.

Set the is_error_processed flag before halting, so that when an external
agent resets us while we're halted, we do not report the error and halt
again.
2019-01-30 12:58:25 +02:00
Kevin Bracey 6e3c492cd8 mbed_retarget.cpp: Combine ARMC5 and ARMC6 tests
A couple of places in mbed_retarget.cpp were testing for either ARMC5 or
ARMC6 in a long-winded fashion. Testing for __ARMCC_VERSION being
defined is sufficient.
2019-01-29 17:49:19 +02:00
Kevin Bracey c55329157a Use atomics in __cxa_guard functions
Similar to SingletonPtr, use atomic accesses when loading the guard word
outside the lock, and when storing, to ensure no races for threads that
don't take the lock.

Lack of atomics unlikely to be a problem in current builds, but code
could conceivably be subject to reordering if link-time optimisation was
enabled.
2019-01-29 17:49:18 +02:00
Kevin Bracey 6e41d6cdb7 Make SingletonPtr safe using atomics
SingletonPtr's implementation wasn't totally safe - see "C++ and the
Perils of Double-Checked Locking"by Meyers and Alexandrescu. No problems
observed in practice, but it was potentially susceptible to compiler
optimisation (or maybe even SMP issues).

Now that we have atomic loads and stores, the function can be made safe,
avoiding any potential races for threads that don't take the lock:
ensure that the unlocked load is atomic, and that the pointer store is
atomic.

See https://preshing.com/20130930/double-checked-locking-is-fixed-in-cpp11/
for more discussion.
2019-01-29 16:01:33 +02:00
Kevin Bracey f60bb8f3a7 Second barrier for core_util_atomic_flag_clear
As barriers were added in #9247, review comments pointed out that atomic
stores needed a second barrier, and they got one. But atomic_flag_clear
was missed.
2019-01-29 10:45:20 +02:00
Senthil Ramakrishnan d0b95031c5 Print crash report reboot messages only for non-release builds 2019-01-23 17:40:05 -06:00
Senthil Ramakrishnan cc5969b1ec Remove printf completely and fix the optimization check 2019-01-22 16:04:47 -06:00
Martin Kojtal 4019efb21d
Merge pull request #9399 from paul-szczepanek-arm/fix-null-check
BLE: fix missing null checks on Gap event handler
2019-01-21 13:43:16 +01:00
paul-szczepanek-arm 42e4290160 error when there is no handler 2019-01-18 14:55:38 +00:00
Kevin Bracey 703e44031c Add atomic loads and stores and barriers
Add atomic load and store functions, and add barriers to the existing atomic
functions.

File currently has no explicit barriers - we don't support SMP, so don't
need CPU barriers.

But we do need to worry about compiler barriers - particularly if link time
optimisation is activated so that the compiler can see inside these
functions. The assembler or intrinsics that access PRIMASK for
enter/exit critical act as barriers, but LDREX, STREX and simple
volatile pointer loads and stores do not.
2019-01-18 09:32:04 +02:00
Martin Kojtal 53bb9868ed
Merge pull request #9405 from cmonr/fix-doxy
Travis: Fix doxy-spellcheck job
2019-01-17 17:21:14 +01:00
Martin Kojtal a1daecb200
Merge pull request #9280 from deepikabhavnani/refactor_a
Sleep manager implements all the API's in platform file
2019-01-17 12:40:03 +01:00
Cruz Monrreal II 26696c2f5b Fixed rtc doxygen spelling errors 2019-01-16 23:30:03 -06:00
Cruz Monrreal 5dbb4b9de9
Merge pull request #8497 from kegilbert/gettimeofday_patch
Add get/settimeofday retargets
2019-01-16 22:07:35 -06:00
Deepika a1a90518ed Update the header files
File was moved from hal -> platform folder, hence includes should be
changed accordingly.
2019-01-15 11:47:51 -06:00
deepikabhavnani e2a7b89a90 Sleep manager implements all the API's in platform/mbed_sleep_manager.changes
Not sure why mbed_sleep_manager.c was in hal, moving it to platform
2019-01-15 11:47:51 -06:00
kegilbert dafb01c755 Add get/settimeofday retargets 2019-01-11 14:30:44 -06:00
kegilbert 70b9b753db Add doxygen spellcheck jobs to Travis
Currently tests
    - drivers
    - platform
    - rtos
    - events
    - features/netsocket
2019-01-11 10:22:15 -06:00
Cruz Monrreal f8d7c31a9b
Merge pull request #9188 from SenRamakri/sen_ErrorUrlEnhance
Add more information to error url to enhance error analytics
2019-01-10 00:12:46 -06:00
Martin Kojtal 965f15da82
Merge pull request #9231 from kjbracey-arm/critical_volatile
critical sections: remove unnecessary volatile
2019-01-07 16:26:38 +00:00
Senthil Ramakrishnan f10ed4b286 Add more information to error url to enhance error analytics 2019-01-04 09:24:31 -06:00
bcostm f3b304d3af NUCLEO_H743ZI: enable crash capture 2019-01-04 10:03:36 +01:00
Kevin Bracey 70af016348 critical sections: remove unnecessary volatile
Critical section count/state variables are synchronised by IRQ disabling and
critical section calls themselves, so do not need to be volatile.

This eliminates a couple of unnecessary reads of the counter variable.
2019-01-03 11:06:44 +02:00
Senthil Ramakrishnan daa8b0e5c1 Disable printf in crash reporting for release builds 2018-12-20 13:47:35 -06:00
Alastair D'Silva 2617c5d55b Don't use define checks on DEVICE_FOO macros (mbed code)
The DEVICE_FOO macros are always defined (either 0 or 1).

This patch replaces any instances of a define check on a DEVICE_FOO
macro with value test instead.

Signed-off-by: Alastair D'Silva <alastair@d-silva.org>
2018-12-20 10:16:42 +11:00
Cruz Monrreal 6f576009c7
Merge pull request #9061 from kjbracey-arm/more_mpu_work
More MPU work
2018-12-19 12:32:54 -06:00
Cruz Monrreal 80c6f5f8ee
Merge pull request #8972 from kjbracey-arm/merge_file_truncate
Merge feature-posix branch (FileHandle::truncate)
2018-12-17 14:49:56 -06:00
Kevin Bracey ae17f6ebba Add FileHandle::truncate and ftruncate
Add support for file truncation (or extension) to the abstract API.

No hooks to actual implementations in this commit.
2018-12-14 19:29:28 +02:00
Kevin Bracey bd413f1d82 Disable write buffer in debug builds (M3/M4)
As part of work to improve the debugging of exceptions, have
Mbed OS make an effort to make exceptions more precise in debug builds
at the cost of performance.

Related pyOCD work:

   https://github.com/mbedmicro/pyOCD/pull/430
2018-12-13 16:32:38 +02:00
Russ Butler cdc61c5954 Use MPU platform deinit rather than hal free
Use the MPU through the platform layer rather than through the HAL.
2018-12-11 18:59:58 +02:00
Kevin Bracey 770baa22ea Rework MPU use option
Make the option positively named, and as it is a platform config
option make sure it only affects platform code.

HAL functions still remain available even if platform is told not
to use them.
2018-12-11 13:03:59 +02:00
Russ Butler 2af6642f68 Add a platform config to disable the MPU
Add the platform config DISABLE_MPU to allow the MPU to be disabled
from an application.
2018-12-11 13:03:58 +02:00
Cruz Monrreal 89527604ae
Merge pull request #9033 from fkjagodzinski/fix-stream
Fix Stream for IAR toolchain
2018-12-10 19:20:06 -06:00
Russ Butler 390ef301a8 Add header to fix compile failures
Add the header platform/mbed_assert.h to fix build errors with
platform/mbed_mpu_mgmt.c.
2018-12-10 12:54:17 -06:00
Kevin Bracey 1289406f9f Use MBED_ASSERT in MPU manager
MPU lock under- or overflow is not a likely random runtime failure - it
will be a mismatched lock/unlock programming error, so should be
detected during development.  Make the checks asserts so they can be
left out from release builds.  MBED_ASSERT is also a bit smaller than
MBED_ERROR in develop builds.
2018-12-10 15:53:35 +02:00
Filip Jagodzinski 89a475bc4e Fix: Stream: Replace fflush() with fseek()
This is a follow-up to PR #8331; fixing the Stream methods not covered
there.
2018-12-10 14:31:30 +01:00
Kevin Bracey e2f6025b17 Exclude MPU manager code if MPU disabled
Save around 400 bytes from images using FlashIAP by omitting MPU manager
reference counting if DEVICE_MPU is 0.
2018-12-10 14:44:03 +02:00
Martin Kojtal 8230fd7784
Merge pull request #8888 from kegilbert/sys-struct-whitespace-patch
Align comment block in sys stats struct
2018-12-03 13:40:36 +01:00
Martin Kojtal bf36ff77c1
Merge pull request #8855 from michalpasztamobica/warnings_fix
Fix compilation warnings (apart from nanostack)
2018-12-03 13:31:55 +01:00
Martin Kojtal 226219f3f2 rtos: fix style in rtos wait
Found during editing copyright message
2018-11-29 10:51:18 +00:00
Martin Kojtal ad759b7749 platform: add spdx license 2018-11-28 10:39:52 +00:00
Martin Kojtal 52822cb8af
Merge pull request #8871 from c1728p9/mpu
MPU API (Reopened)
2018-11-28 10:28:32 +01:00
Martin Kojtal 4758ddd2c6
Merge pull request #8738 from pan-/ble-extended-advertising
Ble extended advertising
2018-11-28 09:39:13 +01:00
kegilbert 31bbbff08a Align comment block in sys stats struct 2018-11-27 18:06:26 -06:00
Russ Butler caa7b93921 Rename lock functions and classes
Invert the name of the lock functions and classes so you are not
locking a negative.
2018-11-27 09:29:32 +00:00
Russ Butler 1821d37621 Overhaul MPU for new requirements
Make the following changes:
-Allow a vector specific ARM MPU driver by defining MBED_MPU_CUSTOM
-Allow ROM address to be configured for ARMv7-M devices by
    setting the define MBED_MPU_ROM_END
-Add ROM write protection
    -Add new functions and lock
    -enable at boot
    -disable during flash programming
2018-11-27 09:29:32 +00:00
Russ Butler d27566c955 Rename MpuXnLock
Rename MpuXnLock  to ScopedMpuXnLock so it has the same naming
convention as ScopedMutexLock. Also make this class inherit from
NonCopyable to prevent misuse.
2018-11-27 09:29:32 +00:00
Russ Butler ab18442988 Add an RAII class for MPU execute never
Add the class MpuXnLock which uses RAII  to allow execution from RAM
in a block of code.
2018-11-27 09:29:31 +00:00
Russ Butler ecd0414494 Integrate MPU with mbed
Enable the MPU as part of the boot sequence and disable it before
starting a new application. Also add reference counted MPU lock and
unlock functions to allow code to execute from ram when necessary.
2018-11-27 09:29:31 +00:00
Martin Kojtal 29b64e15bf
Merge pull request #8761 from kegilbert/add-all-stats-config-opt
Add MBED_ALL_STATS_ENABLED to config system
2018-11-27 09:12:17 +01:00
Martin Kojtal 436644b7bd
Merge pull request #7760 from ARMmbed/feature_namespace
Give an option to remove 'using namespace'
2018-11-27 09:04:58 +01:00
kegilbert 2a9c930f9b Add MBED_ALL_STATS_ENABLED to config system 2018-11-26 16:59:33 -06:00
deepikabhavnani da69da972f Add BlockDevice and Filesystem classes inside mbed namespace.
Adding new modules inside the namespace could be breaking change for existing code base
hence add `using namespace::class` for classes newly added to mbed namespace to maintian
backwards compatibility.

MBED_NO_GLOBAL_USING_DIRECTIVE is added to remove auto-addition of namespace
Macro guard `MBED_NO_GLOBAL_USING_DIRECTIVE` is added around namespace, to avoid
polluting users namespace.
2018-11-26 13:35:40 -06:00
deepikabhavnani 2df0289ae9 Resolve build issue for unittest
Error Resolved here is:
SingletonPtr.h:93:13: error: ‘NULL’ was not declared in this scope
2018-11-26 09:53:19 -06:00
Deepika f6c1a40b29 Add config options for socket statistics
1. MBED_CONF_NSAPI_SOCKET_STATS_ENABLE to enable the statistics
2. MBED_CONF_NSAPI_SOCKET_STATS_MAX_COUNT max sockets statistics cached
2018-11-26 09:42:45 -06:00
Deepika 09b4bc07ce This is the initial version of stats implementation in network layer.
SocketStats Class is added to collect and provide the statistics information.
In this phase only socket information is collected and max sockets that can
be recorded at any time are configurable through 'MBED_CONF_NSAPI_SOCKET_STATS_MAX_COUNT'

Network statistics can be enabled through a macro MBED_NW_STATS_ENABLED

More information on design is captured in #8743
2018-11-26 09:42:39 -06:00
Michal Paszta e101943cce Fix compilation warnings (apart from nanostack) 2018-11-26 14:27:48 +01:00
Vincent Coubard 1a14453da1 BLE: Add mechanism to track use of non compatible scan API. 2018-11-26 10:24:30 +00:00
Vincent Coubard 732b4255ce revert toolchain changes 2018-11-26 10:21:32 +00:00
Vincent Coubard 0c1e01952b Compilation fixes 2018-11-26 10:21:32 +00:00
Nir Sonnenschein 0283bb84e4
Merge pull request #8667 from davidsaada/kvstore_integration
KVStore & derived classes: design docs, implementation & configuration
2018-11-25 07:30:53 +02:00
David Saada e9c25e23a5 KVStore & derived classes: design docs, implementation & configuration
Implement the following:
KVStore base class
TDBStore class
FileSystemStore class
SecureStore class
Global APIs
Configuration framework
Design documentation
2018-11-24 17:43:35 +02:00
Martin Kojtal 52aea31655
Merge pull request #8702 from SenRamakri/sen_CrashReportingImpl
Crash Reporting implementation
2018-11-23 20:24:53 +01:00
Martin Kojtal 70dfbbfee4
Merge pull request #8189 from deepikabhavnani/wait_updated
Wait API updated to remove deepsleep lock
2018-11-22 11:01:27 +01:00
Martin Kojtal 5b42e2886f
Merge pull request #8607 from aashishc1988/ram_rom_fetch
Fetch ram/rom start/size
2018-11-22 10:49:50 +01:00
Senthil Ramakrishnan f59b99d889 Removing support for printing error-report after reboot and other minor fixes 2018-11-18 22:42:37 -06:00
Senthil Ramakrishnan 423b52e1c3 Fix crc calculation error, code-style issues and other fixes 2018-11-16 17:24:52 -06:00
Senthil Ramakrishnan a07a373c9f Change the reboot-max value semantics and code style and other fixes 2018-11-16 14:00:00 -06:00
Senthil Ramakrishnan 254062fc5a Add thread safety across reboot error info operations 2018-11-16 14:00:00 -06:00
Senthil Ramakrishnan 9ac31dbaef Enable crash capture feature for platforms with linkerscript changes 2018-11-16 13:59:59 -06:00
Senthil Ramakrishnan 6181394e37 Error and fault handling changes for crash reporting 2018-11-16 13:59:59 -06:00
Cruz Monrreal II 5c1c7bf71f Merge branch 'fix_astyle_error' of ssh://github.com/0xc0170/mbed-os into rollup-b.1 2018-11-15 18:26:09 -06:00
Aashish chaddha 0c594a42dc The check for managed bootloader support should be in regions and we need a try/catch when we call it.
Moved "bootloader_not_supported" check to where it was and handle that exception at only one place.

Removed ram/rom size info for realtek from targets.json. THe info we have is not correct.

was Not handling config exceptions from regions and ram_regions property

adding rom-ram info for REALTEK_RTL8195AM
2018-11-15 15:28:14 -06:00
Martin Kojtal 2422949398 Merge branch 'platform-lib-whitespace-patch' of https://github.com/kegilbert/mbed-os into dev_rollup 2018-11-15 13:59:30 +00:00
Martin Kojtal 3d859575d2 platform: fix coding style 2018-11-15 07:20:11 +00:00
Martin Kojtal 43615baf0e CThunkbase: fix coding style 2018-11-15 07:20:09 +00:00
Deepika ad736e9894 Add RAM/ROM memory statistics to system stats structure
Internal RAM / ROM memory size and start address of target can be
fetched using `mbed_stats_sys_get()` API.
2018-11-14 09:51:33 -06:00
kegilbert 44d3e62835 Patch whitespace inconsistencies in platform lib file 2018-11-13 19:08:44 -06:00
shileiyu 627064297e New target UNO_91H from RDA Microelectronics. 2018-11-10 18:15:26 +08:00
Cruz Monrreal e635613b28
Merge pull request #7849 from TacoGrandeTX/fix_rtc_settime
Low power timer needs to be reset when setting time
2018-11-08 10:50:04 -06:00
Cruz Monrreal 0fe6369950
Merge pull request #8488 from c1728p9/cthunk_overhaul
Rewrite CThunk so it does not execute from ram
2018-11-07 19:15:14 -06:00
Russ Butler 5a8727623b Rewrite CThunk so it does not execute from ram
Modify the implementation of CThunk so it does not execute from ram.
Instead is uses an array of functions in flash which can be allocated
as a thunk. The number of CThunks that can be used by an application
can be configured with MBED_CONF_PLATFORM_CTHUNK_COUNT_MAX.
2018-11-06 09:49:56 -06:00
Martin Kojtal 2ae9981bea Merge branch 'platform-doxy-typo-fix' of https://github.com/kegilbert/mbed-os into dev_rollup 2018-11-06 12:10:26 +00:00
RFulchiero d82990cd25 Low power timer needs to be reset when setting time.
Reset _rtc_lp_timer only if DEVICE_LPTICKER is defined.
2018-11-01 17:11:45 -05:00
Cruz Monrreal 430fb3e7ba
Merge pull request #8601 from kjbracey-arm/error_fmtcheck
Add format checking to printf-type APIs
2018-11-01 16:09:05 -05:00
kegilbert 766359c7c5 Typo fixes in Doxygen for Platform 2018-11-01 12:10:08 -05:00
Cruz Monrreal 3d09f3bd98
Merge pull request #8598 from VeijoPesonen/fix_atcmdparser_oob_handling
ATCmdParser: Fix OOB handling performance-wise
2018-10-31 18:52:21 -05:00
Cruz Monrreal b35799dd8c
Merge pull request #8329 from paul-szczepanek-arm/fix-namespace
Platform: fix missing namespace for SharedPtr
2018-10-31 12:35:25 -05:00
Amanda Butler c58c80e042
Make minor copy edits to mbed_wait_api.h
Make minor edits to existing text.
2018-10-31 11:12:35 -05:00
Martin Kojtal 56293af0e7
Merge pull request #8584 from kjbracey-arm/noreturn
system_reset is MBED_NORETURN
2018-10-31 14:46:46 +01:00
Kevin Bracey 638e071820 mbed_error.c: Fix format specifiers 2018-10-31 14:49:22 +02:00
Kevin Bracey 814d631c55 Add format checking to Stream methods 2018-10-31 14:26:35 +02:00
Kevin Bracey 51df320614 Add format check to debug() 2018-10-31 14:26:33 +02:00
Kevin Bracey 1f56fbe397 Add format checking to mbed_error_printf 2018-10-31 14:26:29 +02:00
Kevin Bracey 644022890c Fixes ATCmdParser OOB handling performance-wise
The issue is that the process_oob check would only return immediately
if no data at all on entry, or when receiving a known OOB. Any other
line noise or unknown OOBs could lead to a timeout delay - read the
noise or unknown OOB then timeout waiting for another line of input.

This revised version modifies the parser to recheck readable after each
line end when only looking for OOBs, so it can immediate exit.
2018-10-31 11:28:17 +02:00
Deepika Bhavnani 5a87f04872
Update doc for wait_ms 2018-10-30 13:07:59 -05:00
Amanda Butler f5e28fe729
Edit mbed_wait_api.h
Standardize unit of time measurements, and change passive to active voice.
2018-10-30 10:06:30 -05:00
Kevin Bracey e9ccabcadc system_reset is MBED_NORETURN 2018-10-30 12:39:03 +02:00
Martin Kojtal 27c0affef7
Merge pull request #8578 from cmonr/rollup
Rollup PR: Samll docs changes
2018-10-30 10:03:01 +01:00
Cruz Monrreal 5ed07c2dd4
Merge pull request #8328 from kjbracey-arm/noreturn
Error path tightening: use MBED_NORETURN; add+use core_util_atomic_flag
2018-10-29 20:49:54 -05:00
Cruz Monrreal II 8b58ed75b0 Merge branch 'kegilbert-patch-6' of ssh://github.com/ARMmbed/mbed-os into rollup 2018-10-29 19:13:29 -05:00
Cruz Monrreal c9eaddd7e0
Merge pull request #8487 from kegilbert/mbed_mem_trace_config_patch2
Update mbed_mem_tracing config option
2018-10-29 18:53:25 -05:00
Amanda Butler 9ab13df3bd
Make changes from comments to FileHandle.h
Address comments.
2018-10-29 14:09:16 -05:00
Kevin Bracey ea16a6ba1d Add MBED_NORETURN attributes
Save some ROM space by putting MBED_NORETURN attributes on error
functions and failed asserts.

mbed_error was documented as returning an error code. It never
actually could return, so documentation updated, but return type
kept.
2018-10-29 13:58:06 +02:00
Kevin Bracey 57748bd46e Adjust error paths locking and returning
Various fixes in preparation for making sure error calls do not return.

* Clear out handle_error's use of error_in_progress as a sort of spin
  lock; this is most likely to deadlock if ever activated, and conflicts
  with error's use of error_in_progress. Use a normal critical section lock.

* Make error use same mbed_halt_system helper as mbed_error.

* Make error's recursion check avoid print and proceed to halt, rather
  than returning.

* Make mbed_error use error_in_progress to avoid recursion in same way
  as error() does.

* Give mbed_halt_system its own recursion check in case of error in
  mbed_die - give it a simple fallback.

* Make the in_progress things properly atomic, just in case.
2018-10-29 13:58:06 +02:00
Kevin Bracey c32984c3a8 Add atomic_flag utility
An atomic flag primitive is sometimes wanted, and it is cumbersome to
create it from the compare-and-swap operation - cumbersome enough that
people often don't bother.

Put in a core_util_atomic_flag that follows the C11/C++11 atomic_flag
API, such that it could be mapped to it with #define later.
2018-10-29 13:58:05 +02:00
Kevin Bracey 0b27736536 Remove sleep manager tests that trigger mbed_error
Intercepting mbed_error will be too hard after mbed_error becomes
[[noreturn]], so remove tests that do this.
2018-10-29 13:58:05 +02:00
Cruz Monrreal d23d7855fc
Merge pull request #8552 from cmonr/rollup
Rollup PR: UK Docathon pt2
2018-10-27 08:27:02 -05:00
kegilbert a2ac895c37 This reverts commit 9b53d1256fb358407acbaf81c70b71d937b1f7cd.i
Move the memory tracing enabled macro to a config option but
revert the !defined -> #if changes to no longer cause breaking
changes.
2018-10-26 17:35:33 -05:00
Cruz Monrreal II 99e198aa4f Merge branch 'non-copyable-doc' of ssh://github.com/pan-/mbed into rollup 2018-10-26 11:43:04 -05:00