Commit graph

43582 commits

Author SHA1 Message Date
Simon Glass 302d671ea2 emul: Create an emulation implementation
Create a header file and implementation for emulators. Set up a linker
list so that emulators can be found and initialised at start-up.

Emulators are used to emulate hardware devices, to support testing of
various subsystems. For example, it is possible to write an emulator
for an I2C compass such that it appears on the I2C bus and can be used
just like a real hardware device.

Emulators often implement special features for testing. For example a
compass may support returning bogus data if the I2C bus speed is too
high, or may return invalid measurements if calibration has not yet
been completed. This allows for testing that high-level code can
handle these situations correctly. Test coverage can therefore
approach 100% if all failure conditions are emulated.

Signed-off-by: Peter Bigot <peter.bigot@nordicsemi.no>
Signed-off-by: Simon Glass <sjg@chromium.org>
2020-09-01 14:30:46 -04:00
Erwin Rol dce9580490 drivers: i2c_ll_stm32_v1: Reset i2c device on read/write error
Reset the i2c device when read or write return with an error
code. This is to bring the i2c hardware back into a known
state after a hardware error (like EMC spikes) caused
the device to lock up.

Signed-off-by: Erwin Rol <erwin@erwinrol.com>
2020-09-01 09:21:44 -05:00
Joakim Andersson 9ac8dcf5a7 Bluetooth: Call bt_recv from priority higher that TX thread.
A build assert in dummy.c lists the following requirement:
[...] receive thread priority shall be higher than the Bluetooth
Host's Tx and the Controller's receive thread priority.
This is required in order to dispatch Number of Completed Packets
event before any new data arrives on a connection to the Host threads.

The drivers uses a priority that is equal to the Host TX thread,
and since they don't use the CONFIG define that is only available
to the controller then this BUILD_ASSERT will not catch the
requirement.

Signed-off-by: Joakim Andersson <joakim.andersson@nordicsemi.no>
2020-09-01 15:15:36 +03:00
Spoorthy Priya Yerabolu 9247e8bc44 code-guideline: Tag name should be a unique identifier
Following are the changes to variable names that are matching
with tag names (Rule 5.7 violations)

In kernel.h, event_type is matching with a tag name in
lib/os/onoff.c. Added a _ prefix to event_type and
also to the macro argument names.

In userspace.c, *dyn_obj is matching with the tag name
dyn_obj in the file itslef. Changed it to dyn

In device.h, device_mmio.h, init.h and init.c,
changed the *device to dev. Except for one change in
init.h

Signed-off-by: Spoorthy Priya Yerabolu <spoorthy.priya.yerabolu@intel.com>
2020-09-01 08:03:23 -04:00
Krzysztof Chruscinski c2122313c3 samples: bluetooth: hci_uart: Improve TX path
Improved TX path to use uart_fifo_fill instead of uart_poll_out

Signed-off-by: Krzysztof Chruscinski <krzysztof.chruscinski@nordicsemi.no>
2020-09-01 13:57:27 +02:00
Trond Einar Snekvik 18ace841d8 Bluetooth: Mesh: Config client net_key_del
Adds a Config Client API for deleting netkeys on the target node, with
matching shell command.

Signed-off-by: Trond Einar Snekvik <Trond.Einar.Snekvik@nordicsemi.no>
2020-09-01 14:49:20 +03:00
Eugeniy Paltsev 7547b44441 ARC: use generic bitops implementation
There is no need in custom, partially ASM bitops implementation
for ARC, we can use generic one.

Signed-off-by: Eugeniy Paltsev <Eugeniy.Paltsev@synopsys.com>
2020-09-01 13:36:48 +02:00
Eugeniy Paltsev 874d9426b3 ARM: aarch64: use generic bitops implementation
aarch64 has bitops implementation fully identical to generic one.
So drop redundant code.

Signed-off-by: Eugeniy Paltsev <Eugeniy.Paltsev@synopsys.com>
2020-09-01 13:36:48 +02:00
Eugeniy Paltsev c45fd74ab4 ARM: aarch32: cortex_a_r: use generic bitops implementation
aarch32/cortex_a_r has bitops implementation fully
identical to generic one. So drop redundant code.

Signed-off-by: Eugeniy Paltsev <Eugeniy.Paltsev@synopsys.com>
2020-09-01 13:36:48 +02:00
Eugeniy Paltsev ebe51e26cb ARCH: COMMON: split sys_io.h for MMIO & memory bits functions
As of today 'include/arch/common/sys_io.h" has generic implementation
for MMIO accessors and memory bits manipulation functions. That leads
to several architectures like ARC, ARM/aarch64, ARM/aarch32/corter_a_r
redefine entire 'common/sys_io.h' even if they only have different
MMIO accessors implementation.

So split 'include/arch/common/sys_io.h" to
 * sys_io.h - generic MMIO accessors
 * sys_bitops.h - generic memory bits manipulation functions

Signed-off-by: Eugeniy Paltsev <Eugeniy.Paltsev@synopsys.com>
2020-09-01 13:36:48 +02:00
Alexandre Bourdiol cb12440322 boards: arm: stm32f3_disco: enable PWM
Tested with tests/drivers/pwm/pwm_api/
(requires https://github.com/zephyrproject-rtos/zephyr/pull/27204)
and with oscillo.

Signed-off-by: Alexandre Bourdiol <alexandre.bourdiol@st.com>
2020-09-01 13:35:55 +02:00
Alexandre Bourdiol 8098ecbc02 boards: arm: nucleo_g071rb enable PWM
Tested with tests/drivers/pwm/pwm_api/
(requires https://github.com/zephyrproject-rtos/zephyr/pull/27204)
and with oscillo.

Signed-off-by: Alexandre Bourdiol <alexandre.bourdiol@st.com>
2020-09-01 13:35:48 +02:00
Mulin Chao b3188f1c32 drivers: npcx: replace type of register base address with uintptr_t
Replace npcx register base address type, uint32_t, with uintptr_t.
It is easier to know what type of base address and for linear
addresses treated as integral values.

This CL also modified IS_BIT_SET() macro function to fit MISRA code
guidelines.

Signed-off-by: Mulin Chao <MLChao@nuvoton.com>
2020-09-01 13:35:25 +02:00
Mulin Chao 1eca7ab46a drivers: npcx: remove suffix '_t' of device register structure.
Remove the '_t' suffix of device register structure since it is used
mainly with typedefs.

Signed-off-by: Mulin Chao <MLChao@nuvoton.com>
2020-09-01 13:35:25 +02:00
Mulin Chao fb1c2b58ac tests: kernel: gen_isr_table: Add workaround for npcx7m6fb soc.
In NPCX7M6FB, it uses some the IRQs at the end of the vector table,
for example, the irq 60 and 61 used for Multi-Input Wake-Up Unit (MIWU)
device by default, and conflicts with isr used for testing. Moving IRQs
for this test suite to solve the issue.

Signed-off-by: Mulin Chao <MLChao@nuvoton.com>
2020-09-01 13:35:25 +02:00
Mulin Chao 288e35ab1a driver: uart: add wake-up support for uart device.
This CL configures the UART wake-up event triggered from a falling edge
(START condition) on CR_SIN pin. It also includes:

1. Introduce wui_maps property in yaml file to present relationship
   between Wake-Up Input (WUI) and UART device.
2. Implement wake-up mechanism by MIWU api functions.

Signed-off-by: Mulin Chao <MLChao@nuvoton.com>
2020-09-01 13:35:25 +02:00
Mulin Chao 6deb68a517 driver: gpio: add gpio driver support in NPCX series
Add gpio support for Nuvoton NPCX series. This CL includes:

1. Add GPIO device tree declarations.
2. Introduce wui_maps property in yaml file to present relationship
   between Wake-Up
   Input (WUI) and 8 IOs belong to the device.
3. Zephyr GPIO api implementation.
4. GPIO callback functions implementation with MIWU api functions.
5. Overlay file for gpio basic tests

Signed-off-by: Mulin Chao <MLChao@nuvoton.com>
2020-09-01 13:35:25 +02:00
Mulin Chao 84d90e456a driver: intc: add MIWU driver support in NPCX series.
The device Multi-Input Wake-Up Unit (MIWU) supports the embedded
controller (EC) to exit 'Sleep' or 'Deep Sleep' power state which allows
chip has better power consumption. Also, it provides signal conditioning
such as 'Level' and 'Edge' trigger type and grouping of external
interrupt sources of NVIC. The NPCX series has three identical MIWU
modules: MIWU0, MIWU1, MIWU2. Together, they support a total of over 140
internal and/or external wake-up sources.

In this CL, we use device tree files to present the relationship bewteen
MIWU and the other devices in different npcx series. For npcx7 series,
it include:
1. npcx7-miwus-int-map.dtsi: it presents relationship between MIWU group
   and NVIC interrupt in npcx7. Please notice it isn't 1-to-1 mapping.
2. npcx7-miwus-wui-map.dtsi: it presents relationship between input of
   MIWU and its source device such as gpio, timer, eSPI VWs and so on.

This CL also includes:
1. Add MIWU device tree declarations.
2. MIWU api function declarations and implementation to configure signal
   conditions and callback function mechanism. They can be be classified
   into two types. One is for GPIO which connects original gpio callback
   implemetation and the other is for generic devices such as timer,
   eSPI, and so on.

Signed-off-by: Mulin Chao <MLChao@nuvoton.com>
2020-09-01 13:35:25 +02:00
Emil Gydesen 9bf50ddb20 Bluetooth: Gatt: Added write callback for gatt (un)subscribe
Added a callback that lets an application get write error
(if any) when subscribing to a gatt characteristic.

Signed-off-by: Emil Gydesen <emil_gydesen@bose.com>
2020-09-01 13:34:25 +02:00
Christian Taedcke d026b5dd34 logging: net: Make autostart of backend configurable
In certain application configuration the networking log backend must not
be started, when the application starts. Starting it must be delayed
until routes to the logging server are established.

This commit introduces a new Kconfig setting to be able to control that
behaviour.

Fixes #27464

Signed-off-by: Christian Taedcke <christian.taedcke@lemonbeat.com>
2020-09-01 13:34:13 +02:00
Martí Bolívar f66a0c3772 build: auto-generate signed mcuboot binaries
Add new Kconfig options which depend on CONFIG_BOOTLOADER_MCUBOOT:

- CONFIG_MCUBOOT_SIGNATURE_KEY_FILE: the path to the key pair which
  should be used to sign the image, in PEM format. This is sent to
  imgtool via 'west sign' when set to produce zephyr.signed.bin and
  zephyr.signed.hex files as needed.

- CONFIG_MCUBOOT_EXTRA_IMGTOOL_ARGS: additional arguments to pass to
  imgtool.

- CONFIG_MCUBOOT_GENERATE_CONFIRMED_IMAGE: also generate
  zephyr.signed.confirmed.{bin,hex}

Add build system support for these options.

This makes a separate 'west sign' step unnecessary when using MCUboot,
if the application image is properly configured with the location of
the key file.

Signed-off-by: Martí Bolívar <marti.bolivar@nordicsemi.no>
2020-09-01 13:33:46 +02:00
Martí Bolívar 9b6736748d scripts: west sign: add --quiet option
This suppresses stdout on normal runs.

Signed-off-by: Martí Bolívar <marti.bolivar@nordicsemi.no>
2020-09-01 13:33:46 +02:00
Martí Bolívar a0382cb925 cmake: add IMGTOOL optional dependency
This will be used in subsequent patches to integrate imgtool into the
build when the user has set CONFIG_BOOTLOADER_MCUBOOT=y.

Signed-off-by: Martí Bolívar <marti.bolivar@nordicsemi.no>
2020-09-01 13:33:46 +02:00
Martí Bolívar c32e90d2a5 build: update stale comment in boilerplate.cmake
The zephyr_property_target use cases have grown.

Signed-off-by: Martí Bolívar <marti.bolivar@nordicsemi.no>
2020-09-01 13:33:46 +02:00
Martí Bolívar 79b1f89f7d cmake: west detection fixes and improvements
Starting with west 0.8, we will have a stable way to run west as a
python module. In west 0.7, we have an undocumented way.

Handle these two cases to override the WEST variable used by the build
system to run west inside the same python interpreter as the rest of
the build system. This makes it intuitive to shell out to west from
elsewhere in the build, without making people reimplement existing
commands in the west API when it is not necessary.

Do so for the 'west topdir' invocation in west.cmake as an example.

The check that looks for whether PYTHON_EXECUTABLE and WEST_PYTHON
match is also not working properly when symbolic links are in use.
Fix it by using REALPATH instead of ABSOLUTE in the
get_filename_component() calls.

Finally, print the error on a failed import that we expect to work.

Signed-off-by: Martí Bolívar <marti.bolivar@nordicsemi.no>
2020-09-01 13:33:46 +02:00
David Leach f62fef5ae5 west: hal_nxp: Fix USB_DEVICE_CONFIG_ENDPOINTS definition
The define for USB_DEVICE_CONFIG_ENDPOINTS erroneously divided
the DTS value for number of USB endpoints by 2.

Signed-off-by: David Leach <david.leach@nxp.com>
2020-09-01 13:32:11 +02:00
Alexandre Bourdiol a6ad4ec95d drivers: entropy: stm32 full driver rework with software fifo
mimic nrf driver as suggested #27825

Signed-off-by: Alexandre Bourdiol <alexandre.bourdiol@st.com>
2020-09-01 13:31:38 +02:00
Alexandre Bourdiol e141b77ca0 dts: arm: st: add interrupts property to rng node
Need to add interrupts property for stm32 rng rework

Signed-off-by: Alexandre Bourdiol <alexandre.bourdiol@st.com>
2020-09-01 13:31:38 +02:00
Dominik Ermel 88deb80718 mgmt: smp: Fix shell sending SMP response to wrong UART
The commit fixes the problem where the SMP over shell responses have
been sent with use of k_str_out(), which is configured to use console
UART directly.  This caused problem when user decided to attach
shell to a different UART then the one that has been used by
the console driver, because the SMP responses would still be sent
to the console UART rather than the shell UART.

The updated code uses, for shell SMP responses, the UART that has been
selected for the shell.

Fixes #26939

Signed-off-by: Dominik Ermel <dominik.ermel@nordicsemi.no>
2020-09-01 13:30:41 +02:00
Ismael Fillonneau fc8f639b9a shields: Modify overlay file order
Shield overlay file has to be taken into account after board overlay
file.
ex: When a new node need to be created for a specific board (in
boards/shields/shield_name/boards/board_name/*.overlay) and used by the
shield (in boards/shields/*.overlay), the order of the overlay files is
important

Signed-off-by: Ismael Fillonneau <ismael.fillonneau@stimio.fr>
2020-09-01 13:30:06 +02:00
Pavel Král 0778a6aaf3 usb: Configurable transfer buffers
This patch removes the hard-coded number of transfer buffers and allows
you to increase the number of transfer buffers when multiple USB
devices are used.

Signed-off-by: Pavel Král <pavel.kral@omsquare.com>
2020-09-01 13:29:47 +02:00
Torsten Rasmussen 2fa48f79d1 cmake: warn user if CPPFLAGS is set as environment setting
Zephyr doesn't use CFLAGS, CXXFLAGS, and CPPFLAGS if they are defined
in environment.

In case user defines CFLAGS or CXXFLAGS in environment, then a warning
message is printed, however CPPFLAGS does not raise a warning.

CPPFLAGS is updated to follow the principle of CFLAGS and CXXFLAGS.

Signed-off-by: Torsten Rasmussen <Torsten.Rasmussen@nordicsemi.no>
2020-09-01 13:29:24 +02:00
Joakim Andersson becd9cadfe Bluetooth: host: Fix option USE_IDENTITY for bt_le_ext_adv_* API
Fix option USE_IDENTITY for bt_le_ext_adv_* API.
The random static identity address that was set in bt_le_ext_adv_create
was overwritten in bt_le_ext_adv_start in the call to
le_adv_set_private_addr.

Signed-off-by: Joakim Andersson <joakim.andersson@nordicsemi.no>
2020-09-01 13:28:56 +02:00
Joakim Andersson 213dbf3ed7 Bluetooth: GATT: Remove wrong documentation for GATT write callback
Remove paragraph in documentation of GATT write callback which is
clearly wrong and was meant for the read callback.

Signed-off-by: Joakim Andersson <joakim.andersson@nordicsemi.no>
2020-09-01 09:33:12 +02:00
Henrik Brix Andersen d92b199173 doc: update list of architectures in introduction
List ARMv6-M (Cortex-M) as a supported architecture.

Signed-off-by: Henrik Brix Andersen <hebad@vestas.com>
2020-08-31 17:37:25 -04:00
Peter Bigot 9024669a67 testsuite: fix unittest cross-language flags
Unit tests may include C++ code, so ensure the compiler flags are
consistent to avoid link errors.

Signed-off-by: Peter Bigot <peter.bigot@nordicsemi.no>
2020-08-31 11:02:35 -04:00
Fabio Utzig c2b567f79e doc: update known issues for Sphinx>=3.2.0
Remove old known issues files and update with issues that still need to
be fixed in Sphinx>=3.2.0 and or Doxygen, including anonymous
union/struct parsing and duplicated symbols (eg struct and functions
having the same name).

Signed-off-by: Fabio Utzig <fabio.utzig@nordicsemi.no>
2020-08-31 09:57:33 -04:00
Fabio Utzig 92431e2bae doc: fix :c:macro: usage
Remove parameters in :c:macro: usage because it's invalid syntax.

Signed-off-by: Fabio Utzig <fabio.utzig@nordicsemi.no>
2020-08-31 09:57:33 -04:00
Fabio Utzig e73d3c82d8 doc: update :cpp:var: to :c:member:
Update references to struct members to use :c:member:

Signed-off-by: Fabio Utzig <fabio.utzig@nordicsemi.no>
2020-08-31 09:57:33 -04:00
Fabio Utzig 4c2f0605da doc: fix invalid usage of function to :c:macro:
Some macros were using :c:func: and :cpp:func: which forbids Breathe
from resolving those symbols. Update to :c:macro: for proper resolution.

Signed-off-by: Fabio Utzig <fabio.utzig@nordicsemi.no>
2020-08-31 09:57:33 -04:00
Fabio Utzig 43133c96f4 doc: update union reference to to :c:union
Update union reference from generic :c:type: to :c:union:.

Signed-off-by: Fabio Utzig <fabio.utzig@nordicsemi.no>
2020-08-31 09:57:33 -04:00
Fabio Utzig ce12936ce1 doc: update enumerator usage to :c:enumerator:
Following the change to use the C domain for parsing, update all
existing :cpp:enumerator: references to :c:enumerator:.

Signed-off-by: Fabio Utzig <fabio.utzig@nordicsemi.no>
2020-08-31 09:57:33 -04:00
Fabio Utzig bb93b337f9 doc: update enum usage to use :c:enum:
Update enum reference usage to use C domain.

Signed-off-by: Fabio Utzig <fabio.utzig@nordicsemi.no>
2020-08-31 09:57:33 -04:00
Fabio Utzig 1622b3e66b doc: do not use :c:macro: for NULL
`NULL` is not defined in the Zephyr sources, but rather a C definition
which is not resolved when building the documentation and generates a
warning. Fall back to using just emphasis.

Signed-off-by: Fabio Utzig <fabio.utzig@nordicsemi.no>
2020-08-31 09:57:33 -04:00
Fabio Utzig f635217f35 doc: add :c:macro to some symbols
Fix some C macros that are currently just emphasized in the
documentation with proper symbol resulition using :c:macro:

Signed-off-by: Fabio Utzig <fabio.utzig@nordicsemi.no>
2020-08-31 09:57:33 -04:00
Fabio Utzig c79d2ce794 doc: update struct references to use :c:struct:
Sphinx>=3.0 includes the `struct` role in the C domain, which provides a
specific way to link to structs, while the old :c:type: role should be
primary used to typedefs. Update existing references, using :c:type:,
:cpp:type: or emphasized symbols that point to structs to use the new
role.

Signed-off-by: Fabio Utzig <fabio.utzig@nordicsemi.no>
2020-08-31 09:57:33 -04:00
Fabio Utzig 53fd5ff236 doc: update function references to use :c:func:
Following the change to use the C domain for parsing, update all
existing :cpp:func: references to :c:func:. Remove the parentheses as
well, if used, because they are not needed, this is already known to be
a function, and how it is displayed in the documentation later is a
semantic decision done by the output builder.

Signed-off-by: Fabio Utzig <fabio.utzig@nordicsemi.no>
2020-08-31 09:57:33 -04:00
Fabio Utzig a56446051e doc: add __subsystem attribute and c attributes
Add __subsystem to list of attributes for the parser, and make the c
parser accept the same attributes than the cpp parser, after the change
to use the c parser for ".c" files.

Signed-off-by: Fabio Utzig <fabio.utzig@nordicsemi.no>
2020-08-31 09:57:33 -04:00
Fabio Utzig dcfe684440 doc: move tabs to spaces in Sphinx config
Sphinx's config file is a python script, so follow the standards and use
spaces for identation.

Signed-off-by: Fabio Utzig <fabio.utzig@nordicsemi.no>
2020-08-31 09:57:33 -04:00
Fabio Utzig 2825f0bcac doc: switch from CPP to C domain for .c files
Older Breathe versions didn't work correctly with the C domain, so there
was a mismatch when refering to functions and #defines, using :cpp: or
:c: depending on the origin of the refered symbol. With Breathe >=4.19
the C domain works correctly so all symbols can be refered to with the
:c: role.

Signed-off-by: Fabio Utzig <fabio.utzig@nordicsemi.no>
2020-08-31 09:57:33 -04:00