Commit Graph

6820 Commits (fcd03f285dee5fbb31efabbcd51fbb1eb8be2a4e)

Author SHA1 Message Date
Sam Grove fcd03f285d Merge pull request #2229 from geky/nsapi-fix-iar
[nsapi] Fixed iar compilation issue with value initializer
2016-07-22 17:22:56 -05:00
Sam Grove aec3695cc5 Merge pull request #2188 from screamerbg/build-common
[Tools] Unify common routines in build_api.py
2016-07-22 17:04:25 -05:00
Mihail Stoyanov ac86584c42 Unify common routines in build_api.py
Introduce prepare_toolchain() which handles:
 * deduplication of src_paths
 * config initialization
 * toolchain initialization
 * toolchain flags
 * returns toolchain
Introduce scan_resources() which handles:
 * scanning of sources
 * scanning of include dirs
 * inclusion of addition include dirs
 * returns resources
2016-07-22 22:21:39 +01:00
Sam Grove 1880daef0d Merge pull request #2215 from geky/tools-cumulative-overrides
[tools] Modified config to aggregate cumulative overrides against targets
2016-07-22 16:16:41 -05:00
Sam Grove 83f24fb0bd Merge pull request #2227 from mbedmicro/include_rtos_by_default
Includre rtos.h in mbed.h if present
2016-07-22 15:50:43 -05:00
Christopher Haster ec993319a9 [nsapi] Fixed iar compilation issue with value initializer
Expression needed to init to zero a simple POD struct

Before (valid in C99/C++11/G++): 	(nsapi_addr_t){}
After (valid in C++03, invalid in C):	nsapi_addr_t()
2016-07-22 15:42:57 -05:00
Sam Grove 9ab05ae7c5 Merge pull request #2216 from geky/nsapi
Introduce the network-socket API to mbed
2016-07-22 14:56:24 -05:00
Bogdan Marinescu b8ab75db03 Includre rtos.h in mbed.h if present
So that apps don't need to include "rtos.h" explicitly anymore.
2016-07-22 18:08:32 +03:00
Martin Kojtal 6b8ff8feb3 Merge pull request #2192 from egostm/sleep_code_refactor
[STM32] Sleep code refactor
2016-07-22 13:40:06 +01:00
Mihail Stoyanov c8a5aae7ab Merge pull request #2098 from svastm/switch_default_build
[STM32XX] Fix default build
2016-07-22 12:11:07 +01:00
Martin Kojtal d5b839fa7d Merge pull request #2218 from fvincenzo/master
[BEETLE] Add comment to clarify LEDs Emulation
2016-07-22 12:05:57 +01:00
Vincenzo Frascino 015067f73b [BEETLE] Add comment to clarify LEDs Emulation
Beetle board is built to optimize power consumption therefore does not
provide on-board LEDs.

This patch adds a comment in PinNames in order to clarify that the
Emulated LEDs are provided for compatibility reasons with the MBED test
suite.

Signed-off-by: Vincenzo Frascino <vincenzo.frascino@arm.com>
2016-07-22 10:28:27 +01:00
Martin Kojtal 51cd3cb972 Merge pull request #2191 from geky/callback-fp-deprecate
[api] Mark FunctionPointer and friends as deprecated
2016-07-22 10:25:07 +01: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
Martin Kojtal 37e254fa16 Merge pull request #2204 from fvincenzo/master
Lp_ticker and Us_ticker time count fix
2016-07-22 09:50:05 +01:00
Martin Kojtal 781fda0465 Merge pull request #2193 from neilt6/lpc15xx-ticker-fix
[LPC15XX] Fixed µs_ticker implementation
2016-07-22 09:11:17 +01:00
Christopher Haster a5ea143c77 Updated config tests to match change in error message 2016-07-22 00:35:13 -05:00
Christopher Haster 9bd7a2fe72 Added proper support for the extra_labels target override
Due to dependencies between the config/target systems, the config
has been modified to preparse the mbed_app.json for overrides.
This means that attributes with dependencies in the targets are
only valid at the application level. A hard error has been
added for these attributes if they are supplied at the library
level.
2016-07-22 00:35:13 -05:00
Christopher Haster f2051b217a Modified config to explicitly update cumulative attributes in targets
Modified '_process_config_and_overrides' to update cumulative
attributes based on cumulative overrides found during walking config
files.

This should remove most of the disparity between the config target
cumulative overrides and cumulative attributes set in targets.json.
These cumulative overrides are updated after the global target
instantiation though, which may cause internal build tool state
dependent on cumulative attributes to not correctly reflect all
cumulative overrides.
2016-07-22 00:35:13 -05:00
Christopher Haster 0fcb20e8c1 Generalized handling of cumulative attributes in target overrides
In tools/config.py, Config now aggregates all cumulative attributes in
target overrides.

{
  "target_overrides": {
    "K64F": {
      "target.features_add": ["UVISOR"],
      "target.extra_labels_add": ["UVISOR_SUPPORTED"],
      "target.macros_add": ["UVISOR_MACRO"],
      "target.device_has_add": ["UVISOR_HAS"]
    }
  }
}

Note: no action is performed on overrides yet
2016-07-22 00:35:13 -05:00
Sam Grove f817ec136c Merge pull request #2142 from theotherjimmy/anti-remove-repo
[tools-build,make,test] Disallow parent of repo as --build args
2016-07-21 22:11:28 -05:00
Sam Grove b10276cbef Merge pull request #2173 from theotherjimmy/abstract-base-class
[toolchains]Abstractify the mbedToolchain base class.
2016-07-21 22:10:49 -05:00
Sam Grove 702707dee7 Merge pull request #2166 from theotherjimmy/prevent-traceback-during-export
Preventing a traceback when a library is not built during export
2016-07-21 22:09:52 -05:00
Sam Grove e6d4b84197 Merge pull request #2213 from pan-/fix#2132
Remove LF clock initialization from os_init_clock.
2016-07-21 22:08:06 -05:00
Christopher Haster 03c5855496 Add 'features/net/network-socket/' from commit 'e09565474188b905cada21166118a82e66359217'
git-subtree-dir: features/net/network-socket
git-subtree-mainline: db60d6a7f7
git-subtree-split: e095654741
2016-07-21 18:30:42 -05:00
Christopher Haster e095654741 Fixed ambiguity/protected access issue in Socket::open
NetworkStack/NetworkInterface overloads
 - Multiple inheritance results in ambiguity

NetworkStack with templated get_stack overload
 - get_stack hidden behind protected access prevents template match
 - explicit call to NetworkInterface::get_stack does not follow vtable

Solution is to use two overloaded function for
NetworkStack/NetworkInterface, and an overload for a templated type that
supports a static_cast to NetworkStack. This resolves the ambiguity
without being blocked by protected access.

Moved duplicated overloads out to overload of common nsapi_create_stack
function.
2016-07-21 18:23:12 -05:00
Christopher Haster 856120994e Standardized documentation of the NetworkInterface class 2016-07-21 18:23:12 -05:00
Christopher Haster 01f38cc940 Added better support for NetworkInterface/NetworkStack
Mostly reduced code duplication for NetworkInterface/NetworkStack
arguments.

Moved to templated Socket constructors/open member functions. This
allows multiple inheritance to be used for classes that provide
both a NetworkInterface and NetworkStack, such as the esp8266.
2016-07-21 18:23:12 -05:00
Christopher Haster 5b63cbbd3e Added primitive nsapi_stack_t and nsapi_stack_api_t structures
Provides a primitive structure for explicitly instantiating
network stack structures/vtables.

- Avoids reoccuring issue with non-gced vtables
- Provides thick api layer for additional nsapi features
- Provides more explicit seperation between implementation and user api

Now implementors have two options:
1. Extend NetworkStack and implement all of the abstract member functions
2. Fill out a nsapi_stack_api_t and provide a NetworkStack with nsapi_create_stack

option 1 provides an easy route for porting single drivers such as the
esp8266 or the c027 and can easily benefit from other C++ classes.

option 2 provides an easy route for porting full network-stacks such as
lwip or nanostack, which provide their own host of networking utilities
and only need a minimal socket interface.
2016-07-21 18:23:12 -05:00
Christopher Haster 7ab9f4c267 Added opaque nsapi_socket_t type
typedef void *nsapi_socket_t

Helps avoid confusion with multiple void*s floating around,
especially when passing a nsapi_socket_t by pointer as a
destination.

The nsapi_socket_t is just an opaque handle, implementations
still need a cast to obtain implementation specific socket pointer.
2016-07-21 18:23:12 -05:00
Christopher Haster d985d70bf8 Added primitive nsapi_addr_t type
Provides primitive type for network address that is more constrained
than "pointer to array of bytes".

- POD type avoids issues with constructors
- Removes complexity from SocketAddress class
- Easily passed through C interfaces
- Easily casted to SocketAddress and vice-versa
2016-07-21 18:23:12 -05:00
Christopher Haster 97380a75c6 Restructured nsapi headers
- Provide nsapi.h as central entry point
- Provide nsapi_types.h as c-compatible destination for nsapi types
- Standardize include paths
2016-07-21 18:22:55 -05:00
Russ Butler 04e4d9f450 Fix async NSAPI race condition
Remove read and write mutexes since multiple calls to send or multiple
calls to recv on different threads is undefined behavior.
This is because the size of data sent or received by these calls is
undefined and could lead to the data being interleaved.  The code now
asserts that there are not multiple threads calling send at the same
or calling recv at the same time.  Note that calling send and recv from
different threads at the same time is still safe and well defined
behavior.

By removing the read and write mutexes and associated timeout it
guarantees that a stack call will always be made and thus the value
NSAPI_ERROR_TIMEOUT cannot get falsely returned.
2016-07-21 18:20:59 -05:00
Russ Butler 90cd978785 Separate interface from stack in NSAPI
This patch consists of:
-Add NetworkInterface to wrap objects bound to a stack and update
    socket code to handle this in addition to NetworkStacks
-Update MeshInterface to inherit from NetworkInterface
-Update NanostackInterface so it only inherits from NetworkStack
-Add MeshInterfaceNanostack and update LoWPANNDInterface and
    ThreadInterface to inherit from this
2016-07-21 18:20:45 -05:00
geky 3ee8e30ae4 Added NSAPI_KEEPINTVL/NSAPI_KEEPIDLE options to the socket API 2016-07-21 18:19:21 -05:00
Christopher Haster a6edc268f3 Coalesce redundant events to reduce cpu usage in lazy implementations
*cough* esp8266 *cough*

this is especially important for event-loop based systems where
excessive events results in problematic memory consumption.
2016-07-21 18:19:21 -05:00
Russ Butler c3baf2792e Fix SocketAddress constructor to support ipv6
Fix typo causing ipv6 addresses in the constructor to fail.
2016-07-21 18:19:21 -05:00
Christopher Haster 1c0a7c2426 Adopt Callback class in NetworkSocketAPI 2016-07-21 18:19:21 -05:00
Russ Butler 8f33c0fc4f Add synchronization to the network socket API
Add mutexes to protect the network socket API.  Also use semaphores to
wait for read/write events.  Also fix a typo in the comments for
timeout.
2016-07-21 18:19:21 -05:00
Christopher Haster 3d310c2463 Small bug fixes
mirrored from:
https://developer.mbed.org/teams/NetworkSocketAPI/code/NetworkSocketAPI/

- Fix bug with SocketAddress init per @c1728p9
- Fix issue with not passing interface through accept call
- Fix port issue in SocketAddress constructor
2016-07-21 18:19:21 -05:00
Christopher Haster 710fab5b8b Add NSAPI_ERROR_PARAMETER
per @c1728p9
2016-07-21 18:19:21 -05:00
Christopher Haster 943dd711a9 Added WFI to save power in temporary polling implementation 2016-07-21 18:19:21 -05:00
Christopher Haster f2715b7e77 Consolidate set_timeout/set_blocking behaviour
- Avoids ambiguity when both are used
- Matches Python behaviour
2016-07-21 18:19:21 -05:00
Christopher Haster bd5e913ca1 Separate Stack/Interface concept into two distinct classes 2016-07-21 18:19:21 -05:00
Christopher Haster a4f1071996 Add standardized stack options 2016-07-21 18:19:21 -05:00
Christopher Haster abd25f9bb3 Added workaround for bug in newlib sscanf
https://bugs.launchpad.net/gcc-arm-embedded/+bug/1399224
2016-07-21 18:19:21 -05:00
Christopher Haster cd4a521e22 Fix race condition in socket close 2016-07-21 18:19:21 -05:00
Christopher Haster fc71badb69 Rename Interface -> Stack
NetworkInterface  -> NetworkStack
EthernetInterface -> EthernetStack
WiFiInterface     -> WiFiStack
CellularInterface -> CellularStack
MeshInterface     -> MeshStack
2016-07-21 18:19:21 -05:00
Christopher Haster d36a0b6b88 Revised documentation for Interface classes 2016-07-21 18:19:21 -05:00
Christopher Haster aa2357a836 Revisited documentation for Socket API 2016-07-21 18:19:21 -05:00