Commit Graph

242 Commits (8569c09626a9aa6ae865cd732b52fae0da565ea2)

Author SHA1 Message Date
Jaeden Amero 0d34c3636e mbed_rtx_idle: uVisor: Don't attempt to sleep
When uVisor is enabled, don't attempt to sleep. Attempting to sleep will
fail, as per <https://github.com/ARMmbed/uvisor/issues/420>.
2017-09-14 17:20:23 +01:00
Anna Bridge 7b428916f5 Merge pull request #4949 from theotherjimmy/feature-armc5+armc6
NEW TOOLCHAIN: Add the ARMC6 Compiler
2017-09-13 10:39:15 +01:00
Jimmy Brisson 922bf1b619 Update mbed OS to handle ARMC6 requirements 2017-09-11 13:20:32 -05:00
Deepika 9422c351e4 Initial RTX and tools support for Cortex M-23/M-33 devices 2017-09-11 11:43:26 -05:00
Anna Bridge cab660d980 Merge pull request #4938 from deepikabhavnani/IAR_fixes
Update IAR to version 8
2017-09-11 17:28:38 +01:00
Russ Butler c3eae587eb Add tickless support for devices without SysTick
Some Cortex-M0 devices, such as the nrf51, don't have the SysTick.
Instead, these targets use a software interrupt to simulate SysTick.
Add the hooks in the tickless code to support these devices. Targets
which do not have SysTick should now define NO_SYSTICK in targets.json
and implement mbed_get_m0_tick_irqn to add os suport.

This patch also removes os tick handling from the existing devices
(nrf51) since this is now handled in common code.
2017-09-07 21:35:04 -05:00
Russ Butler e44d94fa1e Add initial support for tickless RTX
Add support for tickless by replacing RTX's SysTick timer code with
with code which uses an mbed timer along with suspending and
resuming the kernel in the idle loop. Tickless is enabled on a
per-target basis by defining the macro MBED_TICKLESS.
2017-09-07 21:34:57 -05:00
Jimmy Brisson e12f116ec1 Merge pull request #4912 from 0xc0170/dev_sleep_drivers
Add sleep manager API
2017-09-07 18:26:49 -05:00
Martin Kojtal 39f31c3195 idle loop: add deepsleep locks
For backward compability, we invoke just sleep mode. Adding critical section to complete
lock/unlock deepsleep section.
2017-09-07 15:35:07 +01:00
Deepika 7d98eebf2a __IAR_SYSTEMS_ICC__ macro had issues when 7.5 and 8.11 both workbench are installed 2017-09-06 09:51:17 -05:00
Deepika fe2646d183 Added new locking init requirement for v8.x
The application must call void __iar_Initlocks(void); before any
lock is used.
2017-09-06 09:51:16 -05:00
Deepika 6c1ad4a4e4 Use correct IAR toolchain macro 2017-09-06 09:51:16 -05:00
Deepika 22afcfacbd _MAX_LOCK define is moved to DLib_Threads.h 2017-09-06 09:51:15 -05:00
Russ Butler b2384b1629 Remove use of internal RTX types
Make calls to cmsis-os to get thread state, stack size, and max stack
usage rather than accessing internal RTX data directly. Wrap RTX5
specific code in OS_BACKEND_RTX5.

Also refactor the code to use mbed types rather than RTX types:
os_timer_t -> mbed_rtos_storage_timer_t
os_event_flags_t -> mbed_rtos_storage_event_flags_t
osRtxMutex_t -> mbed_rtos_storage_thread_t
2017-09-04 11:26:38 -05:00
Russ Butler ac22225ad9 Move Cortex specific RTX behind TARGET_CORTEX
Update directory structure to include RTX for only cortex targets, and
for all cortex targets. This patch accomplishes this by moving mbed-os
specific RTX files and RTX itself into rtos/TARGET_CORTEX along with
removing TARGET_CORTEX_M from the RTX5 directory.

The old directory structure:

rtos/rtx5/<mbed-os specific RTX files>
rtos/rtx5/TARGET_CORTEX_M/*
rtos/rtx4/*
rtos/<mbed-os specific RTX files>

Is re-arranged to:

rtos/TARGET_CORTEX/rtx5/*
rtos/TARGET_CORTEX/rtx4/*
rtos/TARGET_CORTEX/<mbed-os specific rtx files>

This both encapsulates RTX code more cleanly and makes it easier to
experiment with non-cortex cmsis-os2 backends, such as a posix
based cmsis-os2 backend.

Note - A potentially better name for the CORTEX_M directory would be
something like FEATURE_RTX5 since this directory only contains RTX5
related files. This cannot be done because there is not an easy way
to turn this feature on, since it cannot be done from mbed_lib.json.
2017-08-31 19:55:54 -05:00
Jimmy Brisson 3e00a22d78 Merge pull request #4941 from mprse/fix_mem_pool_header_file
Update of MemoryPool.h header file.
2017-08-24 10:18:18 -05:00
Przemyslaw Stekiel 5abbccb45c Fix pool buffer size, update free() description, add assertion in MemoryPool.h header file.
Provide fix for pool buffer size: pool block size must be
a multiple of 4 bytes.
Add assertion to forbid creation of MemoryPool object with queue size equal to 0.
Update description of free() function. Add information about
statuses returned by this function.
2017-08-21 18:09:51 +01:00
Bartek Szatkowski b0ad73ea41 RTOS: Changes to the EvenFlags API, doxy and tests 2017-08-15 13:33:32 +01:00
YarivCol c532a9a06d RTOS: Add EventFlags class
EventFlags class is a wrapper for Event Flag functionality introduced in
RTOS2/RTX5.
2017-08-15 13:27:30 +01:00
Jimmy Brisson 99a8467b70 Merge pull request #4817 from c1728p9/move_rtx_handlers
Move RTX error handlers into RTX handler file
2017-08-14 11:44:19 -05:00
Jimmy Brisson a81783e177 Merge pull request #4752 from bulislaw/queue_tests
RTOS: Queue tests & docs rework
2017-08-07 10:27:11 -05:00
Russ Butler 46f6f52299 Move RTX error handlers into RTX handler file
Move the RTX error handlers out of mbed_retarget.cpp and into an the
dedicated RTX handler file.
2017-07-27 10:08:39 -05:00
Jimmy Brisson c5c470e22c Merge pull request #4729 from bulislaw/mutex_tests
RTOS: Mutex: Rework tests
2017-07-27 09:40:26 -05:00
Bartek Szatkowski a1736e6341 Boot: Provide dynamic mutexes for ARM toolchain
ARM toolchain requires variable number of dynamic mutexes. We use combination of
RTX mutex pool and heap allocation to achieve that.
2017-07-21 10:09:53 +01:00
Jimmy Brisson 160940b30e Merge pull request #4682 from bulislaw/sem_tests
Test: RTOS: Semaphore: Rework tests
2017-07-17 11:06:48 -05:00
Jimmy Brisson 18bb6fdc1f Merge pull request #4620 from bulislaw/thread_tests
Extend tests for RTOS Thread class
2017-07-17 11:03:34 -05:00
Bartek Szatkowski ffd1c031a6 RTOS: Queue: Improve API docs 2017-07-12 15:39:54 +01:00
Bartek Szatkowski 0935683187 RTOS: Mutex: Improve API docs 2017-07-12 11:02:12 +01:00
Bartek Szatkowski 2963308349 RTOS: Semaphore: Improve API docs 2017-07-11 15:01:40 +01:00
Bartek Szatkowski 739a429820 Test: RTOS: Semaphore: Rework tests 2017-07-11 15:01:39 +01:00
Kevin Gilbert 4d1ad1d3d5 Fix typo runnig_thread -> running_thread 2017-06-30 17:24:43 -05:00
Jimmy Brisson 2ffd264bba Merge pull request #4601 from pan-/fix_memory_pool_destructor
rtos: Fix MemoryPool and Queue destructor
2017-06-29 11:07:38 -05:00
Bartek Szatkowski 0b359263d8 RTOS: Thread: Update thread state docs 2017-06-29 13:01:22 +01:00
Bartek Szatkowski 4c489e686b RTOS: Thread: Fix how free stack is calculated 2017-06-29 13:01:21 +01:00
Bartek Szatkowski 505beb773f RTOS: Thread: Fix return value for signal_wait
Signal wait was always returning success even in case of error.
2017-06-29 12:58:44 +01:00
Bartek Szatkowski af1832d4c7 RTOS: Thread: Update docs; make singal_clr static as it's affects running thread 2017-06-29 12:58:44 +01:00
Bartek Szatkowski 8cc21ea505 RTX: Fixed RTXv5 mutex owner list handling.
The prev-pointer of the running threads mutex list was not set when
multiple mutexes are acquired at a time. This leads to a corrupted list
if the mutexes are not freed in reversed order.

Original commit for CMSIS_5:
commit 729f6ab08540342b7de7612fac103539d5b2f168
Author: Jonatan Antoni <jonatan.antoni@arm.com>
Date:   Wed Apr 19 15:38:43 2017 +0200
2017-06-27 14:39:34 +01:00
Vincent Coubard e690ee04e0 rtos: Add missing Queue destructor. 2017-06-21 11:21:34 +01:00
Vincent Coubard b49fbf1d91 rtos: Add missing destructor for MemoryPool objects. 2017-06-21 11:14:50 +01:00
Vincent Coubard 3119c4238d rtos Thread: Remove private copy constructor and assignment operators in favor of the NonCopyable traits. 2017-06-20 16:23:44 +01:00
Vincent Coubard 4d5f805cde rtos: Tag non value type as NonCopyable.
The types marked are: Mail, MemoryPool, Mutex, Queue, RtosTimer and Semaphore.
2017-06-20 16:23:44 +01:00
Jimmy Brisson 77b6127a71 Merge pull request #4579 from geky/rtos-unbreak-semaphore
RTOS: Fix semaphore
2017-06-19 15:32:48 -05:00
Christopher Haster 6b02ceab5d rtos: Unbreak semaphore, trade assert for saturation with original limit
Before rtx 5, the max count on semaphores was UINT16_MAX, aftewards it
was decreased to 1024 with an assert on overflow.

This is especially problematic for semaphores used for signaling, since
there is no replacement currently available in C++.
2017-06-16 17:18:40 -05:00
Vincent Coubard fd7eff202c RTOS: Allow per target definition of OS_IDLE_THREAD_STACK_SIZE.
The stack required for the idle thread is highly dependent on the
target because it will call the sleep function which is target
specific.

While 256 bytes of stack is enough for most targets, others like the
NRF52840 might require more.

With this change, target maintainers can specify the idle thread stack
size in their mbed_rtx.h file.
2017-06-16 10:11:12 +01:00
Russ Butler fc18250b1f Increase background stack size to fix overflow
Bump the background stack size to 512 bytes to fix stack overflows on
the NRF52 and so it is the same size as it was before the switch to
RTX5.
2017-06-14 17:31:52 -05:00
Martin Kojtal d3cf5fb999 Merge pull request #4445 from theotherjimmy/fix-exporters
Fixes for exporter issues
2017-06-09 15:04:01 +01:00
Jimmy Brisson fc6c2b85ff Upcase assembly file suffix for preprocesssing 2017-06-09 00:03:23 -05:00
Kevin Gilbert 567589f138 Resolve Doxygen errors from RTOS. Fixed minor Doxygen bug in FileSystemHandle.h as well 2017-06-08 15:51:04 -05:00
Jaeden Amero 778d6822bf 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-06-04 14:41:59 +01:00
Russ Butler cabc1e0911 Fix Thread class synchronization
Prevent osTheadTerminate from being called on an already terminated
thread. Also make sure the thread termination process is properly
synchronized.
2017-06-02 23:50:38 -05:00