Commit graph

41120 commits

Author SHA1 Message Date
Andrew Boie
0a41f06159 nios2: add arch_irq_is_enabled()
This arch API was never implemented on this architecture.

Fixes: #9994

Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
2020-03-10 12:06:54 -04:00
Gerard Marull-Paretas
5df13cb910 soc: arm: stm32: configure LDO supply on H7 init
Configure the LDO supply when initializing H7 (M7) SoC. I have
observed MCU hanging on LL_PWR_IsActiveFlag_VOS() wait loop when
doing a cold boot if LDO supply is not explicitely enabled.
According to the datasheet LDO should be enabled by default,
however HAL examples also configure LDO, so there may be a
reason to perform such step.

Signed-off-by: Gerard Marull-Paretas <gerard@teslabs.com>
2020-03-10 10:22:08 -05:00
Jose Alberto Meza
f845c933a3 boards: arm: mec1501modular: Correct I2C bus configurations
MEC1501modular doesn't expose same I2C instances than MEC15xxevb,
additionally this causes undesired reconfiguration of pins with
other function when card is mated with a platform that complies
with MECC specification.

Signed-off-by: Jose Alberto Meza <jose.a.meza.arellano@intel.com>
2020-03-10 10:18:17 -05:00
Trond Einar Snekvik
56a918f8ca Bluetooth: Mesh: Rework msg_cache
Changes the behavior of the message cache to optimize for cache
capacity. Previously, the message cache's primary function was to avoid
decrypting messages multiple times, although the cache's main function
in the spec is to avoid message rebroadcasting. Optimizing for minimal
decryption causes us to fill the network cache faster, which in turn
causes more cache misses, potentially outweighing the advantage.

Now stores src + seq in message cache instead of field hash value. This
cuts cache size in two, while including more of the sequence number than
before.

Adds messages to the cache only after the packet is successfully
decrypted. This reduces noise in the cache, and ensures that no
invalid deobfuscations are added.

Additionally, this fixes a bug where multiple calls to net_decrypt with
the same packet failed, as the message cache found its own entry from
the previous call.

Signed-off-by: Trond Einar Snekvik <Trond.Einar.Snekvik@nordicsemi.no>
2020-03-10 17:13:32 +02:00
Johann Fischer
085e58faf8 drivers: usb_dc_mcux_ehci: re-enable reception after clear stall
Re-enable reception after clear an endpoint stall.

Signed-off-by: Johann Fischer <j.fischer@phytec.de>
2020-03-10 16:04:50 +01:00
Johann Fischer
e0b2227c39 drivers: usb_dc_mcux_ehci: add checks for valid endpoint
Add checks for valid endpoint.
Fix controllerHandle check in usb_dc_detach().

Fixes: #19763

Signed-off-by: Johann Fischer <j.fischer@phytec.de>
2020-03-10 16:04:50 +01:00
Johann Fischer
e9a35dd6f1 drivers: usb_dc_mcux_ehci: rework USB_DeviceNotificationTrigger()
Rework USB_DeviceNotificationTrigger(). Fix style.

Drop messages from USB_DeviceEhciCancel().
MCUX EHCI driver notifies about canceled transfers,
but there is no specific code for this event in
usb_device_callback_message_struct_t, the only way to
recognize it is to check the length value.

Signed-off-by: Johann Fischer <j.fischer@phytec.de>
2020-03-10 16:04:50 +01:00
Johann Fischer
c2d45640c2 drivers: usb_dc_mcux_ehci: rework ep_write/ep_read
Rework ep_write/ep_read. Fix style.

Signed-off-by: Johann Fischer <j.fischer@phytec.de>
2020-03-10 16:04:50 +01:00
Johann Fischer
0958667125 drivers: usb_dc_mcux_ehci: rework endpoint enable/disable
Rework endpoint enable/disable. Fix style.

Signed-off-by: Johann Fischer <j.fischer@phytec.de>
2020-03-10 16:04:50 +01:00
Johann Fischer
031d744b9a drivers: usb_dc_mcux_ehci: rework set/clear stall
Rework set/clear stall. Fix style.

Signed-off-by: Johann Fischer <j.fischer@phytec.de>
2020-03-10 16:04:50 +01:00
Johann Fischer
4bbd5ae438 drivers: usb_dc_mcux_ehci: do not reconfigure active endpoint
Do not reconfigure active endpoint. Fix style.

Signed-off-by: Johann Fischer <j.fischer@phytec.de>
2020-03-10 16:04:50 +01:00
Johann Fischer
adf8cfdf3f drivers: usb_dc_mcux_ehci: fix style, rework usb_dc_detach()
Fix style, rework usb_dc_detach().

Signed-off-by: Johann Fischer <j.fischer@phytec.de>
2020-03-10 16:04:50 +01:00
Johann Fischer
6116a0388b drivers: usb_dc_mcux_ehci: fix style, rework usb_dc_attach
Fix style, rework usb_dc_attach.

Signed-off-by: Johann Fischer <j.fischer@phytec.de>
2020-03-10 16:04:50 +01:00
Johann Fischer
a6207db0f7 drivers: usb_dc_mcux_ehci: remove unnecessary cast
Remove unnecessary cast, fix style.

Signed-off-by: Johann Fischer <j.fischer@phytec.de>
2020-03-10 16:04:50 +01:00
Johann Fischer
b04715b3b9 drivers: usb_dc_mcux_ehci: fix style, variables name
Fix style, variables name, defines.

Signed-off-by: Johann Fischer <j.fischer@phytec.de>
2020-03-10 16:04:50 +01:00
Marcin Niestroj
f15ac65254 net: icmpv4: drop requests on NET_OFFLOAD interfaces
NET_OFFLOAD interfaces do not handle ICMP request. Request to send ICMP
packet resulted in NULL pointer dereference in net_if_tx() later
on. Prevent that by detecting NET_OFFLOAD interfaces early in icmpv4
module.

Signed-off-by: Marcin Niestroj <m.niestroj@grinn-global.com>
2020-03-10 16:44:13 +02:00
Patrik Flykt
cbef6760c1 scripts: net: Enhance error reporting
Enhance error reporting by returning immediately when the calling
function reports an error.

Signed-off-by: Andrei Laperie <andrei.laperie@intel.com>
Signed-off-by: Patrik Flykt <patrik.flykt@intel.com>
2020-03-10 16:43:10 +02:00
Patrik Flykt
3401192e7f scripts: net: Add option to keep container after test
Add '--keep' option to leave Docker container and network running
after the test.

Signed-off-by: Patrik Flykt <patrik.flykt@intel.com>
2020-03-10 16:43:10 +02:00
Patrik Flykt
ad1b38bebe scripts: net: Return final return value from Docker test
Return the final return value from Docker script when running echo
client in the container, first for UDP and then TCP, for both IPv4
and IPv6.

Signed-off-by: Patrik Flykt <patrik.flykt@intel.com>
2020-03-10 16:43:10 +02:00
Patrik Flykt
8f451b7338 scripts: net: Add overlay file to sample script
Add an '--overlay' command line option in order to use an overlay
file when compiling Zephyr.

Signed-off-by: Patrik Flykt <patrik.flykt@intel.com>
2020-03-10 16:43:10 +02:00
Andrew Boie
81cfb08f52 random: remove rand32_timestamp.c
This is a copy of rand32_timer.c that uses
z_do_read_cpu_timestamp32() instead of k_cycle_get_32(),
with some logic to ensure different values when called in
rapid succession missing.

Like the other driver, its reported values are not random,
it's a testing generator only.

This appears to have no advantages over rand32_timer.c,
just remove it. In QEMU emulation, the reported TSC values
tend to have the lowest five bits zeroed.

Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
2020-03-10 10:40:13 -04:00
Andrew Boie
9f0acd44a4 kernel: add APIs for atomic os on pointers
The existing APIs are insufficient on 64-bit systems as atomic_t
is 32-bits wide.

Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
2020-03-10 10:18:16 -04:00
Andrew Boie
60e0019751 kernel: fix return type for atomic_cas()
In some cases this was a bool, in some cases an integer value
of 1 or 0. Standardize on bool.

Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
2020-03-10 10:18:16 -04:00
Andrew Boie
831f6d5051 shell: use correct data type for atomic variables
The variable needs to be an atomic_t, and in one case it was
being incremented outside of an atomic_inc/atomic_add.

Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
2020-03-10 10:18:16 -04:00
Andrew Boie
06d19213c4 tests: interrupt: fix testcase.yaml
The test itself handles correctly whether gen_isr_table
style dynamic interrupts are supported or not, there's
no need for an alternate scenario.

The tests work fine on riscv32 now, remove the exclusion.
Add a github link as to why Nios II is still excluded.

Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
2020-03-10 10:14:55 -04:00
Andrew Boie
7eb07d1470 tests: interrupt: fix broken scenario
The author of this test case seems to have been under the
mistaken impression that interrupts are locked in ISRs, which
is untrue.

The only reason this ever passed, anywhere, was a race between
the timer firing and the zassert_not_equal() check in
offload_function. If the busy_wait call is moved after the timer
is started, this fails everywhere.

We do not re-use the timer object from the previous case,
resolving some crashes observed on riscv.

Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
2020-03-10 10:14:55 -04:00
Andrew Boie
921c628f1e tests: interrupt: use one CPU only
The test tries to mask CPU interrupts and then enable a k_timer,
passing if it didn't fire.

This is totally defeated if the interrupt just fires on another
CPU that doesn't have interrupts masked.

Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
2020-03-10 10:14:55 -04:00
Andrew Boie
6cf496f324 kernel: use sched lock for k_thread_suspend/resume
This logic should be using the sched_lock and not its own
separate lock for these two functions.

Some simplications were made; z_thread_single_resume and
z_thread_single_suspend were only used in one place, and there was
some redundant logic for whether to reschedule in the suspend case.

Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
2020-03-10 09:57:58 -04:00
Andrew Boie
e23102f5dc samples: pi: fix stack overflow
This was silently corrupting memory on x86-64.
Enable CONFIG_TEST so that this is detected properly,
and increase the stack size appropriately.

Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
2020-03-10 09:57:58 -04:00
Lucian Copeland
dcacaf7078 boards: arm: Add board definition for Adafruit Feather STM32F405 Express
Added board definition additions for adafruit_feather_stm32f405 board.

Signed-off-by: Lucian Copeland <hierophect@gmail.com>
2020-03-10 15:41:24 +02:00
Jukka Rissanen
ded0ea62a1 driver: modem: Print sent data if verbose debugging is enabled
User is currently able to enable verbose packet debugging for
received packets. This commit enables the same for sent packets.

Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2020-03-10 15:20:02 +02:00
Nicholas Lowell
17b19eb810 pthread: add setname/getname glibc extensions
Adding the ability to set and get pthread names by defining
some non-standard extension functions that were first
introduced by Glibc.

Similar to zephyr thread naming, these allow for thread
tracking and debugging even when using the more portable
posix API.

Though Glibc was the originator, the current POSIX functions
have return codes based on Oracle's adopted spec, so these
functions follow suit.  The Oracle and Glibc function
prototypes match.

Signed-off-by: Nicholas Lowell <nlowell@lexmark.com>
2020-03-10 15:15:34 +02:00
Francois Ramu
3dfceded48 drivers: watchdog: disable iwdg at boot on stm32
With this patch, the specific flag IWDG_STM32_START_AT_BOOT
is replaced by the zephyr generic WDT_DISABLE_AT_BOOT.

Signed-off-by: Francois Ramu <francois.ramu@st.com>
2020-03-10 15:12:20 +02:00
Jacob Siverskog
09ade0191d doc/reference/runtime_conf: improve example snippet
Improve settings example snippet so that it builds and works as
expected. For usability purposes, add print of stored value.

Signed-off-by: Jacob Siverskog <jacob@teenage.engineering>
2020-03-10 15:11:27 +02:00
Paul Sokolovsky
29493fdf9b modules: mbedtls: Better help for MBEDTLS_BUILTIN vs MBEDTLS_LIBRARY
More clear and detailed description of choices, and explicit
recommendations for users. Based on a question on the mailing list.

Signed-off-by: Paul Sokolovsky <paul.sokolovsky@linaro.org>
2020-03-10 15:10:15 +02:00
Joakim Andersson
564ba1a07b Bluetooth: host: Use switch statement in bt_conn_set_state
Refactor old state handling in bt_conn_set_state to use switch statement
instead of if statements.
This will give us warning about enum values not covered.

Signed-off-by: Joakim Andersson <joakim.andersson@nordicsemi.no>
2020-03-10 15:09:43 +02:00
Joakim Andersson
f19b7a6e69 Bluetooth: host: Fix local RPA not valid in connection complete
Fix connection complete event handling when the local RPA is not valid.
This can happen when the controller was not instructed to use an RPA
address, or the local IRK was set to an all zero IRK.

Signed-off-by: Joakim Andersson <joakim.andersson@nordicsemi.no>
2020-03-10 15:09:31 +02:00
Paul M. Bendixen
0563d8ba53 boards: arm: Nucleo F303RE Added support
Added support for Nucleo-64 board with STM32F303RE chip.
Based on nucleo_f302R8

Signed-off-by: Paul M. Bendixen <paulbendixen@gmail.com>
2020-03-10 15:08:59 +02:00
Paul M. Bendixen
878faa9e5a soc: arm: st_stm32 : Add stm32f303Xe version
Added stm32f303Xe based on the stm32f303Xc Kconfig

Signed-off-by: Paul M. Bendixen <paulbendixen@gmail.com>
2020-03-10 15:08:59 +02:00
Paul M. Bendixen
64ed1a610b dts: arm: stm32f303Xe Added SoC
Added the stm32f303Xe device tree.

Signed-off-by: Paul M. Bendixen <paulbendixen@gmail.com>
2020-03-10 15:08:59 +02:00
Håkon Øye Amundsen
64d8e65f33 DFU: add init function with area id as parameter
This allows flash_img.c to be used outside of mcuboot scope.
Add new call to not break existing code.

Signed-off-by: Håkon Øye Amundsen <haakon.amundsen@nordicsemi.no>
2020-03-10 15:07:27 +02:00
Rubin Gerritsen
9c28569901 bluetooth: controller: Fix incorrect dependency of Coded PHY
In Core v5.2, Vol 6, Part B, Section 4.6.9 it is stated that it is
mandatory to support the PHY procedure if any PHY other than 1M is
supported.

Signed-off-by: Rubin Gerritsen <rubin.gerritsen@nordicsemi.no>
2020-03-10 15:05:51 +02:00
Rubin Gerritsen
213c8e9d53 bluetooth: controller: Allow any controller to config PHY support
For the time being this 2M is only selectable for !nRF51 platforms.
Coded PHY is only selectable for nRF platforms supporting Coded PHY.

Signed-off-by: Rubin Gerritsen <rubin.gerritsen@nordicsemi.no>
2020-03-10 15:05:51 +02:00
Andrzej Puzdrowski
b1edb7a4fc codeowners: add subsys/dfu codeowner
Added dfu support subsystem codeowner
Before this subystem was orphaned.

Signed-off-by: Andrzej Puzdrowski <andrzej.puzdrowski@nordicsemi.no>
2020-03-10 15:04:46 +02:00
Nick Ward
ad7350ed6c samples: shell_module: Add date commands
Add date command to set and display date.

Signed-off-by: Nick Ward <nix.ward@gmail.com>
2020-03-10 15:04:12 +02:00
Nick Ward
c411ed9322 shell: modules: Add date commands to display or set date
Currently only supports Unix time.

‘get’ subcommand returns date in format “Y-m-d H:M:S”
‘set’ subcommand format is ‘[Y-m-d] <H:M:S>’

The ‘set’ subcommand is implemented with basic date validation.

For user convenience of small adjustments to time the time argument
will accept H:M:S, :M:S or ::S where the missing field(s) will be
filled in by the previous time state.

Signed-off-by: Nick Ward <nix.ward@gmail.com>
2020-03-10 15:04:12 +02:00
Paul Sokolovsky
347f6784fb include: posix: time: Make possible to include with CONFIG_ARCH_POSIX
While CONFIG_ARCH_POSIX in general isn't compatible with Zephyr POSIX
subsys (because CONFIG_ARCH_POSIX itself is implemented on top of
POSIX, so there're obvious conflicts), apply workaround to allow to
at least use clock_gettime() and clock_settime() functions.

This change is grounded in upcoming support for date manipulation
commands for Zephyr shell, which are implemented using functions
above. There's no guarantee that CONFIG_ARCH_POSIX and Zephyr POSIX
subsys will coexist for any other usecase. (But the change is
relatively clean and is definitely in the right direction of
prototyping ways of such a coexistance.)

Signed-off-by: Paul Sokolovsky <paul.sokolovsky@linaro.org>
(cherry picked from commit 4a05644bce81f4792c018964d29c1158f1982d1e)
2020-03-10 15:04:12 +02:00
Joakim Andersson
681dfdc12b Bluetooth: HCI_VS: Check for supported command
According to the Zephyr VS HCI specification:
Only Read_Version_Information and Read_Supported_Commands commands are
mandatory.

Check for supported Read Supported Features command before issuing this
command to the controller.

Signed-off-by: Joakim Andersson <joakim.andersson@nordicsemi.no>
2020-03-10 15:02:48 +02:00
Vinayak Kariappa Chettimada
66d1be6728 Bluetooth: controller: nRF51x: Force optimize for speed
Make BT_CTLR_OPTIMIZE_FOR_SPEED option so that it is not
user selectable for nRF51x series SoC with encrypted
connections support.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2020-03-10 15:01:43 +02:00
Vincent Wan
13b10b544b boards: cc26x2r1_launchxl: workaround for xds firmware 3.x
Newer XDS firmware fails to flash correctly with higher adapter clock
speed. Using a slower speed for now to prevent errors.

Fixes #21372

Signed-off-by: Vincent Wan <vincent.wan@linaro.org>
2020-03-10 15:00:44 +02:00