Commit graph

41120 commits

Author SHA1 Message Date
Marek Pieta
ac31020deb doc: subsystems: shell: Documentation fix
Change fixes typo in documentation.

Signed-off-by: Marek Pieta <Marek.Pieta@nordicsemi.no>
2018-11-20 12:11:22 +01:00
Andy Ross
7d78122caa lib/mempool: One more spurious -ENOMEM condition
Similar to the last patch, there was a spot in block recombination
where the lock would be released while the combined block was being
held allocated.  That means that when recombining a single top-level
block, it was possible for the entire heap to look allocated.

Make the combination and re-addition of the larger block atomic.
Requires a little surgery to the structure of the code, so this is a
little more involved than the earlier fix.

Signed-off-by: Andy Ross <andrew.j.ross@intel.com>
2018-11-20 11:35:10 +01:00
Andy Ross
7845e1b01e lib/mempool: Fix spurious -ENOMEM due to agressive latency control
The mempool operations need to be atomic, but because of latency
concerns (the allocator is intended for use in an ISR) the locking was
designed to be as minimal as possible.  And it... mostly got it right.
All the list handling was correctly synchronized.  The merging of four
child blocks into a parent block was atomic.  The splitting of a block
into four children was atomic.

BUT: there was a moment between the allocation of a large block and
the re-addition of its three unused children where the lock was being
released.  This meant that another context (e.g. an ISR that just
fired, interrupting the existing call to k_mem_pool_alloc()) would see
some memory "missing" that wasn't actually allocated.  And if this
happens to have been the top level block, it's entirely possible that
the whole heap looks empty, even though the other allocator might have
been doing only the smallest allocation!

Fix that by making the "remove a block then add back the three
children we don't use" into an atomic step.  We can still relax the
lock between levels as we split the subblocks further.

(Finally, note that this trick allows a somewhat cleaner API as we can
do our "retry due to race" step internally by walking back up the
block size list instead of forcing our caller to do it via that weird
-EAGAIN return value.)

Fixes #11022

Signed-off-by: Andy Ross <andrew.j.ross@intel.com>
2018-11-20 11:35:10 +01:00
Paul Sokolovsky
2e21a95fd4 net: sockets: zsock_close: Be sure to free file descriptor
File descriptor I freed automagically when using POSIX subsystem's
close() function, but any subsys-adhoc functions like zsock_close()
should do that explicitly.

Signed-off-by: Paul Sokolovsky <paul.sokolovsky@linaro.org>
2018-11-20 11:25:17 +01:00
Vinayak Kariappa Chettimada
aa5bbd5dfe Bluetooth: controller: Fix enable and disable of scan state
Updated controller implementation to disallow disabling
initiator state using scan disable. But allow disabling an
already disabled scan state. Also, disallow enabling scan
state while in initiator state.

Signed-off-by: Szymon Janc <szymon.janc@codecoup.pl>
Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2018-11-20 11:19:07 +01:00
Luiz Augusto von Dentz
3fdedde967 Bluetooth: ATT: Assert if request is invalid
Consider invalid if the request pointer is NULL or the callback is NULL
or there is a request ongoing. This conditions would likely lead to a
crash and most likely there is some other bug involved like for example
the application queueing the same request multiple times.

Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
2018-11-20 11:15:33 +01:00
Rajavardhan Gundi
4e8e0748e8 storage: flash_map: Make flash_map as extern
flash_map should be made extern in flash_map.c since it is defined
in flash_map_default.c. Not having flash_map as extern will result
in build errors.

Signed-off-by: Rajavardhan Gundi <rajavardhan.gundi@intel.com>
2018-11-20 11:15:16 +01:00
Vinayak Kariappa Chettimada
c326ae729f Bluetooth: controller: Do not feature exchange more than once
Updated the controller implementation to not feature
exchange if already done once either by local or remote peer
device in an active connection session.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2018-11-20 11:14:58 +01:00
Flavio Ceolin
c554ab7100 subsys: logging: Fix invalid memory access
Coverity-CID: 189512

Signed-off-by: Flavio Ceolin <flavio.ceolin@intel.com>
2018-11-20 11:14:31 +01:00
Spoorthi K
06fa2e6764 tests: msgq: Modify test to verify k_msgq_peek
Verify k_msgq_peek() API functionality by
modifying existing test suite.

Signed-off-by: Spoorthi K <spoorthi.k@intel.com>
2018-11-19 22:43:04 -05:00
David B. Kinder
e4759cbc41 doc: fix links in Galileo doc
Fix link text to remove substitutions that are ignored by Sphinx.  Also
replace link to Quark SOC HW ref manual to be from an Intel site (not
Russian).

Fixes: #11516

Signed-off-by: David B. Kinder <david.b.kinder@intel.com>
2018-11-19 21:36:22 -05:00
Sathish Kuttan
e275ae5e06 doc: kernel: add k_msgq_peek() API
Add documentation for k_msgq_peek()

Signed-off-by: Sathish Kuttan <sathish.k.kuttan@intel.com>
2018-11-19 17:53:22 -05:00
Sathish Kuttan
a8aa235d9b kernel: msg_q: k_msgq_peek() implementation
Add implementation for k_msgq_peek() which is similar to k_msgq_get()
except the message is not deleted from the queue.

Signed-off-by: Sathish Kuttan <sathish.k.kuttan@intel.com>
2018-11-19 17:53:22 -05:00
Sathish Kuttan
3efd8e17bd kernel: Add k_msgq_peek() API
Add an API to peek into a message queue and read the first message
without removing the message from the queue.

Signed-off-by: Sathish Kuttan <sathish.k.kuttan@intel.com>
2018-11-19 17:53:22 -05:00
Anas Nashif
10b1ee149f ci: use v0.4-rc14 image
- Has cmake 3.8.2 that matches min. required version
- Has west pre-installed
- Uses latest python dependencies from scripts/requirements.txt
- remove ISSM toolchain
- added scancode-toolkit for scanning licenses and copyrights.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2018-11-19 17:22:23 -05:00
Sebastian Bøe
8ba5aff8c0 kconfig: Drop support for specifying CROSS_COMPILE through Kconfig
When we move DT infront of Kconfig we are going to need access to a C
toolchain before Kconfig is evaluated. This means it will not be
possible to specify the toolchain used through Kconfig.

To deal with this we ...

Drop support for specifying CROSS_COMPILE through Kconfig. Still
available is the ability to specify CROSS_COMPILE through the
environment or through a CMake variable.

Signed-off-by: Sebastian Bøe <sebastian.boe@nordicsemi.no>
2018-11-19 15:04:13 -05:00
Anas Nashif
10970a60c0 sanitycheck: remove unused platforms keyword
This keyword had no effect and was being copied over to many samples
errornously.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2018-11-19 15:03:55 -05:00
Gil Pitney
759b987f72 drivers: serial: Update cc32xx uart interrupt handling
The Zephyr console and shell interrupt processing assumes
a TX interrupt is evoked upon first enabling the TX
interrupt via uart_irq_tx_enable.

This was not the case with the cc32xx uart, coming out of
reset, with FIFO's disabled.

The only way found to achieve this behavior is to fill
the fifo with a non-printable character on initialization.

Also, the uart driver was explicitly clearing TX/RX interrupts in
its isr, which was unnecessary, as the act of reading/writing
did that implicitly.

These fixes allow the cc32xx uart to work with the
current Zephyr console/shell design.

Fixes: #11202

Signed-off-by: Gil Pitney <gil.pitney@linaro.org>
2018-11-19 14:01:29 -06:00
Sebastian Bøe
84fe1ec63f cmake: Don't remember misnamed boards
CMake prints a helpful error message with all the boards supported
when a board name has been misspelled. But CMake also
remembers (caches) the corrupted board name and refuses to change it
until the board directory has been cleared.

CMake is rightly hesitant to change the board, as other cached
variables depend on what the board is. But it is safe to change the
board just after it has been selected, because we verify it's
correctness before using it to calculate other variables.

So to support the use-case of changing a misspelled board
name (without clearing the build directory) we unset the cached board
when it is invalid.

Also; change the now unused (in-tree) macro 'assert_with_usage' to
'print_usage'.

Signed-off-by: Sebastian Bøe <sebastian.boe@nordicsemi.no>
2018-11-19 11:42:25 -05:00
Bobby Noelte
098dbfd185 dts: scan application dir for files included by dts
In addition to zephyr/include and zephyr/dts also scan
the dts directory within the application source directory
for files included by the DTS.

Allows to have application specific DTS includes. This
is especially useful for out of tree drivers.

Signed-off-by: Bobby Noelte <b0661n0e17e@gmail.com>
2018-11-19 11:41:42 -05:00
Robert Lubos
1d4223ef3a samples: sockets: Set correct log module name in echo_server
echo_server used incorrect net_echo_client_* names for logger.

Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
2018-11-19 11:40:39 -05:00
Jakub Rzeszutko
7d31796416 shell: fix shell thread name
Each shell thread will have unique name.
Previously thread name "shell" has been created for each shell
backend.

Signed-off-by: Jakub Rzeszutko <jakub.rzeszutko@nordicsemi.no>
2018-11-19 11:40:05 -05:00
Vincenzo Frascino
03c7d9bd49 drivers: wdog: Update CMSDK Wdog driver
The commit 0c2ef4ea3d "drivers:
watchdog: Watchdog API redesign" introduced an API redesign for the
watchdog drivers compliant with Zephyr.

This patch updated the CMSDK Watchdog driver to be compliant with the
new API.

Signed-off-by: Vincenzo Frascino <vincenzo.frascino@linaro.org>
2018-11-19 08:40:48 -06:00
Henrik Brix Andersen
e5460c6bcc drivers: watchdog: wdt_sam0: Convert Atmel SAM0 driver to the new API
Convert the Atmel SAM0 watchdog driver to the new watchdog API and
enable DTS support.

This fixes #10914.

Signed-off-by: Henrik Brix Andersen <henrik@brixandersen.dk>
2018-11-19 08:40:15 -06:00
Stanislav Poboril
7ca69b385d sample: Add IMX IPM sample application
Add IMX IPM sample application. It reads the data sent to the
Messaging Unit and sends them back. It has been tested on Udoo Neo Full
board with the Cortex-A9 core running Linux and sending the data
into the Messaging Unit A and the Cortex-M4 running this sample Zephyr
application and reading the data from Messaging Unit B and sending it
back for Linux side to read it from Messaging Unit A.

Origin: Original

Signed-off-by: Stanislav Poboril <stanislav.poboril@nxp.com>
2018-11-19 08:38:38 -06:00
Stanislav Poboril
15eace97c9 imx: Enabled Messaging Unit in Udoo Neo Full board
Enabled Messaging Unit B in Cortex-M4 core of Udoo Neo Full board
so it can use IMX IPM.

Origin: Original

Signed-off-by: Stanislav Poboril <stanislav.poboril@nxp.com>
2018-11-19 08:38:38 -06:00
Stanislav Poboril
871fc0f3c2 imx: Add Messaging Unit peripheral support for i.MX6SoloX soc
Add Messaging Unit B peripheral support for i.MX6SoloX soc so it can
use IMX IPM.

Origin: Original

Signed-off-by: Stanislav Poboril <stanislav.poboril@nxp.com>
2018-11-19 08:38:38 -06:00
Stanislav Poboril
ba3ed24f3d imx: Add IMX IPM driver for i.MX socs
Add driver for i.MX Messaging Unit peripheral which can be used for
i.MX6SoloX, i.MX7D and other i.MX socs.

Origin: Original

Signed-off-by: Stanislav Poboril <stanislav.poboril@nxp.com>
2018-11-19 08:38:38 -06:00
Bobby Noelte
1bf1d6a267 scripts: extract_dts_includes: fix cell name readout from yaml
Default for a unavailable cell name was an empty list, whereas a
given name is a string. Leads to a runtime error if the name is given.
Make the default an empty string.

Names for cells are taken from the yaml binding. The key used is
"#cells" which clashes if there are different cell based properties
for a device. Readout names from the more specific "#xxx-cells" if
given and fall back to "#cells" if not given.

Signed-off-by: Bobby Noelte <b0661n0e17e@gmail.com>
2018-11-19 08:35:10 -06:00
Sean Nyekjaer
5501e0d7bd boards: atsamd20_xpro: fix tx pin number for sercom3
Not pretty to change the PAD name from 2 to 1 as the correct
is PAD2 but for the SAMD20 the register value is 1.

Fixes: 6d08958ad5 ("drivers: uart_sam0: move sercom pad info to dts")
Signed-off-by: Sean Nyekjaer <sean.nyekjaer@prevas.dk>
2018-11-19 08:34:48 -06:00
Håkon Alseth
a88dc36f60 clang-format: add support for clang-format
Add .clang-format style from linux kernel to allow easier
style formatting for developers that do not use uncrustify.
You can call "clang-format -style=file -i my_src.c" within the repo
to in-place fix the style.

Signed-off-by: Håkon Alseth <haal@nordicsemi.no>
2018-11-19 09:31:44 -05:00
Robert Lubos
b5fd15de0c tests: mqtt: Add test to verify publish reception
Add MQTT test to verify PUBLISH message reception.

Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
2018-11-19 09:31:01 -05:00
Robert Lubos
0f7698be8b tests: mqtt: Port tests to use new implementation
Port existing MQTT tests to new socket MQTT API.

Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
2018-11-19 09:31:01 -05:00
Robert Lubos
4d97d9f6be samples: mqtt: Switch MQTT Publisher to new MQTT implementation
Port MQTT Publisher sample to new socket MQTT API.

Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
2018-11-19 09:31:01 -05:00
Robert Lubos
d2a397bcf8 net: mqtt: Add TLS socket transport
Add TLS transport to socket MQTT implementation.

Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
2018-11-19 09:31:01 -05:00
Robert Lubos
37563a92d5 net: mqtt: Add BSD socket implementation
Add new, socket based MQTT implementation, based on MQTT from Nordic
nRF5 SDK, introducing the following features:

* transport independent MQTT logic, with support for multiple transports
* support for multiple MQTT versions (3.1.0 and 3.1.1 supported)
* single event handler - no need to keep callback array in RAM
* automatic send of Ping Requests, for connection keep-alive
* message/event parameters wrapped into strucutres - easier extension
  for future MQTT versions
* no separate thread needed to run MQTT - application only needs to call
  mqtt_input and mqtt_live periodically

Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
2018-11-19 09:31:01 -05:00
Robert Lubos
f50aa6d3fb net: mqtt: Mark existing implementation as legacy
Rename existing headers and sybols to mqtt_legacy, to allow new
implementation to keep old config and header names.

Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
2018-11-19 09:31:01 -05:00
Johan Hedberg
d0253d310d samples: reel_board/mesh_badge: Fix various coding style issues
Fix coding style issues, mainly related to whitespace usage.

Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
2018-11-19 15:06:14 +02:00
Johan Hedberg
b164c9723f samples: reel_board/mesh_badge: Fix out-of-bounds array access
The show_sensors_data() function tries to access val[2] when
outputting the Z-axis value, so the array must have at least three
elements. This also triggered Coverity CID 189741.

Fixes #11482

Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
2018-11-19 15:06:14 +02:00
Johan Hedberg
381a9dd1ee samples: reel_board/mesh_badge: Fix comparison with unsigned number
This comparison was always supposed to be > rather than >=. Fixing
this also fixes Coverity CID 189740.

Fixes #11483

Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
2018-11-19 15:06:14 +02:00
Szymon Janc
e693997c29 Bluetooth: host: Fix not starting slave conn param update timer
When issuing LE Set Data Length Command host should not assume that
LE Data Length Change Event will be generated. From Core Spec 5.0:
"If the command causes the maximum transmission packet size or maximum
packet transmission time to change, an LE Data Length Change Event
shall be generated."

Change-Id: I17723b58ed4f390aa465db3f69126ee229871123
Signed-off-by: Szymon Janc <szymon.janc@codecoup.pl>
2018-11-19 13:40:13 +02:00
Szymon Janc
bf71fa1aeb Bluetooth: host: Don't send slave conn param request if not needed
If master or application decided to switch connection parameters to
ones that meet pending parameters don't bother sending request
after 5 seconds timeout.

Signed-off-by: Szymon Janc <szymon.janc@codecoup.pl>
2018-11-19 13:22:43 +02:00
Ulf Magnusson
37fcec9833 kconfiglib/menuconfig/kconfig.py: Various improvements
Update Kconfiglib and menuconfig to upstream revision d3866958c7685, to
add various improvements:

 - Support HOME and END in the jump-to dialog in the menuconfig. END can
   be handy as choices, menus, and comments appear at the end.

 - Add more fine-grained warning controls for multiple assignments to a
   symbol in configuration files. Use it to simplify kconfig.py a bit.

   Clean up kconfig.py a bit in other ways too, e.g. by removing unused
   imports.

 - Improve Kconfig parsing performance slightly

Signed-off-by: Ulf Magnusson <Ulf.Magnusson@nordicsemi.no>
2018-11-19 12:18:23 +01:00
Krzysztof Chruscinski
8421543f1c shell: Add initial log level for rtt and uart backends
RTT and uart shell backends were started with fixed
log limit set to INF. Configuration has been moved
to Kconfig allowing certain level or default LOG_MAX_LEVEL.

Signed-off-by: Krzysztof Chruscinski <krzysztof.chruscinski@nordicsemi.no>
2018-11-19 12:05:44 +01:00
Anas Nashif
644b31d2a4 Revert "Build: Offsets lib as OBJECT not STATIC"
This reverts commit 18f9bb04f7.

This breaks with cmake 3.8.2, the minimal required version we have in
all of our cmake files.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2018-11-17 22:28:33 -05:00
Himanshu Jha
4d1a1217f1 doc: application: coccinelle: Add information about coccinelle list
Add link to coccinelle mailing list info and archives.

Signed-off-by: Himanshu Jha <himanshujha199640@gmail.com>
2018-11-17 14:50:33 -05:00
Michael Scott
b010cd763e samples: net: lwm2m_client: expand sanity testing
Let's expand the sanity build testing for the lwm2m_client by
doing the following:

- Add variant builds for DTLS, bluetooth and modem
- Check various combinations of hardware across each of these
  variant builds: frdm_k64f, nrf52_pca10040, nrf52840_pca10056,
  disco_l475_iot1

Signed-off-by: Michael Scott <mike@foundries.io>
2018-11-17 00:50:15 -05:00
Michael Scott
7f6fcf2198 dts-binding: modem: wnc-14a2a: remove base_label to fix build errors
When the WNC-14A2A modem binding was originally introduced, I thought
the base_label would shorten the define keeping the result short and
easily portable.  Turns out with the latest changes, it has a side
effect of removing the "DT_*" prefix which is breaking the build.

Let's remove "base_label" from the modem binding and adjust all of
the dts_fixups referring to the WNC14A2A defines.

NOTE: This commit moves the left-over WNC14A2A dts_fixup defines from
the nRF52 soc into samples/net/lwm2m_client as the new values.
They will stay there until the modem can be re-configured as a shield.

Signed-off-by: Michael Scott <mike@foundries.io>
2018-11-17 00:50:15 -05:00
Michael Scott
d80e6f24d4 samples: net: lwm2m_client: add "ok" and baud rate to k64f overlay
During the modem overlay move from the K64F board directory to the
LwM2M sample code, 2 DTS entries were dropped:
current-speed = <115200>;
status = "ok";

Without these entries the DTS defines for UART2 and CURRENT_SPEED
are missing from the generated_dts_board.h file.

Signed-off-by: Michael Scott <mike@foundries.io>
2018-11-17 00:50:15 -05:00
Marti Bolivar
18e6c10339 scripts: print notice that west's copy is a copy
One of the most common issues I've had to deal with as people are
starting to try west is that bash has cached the 'west' binary to the
version in zephyr/scripts/west after they ran zephyr-env.sh on Unix
operating systems.

This makes people (correctly) think they are running an older version
when they get output about missing clone commands, etc., but doesn't
give them any hints about why that happened, because most people don't
know that west is already in widespread use for flashing and
debugging.

To make fielding support for these users easier while we're
transitioning, print a notice at the end of the copy informing users
what just happened. We can make it more forceful as time goes on.

Signed-off-by: Marti Bolivar <marti@foundries.io>
2018-11-17 00:49:12 -05:00