Commit Graph

94 Commits (f51d8cfa3ebc43528b3987660be4d4cd61126823)

Author SHA1 Message Date
Russ Butler d9ac33d0c3 Increase interrupt stack size for K64F
The config store tests use more than 2K of the interrupt stack, causing
an overflow.  This patch bumps the K64F interrupt stack size to 4K
for ARMCC and GCC. The IAR interrupt stack is left untouched since
it is 32K.
2016-08-09 14:55:05 -05:00
Russ Butler 1615dca6bd Add a test for heap and stack layout
Test the following components of the heap and stacks:
-Heap and interrupt stack are at the expected locations
-Entire heap can be used
-Heap limit is properly enforced and returns NULL when out of
  of memory
2016-08-09 14:54:17 -05:00
Russ Butler 81382ebdb2 Turn on main thread stack checking
Since the heap and stack are no longer shared, stack checking on the
main thread can be turned back on. This allows stack overflows on the
main thread to be caught quickly.
2016-08-09 14:50:17 -05:00
Russ Butler 1d3d01f000 Correctly set INITIAL_SP for K64F
With the latest K64F linker file the initial stack is out of sync
with INITIAL_SP when uVisor is not present. This patch removes
the incorrect declaration.
2016-08-09 14:49:47 -05:00
Russ Butler da4787f036 Adjust stack size for the nrf51
Decrease the main stack size for the nrf51 so there is more heap
space available.
2016-08-09 14:42:09 -05:00
Russ Butler 7cf1dc1155 Fix heap limit checking and make memory explicit
Set well defined limits for the heap and configure GCC and ARMCC to
correctly check these. IAR already correctly checked its heap.

This also statically declares the main thread stack so the
linker is responsible for its placement.
2016-08-09 13:44:33 -05:00
Russ Butler e44ab35c42 Fix joining a terminated thread
When a thread is terminated signal the join semaphore so any threads
joining the terminated thread wake up as expected.
2016-08-08 16:42:20 -05:00
Sam Grove 34caf43f5a Merge pull request #2238 from OpenNuvoton/nuc472
[NUC472] Add NUMAKER-PFM-NUC472
2016-08-04 10:37:31 -05:00
Russ Butler 191596ea57 Set thread ID to NULL after termination
After a thread has been terminated set its ID to NULL since the handle
is no longer valid. This prevents accidental use of a deleted thread.
2016-08-03 11:02:46 -05:00
Russ Butler 55d74c55ed Fix join and make Thread class thread safe
Add a mutex to the thread object to protect its internal data. Prevent
making OS calls with a thread ID that has been terminated. This thread
ID can be reused by another thread, leading to undefined behavior if it
is used after termination.

Update the function Thread::join to use a semaphore to
determine when the thread finishes. This both avoids polling and
prevents a freed TCB from being accessed.
2016-08-02 21:17:40 -05:00
ccli8 41242e3d55 Support NUMAKER_PFM_NUC472 2016-07-28 10:00:49 +08:00
Sam Grove 90fa585568 Merge pull request #2211 from pan-/nrf52_nrf51_unified_integration
NRF52 target and unification with NRF51
2016-07-27 02:35:43 -05:00
Sam Grove d1da7bc0e7 Merge pull request #2256 from NXPmicro/K22_RTOS_FIX
The core clock in run mode is 80MHz for K22F
2016-07-26 21:20:23 -05:00
Russ Butler 2d50c60a78 Fix MAIN_THREAD_ID check
In cmsis_os.h OS_TIMERS is undefined unless the timer thread is
disabled, in which case it is defined to 0. When comparing against
an undefined value, the undefined value will evaluate as if it were
0. Because of this the MAIN_THREAD_ID was always set to 0x1.
This patch fixes that problem by checking if OS_TIMERS is defined
before comparing it to 0.

This problem only effects IAR since it has a different heap/stack
layout. GCC_ARM and ARM have a dedicated stack region so
the presence of a guard word and stack checking does not cause
problems.

This problem manifested on the NRF51_DK in the pull request
https://github.com/mbedmicro/mbed/pull/2211
as a c_strings test failure on floating point. This is because the
guard word of the main stack overlapped with standard library
data used by sprintf and corrupted it.
2016-07-26 18:05:58 -05:00
Mahadevan Mahesh 5a0ad646a1 The core clock in run mode is 80MHz for K22F
Signed-off-by: Mahadevan Mahesh <Mahesh.Mahadevan@nxp.com>
2016-07-26 13:50:50 -05:00
Martin Kojtal 239f31b437 Merge pull request #2199 from neilt6/rtos-timer-update
[RTOS] Updated RtosTimer to use Callback
2016-07-22 10:17:32 +01:00
Vincent Coubard f10cf7fe16 Merge remote-tracking branch 'mbed-nordic/epr_integration' into nrf52_nrf51_unified_integration 2016-07-21 14:50:37 +01:00
Martin Kojtal dd010097ba Merge pull request #2159 from jeromecoutant/PR_dev_NUCLEO_F207ZG
New STM32 board : NUCLEO_F207ZG
2016-07-21 11:13:33 +01:00
Neil Thiessen 2133dadb63 [RTOS] Fixed missing include in RtosTimer.h
Added missing include for the MBED_DEPRECATED macro.
2016-07-20 16:14:20 -06:00
Neil Thiessen 4d4089e7bc [RTOS] Added deprecated RtosTimer constructor
Reintroduced the original RtosTimer constructor as an additional deprecated constructor for backwards compatibility.
2016-07-20 16:07:12 -06:00
neilt6 511117acdf [RTOS] Updated RtosTimer to use Callback
Updated the RtosTimer class to use Callback in order to be consistent
with the updated Thread class.
2016-07-20 10:51:45 -06:00
Sam Grove 518afae619 Merge pull request #2189 from geky/rtos-sema-default
[rtos] Add default constructor for Semaphore
2016-07-19 17:11:22 -05:00
Sam Grove d89c3c18f9 Merge pull request #2158 from c1728p9/singleton_support
Singleton support
2016-07-19 16:34:20 -05:00
0xc0170 edf015ad92 Merge branch 'master' into release
Conflicts:
	tools/export/uvision4.py
	tools/export/uvision5.py
2016-07-19 08:44:34 +01:00
Christopher Haster 0140dc2e80 Added default constructor for Semaphore
Currently Semaphore can not be instantiated without an explicit count
as a constructor argument. This limits where Semaphores can be declared
and requires explicit initialization in several annoying places, such
as in member variables and SingletonPtr targets.

This adds a default count of 0, which has shown to be the most common
initial value used for semaphores.
2016-07-18 14:51:38 -05:00
Russ Butler 348b32c3c6 Create singleton class and update code to use it
Create the wrapper class SingletonPtr.  This provides a safe way to
declare and use singletons.  This class allows both the lazy
initialization of a singleton, and allows the singleton to be
garbage collected by the linker if it is never referenced.

This patch also updates the HAL to use SingletonPtr when declaring
singleton mutexes.
2016-07-15 14:37:43 -05:00
Russ Butler d4627176da Update ARMCC pre_main to be in C
Switch pre_main from assembly to C for ARMCC.  This function does not
need to be in assembly.
2016-07-15 14:12:37 -05:00
Russ Butler 59e2f9621c Suppress warnings about deprecated __ldrex/strex
Suppress warnings about ARMCC warnings about the __ldrex and __strex
intrinsics to match CMSIS 5.
2016-07-15 11:10:38 -05:00
Vincent Coubard 9745eff74c Merge commit 'ce830296d0297a8da543c24134bf859710fd7698' into epr_integration
Merge the EPR tag and the nordic branch together.
2016-07-13 12:06:02 +01:00
jeromecoutant 9fc0a625bd rtos update to add NUCLEO_F207ZG 2016-07-12 16:38:07 +02:00
0xc0170 9a7591f21f rtos - add mbed lib version requirement 2016-07-08 13:07:38 +01:00
tomoyuki yamanaka 8331d5641c Modify the timing at which mbed_main() is called in IAR compiler.
Renesas modified the timing at which mbed_main() is called in IAR compiler.
Because we fail about test "mbed call before main" in IAR compiler.
2016-07-07 21:58:01 +09:00
Martin Kojtal fe3b80aa68 Merge pull request #2090 from jamike/fix#2089
Fix#2089
2016-07-05 08:36:13 +01:00
Laurent Meunier be889fc49b [NUCLEO_F446ZE] Add RTOS support 2016-07-04 11:47:06 +02:00
Michel JAOUEN b73fd5e6f9 Fix issue #2089 :IAR set_main_stack
i.e test RTOS_4 on NUCLEO_F303K8 with IAR fails.
(rt_stk_check detects that main_stack Magic is corrupted)
2016-07-03 23:47:08 +02:00
ohagendorf fdda915a8a [NUCLEO_F767ZI] adding target to rtos lib 2016-07-01 15:19:30 +02:00
Martin Kojtal d3f95d2f60 Merge pull request #2055 from geky/rtos-deprecate-threads
Marked thread-spawning constructors as deprecated
2016-07-01 13:31:33 +02:00
Sam Grove 26e9aa4b4e Merge pull request #2075 from 0xc0170/fix_#2059
RTOS - fix for main thread id might not be 0x02
2016-06-30 14:29:21 -05:00
svastm 505814147d [NUCLEO_L432KC] Add RTOS support 2016-06-30 15:05:09 +02:00
0xc0170 757d340b0a RTOS - fix for main thread id might not be 0x02
Fixes #2059. As reported, if timer thread is not created, the main thread
id is 0x01. We introduce MAIN_THREAD_ID macro to define the id. We shall consider,
if we keep this in a variable.

I placed MAIN_THREAD_ID in cmsis_os.h as that header is safe to include within RTX, not like
RTX_Config.h or RTX_CM_Lib.h).
2016-06-30 11:15:21 +02:00
Sam Grove dff2c313ea Merge pull request #2053 from AlessandroA/guard_svc_priority_set
RTOS: Only set the SVC priority if uVisor is not present
2016-06-29 14:26:16 -05:00
Sam Grove 76be7c185b Merge pull request #2052 from meriac/master
Add secured page allocator for uVisor
2016-06-29 14:26:03 -05:00
Sam Grove 78cef9c176 Merge pull request #2019 from TomoYamanaka/master_3
Change stack size of main thread for RZ_A1H
2016-06-28 20:46:49 -05:00
Christopher Haster fab672a05e Marked thread-spawning constructors as deprecated
Thread-spawning constructors hide errors and may lead to complex
program state when a thread is declared.

The explicit Thread::start member function should be used to spawn
a thread.
2016-06-28 14:33:22 -05:00
Alessandro Angelino e22280e684 RTOS: Only set the SVC priority if uVisor is not present
uVisor requires the SVCall to have priority 0, while RTX allows it to be
the second lowest priority level in the system (after PendSV).

This commit makes sure that the SVCall priority is not changed if uVisor
is present. The PendSV priority is not affected.
2016-06-28 18:52:11 +01:00
Niklas Hauser 5044c968dd Use the stack top defined in the linkerscript 2016-06-28 16:49:00 +00:00
tomoyuki yamanaka 287aea22ee Update the comments of stack size for main threads
We updated the comments of stack size for main threads.
2016-06-28 11:15:19 +09:00
tomoyuki yamanaka e412f20e70 Change stack size of main thread for RZ_A1H
We changed the stack size of main thread for RZ_A1H.
We changed "OS_MAINSTKSIZE" from 2048 to 4096.
Because stack shortage was found in the automatic test by the CI System .
2016-06-27 20:42:19 +09:00
tomoyuki yamanaka d6624c078a RTX - init sequence (C++ array init) for Cortex-A version
This is an update to RTX kernel for Cortex-A version to allow c++ libc array init to be called after kernel start.
Ref: https://github.com/mbedmicro/mbed/pull/1730
2016-06-27 19:40:22 +09:00
Brian Daniels 93773bad68 Calling mbed_main when using RTX and compiling with IAR 2016-06-23 17:09:38 -05:00