Commit Graph

315 Commits (374b705d969df026a8049cfabbd72d17784c38c3)

Author SHA1 Message Date
Brendan McDonnell 18716f1b20 remove unused variable / resolve compiler warning 2018-02-23 17:08:30 -06:00
Deepika e33ff50409 Pulling in CMSIS commit 05fa9d328a
Systick handler switch to secure/nonsecure issues addressed:
1. Switch to secure/nonsecure context save/restore is based on 6th bit in
LR register, correct the bug (R7 instead of LR was used for decision)
2. Prevent R7 from being corrupted in Sys_ContextSave
3. Branch when non-secure rather than secure
2018-02-23 17:08:29 -06:00
deepikabhavnani 3e181422d8 RTX5: 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-02-23 17:08:29 -06:00
Deepika c37f25a090 Default values for Trustzone Idle/Timer thread updated
Default value for timer/idle thread trustzone identifier is 0, updated
it to 1 to allow threads to access secure functions when timer is secure device.
2018-02-23 17:08:29 -06:00
Deepika cdb2ec21c1 RTX changes pulled in from d20b8aad7f5e
RTX5: Added TrustZone Module Identifier configuration for Idle and Timer Thread
2018-02-23 17:08:29 -06:00
Kevin Bracey 5784c8aed7 Correct ConditionVariable ISR comments
No ConditionVariable methods are useable from ISR, due to the built-in
mutex and the requirement that the caller of notify holds the mutex.
2018-02-09 14:18:44 +00:00
Kevin Bracey 8f521a4743 Add Thread::wait_until
API is somewhat loose to cope with potential shift in the underlying
RTOS APIs.
2018-02-09 14:18:44 +00:00
Kevin Bracey f740ecea13 Add Semaphore::wait_until
Given the 64-bit timebase, add wait_until to Semaphore.

Naming is based on Thread::wait_until.

pthreads uses "timedwait", but that's not a good fit against our
existing wait() - pthreads only has an absolute-time wait, not relative.
2018-02-09 14:18:44 +00:00
Kevin Bracey 436301dc5e Add Mutex::trylock_until and trylock_for
Given the 64-bit timebase, add trylock_until to Mutex.

Naming is based on a combination of Mutex::trylock, Thread::wait_until,
and C++11 timed_mutex::try_lock_until.

pthreads and C11 use "timedlock", but that's not a good fit against our
existing trylock() and lock(timeout) - they have only absolute-time
waits, not relative.

To increase the similarity to C++11, add trylock_for - same parameters
as lock, but with the bool return value of trylock and trylock_until.

Add an assertion when convering status codes to booleans to check that
there are no non-timeout errors.
2018-02-09 14:18:44 +00:00
Kevin Bracey 029751db20 Add ConditionVariable::wait_until
Given the 64-bit timebase, add wait_until to ConditionVariable.

Move the timeout example to wait_until(), and give wait_for() an
alternative example, as it's no longer the best option for a
timeout.

Tidy up - remove the redundant RESUME_SIGNAL definition.
2018-02-09 14:18:44 +00:00
Kevin Bracey 866b669d6e Add Kernel::get_ms_count
Give C++ access to the RTOS's absolute timebase, reducing the need to
run private Timers and similar. Allows wait_until functionality, and
makes it easier to avoid time drift.

Place it in a new header and namespace in case we want more kernel
functions in future.

Try to cover over the breaking API change potentially upcoming in
CMSIS-RTOS 2.1.1, when it reduces the tick count from 64-bit to 32-bit.
(See https://github.com/ARM-software/CMSIS_5/issues/277)

Explicitly state that ticks are milliseconds in mbed OS, despite CMSIS
RTOS 2 permitting different tick rates.

See also https://github.com/ARMmbed/mbed-os/pull/3648 (wait_until
for condition variables) and
https://github.com/ARMmbed/mbed-os/issues/5378 (EventQueue should
use RTOS tick count).
2018-02-09 14:18:44 +00:00
Russ Butler c5d5718ed4 Remove tickless assert for tick count
Remove the assert that the tick count of the OS matches the tick
count of the tickless timer as this occurs frequently when
debugging. This is because the function svcRtxKernelResume
only increments the OS's tick count until the next wakeup event
so if the device was halted by a debugger past the next wakeup
event the tick counts will be out of sync.
2018-01-27 00:57:55 -06:00
Martin Kojtal 51b7ed1114 RTX idle: sleep without locked deep sleep fix
If tickless is enabled, it should not be locking deepsleep
2018-01-27 00:57:46 -06:00
Amanda Butler 09f6c63219 Copy edit Thread.h
Copy edit file for active voice.
2018-01-27 00:57:22 -06:00
Amanda Butler 5e289cba3b Copy edit Semaphore.h
Copy edit file for active voice.
2018-01-27 00:57:22 -06:00
Amanda Butler 6d77c7fc8e Copy edit RtosTimer.h
Copy edit file for active voice.
2018-01-27 00:57:22 -06:00
Amanda Butler 06b8b8ccff Copy edit Queue.h
Copy edit file for active voice.
2018-01-27 00:57:21 -06:00
Amanda Butler b6a1662790 Copy edit Mutex.h
Copy edit file for active voice.
2018-01-27 00:57:21 -06:00
Amanda Butler 9dfa3bda4b Copy edit MemoryPool.h
Copy edit file for active voice.
2018-01-27 00:57:21 -06:00
Amanda Butler bdc21ed978 Copy edit Mail.h
Copy edit file for active voice and American English.
2018-01-27 00:57:21 -06:00
Amanda Butler 9c5536112e Copy edit EventFlags.h
Copy edit file for active voice and agreement.
2018-01-27 00:57:21 -06:00
Amanda Butler ad14bfde4e Copy edit ConditionVariable.h
Copy edit docs changes for active voice.
2018-01-27 00:57:21 -06:00
Bartek Szatkowski ddeea847c6 Add notes about ISR safety to RTOS doxygen 2018-01-27 00:57:21 -06:00
Vladimir Umek d4eb833f26 RTX5: fixed __get_PSP function for Cortex-A on IAR (#288) 2018-01-02 15:22:03 +00:00
Robert Rostohar 80521c8369 Core(A): Updated __FPU_Enable function (VFP register count detection) 2018-01-02 15:22:03 +00:00
Robert Rostohar 668883a7f0 RTX5: Cortex-A exception handlers updated (VFP register count detection) 2018-01-02 15:22:02 +00:00
Maciej Rogozinski 9cdeab949d Fixed whitespace 2017-12-20 16:05:44 +00:00
Maciej Rogozinski 3db98b5223 Fatal parameter error when deleting/terminating Thread object
Call to osThreadTerminate is guarded by local_id check, to avoid parameter error fault when deleting or terminating Thread object that was not started.
2017-12-20 16:05:44 +00:00
Senthil Ramakrishnan a3bb61b8f0 Statically allocate ARMCC required mutex objects 2017-12-20 16:05:44 +00:00
Bartek Szatkowski 80dc8d67f4 Remove inclusion of an internal RTX header 2017-12-20 16:05:42 +00:00
Christopher Haster 7e45aee8a5 Fixed mutex assert in armcc fopen and related memory leak
armcc fopen allocated a mutex using the retargeted system-level
_mutex_initialize function. Interestingly, malloc also uses this
same _mutex_initialization function, which prevents a full solution
relying on malloc. The solution previously implemented involved using
the rtx mutex pool for the first 8 mutexes, then falling back on
malloc.

The previous implementation relied on osMutexNew returning an error
on out-of-memory. An unrelated change causes osMutexNew to instead
assert (except for release mode). This meant if you exceed 8 system-
level mutexes in armcc you will hit an assert. Since the filesystem
code can call fopen an unlimited number of times, this is a problem.

Solution is to keep track of which static mutexes we've allocated, so
we know before calling osMutexNew if we need to call malloc.

Also _mutex_free never deallocated the malloced mutexes, which would
cause fopen to leak memory.
2017-11-22 16:53:19 -06:00
Russ Butler 93cf15d57c Fix and add test for ConditionVariable
Fix the circular linked list handling in ConditionVariable and add a
test to validate the linked list implementation.
2017-11-15 16:15:27 -06:00
Martin Kojtal 41eb565d9c
Merge pull request #5342 from ARMmbed/feature_cortex_a
Update CMSIS/RTX with Cortex-A support
2017-11-15 11:24:36 +00:00
Bartek Szatkowski 7bee352dd7 Update SysTick API usage for tickless mode 2017-11-10 09:53:42 +00:00
Bartek Szatkowski 4b354f80cf Update include paths to match updated CMSIS 2017-11-10 09:53:41 +00:00
Martin Kojtal fbd9e7eaf2
Merge pull request #5372 from SenRamakri/sen_PlatformDoxygenUpdates
Doxygen comments fixes
2017-11-09 16:38:45 +00:00
Martin Kojtal c45dd269f5
Merge pull request #3648 from c1728p9/condition_variable
Add ConditionVariable to mbed rtos
2017-11-09 16:38:02 +00:00
Martin Kojtal 242c8700a6
Merge pull request #5428 from kjbracey-arm/rtos_attrs
Shrink RTOS classes
2017-11-09 16:29:15 +00:00
Kevin Bracey 130fffaf8b Shrink RTOS classes
Various RTOS classes were storing their CMSIS-RTOS creation attribute
structure as a member, when it's not required after construction. Reduce
memory by eliminating this member.
2017-11-03 15:22:22 +02:00
Russ Butler 0c4e50abb3 Add ConditionVariable to mbed rtos
Add the ConditionVariable class to mbed rtos to provide easier and
safer synchronization.
2017-11-02 21:02:27 -05:00
Jimmy Brisson 3a05b63f1e
Merge pull request #5158 from YarivCol/master
RTOS : added empty and full functions to Mail and Queue
2017-11-02 10:46:06 -05:00
Jaeden Amero 75ad20b65f 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.
2017-11-01 09:25:43 +00:00
Jaeden Amero 474f6c63ba RTX5: uVisor: Use OsEventObserver 2017-11-01 09:25:43 +00:00
Jaeden Amero 12a47f0031 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.
2017-11-01 09:25:43 +00:00
Jaeden Amero f363ccbb59 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.
2017-11-01 09:25:42 +00:00
Jaeden Amero 372b7b8b47 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.
2017-11-01 09:25:42 +00:00
Bartek Szatkowski b8aa068def CMSIS/RTX: Rename asm files to upper case .S 2017-11-01 09:25:42 +00:00
Bartek Szatkowski 4523b5d266 CMSIS/RTX: Allow overwriting _mutex_initialize symbol for ARMC 2017-11-01 09:25:42 +00:00
Bartek Szatkowski 3f97e57364 CMSIS/RTX: Remove os_tick_gtim.c
This implementation of timer conflicts with the default ptim, we will
keep the default and let the timer override the implmenetation if
needed.
2017-11-01 09:25:42 +00:00
Bartek Szatkowski 1b131edd69 CMSIS/RTX: Patch RTX so irq_cm4f.s files work with no FPU targets 2017-11-01 09:25:42 +00:00