Commit graph

41176 commits

Author SHA1 Message Date
Daniel Leung
8cce5d31ba soc: intel_apl_adsp: select CONFIG_ATOMIC_OPERATIONS_BUILTIN
The GCC 9.2 toolchain for intel_apl_adsp has builtin atomic
functions already so we can use that instead of the custom
one in arch. This allows the atomic function calls to be
inlined.

Signed-off-by: Daniel Leung <daniel.leung@intel.com>
2020-03-25 19:07:28 -04:00
Daniel Leung
0ba204083d soc: intel_s1000: add SMP support
This adds SMP support for Intel S1000 SoC.

Some of the start-up code is borrowed from ESP32.

Signed-off-by: Daniel Leung <daniel.leung@intel.com>
2020-03-25 19:07:28 -04:00
Daniel Leung
492e890cd6 ipm: add driver for the CAVS DSP Intra-DSP Communication (IDC)
This adds a rather primitive driver for use with the Intra-DSP
Communication (IDC) on the DSP on certain Intel SoCs. The IDC
generates interrupts from one core to another by writing to
certain registers. This is also being utilized as
the scheduler IPI since it can interrupt other cores.

Signed-off-by: Daniel Leung <daniel.leung@intel.com>
2020-03-25 19:07:28 -04:00
Daniel Leung
eb7b0884ea dts: ipm: add binding for intel,cavs-idc
This adds the DTS binding for the CAVS Intra-DSP Communication (IDC)
driver for the DSP on Intel SoC.

Signed-off-by: Daniel Leung <daniel.leung@intel.com>
2020-03-25 19:07:28 -04:00
Daniel Leung
4e1637b54e kernel: add sys init level for SMP
This adds a sys init level which allows device and sys_init
to be done after SMP initialization, z_smp_init(), when all
cores are up and running.

Signed-off-by: Daniel Leung <daniel.leung@intel.com>
2020-03-25 19:07:28 -04:00
Daniel Leung
5539c3ed90 xtensa: add calling entry point for multi-processing
Under multi-processing, only the first CPU#0 needs to go through
setting up the kernel structs and clearing out BSS (among others).
There is no need for other CPUs to do those tasks. Since each
Xtensa core starts using the same boot vector, CPUs other than #0
need to skip all the startup tasks by not calling to z_cstart().
So provide another entry point for those CPUs. Note that Xtensa
arch is highly configurable. So the implementation of the entry
point is up to each individual SoC config.

Signed-off-by: Daniel Leung <daniel.leung@intel.com>
2020-03-25 19:07:28 -04:00
Daniel Leung
ad2ee13c27 soc: intel_s1000: use EXCSAVE7 for CPU pointer
EXCSAVE2 is used for level 2 exception save location.
Since we are using level 2 interrupts, use EXCSAVE7
instead as level 7 interrupts are not being used
by the SoC.

Signed-off-by: Daniel Leung <daniel.leung@intel.com>
2020-03-25 19:07:28 -04:00
Daniel Leung
3751c396cd soc: intel_s1000: use CAVS DSP wall clock timer for SMP
The DSP wall clock timer is a timer driven directly by
external oscillator and is external to the CPU core(s).
It provides a common and synchronized counter for all
CPU cores (which is useful for SMP), instead of
indepedently running local core timer (xtensa_timer).

Signed-off-by: Daniel Leung <daniel.leung@intel.com>
2020-03-25 19:07:28 -04:00
Daniel Leung
6d49e7c692 timer: add CAVS DSP wall clock timer for Intel SoC
The DSP wall clock timer on some Intel SoC is a timer driven
directly by external oscillator and is external to the CPU
core(s). It is not as fast as the internal core clock, but
provides a common and synchronized counter for all CPU cores
(which is useful for SMP).

This uses the RISCV timer as base as it is using 64-bit
counter.

Signed-off-by: Daniel Leung <daniel.leung@intel.com>
2020-03-25 19:07:28 -04:00
Daniel Leung
e6d468ac22 interrupt_controller: cavs: add support in ISR for SMP
The CAVS interrupt controller has different base addresses for
each CPU. When running under SMP, the driver needs to look at
the correct address for the CPU the ISR is running so interrupts
can be dispatched correctly. This adds a function to calculate
the correct base address. Note that each supported SoC may have
different offsets so per SoC config will need to added. Support
for intel_s1000 is added as an example.

Signed-off-by: Daniel Leung <daniel.leung@intel.com>
2020-03-25 19:07:28 -04:00
Daniel Leung
b4a7eed82e interrupt_controller/dw_ictl: need to be initialized earlier
The dw_ictl interrupt controller is an interrupt aggregator
supporting multi-level interrupts. Therefore, it needs to be
initialized earlier than any downstream interrupt controllers
and devices.

Signed-off-by: Daniel Leung <daniel.leung@intel.com>
2020-03-25 19:07:28 -04:00
Daniel Leung
518f329b3a interrupt_controller/cavs_ictl: need to be initialized earlier
The cavs_ictl interrupt controller is an interrupt aggregator
supporting multi-level interrupts. Therefore, it needs to be
initialized earlier than any downstream interrupt controllers
and devices.

Signed-off-by: Daniel Leung <daniel.leung@intel.com>
2020-03-25 19:07:28 -04:00
Daniel Leung
e8d2c92abb arch/xtensa: smp: only zero BSS only when boot from CPU #0
Under SMP, the main BSS section only needs to be zero-ed on CPU #0.
Other CPUs should not zero out BSS, or else it may cause CPU #0 to
crash on invalid data.

Signed-off-by: Daniel Leung <daniel.leung@intel.com>
2020-03-25 19:07:28 -04:00
Vincent Wan
fc8d66c119 boards: arm: add doc on power management and uart for cc13xx/cc26xx
Adding documentation to inform users that characters may be lost if
polling is used and a character arrives while the system is in standby
mode.

Signed-off-by: Vincent Wan <vincent.wan@linaro.org>
2020-03-25 16:21:33 -04:00
Vincent Wan
61625366c9 power: policy: only bring devices to low-power when in sleep mode 2
Sleep mode 1 is supposed to be a low-latency sleep mode where devices
are left in active mode. Thus we should only bring devices to low-power
when in sleep mode 2 in sys_pm_policy_low_power_devices().

Signed-off-by: Vincent Wan <vincent.wan@linaro.org>
2020-03-25 16:21:33 -04:00
Vincent Wan
c806947d87 drivers: i2c: cc13xx_cc26xx: reset pin type when entering low power mode
It was observed that leaving the pin type configured for i2c for SDA
and SCL results in higher power consumption during standby. So we are
resetting the pin type when bringing the i2c into low power mode, and
setting it back to the correct type when exiting low power mode.

Signed-off-by: Vincent Wan <vincent.wan@linaro.org>
2020-03-25 16:21:33 -04:00
Vincent Wan
f23940c678 drivers: i2c: cc13xx_cc26xx: add power management support
Add a dependency on the I2C resource in the TI Power module,
reconfigure the peripheral upon CPU exiting standby, and add
support for device PM.

Signed-off-by: Vincent Wan <vincent.wan@linaro.org>
2020-03-25 16:21:33 -04:00
Vincent Wan
ddfb1b5ec7 drivers: spi: cc13xx_cc26xx: add power management support
Add a dependency on the SSI resource in the TI Power module, and add
support for device PM.

Signed-off-by: Vincent Wan <vincent.wan@linaro.org>
2020-03-25 16:21:33 -04:00
Vincent Wan
41cc9b2c2a power: device: add core device list for cc13xx/cc26xx
Update the core device list to support device power management.

Signed-off-by: Vincent Wan <vincent.wan@linaro.org>
2020-03-25 16:21:33 -04:00
Vincent Wan
e21bb3a812 drivers: serial: cc13xx_cc26xx: add power management support
Add a dependency on the UART resource in the TI Power module,
reconfigure the UART upon CPU exiting standby, and add support
for device PM.

Signed-off-by: Vincent Wan <vincent.wan@linaro.org>
2020-03-25 16:21:33 -04:00
Vincent Wan
d2cf6c4a74 drivers: gpio: cc13xx_cc26xx: add power management support
Adding a dependency on the GPIO resource in the TI Power module, and
configuring the edge detection on pads as a wakeup source.

Signed-off-by: Vincent Wan <vincent.wan@linaro.org>
2020-03-25 16:21:33 -04:00
Vincent Wan
b591bc0b94 soc: cc13x2_cc26x2: set SYS_PM_STATE_LOCK when power management is enabled
When power management is enabled, SYS_PM_STATE_LOCK is necessary
in order to prevent the power policy from automatically entering
certain sleep states.

Signed-off-by: Vincent Wan <vincent.wan@linaro.org>
2020-03-25 16:21:33 -04:00
Mikkel Jakobsen
8bbca5aa5d editorconfig: add yaml file extension variant
This commit adds *.yaml files to the yaml editorconfig section.

Signed-off-by: Mikkel Jakobsen <mikkel.aunsbjerg@prevas.dk>
2020-03-25 16:16:01 -04:00
Ioannis Glaropoulos
d415680197 CODEOWNERS: Auto-assign @stephanosio in tests/arch/arm suite reviews
Add @stephanosio as a code-owner for the tests/arch/arm
test suites, so they get auto-assigned in reviews.

Signed-off-by: Ioannis Glaropoulos <Ioannis.Glaropoulos@nordicsemi.no>
2020-03-25 16:15:24 -04:00
Ioannis Glaropoulos
ac6b4a00a9 tests: arch: arm: arm_interrupt: remove side effect in assertion
Remove a side effect in an assertion check of the
expected reason after spurious interrupt handling.

Signed-off-by: Ioannis Glaropoulos <Ioannis.Glaropoulos@nordicsemi.no>
2020-03-25 16:15:24 -04:00
Christian Hirsch
6380c24626 drivers: sensor: BME280: add forced sampling mode
add the forced sampling mode, to take just a single
measurement when fatching a sample

Signed-off-by: Christian Hirsch <christian.hirsch@tuwien.ac.at>
2020-03-25 14:52:07 -05:00
Sebastian Bøe
a8e90cbfb3 cmake: Fix shield bug when BOARD_ROOT is a list
Fix bug where SHIELDS would be marked as "not found" in the
NOT_FOUND_SHIELD_LIST when they were present, just not in the first
BOARD root in the BOARD_ROOT list.

Instead of marking shields in the NOT_FOUND_SHIELD_LIST, we (continue)
popping shields from SHIELD and check if there are any shields left in
SHIELD.

Signed-off-by: Sebastian Bøe <sebastian.boe@nordicsemi.no>
2020-03-25 20:23:09 +01:00
Martí Bolívar
0206feb6bc doc: west: add pointer to board porting guide for flash/debug
The board porting guide now has useful information on supporting
flash/debug commands. Link to it from the top of the page describing
these commands to hopefully make it easier to find.

Signed-off-by: Martí Bolívar <marti.bolivar@nordicsemi.no>
2020-03-25 19:43:30 +01:00
Martí Bolívar
a5268773a6 scripts: run_common: don't dump stack on unavailable runner
Originally reported in #23539 (though that seems to have been another
problem), west flash and friends are dumping stack when used with an
unconfigured runner.

Let's just promote the warning about this to an error. The idea that
this ever could have worked without explicit support has not worked
out in practice, to my knowledge.

Signed-off-by: Martí Bolívar <marti.bolivar@nordicsemi.no>
2020-03-25 19:43:30 +01:00
Andrew Boie
a4c9190649 kernel: fix oops policy for k_thread_abort()
Don't generate a Z_OOPS() if k_thread_abort() is called on a
thread that isn't running. Just return to the caller instead,
much like how k_thread_join() functions.

Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
2020-03-25 10:23:12 -07:00
Flavio Ceolin
81d96d6e9b drivers: counter: Fix get_value verification handler
z_vrfy_counter_get_value should check the size of memory pointed to
ticks and not the size of the pointer.

Fixes: #22431
Coverity CID :207984

Signed-off-by: Flavio Ceolin <flavio.ceolin@intel.com>
2020-03-25 16:25:45 +01:00
Flavio Ceolin
a7b327310d samples: fxos8700-hid: Fix possible underflow
gpio_pin_get() returns a negative value in case of error and
callbacks_configure was assigning this value to an unsigned variable.

Fixes: #22643
Coverity CID :208206

Signed-off-by: Flavio Ceolin <flavio.ceolin@intel.com>
2020-03-25 16:25:45 +01:00
Måns Ansgariusson
2f323e65b2 lib: cmsis_rtos: Fix Periodic timer
This commit changes the behaviour of the CMSIS-RTOS periodic timers to
have an initial timeout equal to the periodic timeout instead of
executing the callback function directly when calling the
osTimerStart(...); function.

This behavioural change is according to the CMSIS-RTOS specification.

Signed-off-by: Måns Ansgariusson <Mans.Ansgariusson@AssaAbloy.com>
2020-03-25 09:37:59 -04:00
Kumar Gala
9ede3c9a97 drivers: serial: uart_pl011: remove shared irq support
The shared irq support isn't needed in this driver.  We just need to
deal with the fact that some SoCs have only a single interrupt line and
some have three interrupts.  We can just ifdef that based on
DT_NUM_IRQS.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2020-03-25 08:34:40 -05:00
Krzysztof Chruscinski
f0548f100e shell: Replace __attribute__((unused)) with __unused
Replaced gcc specific with generic.

Signed-off-by: Krzysztof Chruscinski <krzysztof.chruscinski@nordicsemi.no>
2020-03-25 09:34:21 -04:00
Krzysztof Chruscinski
2885da209b logging: Replace __attribute__((unused)) with __unused
Replaced gcc specific with generic.

Signed-off-by: Krzysztof Chruscinski <krzysztof.chruscinski@nordicsemi.no>
2020-03-25 09:34:21 -04:00
Jukka Rissanen
b50dabb9fd drivers: eth: enc28j60: Add VLAN support
Add Virtual LAN support to enc28j60 Ethernet driver.

Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2020-03-25 15:06:38 +02:00
Martí Bolívar
1edc84f526 sys/util.h: add UTIL_OR and UTIL_AND
These are short-circuiting utility helpers that can save typing
in situations where avoiding evaluation of the not-taken branch
skips invalid expressions.

Signed-off-by: Martí Bolívar <marti.bolivar@nordicsemi.no>
2020-03-25 13:21:28 +01:00
Martí Bolívar
3c7a939743 tests: add util.h MACRO_MAP_CAT test
This wasn't tested when it was first added.

Signed-off-by: Martí Bolívar <marti.bolivar@nordicsemi.no>
2020-03-25 13:21:28 +01:00
Robert Lubos
bd8410cf3c net: openthread: Fix builds with NCP option disabled
In case OPENTHREAD_NCP option is disabled, uart.c platform driver should
not be compiled as it misses dependencies.

Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
2020-03-25 12:16:32 +02:00
Robert Lubos
adc5e42b75 west.yml: Update OpenThread revision
Introduce an update in the mbedTLS configuration, which is needed after
the OpenThread update. The default mbedTLS CMake configuration was
changed upstream, which resulted in broken cryptography in Zephyr.

Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
2020-03-25 12:16:32 +02:00
Giancarlo Stasi
2f3c3a65fd soc: arm: st_stm32: add support for STM32L462xE
Add support for the STM32L462xE SoC (AES not yet supported).

Signed-off-by: Giancarlo Stasi <giancarlo.stasi.co@gmail.com>
2020-03-25 09:38:30 +01:00
Tomasz Bursztyka
e68cec3614 soc: stm32: Add flash dts fixup for stm32f4
This was a simple missing macro, that prevented flash_shell to build
for stm32f4 based boards (which is weird, CI should have caught that
much earlier)

Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2020-03-25 03:25:54 -05:00
Patrik Flykt
c99392f2d6 scripts: net: Add TLS test for mqtt_publisher
In addition to the existing plain TCP MQTT test, add the same test
with TLS applied. Robert Lubos provided the updated test_cert.h, which
contains the same certificate as in the echo samples.

Signed-off-by: Patrik Flykt <patrik.flykt@intel.com>
2020-03-25 08:39:39 +02:00
Patrik Flykt
5b3d329a58 west: Require net-tools version with MQTT TLS support
Add dependency on newer version of net-tools.

Signed-off-by: Patrik Flykt <patrik.flykt@intel.com>
2020-03-25 08:39:39 +02:00
Markus Becker
5becb2cc27 net: openthread: Use updated OpenThread module
The relevant upstream changes in OpenThread for NCP support have
been integrated in
https://github.com/zephyrproject-rtos/openthread/pull/6.

Signed-off-by: Markus Becker <markus.becker@tridonic.com>
2020-03-25 08:37:16 +02:00
Markus Becker
63e592f8f6 net: openthread: Add NCP sample
OpenThread NCP sample application.

Tested on FRDM-K64 with RF2XX connected via USB to a Linux machine
running wpantund.

Signed-off-by: Markus Becker <markus.becker@tridonic.com>
2020-03-25 08:37:16 +02:00
Markus Becker
0651141d84 net: openthread: Add NCP start-up and required platform changes
When NCP starts-up some of the initialisation functions of a regular
OpenThread device do not need to be called, because they get triggered
by wpantund via UART. Instead NCP initialisation needs to be called.

A small typo has been fixed as well.

Also initialisation for raw link packet interface has been added. Can be
used for picking up 802.15.4 frames and interpreting them in the
application.

Signed-off-by: Markus Becker <markus.becker@tridonic.com>
2020-03-25 08:37:16 +02:00
Markus Becker
71ce94e0ed net: openthread: Add UART platform backend for NCP
Currently based on CDC-ACM. Can possibly be used with plain UART as
well.

Signed-off-by: Markus Becker <markus.becker@tridonic.com>
2020-03-25 08:37:16 +02:00
Markus Becker
653a15d138 net: openthread: Remove log_strdup warnings for OpenThread
Log messages from the OpenThread logging system were not log_strdup()

Signed-off-by: Markus Becker <markus.becker@tridonic.com>
2020-03-25 08:37:16 +02:00