Commit Graph

6515 Commits (2b5f0317c440e0317cc44f3d6b8ef8070eaae071)

Author SHA1 Message Date
Russ Butler d0b7b3b497 Fix duplicate symbols for malloc lock and unlock
When the malloc lock and unlock functions are inside a library they
conflict with the standard libraries weak version of these functions.
This is because of the way weak references are handled by the linker.
This patch renames the lock and unlock functions defined inside RTX
so they do not conflict.  A thunk inside retarget.cpp then calls the
RTX functions.  This problem does not occur with retarget.cpp since
it is always build into an object file rather than a library file.
2016-06-12 18:18:41 +01:00
Russ Butler 3db2c030d2 Only allow one thread on unsafe standard libs
When using a standard library which does not support multi-threading
allow only one thread to be used.  This allows the code to remain
safe.
2016-06-12 18:18:40 +01:00
Russ Butler ba4834dcd0 Fix OS_TCB_SIZE
The define OS_TCB_SIZE does not match the real stack size.  This
leaves the system with less than OS_TASKCNT TCBs and prevents
a single thread configuration.  This updates OS_TCB_SIZE to the
correct value to fix the problem.
2016-06-12 18:18:38 +01:00
Russ Butler 2518eaeaf5 Move main stack to fix stack overflow detection
The main stack ends at the start of the heap.  In some configurations
this causes the guard word to be overwritten when memory is allocated.
This causes an OS error in RTX since it appears that the main stack
overflowed.

This patch moves the main stack to the upper 1/4th of the heap which
prevents the guard word from getting overwritten.
2016-06-12 18:18:32 +01:00
Sam Grove 95c83935ac Merge pull request #1908 from mbedmicro/tools-update
Aligned make.py and build.py options
2016-06-12 17:58:50 +01:00
Sam Grove 4dba251c33 Merge pull request #1896 from geky/align-stack-iar
Added warning about stack alignment limitations on IAR
2016-06-12 17:45:34 +01:00
geky 6c24601550 Merge pull request #1905 from geky/rtx-iar-svc-clobbered
[rtos] Fixed registers clobbered SVC_Handler in IAR
2016-06-12 17:27:03 +01:00
Mihail Stoyanov 8f4cb59002 Added script for detecting connected mbed targets/boards 2016-06-12 10:59:51 +01:00
Christopher Haster 70ebb6f16b [rtos] Fixed registers clobbered SVC_Handler in IAR
The rtx SVC_Handler for IAR clobbers r0-r3 despite the number of
arguments. However, in the SVC calls, the __swi function is declared
with fewer arguments. IAR doesn't understand that the other registers are
clobbered and stores variables in r0-r3 when multiple SVCs are
dispatched in a single function.

This bug was noticed in osThreadExit, which hard-faults on IAR,
preventing any threads from exiting.
2016-06-11 19:34:20 -05:00
Mihail Stoyanov 9dbf80722d Aligned make.py and build.py options 2016-06-12 01:06:15 +01:00
Mihail Stoyanov 36ac663fa2 Merge pull request #1906 from geky/config-features
[build tools] Added support for cumulative attributes in configs directly
2016-06-12 00:13:17 +01:00
Christopher Haster 2d38065e1f [build tools] Added support for completely overriding cumulative attributes 2016-06-11 15:45:11 -05:00
Christopher Haster 36904fad1f [build tools] Moved cumulative attributes into target overrides
Attributes now get the filtering provided by target_overrides:
{
    "name": "cmsis-nodejs-SQL-x86",
    "target_overrides": {
        "*": {
            "device_has": ["SILLY_STRING", "FIRE"]
        },
        "SHOE": {
            "features_add": ["SMELLS_FUNNY"],
            "features_remove": ["SMELLS_NICE"],
        }
    }
}

per @screamerbg
2016-06-11 15:30:26 -05:00
Christopher Haster e3bde44b87 [build tools] Added support for cumulative attributes in configs directly
in mbed_lib.json:
{
    "name": "cmsis-nodejs-SQL-x86",
    "features_add": ["SMELLS_FUNNY"],
    "features_remove": ["SMELLS_NICE"],
    "device_has": ["SILLY_STRING", "FIRE"]
}
2016-06-11 14:44:59 -05:00
Sam Grove df0c855df9 Merge pull request #1904 from sg-/iar-lpc-eth-patch
rename section used for eth and usb
2016-06-11 18:25:01 +01:00
Sam Grove 1947c48502 Merge pull request #1863 from c1728p9/thread_safe_cpp_api
Make core mbed API thread safe
2016-06-11 18:07:44 +01:00
Russ Butler 3d8d441263 Make FAT filesystem thread safe
Add lock and unlock calls to the FAT filesystem so it is thread safe.
2016-06-11 17:33:13 +01:00
Russ Butler b174d6a314 Add virtual lock for thread safe classes
Add a virtual lock for the classes which are thread safe.  This
allows the use of a mutex to be overridden.
2016-06-11 17:33:12 +01:00
Russ Butler e4f6e1b327 Update assert and error to be interrupt safe
Add printf functions intended for errors which are safe to call from
interrupts.  Update assert and error to use this function.
2016-06-11 17:33:10 +01:00
Russ Butler a6f611b706 Add sync level documentation to classes
Document public classes to indicate level of protection provided.
2016-06-11 17:33:09 +01:00
Russ Butler feb60784e9 Make core mbed API thread safe
Make the mbed C++ API thread safe by adding a combination of
mutexes and critical sections.  Stub out all mutexes when the
RTOS is not present.
2016-06-11 17:33:02 +01:00
Sam Grove 50c106f718 rename section used for eth and usb 2016-06-11 07:11:09 -07:00
Yoshihiro TSUBOI 3c2229a2b1 [HRM1017] Update exporting template
changed merging softdevice from s110 to s130
2016-06-11 08:06:06 +09:00
Jimmy Brisson e333f9008f Add alias for uvision4 exporter
it is now called both uvision (old name) and uvision4 (new alias)
2016-06-10 14:22:30 -05:00
Sam Grove 52e93aebd0 Merge pull request #1893 from screamerbg/tools-improvements
mbed Tools features and improvements
2016-06-10 18:34:23 +01:00
Sam Grove 0b3556db2f Merge pull request #1898 from pan-/fix_nrf51_stack
Adjust the main stack of nrf51 targets to the call stack of thesoftdevice.
2016-06-10 18:00:45 +01:00
Sam Grove dc1c716618 Merge pull request #1897 from pan-/fix_nrf51_rtos_ticker
Fix function RTOS ticker of nrf51 port
2016-06-10 17:59:50 +01:00
Sam Grove 123d55d803 Merge pull request #1753 from meriac/master
Add initial uVisor port
2016-06-10 17:35:40 +01:00
Milosch Meriac 08ba670c7b Add initial uvisor release library 2016-06-10 17:01:29 +01:00
Alessandro Angelino 47025b81d2 uVisor: Define UVISOR_PRESENT based on target labels
Now there is no need any more to specify the UVISOR_PRESENT symbol from
the mbed command line tools. By using a target that has UVISOR_SUPPORTED
has a label, the uVisor-internal UVISOR_PRESENT symbol will be set
automatically.
2016-06-10 16:56:17 +01:00
Jaeden Amero 829ca3333b RTX: Actively switch to the idle thread
Prevent a switch to a NULL target thread by setting the new task to run
to be the idle task. Otherwise, we get nasty usage fault because we
would be returning from the rt_sys_init SVC with a PSP of 0x20.
2016-06-10 16:56:17 +01:00
Jaeden Amero 58336594ac RTX: Run unprivileged if uVisor is present
As priviliged threading is incompatible with uVisor
2016-06-10 16:56:17 +01:00
Alessandro Angelino a076f9a415 K64F: Add call to uvisor_init() in the startup code
This is backwards-compatible with unsupported targets.

If an application is compiled using the K64F target without uVisor
(UVISOR_PRESENT not set or set to 0) then uvisor_init() will just be an
empty function that immediately returns.
2016-06-10 16:56:17 +01:00
Alessandro Angelino 6aeafab6b3 K64F: Add page allocator sections to linker script
These changes are backwards compatible.

Targets that do not use the page allocator heap will have the same stack
and heap sizes available.
2016-06-10 16:56:17 +01:00
Alessandro Angelino eb9d124230 K64F: Add uVisor sections to the linker script
This commit includes all sections that are just added to the linker
script. These changes are backwards-compatible, meaning that they will
not affect the existing code.

Targets that do not support uVisor will leave those sections empty.
2016-06-10 16:56:17 +01:00
Niklas Hauser f81cf5d686 Add default implementation of malloc wrapping
For GCC malloc is always wrapped, but only used for FEATURE_UVISOR.
Otherwise we have to simply forward the wrappers.
2016-06-10 16:56:17 +01:00
Jaeden Amero 5d48984914 Initialize uvisor-lib
uvisor-lib has an init function that must be called before the RTOS kernel
is initialized. Call uvisor_lib_init from software_init_hook to accomplish
this.
2016-06-10 16:56:17 +01:00
Jaeden Amero 43e595aec3 Wrap software_init_hook
Wrap software_init_hook so that it can be used or extended from outside the
RTOS. This is desirable so that code can be added to the software_init_hook
without making the RTOS depend on new features or libraries.
2016-06-10 16:56:17 +01:00
Niklas Hauser 61166870ed RTX: Add context to osThreadCreate/Terminate 2016-06-10 16:56:16 +01:00
Niklas Hauser 259bd28c45 RTX: Add pointer to context to task structure 2016-06-10 16:56:16 +01:00
Jaeden Amero 4cdc4a7b45 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.
2016-06-10 16:56:16 +01:00
Jaeden Amero 55f464da27 Copy memory management code over from uVisor
Add the memory management code from uVisor to a shared location that is
suitable for both supported and unsupported use. To do this, we copy all
the RTX-specific files from the RTX folders in uVisor.

Note that the page allocator code is so identical between uVisor supported
and unsupported mode that we can copy the file as-is from uVisor for use on
unsupported targets. This commit performs that copying, to a file called
page_allocator.c_inc, which is included from unsupported_page_allocator.c
only for targets where uVisor is not present.
2016-06-10 16:56:16 +01:00
Milosch Meriac 10d9c2fa97 Add updated uVisor importer script 2016-06-10 16:56:16 +01:00
Mihail Stoyanov f6acb1ffb4 Forward ported changes to tools 2016-06-10 15:19:02 +01:00
Vincent Coubard 06e2139e6a Adjust the main stack of nrf51 targets to the call stack of the
softdevice.

The call stack of the soft device can be 0x600 (1536) bytes long, by
adjusting the stack to a value of 2048 bytes, their is enough room for
the softdevice and RTX kernel to live together in the main stack.

Random issues due to stack overflow were visible with the previous value.
2016-06-10 14:57:51 +01:00
Vincent Coubard 6315f8e486 Fix function is_in_wrapped_range, the function where returning false when
instead of true when begin <= val < end. The documentation was correct but
not the code.
2016-06-10 14:46:11 +01:00
Mihail Stoyanov 51c10165ca Fixed toolchain flags so exporters can use them 2016-06-10 13:12:21 +01:00
Mihail Stoyanov 75a18ff1a3 Add config system macros to exporters
Support various exporter features
2016-06-10 11:27:23 +01:00
bcostm 6e645e50e8 Add USART force/release Reset at Init phase 2016-06-10 11:56:42 +02:00
bcostm ec36ce72c8 Add force/release reset during Serial init phase 2016-06-10 11:26:15 +02:00