Commit Graph

10994 Commits (0da63eef2b3debaed5db9776d1e913ae982ce7c3)

Author SHA1 Message Date
Vincent Coubard 045b026ad4 NCS36510 RTC driver: Fix driver.
* Initialization clear interrupt status
* Remove state in management of interrupt
* Handle timestamp in the past
* Handle current seconds, even if out of the relative timestamp.
* Simplify interrupt handling logic.
2017-06-01 16:33:49 +01:00
Vincent Coubard c6433b018a lp ticker test: Fix timestamp update during deepsleep test. 2017-06-01 16:31:48 +01:00
Hasnain Virk 91aab99727 Add APIs to namespace mbed
Certain public APIs are being added to mbed.h so as to make them
part of namespace mebd.

APIs being added are:

	* drivers/UARTSerial.h
	* platform/ATCmdParser.h
	* platform/mbed_poll.h
	* netsocket/nsapi_ppp.h
2017-06-01 15:17:53 +03:00
Martin Kojtal 9381a7af06 Merge pull request #4413 from theotherjimmy/fix-dep-bug
Fix a bug in dependency handling
2017-06-01 14:06:46 +02:00
Martin Kojtal 3553a4573a Merge pull request #4178 from nvlsianpu/getAddrFromPeerTab_sd_api_5
[NRF52840]: SecurityManager::getAddressesFromBondTable
2017-06-01 14:05:39 +02:00
Martin Kojtal e229a49182 Merge pull request #4207 from geky/spi-remove-byte-locking
spi: Add SPI block-write to C++ and HAL for performance
2017-06-01 14:03:36 +02:00
Martin Kojtal 9355531653 Merge pull request #4388 from c1728p9/deprecate_config_store
Deprecate config store and related libraries
2017-06-01 14:02:43 +02:00
Martin Kojtal 8a870a66c0 Merge pull request #4119 from hasnainvirk/cellular_feature_br
Cellular feature br
2017-06-01 14:01:17 +02:00
Martin Kojtal c674ee2290 Jenkinsfile: remove client app test temporarily
This should be fixed as soon as client and its dependencies
are updated to resolve conflicts there. We expect this to be reverted asap.
2017-06-01 12:15:09 +01:00
Vincent Coubard 6fe07c640f Ticker NCS36510: Fix tests of the status register. 2017-05-31 19:16:05 +01:00
Vincent Coubard f52da48d95 TimerEvent: Use ticker_insert_event_us instead of the old API in
insert_absolute.

With this patch, event insertion should be more precise.
2017-05-31 19:14:21 +01:00
Vincent Coubard 3e24e8fa62 lp_ticker test: Capture completion time at completion point. 2017-05-31 19:13:10 +01:00
Jimmy Brisson 07a6c07408 Revert "Disable Cortex-A in tooling to provide better error messages"
This reverts commit f5859b308b.
2017-05-31 13:06:30 -05:00
Russ Butler 58041a215d Deprecate config store and related libraries
Deprecate configuration-store, flash-journal and
storage-volume-manager for the 5.5 release. Also disable the
storage tests.
2017-05-31 12:08:11 -05:00
Jimmy Brisson 944a17fe3c Merge pull request #4402 from LMESTM/STM32_F2_CUBE_v160
Stm32 f2 cube sdk update to v1.6.0
2017-05-31 11:28:36 -05:00
Jimmy Brisson 99bc80d3b3 Merge pull request #4403 from 0xc0170/fix_mbed_version
mbed: version macros are not defined on master
2017-05-31 11:27:19 -05:00
Jimmy Brisson b46b6c34aa Merge pull request #4321 from hanno-arm/update-mbedtls
Update mbed TLS to version 2.5.0
2017-05-31 11:26:36 -05:00
Jimmy Brisson 4806229090 Fix bug in dependency handling 2017-05-31 09:54:09 -05:00
Hasnain Virk 24de27c989 Major Refactoring & extensions
For keep supporting external APIs with the same name (supposedly there are a larger
number of users of those APIs), BufferedSerial and ATParser are being renamed.
BufferedSerial becomes UARTSerial, will complement a  future USBSerial etc.
ATParser becomes ATCmdParser.

* UARTSerial moves to /drivers

* APN_db.h is moved from platform to cellular/util/.

* Original CellularInterface is restored for backward compatability (again, supposedly there
  are users of that).

* A new file, CellularBase is added which will now servce as the base class for all
  upcoming drivers.

* Special restructuring for the driver has been undertaken. This makes a clear cut distinction
  between an on-board or an off-board implementation.
  	- PPPCellularInterface is a generic network interface that works with a generic FileHandle
          and PPP. A derived class is needed to pass that FileHandle.
        - PPPCellularInterface provides some base functionality like network registration, AT setup,
          PPP connection etc. Lower level job is delegated to the derived classes and various modem
          specific APIs are provided which are supposed to be overridden.
        - UARTCellularInterface is derived from PPPCellularInterface. It constructs a FileHandle and
          passes it back to PPPCellularInterface as well as provides modem hangupf functionality.
          In future we could proive a USBInterface that would derive from PPPCellularInterface and could
          pass the FileHandle back.
	- OnboardCellularInterface is derived from UARTCellularInterfae and provides hooks to
          the target provided implementation of onbard_modem_api.h. An off-board modem, i.e, a modem on
          a shield has to override the modem_init(), modem_power_up() etc as it cannot use
          onboard_modem_api.h.
2017-05-31 15:02:11 +03:00
Hasnain Virk b51fbe817b mbedtls md5 or lwip internal crypt Fudge
Some targets define MBEDTLS_md5_C in targets.json in order to force the system to use
external mbedtls instead of lwip internal crypt, i.e.,  polarssl.
LWIP's internal md5 mechanism is tied to PPP  for some reason. In a previosly merged commit
an attempt was made to steal md5 functions by faking that PPP was turned on. However
that solution was broken in case of really turning on PPP  functionality.

This commit fixes the breakage and also corrects the logic in case a target decides to use
external md5 implementation from mbedtls or otherwise (i.e, wants to stick to the internal
implementation).
2017-05-31 15:02:11 +03:00
Hasnain Virk c8933e4c71 Removing _poll_change() for now
There is currently no proper wake up mechanism provided
by mbed-os. _poll_change() was supposed to wake upa blocking
poll() in case of a POLL event but the implementation was dependent
upon underlying wake up mechanism. In the absence of conditioanl
variables or some other alternative, _poll_change() wasn't able to
serve its purpose. Removing it for now. Should be implemented at some later stage
2017-05-31 15:02:11 +03:00
Hasnain Virk c65f81bf46 Remove sigio implementation from FileHandle
Make FileHandle more of an interface class, by requiring implementers to
provide the sigio() functionality themselves.

sigio() and poll() remain parallel independent mechanisms, so FileHandle
implementations must trigger both on state changes.
2017-05-31 15:02:11 +03:00
Hasnain Virk 1afc7bfbef A Reference CellularInterface driver
* Implements CellularInterface
* Reference design for CellularInterface implementations
* Uses an external mbed-os IP stack and talks to modem over PPP.
2017-05-31 15:02:11 +03:00
Hasnain Virk ccbf00571f Introducing hal/modem_api.h
This provides a HAL layer for Modem bearing devices.
Provides a standard interface to upper layer drivers.
Platform providers will be implementing this API under their
specific targets.

As a reference, two implementations are provided under TARGET_C027 (UBLOX)
and TARGET_MTS_DRAGONFLY_F411RE (MultiTech).

targets.json now contains a tag "MODEM" which tells that this target
has a modem and the modem_api is protected by a flag DEVICE_MODEM
(following the DEVICE_SERIAL fashion ).
2017-05-31 15:02:11 +03:00
Hasnain Virk fcbcfafec5 Preparing grounds for modem api
* Lays down ground for mbed modem_api
* Standardizes pin names relating to modem device for UBLOX C027 and MTS_DRAGONFLY_F411RE
  devices
* Ublox modem api is changed to use a standard, platform independent name so that same
  api could be used with multiple ubloc modems.
* DCD Polarity macro is added to assist the driver in knowing correct polarity
2017-05-31 15:02:11 +03:00
Hasnain Virk 925f54bfce Heap size reduced to 64k for IAR
IAR heap sizes were hard configured to be 96k which is 75% of the
total RAM available. Reduced it to be 64k which is half of the available RAM.
2017-05-31 15:02:11 +03:00
Hasnain Virk 658ddf7c30 ARMCC link errors fixed, nsapi_ppp glue layer changed
GCC have not been capable enough to catch some linker errors which arose when
ethernet support for LWIP was disabled. Checks have been added to make sure that
unrefrenced code is not linked in.

nsapi_ppp glue layer is made more transparent to public cellular API. Storage of IP
addresses is removed. PPP layer already stores the addresses, so we pass the pointer back
to the upper layers.

If PPP is not used, we provide dummy functions.
2017-05-31 15:02:11 +03:00
Hasnain Virk 01088647b9 Finalizing the public API for Cellular
* state machine corrections
* adding various standard API methods
* Addition/revision/enhancement of the nsapi_ppp glue layer
* Turning off debug by default
2017-05-31 15:02:11 +03:00
Hasnain Virk f602c936ff Redirecting LWIP debug trace to mbed-trace
This piece of code redirects LWIP debug trace to mbed-trace if configured.
This enables us to have universal traces.
2017-05-31 15:02:11 +03:00
Hasnain Virk 3b44f4758d Adding support for APN lookup
Mainly reutilizing code from ublox C027 support lib.
As we are using external PDP context, i.e., an external IP stack,
we will pass username and password to underlying stack running PPP.
We only support CHAP as the authentication protocol.
2017-05-31 15:02:11 +03:00
Hasnain Virk 93f436ebe0 Using DCD line to invoke poll() HUP
POSIX poll() provides a mechanism to attach a POLL_HUP event
if the modem or device hangs up on you. POLL_HUP and POLL_OUT are
mutually exclusive. We poll in the PPP_input() routine if the modem
hung up. If it did we stop the data consumption, close PPP and go back
to the driver for reserruction of AT parser and subsequent retries or
application specific actions.
This is achieved by attaching an interrupt to the DCD line of the modem.
When DCD line goes high (off), we have lost the carrier. So we record an
POLLHUP event using _poll_change().
2017-05-31 15:02:11 +03:00
Hasnain Virk 87a4580e5f Bug fixes & state machine corrections
In case of carrier lost, we would like to inform PPP data pump.
That involved setting up link status flag down semaphores.
mbed_lwip_bringup() and mbed_lwip_bringdown() had been Ethernet specific only.
We extend these routines to support PPP as well. Currently we support only one interface
at a time. However, future enhancement to multi interface support should be trivial.
2017-05-31 15:02:11 +03:00
Kevin Bracey 7e3c529d21 Unify LWIP Ethernet and PPP initialisation 2017-05-31 15:02:11 +03:00
Hasnain Virk 2abb078f27 Adding PPP link status callback
mbed_ppp_init() is extended to take a function ptr.
ppp_lwip will call this callback upon a change in ppp link status.
in the beginning, the Ublox driver waits until the PPP link is established properly.
2017-05-31 15:02:11 +03:00
Hasnain Virk 091396defe Adding mbed_trace to ppp_lwip
We introduce here mbed_trace to ppp_lwip shim layer.
If for some reason, FEATURE_COMMON_PAL is not included in the build,
dummies for trace functions are provided.
2017-05-31 15:02:11 +03:00
Kevin Bracey be00c1720b Separate LWIP core and Ethernet interface initialisation
Will allow LWIP to be initialised for PPP use.
2017-05-31 15:02:11 +03:00
Kevin Bracey ae7fd61d65 RAM optimizations
Trying to save RAM wherever possible for Ublox C027 platform
2017-05-31 15:02:11 +03:00
Kevin Bracey f37f265ed5 Add more LWIP JSON configuration, including PPP
Add configuration to control Ethernet, PPP and TCP support.

Replaces LWIP_TRANSPORT_ETHERNET/PPP defines formerly used by targets.

Ethernet and PPP can be enabled simultaneously.

DHCPv4 is now only enabled if IPv4 and Ethernet are both enabled - we
assume PPP uses IPCP for configuration.

PPP configuration adjusted to cope with LWIP 2.0 changes, and
optimised for RAM a little.
2017-05-31 15:02:11 +03:00
Kevin Bracey d0820d1ed3 Cope with different LWIP configurations 2017-05-31 15:02:11 +03:00
Kevin Bracey 7f136d5a35 PPP Interface for LWIP using FileHandle stream
This is a glue layer between LWIP PPP implementation and a device type FileHandle
stream. This enables an external interface which has a FileHandle, utilize LWIP network
stack via PPP, e.g., Cellular device, WiFi chips etc.
Its totally transparent to external device. Only thing this layer is interested in, is a
FileHandle. Similar is true for for the external device, it just hands over its stream to this
PPP layer and rest of the magic is done by this layer.
2017-05-31 15:02:11 +03:00
Hasnain Virk ea117e5a1a Memory Optimizations and simplifications in ATParser
ATParser had been using std <vector> which had been pulling along a lot
of standard C++ stuff. We have an alternative implementation whcih achieves
a similar effect but without using <vector>. this saves a bunch of valuable
RAM resource.

We have also simplified the overall system by introducing proper CR and LF
rather than \r\n type of delimiters. This newline simplification is borrowed
from retarget.cpp.
2017-05-31 15:02:11 +03:00
Hasnain Virk 4a04c9ce5d Extending ATParser to use FileHandle
Existing ATParser is extended to use FileHandle. This essentially detaches
ATParser from previous tight binding with various implementations of serial
interfaces with buffering.
Now the ATParser uses only abstract FileHandle and doesn't really care about
the underlying implementation. Underneath, it could be a USB device type FileHandle
or a Serial device type FileHandle etc.
Some simplification steps were taken as the code provided opportunities to simplify
and optimize.
2017-05-31 15:02:11 +03:00
Hasnain Virk 2790d44862 Introducing a BufferedSerial
BufferedSerial is a FileHandle and using SerialBase.
It keeps the SerialBase private however lets the user extend FileHandle
by keeping it public.

It is using CircularBuffer class for having circular buffers.

There are some minor amendments in CircularBuffer too.

Adding an entry for tx/rx buffer sizes in platform/mbed_lib.json.
Default size is 256 bytes.

For RTOS read(), write() calls yield for other threads to carry on with their stuff.
For non-RTOS blovking read or write would mean a loop where 100 percent resources are
consumed by this loop. Need to get a better implementation in. Currently no mechanism to
wake the mcu up after WFE.
2017-05-31 15:02:11 +03:00
Hasnain Virk 09ae609d56 Stream class should use mbed::fdopen() to attach a stream
mbed::fdopen() is provided in mbed_retarget.cpp which will attach a stream to the
given FileHandle. Removing mbed_set_unbuffered_stream() from stream class as it
is defined in mbed_retarget.cpp. Stream class should not decide whether it wants
to detach buffers from c library or not. mbed::fdopen() will do that based upon
isatty() call. So if a FileHandle is not a tty, i.e., is not a device type, c library
buffering will not be turned off. For device type FileHandles, c library buffering
is turned off.
2017-05-31 15:02:11 +03:00
Hasnain Virk b2408d8a16 Extending FileHandle & introducing mbed_poll
This has been an attempt to extend existing FileHandle to behave like POSIX
file descriptor for input/output resources/devices too.
This will now provide an abstract indicator/handle any arbitrary file or device
type resource. May be in future, sockets too.

In order to correctly detect availability of read/write a FileHandle, we needed
a select or poll mechanisms. We opted for poll as POSIX defines in
http://pubs.opengroup.org/onlinepubs/009695399/functions/poll.html Currently,
mbed::poll() just spins and scans filehandles looking for any events we are
interested in. In future, his spinning behaviour will be replaced with
condition variables.

In retarget.cpp we have introduced an mbed::fdopen() function which is
equivalent to C fdopen(). It attaches a std stream to our FileHandle stream.
newlib-nano somehow does not seem to call isatty() so retarget doesn't work for
device type file handles. We handle this by checking ourselves in
mbed::fdopen() if we wish to attach our stream to std stream.  We also turn off
buffering by C library as our stuff will be buffered already.

sigio() is also provided, matching the API of the Socket class, with a view to
future unification. As well as unblocking poll(), _poll_change calls the user
sigio callback if an event happens, i.e., when FileHandle becomes
readable/writable.
2017-05-31 15:02:11 +03:00
Kevin Bracey fb7cbdf356 Tighten mbed_retarget.cpp error handling
* Don't set errno when calls are successful (will slightly alleviate the problem
  of errno not being thread-safe yet).
* Transfer errors returned from size() and seek() into errno.
* Fix isatty() - could never return 1 from a FileHandle.
* Use more appropriate errors than EBADF in some places (eg ENOENT for non-existant path).
2017-05-31 15:02:11 +03:00
Kevin Bracey 533910cb87 Correct return type of FileHandle::size()
File size should be off_t, not size_t.
2017-05-31 15:02:11 +03:00
Martin Kojtal 88c398b52a Merge pull request #4377 from theotherjimmy/disable-cortex-A
Disable Cortex-A in tooling for better error messages
2017-05-31 07:50:21 +01:00
Sam Grove e65bb8d1a2 spi: Added default spi_master_block_write implementation to stm targets
There is an easy default implementation of spi_master_block_write that
just calls spi_master_write in a loop, so the default implementation
of spi_master_block_write has been added to all targets.
2017-05-30 23:11:24 -05:00
Jimmy Brisson f5859b308b Disable Cortex-A in tooling to provide better error messages
Disable Cortex-A in compile supported matrix
Disable Cortex-A in export supported matrix
2017-05-30 14:32:06 -05:00