Commit graph

41120 commits

Author SHA1 Message Date
Gerson Fernando Budke
9d9b248965 samples: net: sockets: echo_client: Update README.rst
Add information about how to build and test atsamr21_xpro board with
IEEE 802.15.4 RF2xx driver.

Signed-off-by: Gerson Fernando Budke <nandojve@gmail.com>
2020-02-11 17:46:05 +02:00
Gerson Fernando Budke
850a200b41 samples: net: sockets: echo_client: Add sam_v71_xult config
Add necessary configuration to run demo on the sam_v71_xult board.

Signed-off-by: Gerson Fernando Budke <nandojve@gmail.com>
2020-02-11 17:46:05 +02:00
Gerson Fernando Budke
3f6029dd80 samples: net: sockets: echo_client: Add sam4s_xplained config
Add necessary configuration to run demo on the sam4s_xplained board.

Signed-off-by: Gerson Fernando Budke <nandojve@gmail.com>
2020-02-11 17:46:05 +02:00
Gerson Fernando Budke
cfe1ce967c samples: net: sockets: echo_client: Add atsamr21_xpro config
Add special configuration for SAMR21 SoC. Since it have only 32k SRAM,
all possible application buffers need to be shrinked. This
configuration was tested with two boards for more than 2H with success.

[02:18:57.635,00] net_echo_server_sample: IPv6 UDP: Sent 333000 packets

Signed-off-by: Gerson Fernando Budke <nandojve@gmail.com>
2020-02-11 17:46:05 +02:00
Kumar Gala
af16c3b3e7 doc: Add reference in toplevel README.rst to install_py_requirements
In the section 'Documentation presentation theme' put a reference to
'install_py_requirements' section in the getting start guide.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
Signed-off-by: Martí Bolívar <marti.bolivar@nordicsemi.no>
2020-02-11 17:43:48 +02:00
Johann Fischer
46db22c6c8 boards: pca10056: fix pin properties for spi2 node
Commit 5b4f4253c1
("drivers: flash: add Nordic JEDEC QSPI NOR flash driver")'
added SPI2 pin properties wich are in conflict with CS pin
of the SPI3, pin D9, and pin D8 routed to Arduino connector
of the pca10056 board. This change has broken any shield
support on this board.

Route SPI2 node pin properties to MX25R64 device.

Signed-off-by: Johann Fischer <j.fischer@phytec.de>
2020-02-11 17:42:14 +02:00
Erwan Gouriou
137d4c1882 board: stm32h474i_disco: Small fixes on m4 core
ST-Link VPC is wired to UART_1.
Console should be assigned to this peripheral to be available.
By default UART_1 is assigned to m7 core and not available to m4.

This commit does not change this, but makes it easier to change
UART_1 assignment from m7 to m4 core.

Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
2020-02-11 17:41:49 +02:00
Erwan Gouriou
157fb6af72 drivers/clock_control: stm32: HSE_BYPASS code cleanup
Rework CONFIG_CLOCK_STM32_HSE_BYPASS related code to make
this part of the code more readable.

Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
2020-02-11 17:41:49 +02:00
Erwan Gouriou
9631709ca4 soc: stm32h7: Move PWR init code in soc init function
Move PWR init code out of clock control driver and
put SMPS related function under SMPS condition as it
is not supported by all soc variants of the series.

Fixes #22363

Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
2020-02-11 17:41:49 +02:00
Ulf Magnusson
e63b6525bf kconfig: Clarify Kconfig.defconfig explanation in Kconfig.zephyr
Group the 'source's of Kconfig.defconfig files together to make it
clearer what the comment is talking about. Remove blank lines between
the other 'source's too, splitting the 'source's into two groups.

Also touch up the comment to make it more concrete and shorten it a bit.
Mention that it applies to 'choice's as well.

Signed-off-by: Ulf Magnusson <Ulf.Magnusson@nordicsemi.no>
2020-02-11 17:40:12 +02:00
Jukka Rissanen
ed7dd4412c sample: net: gsm_modem: Add sample.yaml file
sample.yaml is needed so that we can do some sanity checks
for the GSM modem code.

Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2020-02-11 13:49:22 +02:00
Kamil Piszczek
8f7fe8357e bluetooth: host: fix RPMsg driver headroom configuration
Corrected configuration of BT_HCI_RESERVE for the RPMsg HCI driver.
This change fixes the following assert:
[net_buf_simple_headroom(buf) >= len] @ ZEPHYR_BASE/subsys/net/buf.c:881

Signed-off-by: Kamil Piszczek <Kamil.Piszczek@nordicsemi.no>
2020-02-11 13:23:50 +02:00
Torsten Rasmussen
9dbc5eeb3b cmake: Invoke west topdir only with version >= 0.7.1
West version 0.7.0 introduced `west topdir` command.
Unfortunately version 0.7.0 would print the path in windows path style
when executed in Windows.

This commit ensure that `west topdir` is only used if west >= 0.7.1.

Signed-off-by: Torsten Rasmussen <Torsten.Rasmussen@nordicsemi.no>
2020-02-10 22:52:34 +01:00
Michael Scott
309da27394 net: config: init: fix NET_NATIVE=n behavior
commit e3dc05f14d ("net: config: Wait network interface to come up")
introduced check_interface() function, which accidentally has 2
different signatures depending on CONFIG_NET_NATIVE selection.

Let's fix the second signature to be correct.

Fixes: https://github.com/zephyrproject-rtos/zephyr/issues/22693

Signed-off-by: Michael Scott <mike@foundries.io>
2020-02-10 23:31:05 +02:00
Luiz Augusto von Dentz
6ea0ea38a7 Bluetooth: L2CAP: Fix not queueing in case there are no credits
This can happens if for example the remote peer have the initial credits
set to 0 which would cause bt_l2cap_chan_send to fail instead of just
queue the packets until more credits are given.

Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
2020-02-10 22:08:14 +02:00
Stephanos Ioannidis
71362ddf5d arch: arm: aarch64: linker.ld: Remove redundant text section offset
This commit removes the redundant text section offset specification in
the AArch64 linker script.

The text section offset is already specified by the
`text_section_offset.ld`, which is included by
`arch/common/CMakeLists.txt`.

Signed-off-by: Stephanos Ioannidis <root@stephanos.io>
2020-02-10 20:04:21 +01:00
Michael Scott
e934825719 drivers: modem: sara-r4: fix APN setting for U2 modem
usage of AT+UPSD command per UBX-17003787(R15) command reference is:
AT+UPSD=<profile_id>, <param_tag>, <param_val>

For AT+UPSD=0, 1, "<value>": we are setting value to MCCMNO, which
is technically incorrect.  <param_tag> of 1 means:

1: APN - <param_val> defines the APN text string, e.g.
"apn.provider.com"; the maximum length is 99. The factory-programmed
value is an empty string.

Let's use APN here instead.  This fixes a +CME ERROR: 113 when
connecting with U2 modem.

Fixes: https://github.com/zephyrproject-rtos/zephyr/issues/22689

Signed-off-by: Michael Scott <mike@foundries.io>
2020-02-10 20:00:15 +02:00
Jukka Rissanen
45eccbc5d7 drivers: modem: gsm: Command handlers should return value
GSM modem command handlers were missing a return value.

Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2020-02-10 19:52:33 +02:00
Carlo Caione
5a7f073db6 board: qemu_cortex_a53: Enable default testing
QEMU Cortex-A53 is the default (and only) board for this architecture,
as such we should enable default testing.

Signed-off-by: Carlo Caione <ccaione@baylibre.com>
2020-02-10 17:00:20 +01:00
Daniel Leung
0c3a9c83d8 boards: up_squared_adsp: fix mis-used logical operator
In the bootloader code, there is a mis-used logical operator
which should be bitwise operator. So fix it.

Fixes #22651
Coverity-CID: 208198

Signed-off-by: Daniel Leung <daniel.leung@intel.com>
2020-02-10 12:35:30 +02:00
Inbar Anson Bratspiess
827f6f1714 net: socket: Release fd on failure in accept()
The zsock_accept_ctx() calls z_reserve_fd() on entry but fails
to call z_free_fd() on failure. This will leak the allocated
socket descriptor.

Fixes #22366

Signed-off-by: Inbar Anson Bratspiess <inbar.anson.bratspiess@330plus.net>
2020-02-10 12:33:22 +02:00
Jukka Rissanen
b05e72f3bb drivers: modem: gsm: Add setting of MCC number
Add Kconfig option that allows user to set MCC (Mobile Country
Code). If user does not set it, then automatic operator
registration is used.

Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2020-02-10 12:32:24 +02:00
Jukka Rissanen
49724e25a0 drivers: modem: gsm: Add misc fixes like line ending char set
Misc fixes / enhancements to the GSM driver:
* set the \r as a line ending character
* make gsm_init() static as there is no need to expose it
* print the gsm context pointer at init
* set buffer allocation timeout to modem context so that it is
  not infinite

Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2020-02-10 12:32:24 +02:00
Jukka Rissanen
4c1b0ab2a9 drivers: modem: gsm: Add context to DEVICE_INIT()
Instead of using global static variable "gsm" everywhere,
store the context when calling DEVICE_INIT(). Then in the device
init function get the context from the device struct. This way
it is possible to use the same functions for implementing two
gsm modem instances. Currently this is not fully possible because
the context is not passed via uart_pipe API and modem_cmd
callbacks. So some future work would still be needed.

In practice this commit does not change anything, it just makes
it a little bit easier to have two instance of this modem which
might be quite unlikely case. Anyway, the driver now follows the
same style how some other drivers are done like Ethernet etc.

Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2020-02-10 12:32:24 +02:00
Alexander Wachter
1faaff1ea5 tests: canbus: isotp: Fix wrong variable used for assert
The assert for error checking used the wrong variable.
data_buf was checked instead of the ret variable.

Fixes #22656
Coverity-CID: 208192

Signed-off-by: Alexander Wachter <alexander@wachter.cloud>
2020-02-10 12:32:01 +02:00
Alexander Wachter
c9d76eef88 canbus: isotp: Fix NULL deref after overflow
The implementation checks if there are not enough buffers
to add the received data. However, a return was missing
after the error signaling.

Fixes #22657
Coverity-CID: 208191

Signed-off-by: Alexander Wachter <alexander@wachter.cloud>
2020-02-10 12:32:01 +02:00
Michael Scott
b6b4396c48 drivers: modem: sara-r4: use +USO[RF|RD] based on proto
Regardless of whether from is set, let's use the correct socket read
commands for UDP and TCP.

Signed-off-by: Michael Scott <mike@foundries.io>
2020-02-10 12:29:41 +02:00
Michael Scott
a6fc7f8669 drivers: modem: sara-r4: disable hex mode for binary data
Now that the u-blox driver can let cmd_handler know that it hasn't
received enough data, let's disable the hex mode for readying
binary data.

On the SARA-R4 this mode limits the receiving MTU to 512 which is
unacceptable.

Signed-off-by: Michael Scott <mike@foundries.io>
2020-02-10 12:29:41 +02:00
Michael Scott
90c6dc5e7f drivers: modem: cmd_handler: add return value to modem commands
Some modem commands can determine if they have enough data pulled from
the modem to continue or not.  Let's allow those functions to return
EAGAIN which means there's more data needed from the modem.

Signed-off-by: Michael Scott <mike@foundries.io>
2020-02-10 12:29:41 +02:00
Michael Scott
5185b8cf40 drivers: modem: cmd_handler: honor num of params in parse_params
Modem commands are setup with arg_count to denote the number of params
to parse before returning.  Let's honor that setting and return once
we've parse them.

This fixes a run-on bug where the parser would find as many of the
parameters via the supplied delimiter as it could.

Signed-off-by: Michael Scott <mike@foundries.io>
2020-02-10 12:29:41 +02:00
Michael Scott
b08ac66f91 boards/shields: sparkfun_sara_r4: enable SARA_R4_NET_STATUS
There is a blue LED used to display connectivity for the SparkFun
SARA-R4 shield.  This LED is connected to the modem via GPIO 16
which is the default used by SARA-R4 driver when
CONFIG_MODEM_UBLOX_SARA_R4_NET_STATUS is enabled.

Signed-off-by: Michael Scott <mike@foundries.io>
2020-02-10 12:29:41 +02:00
Michael Scott
698661b56e drivers: modem: sara-r4: update functions to return POSIX values
The original Ublox SARA-R4 driver was written for the net_context
APIs.  As a result many of the return values are not POSIX standard.

Let's go through all of the socket offload functions and make sure
we return standard values (0 or -1) and set errno where appropriate.

Signed-off-by: Michael Scott <mike@foundries.io>
2020-02-10 12:29:41 +02:00
Michael Scott
87481e8eef drivers: modem: sara-r4: handle read limits
SARA-R4 has a max read limit of 512 when using binary hex formatting.
Otherwise the max read limit is 1024.

Signed-off-by: Michael Scott <mike@foundries.io>
2020-02-10 12:29:41 +02:00
Michael Scott
52afcc21d6 drivers: modem: sara-r4: fix error text in net_offload_dummy_get
Correctly tell the user that CONFIG_NET_SOCKETS_OFFLOAD needs to be
enabled.

Signed-off-by: Michael Scott <mike@foundries.io>
2020-02-10 12:29:41 +02:00
Michael Scott
2be4f997b3 drivers: modem: sara-r4: use new socket functions
New socket functions were introduced to hide some of the modem_socket
internals:
- modem_socket_next_packet_size()
- modem_socket_wait_data()
- modem_socket_data_ready()

Let's use them.

Signed-off-by: Michael Scott <mike@foundries.io>
2020-02-10 12:29:41 +02:00
Michael Scott
36e4fc7743 drivers: modem: sara-r4: manage sock->is_connected
Let's use sock->is_connected to check whether we need to clean up
the modem's socket.  It may have already been closed via URC.

Signed-off-by: Michael Scott <mike@foundries.io>
2020-02-10 12:29:41 +02:00
Michael Scott
6c9bb48ce7 drivers: modem: sara-r4: use 120s connection timeout
SARA-R4 AT command manual states +USOCO has a max timeout of 120s.
Let's use that instead of the default 10s command timeout.

Signed-off-by: Michael Scott <mike@foundries.io>
2020-02-10 12:29:41 +02:00
Göran Weinholt
8fb3f21e58 drivers: modem: sara-r4: support for 2G on the SARA R412M modem
The SARA R412M requires manual activation of the PDP context. It also
reports RSSI instead of RSRP when on 2G. An off-by-one in the RSRP
calculation was also fixed in this commit.

Signed-off-by: Göran Weinholt <goran.weinholt@endian.se>
2020-02-10 12:29:41 +02:00
Göran Weinholt
bf59ceda0b drivers: modem: sara-r4: support for network indication on SARA modems
The u-blox SARA modems have the ability to output the network status
on a GPIO pin. This can be used to light up a LED when the modem is
connected to the network.

Signed-off-by: Göran Weinholt <goran.weinholt@endian.se>
2020-02-10 12:29:41 +02:00
Göran Weinholt
ea99d34e00 drivers: modem: sara-r4: continually signal the modem to power off
The U2 modem will sometimes not power off even if we have given it the
signal to do so. We now signal it continually until the modem
indicates that power is off with VINT=0.

Signed-off-by: Göran Weinholt <goran.weinholt@endian.se>
2020-02-10 12:29:41 +02:00
Hans Wilmers
1db79054af drivers: modem: sara-r4: fix modem reset
This fixes two problems in modem_reset():

- mdata.net_iface is used without checking that it is valid.
  Now, we validate mdata_net_iface before usage, and give a warning
  if it was not set.

- if the modem does not perform network registration within the
  given time of 20s, in the previous implementation the driver
  gave up.
  Now, the driver disables RF for a second, enables it again and
  gives the modem another 20s to register. This has been seen
  to help in roaming situations.

Tested on Sara R4.

Signed-off-by: Hans Wilmers <hans@wilmers.no>
2020-02-10 12:29:41 +02:00
Hans Wilmers
97921368d3 drivers: modem: sara-r4: adjust send and receive lengths
- limit max. number of bytes when sending to socket
  The number of bytes sent to a socket in one transaction
  is limited to 512 in HEX mode (Sara-R4), and to 1024
  otherwise. This corresponds to numbers given in the
  manual for ublox cellular modems.

- report number of bytes actually sent, as reported by modem
  After writing data to a socket, we now return the number of
  bytes actually written, as reported by the modem.

Signed-off-by: Hans Wilmers <hans@wilmers.no>
2020-02-10 12:29:41 +02:00
Michael Scott
a18f78894f drivers: modem: sara-r4: make room for NUL in match_buf
In order to still process 128 bytes at a time, let's add 1 to the
length of match_buf which will be used to store a NUL char when
the match_buf is at max size (size - 1).

Otherwise we're processing 127 bytes at a time which is inefficient
compared to the data buffer sizes in net_buf.

Signed-off-by: Michael Scott <mike@foundries.io>
2020-02-10 12:29:41 +02:00
Michael Scott
8ef2ae8ce5 drivers: modem: sara-r4: add offloaded DNS handling
SARA-R4 modem supports offloaded DNS via AT+UDNSRN command.
Let's implement it.

NOTE! On SARA-R4 a new firmware *IS* required to support this feature:
L0.0.00.00.05.08 [Apr 17 2019 19:34:02]

Signed-off-by: Michael Scott <mike@foundries.io>
2020-02-10 12:29:41 +02:00
Michael Scott
50d4e07d0c drivers: modem: sara-r4: remove interface up / down
Managing the interface up / down events from driver code (as opposed
to L2 layers) has been an issue for quite some time.  There are
race conditions which result in data aborts (referencing NULL
iface or NULL iface->if_dev) or ends up breaking ASSERT checks for
non-NULL iface.

Let's remove the handling for now and come up with something better
when a user actually needs it.

Signed-off-by: Michael Scott <mike@foundries.io>
2020-02-10 12:29:41 +02:00
Michael Scott
1265843495 drivers: modem: sara-r4: cleanup offload_recvfrom timeout
In offload_recvfrom(), if we end up calling modem_cmd_send(),
then we should always wait for the results.  We've already
checked for MSG_DONTWAIT and made sure that there is data ready.
We just need to get it from the modem buffer at this point.

Signed-off-by: Michael Scott <mike@foundries.io>
2020-02-10 12:29:41 +02:00
Michael Scott
ba34136581 drivers: modem: sara-r4: dont unblock on sockread
Users may be waiting for data via socket recv() function.  We
notify them that data is ready when URC is received from modem.

Once unblocked, we read the data from the modem buffer which
is handled via on_cmd_sockread_common().  At this point, we
don't need to unblock waiting users again.

Signed-off-by: Michael Scott <mike@foundries.io>
2020-02-10 12:29:41 +02:00
Michael Scott
1f68802899 drivers: modem: sara-r4: space for NUL in buffer is optional
The hex_to_binary() function is incorrectly assuming all buffers
passed to recv() will have an additinal byte for storing a NUL
terminating char.  This should be optional as MQTT library uses
exact sized buffers for parsing socket data.

Signed-off-by: Michael Scott <mike@foundries.io>
2020-02-10 12:29:41 +02:00
Michael Scott
179307c723 drivers: modem: sara-r4: return send bytes from send_socket_data
The send_socket_data() is incorrectly sending 0 as successful result.

The socket APIs require the number of bytes sent to be returned.

Signed-off-by: Michael Scott <mike@foundries.io>
2020-02-10 12:29:41 +02:00
Michael Scott
82dc1665af drivers: modem: cmd_handler: fix findcrlf() indentation
Missed during previous rework.

Signed-off-by: Michael Scott <mike@foundries.io>
2020-02-10 12:29:41 +02:00