Commit Graph

493 Commits (d22adbdb26667b2893f026b659471b8d2d01302b)

Author SHA1 Message Date
Cruz Monrreal b7cf1abf81
Merge pull request #8039 from c1728p9/stack_size_framework
Add framework for configuring boot stack size
2018-10-08 10:26:16 -05:00
Cruz Monrreal 1a638c7870
Merge pull request #8106 from c1728p9/macros_to_config
Replace macros with config options
2018-09-22 16:40:53 -05:00
Martin Kojtal 9abcbf6acf
Merge pull request #7901 from deepikabhavnani/warning_fix
Compiler Warning fixes
2018-09-17 14:29:15 +02:00
Russ Butler b9b4b8ada6 Replace macros with config options
Add a config option for the following values:
MBED_SYS_STATS_ENABLED
MBED_STACK_STATS_ENABLED
MBED_CPU_STATS_ENABLED
MBED_HEAP_STATS_ENABLED
MBED_THREAD_STATS_ENABLED
MBED_CONF_APP_MAIN_STACK_SIZE
MBED_CONF_APP_TIMER_THREAD_STACK_SIZE
MBED_CONF_APP_IDLE_THREAD_STACK_SIZE
MBED_CONF_APP_THREAD_STACK_SIZE

To maintain backwards compatibility inside the RTOS both
APP and RTOS config values can be used.
2018-09-12 13:59:46 -05:00
Russ Butler 1ead033423 Add framework for configuring boot stack size
Add the target config option "boot-stack-size" which is passed to the
linker as the define "MBED_BOOT_STACK_SIZE" so the linker can
adjust the stack accordingly. On mbed 2 the boot stack becomes the
main stack after boot.  On mbed 5 the boot stack becomes the
ISR stack after boot. Because of these different uses  the stack size
for mbed 2 is set to 4K by default while on mbed 5 it is set to 1k.

Additionally, the NRF5X family requires a larger interrupt stack size
due to the softdevice so the size  is increased to 2k on mbed 5 builds.
2018-09-07 16:31:49 +01:00
Anna Bridge c2fdc0d972
Merge pull request #7423 from mprse/mutex_lock_assert
Fix issue #6872 - Mutex lock has possibility to fail at runtime (returning status flag)
2018-09-03 14:14:24 +01:00
Przemyslaw Stekiel fba9c4bc57 Address review comments.
Perform the following changes:
- change definition of `void Mutex::lock(void)` to `osStatus Mutex::lock(void)`.
- change definition of `void Mutex::unlock()` to `osStatus Mutex::unlock()`.
- use MBED_ERROR1 macro to check the lock/unlock operation status.
- add notes in the description of lock/unlock functions: "This function asserts status of the lock/unlock operation (will not return in case of failure). Use of the return value is deprecated, as the return is expected to become void in the future.".
- modify/add description of the return value.
- remove reference to Mbed 6.
- make `lock(millisec)` deprecated in favour of lock(), trylock() and trylock_for() functions.
2018-09-03 07:40:01 +02:00
Cruz Monrreal 48232be98e
Merge pull request #7872 from kjbracey-arm/thisthread
Add ThisThread namespace and deprecate static Thread methods
2018-09-02 15:10:18 -05:00
Cruz Monrreal 00b7700be2
Merge pull request #7875 from c1728p9/feature_CMSIS_5_0b521765
Update CMSIS to 5.4.0
2018-08-31 11:31:37 -05:00
Russ Butler 325565bf79 Refactor boot process
Refactor the Mbed 5 boot process to make is simpler and more modular.
This is done by breaking the boot sequence into 4 distinct steps -
Target setup, Toolchain setup, RTOS setup and Mbed setup. This patch
also move toolchain specific code into a per toolchain folder to make
it more maintainable.
2018-08-28 19:26:55 -05:00
Kevin Bracey 0ddd1d9af5 Make Thread methods const 2018-08-28 13:25:17 +03:00
Kevin Bracey 1330eeecd0 Add ThisThread 2018-08-28 13:25:17 +03:00
Deepika b9ba27b3ee Fixed: @44,18: unused variable 'tid' [-Wunused-variable] 2018-08-27 10:32:35 -05:00
Kevin Bracey 6477b762d1 Style clean-up of Thread-related files 2018-08-27 12:30:33 +03:00
Przemyslaw Stekiel ac2db7cc06 Mutex: fixing missing include
Macro MBED_DEPRECATED_SINCE is defined in platform/mbed_toolchain.h which was not included.
If someone used member functions lock (which are prefixed with MBED_DEPRECATED_SINCE since some time), there would be a compile error instead of a warning.
Including mbed_toolchain.h fixes that.
2018-08-27 08:50:00 +02:00
Przemyslaw Stekiel c693eb512a Change `Mutex::unlock()` function definition - void return value
This is done for consistency with the new version of `Mutex::lock()` member function which does not return status.
2018-08-27 08:48:59 +02:00
Przemyslaw Stekiel b626e185ec `osStatus lock(uint32_t millisec=osWaitForever)` - remove default value
Since `void lock(void)` member function has been added we need to remove default value from deprecated `lock(uint32_t millisec=osWaitForever)` member function since otherwise calling `lock()` would be ambiguous.
2018-08-27 08:47:16 +02:00
Przemyslaw Stekiel 3decd510dc Fix codding style. 2018-08-27 08:47:16 +02:00
Przemyslaw Stekiel ca8070a482 Fix for issue #6872 - Mutex lock has possibility to fail at runtime (returning status flag)
Add assertions for statuses returned by osMutexAcquire().
Add void Mutex::lock(void) member function - lock function which does not return status and waits for the mutex forever.
Make osStatus Mutex::lock(uint32_t millisec=osWaitForever) member function deprecated in favour of bool Mutex::trylock_for(uint32_t millisec).
2018-08-27 08:47:16 +02:00
Russ Butler d5be92adb1 Fix define around EvrRtxKernelInitialized
Rename the define EVR_RTX_KERNEL_INITIALIZE_COMPLETED_DISABLE to
EVR_RTX_KERNEL_INITIALIZED_DISABLE so it matches the rest of RTX.
2018-08-25 20:41:11 -05:00
Russ Butler 6f7964b23f CMSIS/RTX: Remove the file os_tick_gtim.c
Cortex-A devices in mbed-os supply their own OS timer so the code
from RTX is not needed.
2018-08-25 20:41:11 -05:00
Bartek Szatkowski b7efe36125 CMSIS/RTX: Fix using FALSE/TRUE with preprocesor
(cherry picked from commit 1752803626)
2018-08-25 20:41:10 -05:00
deepikabhavnani 67b677d285 CMSIS/RTX: Pre-processor defines used for assembly
CMSIS repo does not support pre-processor defines, hence multiple assembly
files are added for secure/non-secure and floating point tools.

Mbed OS tools support assembly file pre-processing, but the build system
does not support multiple assembly files for each target, hence updating
the assembly files.

(cherry picked from commit 287121ffdc)
2018-08-25 20:41:09 -05:00
Bartek Szatkowski 4fd0daf9f5 CMSIS/RTX: Allow overwriting mutex ops for ARMC
(cherry picked from commit b88254809e)
2018-08-25 20:41:09 -05:00
Bartek Szatkowski 1be672d5f0 CMSIS/RTX: Patch RTX so irq_cm4f.s files work with no FPU targets
(cherry picked from commit cc2e0517e1)
2018-08-25 20:41:09 -05:00
Bartek Szatkowski 9a87d7b6a0 CMSIS/RTX: Patch RTX4 to preserve osThreadDef compatibility
mbed OS used older RTX4 version and with osThreadDef accepting only 3
parameters, to preserve compatibility we hardcode the 'instances'
parameter to 1.

(cherry picked from commit 428acae1b2ac15c3ad523e8d40755a9301220822)
(cherry picked from commit 4360b7bbf8)
2018-08-25 20:41:08 -05:00
Russ Butler 342841aa0f [CMSIS_5]: Updated to 0b521765 2018-08-25 20:41:00 -05:00
Russ Butler 5d0aac53bb Move Code to get Cortex A tick irqn
Move the function "mbed_get_a9_tick_irqn()" declared in os_tick.h
to SysTimer.h so it does not get overridden when RTX is updated.

This function was originally added in:
3d3e89097d
Fixes for RZ_A1H issue 6543
2018-08-25 20:40:17 -05:00
Oren Cohen 787317b7eb Remove uVisor from mbed-os 2018-08-22 16:36:59 +03:00
Cruz Monrreal f62e1032af
Merge pull request #7600 from c1728p9/remove_unnecissary_low_power_ticker_rescheduling
Remove unnecessary low power ticker rescheduling
2018-08-16 13:37:01 -05:00
Brendan McDonnell b2480d6281 fix comment copy/paste error 2018-07-31 18:14:31 -04:00
Cruz Monrreal 41bd4c48b9
Merge pull request #7628 from SenRamakri/sen_RtxEvrOptimization
Optimize the configuration for RTX evr events
2018-07-31 11:40:03 -05:00
Cruz Monrreal b8a2a461cf
Merge pull request #7545 from SenRamakri/sen_StackMaxStackIssue
Fix for Thread::max_stack not returning right value when OS_STACK_WATERMARK is enabled
2018-07-31 11:37:15 -05:00
Senthil Ramakrishnan 6221e6fa23 Optimize the configuration for RTX evr events to disable the ones not in use 2018-07-27 13:05:16 -05:00
Russ Butler 05d33b068d Remove unnecessary low power ticker rescheduling
Schedule the next OS tick inside of the ticker interrupt rather than
in the systick interrupt. Scheduling this while the ticker is
dispatching prevents an unnecissary rescheduling since this
rescheduling is done anyway when dispatching is finished.

This is particularly useful for the low power ticker on devices with
LPTICKER_DELAY_TICKS set to a non-zero value. This is because the low
power ticker cannot be reschduled immediately and needs to fall back
onto the microsecond ticker which temporarily locks deep sleep.

Note - the optimization in this commit is made possible by the commit:
"Don't reschedule ticker while dispatching"
2018-07-25 23:24:12 -05:00
Senthil Ramakrishnan 577844d3d3 Fix spelling in error message in fault handler 2018-07-19 10:31:34 -05:00
Senthil Ramakrishnan 481285a324 Fix for max_stack not returning right value when OS_STACK_WATERMARK is enabled 2018-07-18 15:05:39 -05:00
ccli8 0b00d0ce11 Allow non-secure main thread to call secure functions 2018-07-12 18:01:32 +08:00
Jimmy Brisson 0222ca4976 Add _RTX_ define where it's needed and used 2018-07-11 13:49:57 +01:00
Cruz Monrreal 93233c4f5d
Merge pull request #7364 from 0xc0170/fix_storage_rtos
Fix storage rtos types - remove including internal header file
2018-07-05 14:29:46 -05:00
Martin Kojtal 97a3ca193e boot: fix libspace num macro
RTX Config header file is internal and not exposed. With latest fixes to use
only public header files from RTX, we need to add these 2 new macros for
RTX ARMC lib configuration.
2018-06-29 11:43:17 +01:00
Martin Kojtal 2be3c13534
Merge pull request #7355 from deepikabhavnani/rtx_header_fix
Remove semicolon at the end of #6897 

Upstream fix https://github.com/ARM-software/CMSIS_5/pull/384
2018-06-29 08:43:06 +02:00
Martin Kojtal e91ab9c1a1 Thread: fix rtx thread type 2018-06-28 14:40:08 +01:00
Martin Kojtal 5c0f1b5db3 rtos: use RTX identifier
os_thread_t and family are internal and should not be used (thus we included
internal header file). Instead, use those that are exposed via rtx_os.h file.
2018-06-28 14:12:16 +01:00
Deepika 357138468a Remove semicolon at the end of #define 2018-06-27 15:47:49 -05:00
Cruz Monrreal ea47342f81
Merge pull request #7214 from SenRamakri/sen_ErrorOptimAndConfig
Error handling configuration updates and Optimization for exception handling
2018-06-25 10:10:49 -05:00
Deepika bc65153a4d Add names to idle/timer thread 2018-06-21 18:32:43 -05:00
ccli8 8071409963 Move RTX_NO_MULTITHREAD_CLIB from RTX_Config.h to mbed_rtx_conf.h
This is to avoid change to RTX code base.
2018-06-21 09:57:21 +08:00
ccli8 f055c2a700 Add comment with RTX_NO_MULTITHREAD_CLIB movement 2018-06-21 09:54:47 +08:00
Senthil Ramakrishnan baa44eb3f2 Limit error filename capture to 64 chars, wrapping tests with right configs and astyle fixes. 2018-06-20 11:56:32 -05:00
Senthil Ramakrishnan dcdd616e6d Update exception handling code to remove dedicated fault safe printfs and use mbed_error_printf to optimize memory usage.
Dedicated safe printfs were originally developed to print data over serial with minimal resources. But this adds more code space, so we are switching to use mbed_error_printf.
2018-06-20 11:56:32 -05:00
ccli8 afc0a28cc5 Support thread-safety with ARMC6
1. Define RTX_NO_MULTITHREAD_CLIB to provide Mbed-specific multi-thread support for ARM/ARMC6
2. All overridden _mutex_xxx functions are declared with __USED to avoid excluded by linker

NOTE: Microlib doesn't support multi-thread
2018-06-20 10:35:47 +08:00
Jan Jongboom 63d1684bbe
Spelling error in fault handler 2018-06-18 10:58:12 +08:00
Michael Coulter 3d3e89097d Fixes for RZ_A1H issue 6543
Removed debugging code, fixed errors indicated in the comments.
2018-06-11 13:30:17 -05:00
Cruz Monrreal 1fa333df82
Merge pull request #7032 from TomoYamanaka/feature-rtx_update
Update cmsis/rtx for Cortex-A
2018-06-02 20:52:40 -05:00
Cruz Monrreal f92c227558
Merge pull request #7027 from c1728p9/timer_fix
Fix possible bug with SysTimer
2018-05-31 11:07:34 -05:00
Vladimir Umek 4251af0248 RTX5 (Cortex-A): exception handling restructured, post processing moved after context save. 2018-05-28 19:36:42 +09:00
Vladimir Umek 165c663871 RTX5: fixed nesting interrupt handling (Cortex-A) 2018-05-28 13:55:35 +09:00
Vladimir Umek b6c4139328 RTX5: ignoring CPUID field in GIC implementation
updated interrupt handler for GCC and IAR
2018-05-28 13:54:44 +09:00
Vladimir Umek 0226b11b67 RTX5: disabled OS Tick interrupt during post processing in IRQ handler for Cortex-A devices 2018-05-28 12:52:11 +09:00
Russ Butler aa6b931698 Fix possible bug with SysTimer
Ensure the SysTimer isn't added to the timer list twice by adding
an extra call to remove() inside suspend().
2018-05-27 13:15:00 -05:00
Bartek Szatkowski a92ff94904 Fix rebase error 2018-05-25 12:20:10 -05:00
Bartek Szatkowski 9575dd26ec Don't use tickless if LPTICKER is not present
The current implementation of tickless requires LPTICKER to be present.
2018-05-25 12:20:09 -05:00
Cruz Monrreal 527f9a12fd
Merge pull request #6983 from SenRamakri/sen_ErrorHandling_Push2
Standardized Error Handling and Error Codes
2018-05-24 10:57:00 -05:00
Martin Kojtal d8cb72a0a2
Merge pull request #6273 from bulislaw/update_cmsis_5.3
Update cmsis/rtx to version 5.3
2018-05-24 09:37:40 +02:00
Senthil Ramakrishnan 5ef6728c08 Splitting MBED_ERROR macros to support ones with/without error value argument 2018-05-23 12:21:28 -05:00
Senthil Ramakrishnan 693a6c40bb Refactor error reporting 2018-05-23 12:21:11 -05:00
Senthil Ramakrishnan d4fe75731d Adding mbed prefixes to all macros and functions to avoid namespace conflicts 2018-05-23 12:21:10 -05:00
Senthil Ramakrishnan 147d9cac4e Test application/cases optimization for some low memory targets, macro changes and test fixes 2018-05-23 12:21:10 -05:00
Senthil Ramakrishnan cbfc06577b Fixes to align with naming conventions 2018-05-23 12:21:09 -05:00
Senthil Ramakrishnan 92df68b1ea Changed variable names for registers to avoid namespace conflicts, build fixes, macros and other fixes 2018-05-23 12:21:09 -05:00
Senthil Ramakrishnan 530e9d323f Changed variable names for registers to avoid namespace conflicts and rtos disabled build fixes 2018-05-23 12:21:09 -05:00
Senthil Ramakrishnan 2e28dd95e1 Change set_error/set_error_fatal to warning/error, add itm support and other changes 2018-05-23 12:21:08 -05:00
Senthil Ramakrishnan 9041b475c6 Error handling/logging implementation and tests 2018-05-23 12:21:07 -05:00
Bartek Szatkowski b4d5f0e10f CMSIS: Move non-config includes behind PTIM ifdef
That is to enabled integration with build-it-all Mbed OS type build
system.

Cherry-picked from CMSIS_5 repo: e8d0a476
2018-05-14 12:18:21 +01:00
Bartek Szatkowski 1752803626 CMSIS/RTX: Fix using FALSE/TRUE with preprocesor 2018-05-14 12:18:21 +01:00
Bartek Szatkowski a1fb51c283 RTX5: uVisor: Remove static from svcRtxKernelUnlock/Lock to support uVisor 2018-05-14 12:18:21 +01:00
Jaeden Amero 2f7a841e0e RTX5: uVisor: Defer to uVisor for SVCall priority
Only set the SVCall priority if uVisor is not present. If uVisor is
present, keep using whatever priorities it has already set up.
2018-05-14 12:18:21 +01:00
Jaeden Amero 32d04a08d0 RTX5: uVisor: Add OsEventObserver
Add the OsEventObserver mechanism. A client interested in receiving
notifications on certain OS events can register to receive notifications
with osRegisterForOsEvents. This is useful for clients like the secure
memory allocator, which observes thread switching events in order to
swap in and out different memory allocator objects.
2018-05-14 12:18:21 +01:00
Jaeden Amero 86b91beeca RTX5: uVisor: Extend thread control block with context
OsEventObserver objects expect a context to be maintained per thread on
their behalf. Add this context to the thread control block and extend
the thread creation functions with the ability to supply a context.
2018-05-14 12:18:21 +01:00
Jaeden Amero c250369803 RTX5: uVisor: Use OsEventObserver 2018-05-14 12:18:21 +01:00
Jaeden Amero 73a957997f RTX5: uVisor: Switch threads very carefully
uVisor doesn't set the PSP of the target thread. The RTOS sets the PSP
of the target thread from the target thread's TCB. However, when
interrupts of higher priority than PendSV happen between the call to
uVisor to switch boxes, and the RTOS setting PSP, the uVisor vIRQ
interrupt handler will attempt to use an invalid PSP (the PSP from
before the box and thread switch). This leads to a crash. Make box and
thread switching atomic by disabling interrupts immediately before the
box switching until immediately after the new PSP is set.
2018-05-14 12:18:21 +01:00
Bartek Szatkowski 3f1ea4b9ee CMSIS/RTX: Update idle handler and SysTick ops 2018-05-14 12:18:21 +01:00
deepikabhavnani 287121ffdc CMSIS/RTX: Pre-processor defines used for assembly
CMSIS repo does not support pre-processor defines, hence multiple assembly
files are added for secure/non-secure and floating point tools.

Mbed OS tools support assembly file pre-processing, but the build system
does not support multiple assembly files for each target, hence updating
the assembly files.
2018-05-14 12:18:20 +01:00
Bartek Szatkowski b88254809e CMSIS/RTX: Allow overwriting mutex ops for ARMC 2018-05-14 12:18:20 +01:00
Bartek Szatkowski cc2e0517e1 CMSIS/RTX: Patch RTX so irq_cm4f.s files work with no FPU targets 2018-05-14 12:18:20 +01:00
Bartek Szatkowski 4360b7bbf8 CMSIS/RTX: Patch RTX4 to preserve osThreadDef compatibility
mbed OS used older RTX4 version and with osThreadDef accepting only 3
parameters, to preserve compatibility we hardcode the 'instances'
parameter to 1.

(cherry picked from commit 428acae1b2ac15c3ad523e8d40755a9301220822)
2018-05-14 12:18:20 +01:00
Bartek Szatkowski 8afbd66763 [CMSIS_5]: Updated to 49ac527a 2018-05-14 12:18:20 +01:00
deepikabhavnani 97c88188d0 Cleanup
1. Enable watermark to get stack space information
2. Restructured code
3. Throw error if MBED_THREAD_STATS_ENABLED is not set
4. Astyle changes
2018-05-11 10:06:44 -05:00
Cruz Monrreal ab7a856657
Merge pull request #6784 from deepikabhavnani/mbed_stats_fix
Add common define MBED_ALL_STATS_ENABLED to enable all statistics
2018-05-10 23:25:23 -05:00
deepikabhavnani 52c33b5494 Add stats header file to mbed.h
All API header files should be part of mbed.h
2018-05-09 10:24:28 -05:00
Cruz Monrreal 53aa1b04ab
Merge pull request #6654 from kjbracey-arm/fault_cr
Add missing carriage returns to fault handler
2018-05-07 10:41:40 -05:00
ccli8 7b94d4dc32 Add MBED_CONF_APP_TIMER/IDLE_THREAD_STACK_SIZE to configure timer/idle thread stack size by application 2018-05-03 09:46:57 +08:00
ccli8 285bb87fe9 Change back default size of timer thread stack
Configuration for changing this size is kept.
2018-05-03 09:46:56 +08:00
ccli8 eecdd3834e Enlarge timer thread stack size for Cortex-M23/M33 2018-05-03 09:46:55 +08:00
deepikabhavnani a228fd0f3b Add common define to enable all statistics
As part of Device Health requirement, all mbed OS statistics should be
enabled with single macro `MBED_ALL_STATS_ENABLED`
2018-05-02 14:14:07 -05:00
ccli8 47c3197f13 Support RTOS-less secure image build with Cortex-M23/M33 2018-04-26 09:33:09 +08:00
Martin Kojtal 675528b6c0
Merge pull request #6534 from c1728p9/rtos_suspend
Update idle loop to reduce calls to suspend
2018-04-25 13:21:47 +01:00
Cruz Monrreal 5fcc9617de
Merge pull request #6486 from deepikabhavnani/thread_class_tz
Thread class tz
2018-04-23 11:03:08 -05:00
Kevin Bracey fc61b8ab50 Add missing carriage returns to fault handler
Fault handler was outputting just LFs between lines, when standard
terminals require CR+LF, leading to messy output.
2018-04-17 14:35:03 +03:00