Commit graph

42249 commits

Author SHA1 Message Date
Peter Bigot 2fe35e8013 init: refactor documentation
This header provides one public API function, but lacked the
annotations necessary to process it when generating documentation.
Also detailed documentation was provided in Z_INIT_ENTRY_DEFINE which
is an internal function excluded from documentation.

Add the necessary directives to include SYS_INIT() in generated
documentation and move the description of the level and prio
properties to it.

Signed-off-by: Peter Bigot <peter.bigot@nordicsemi.no>
2020-06-22 13:37:07 +02:00
Abhishek Shah 11972a48c2 drivers: pcie: ep: iproc: Add reset callback support
Add support to register callback function for each PCIe reset.
These callback functions are executed from corresponding
PCIe reset interrupt handler if registered.

Signed-off-by: Shivaraj Shetty <shivaraj.shetty@broadcom.com>
Signed-off-by: Abhishek Shah <abhishek.shah@broadcom.com>
2020-06-22 12:44:54 +02:00
Abhishek Shah 7d587abc6e drivers: pcie: ep: iproc: Add reset interrupt handlers
Add reset interrupt handlers for all three types of reset
interrupts that iProc PCIe EP can receive - namely PERST,
INB PERST and FLR.

Signed-off-by: Shivaraj Shetty <shivaraj.shetty@broadcom.com>
Signed-off-by: Abhishek Shah <abhishek.shah@broadcom.com>
2020-06-22 12:44:54 +02:00
Abhishek Shah 19417b2a99 pcie: endpoint: Add public API to register reset interrupt callback
PCIe End Point can get three different reset interrupts from the
Root Complex, Function Level Reset (FLR), PCI Express Reset (PERST)
and Inband PCI Express Reset (INB PERST).

Add public API to let PCIe EP drivers register callback function
for each PCIe reset interrupt. This callback function should be
executed from corresponding reset interrupt handler if registered.

Signed-off-by: Abhishek Shah <abhishek.shah@broadcom.com>
2020-06-22 12:44:54 +02:00
Torsten Rasmussen b69a3d8824 cmake: Allow projects to add additional dependencies to flash target
Using zephyr_target_property::FLASH_DEPENDENCIES to fetch additional
dependencies to the flash operation.

The properties are fetched using a generator expression which allows
users of Zephyr to add dependencies both before and after the flash
target has been defined.

Dependencies can be other targets that must be build / custom commands
which must be executed before the flash operation. Or it can be targets
which must be built.

Signed-off-by: Torsten Rasmussen <Torsten.Rasmussen@nordicsemi.no>
Signed-off-by: Haakon Oeye Amundsen <haakon.amundsen@nordicsemi.no>
2020-06-22 12:44:39 +02:00
Vinayak Kariappa Chettimada 1af8c136a7 Bluetooth: controller: Add explicit opcode check in unknown rsp PDU
Add explicit opcode check when handling received unknown
response PDU.

Without this, for example, an in progress Data Length Update
procedure state was reset when receiving an unknown response
to slave initiated feature request.

Fixes #26252.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2020-06-22 12:33:22 +02:00
Lukasz Maciejonczyk c32286bd30 net: openthread: Add OpenThread l2 api description
Add missing api description.

Signed-off-by: Lukasz Maciejonczyk <lukasz.maciejonczyk@nordicsemi.no>
2020-06-22 11:34:18 +03:00
Lukasz Maciejonczyk 74b1c617af net: openthread: Add possibility to register ot state changed app cb
It may be useful for the application to register its own callback for
ot state changed event which does not override the current one.

Signed-off-by: Lukasz Maciejonczyk <lukasz.maciejonczyk@nordicsemi.no>
2020-06-22 11:34:18 +03:00
Lukasz Maciejonczyk 4ad78d9249 net: openthread: Make function openthread_start be public
It may be useful to start openthread manually but with default
network settings. For instance when the application wants to register
ot state changed callback which should be done before openthread
starts.

Signed-off-by: Lukasz Maciejonczyk <lukasz.maciejonczyk@nordicsemi.no>
2020-06-22 11:34:18 +03:00
Nicolas Pitre ad59e923e9 sys_heap: reduce the size of struct z_heap_bucket by half
This struct is taking up most of the heap's constant footprint overhead.
We can easily get rid of the list_size member as it is mostly used to
determine if the list is empty, and that can be determined through
other means.

Signed-off-by: Nicolas Pitre <npitre@baylibre.com>
2020-06-21 19:25:35 +02:00
Nicolas Pitre 74fbca412a sys_heap: perform cheap overflow detection on freed memory
Make the LEFT_SIZE field first and SIZE_AND_USED field last (for an
allocated chunk) so they sit right next to the allocated memory. The
current chunk's SIZE_AND_USED field points to the next (right) chunk,
and from there the LEFT_SIZE field should point back to the current
chunk. Many trivial memory overflows should trip that test.

One way to make this test more robust could involve xor'ing the values
within respective accessor pairs. But at least the fact that the size
value is shifted by one bit already prevent fooling the test with a
same-byte corruption.

Signed-off-by: Nicolas Pitre <npitre@baylibre.com>
2020-06-21 19:25:35 +02:00
Nicolas Pitre cb3d460a2c sys_heap: simplify some complex checks
Avoid redundancy and bucket_idx() usage when possible.

Signed-off-by: Nicolas Pitre <npitre@baylibre.com>
2020-06-21 19:25:35 +02:00
Nicolas Pitre d1125d21d4 sys_heap: remove need for last_chunk()
We already have chunk #0 containing our struct z_heap and marked as
used. We can add a partial chunk at the very end that is also marked
as used. By doing so there is no longer a need for checking heap
boundaries at run time when merging/splitting chunks meaning fewer
conditionals in the code's hot path.

Signed-off-by: Nicolas Pitre <npitre@baylibre.com>
2020-06-21 19:25:35 +02:00
Nicolas Pitre 6d827fa080 sys_heap: introduce min_chunk_size()
With this we can remove magic constants, especially those used with
big_heap().

Signed-off-by: Nicolas Pitre <npitre@baylibre.com>
2020-06-21 19:25:35 +02:00
Nicolas Pitre e553161b8e sys_heap: optimize struct z_heap
It is possible to remove a few fields from struct z_heap, removing
some runtime indirections by doing so:

- The buf pointer is actually the same as the struct z_heap pointer
  itself. So let's simply create chunk_buf() that perform a type
  conversion. That type is also chunk_unit_t now rather than u64_t so
  it can be defined based on CHUNK_UNIT.

- Replace the struct z_heap_bucket pointer by a zero-sized array at the
  end of struct z_heap.

- Make chunk #0 into an actual chunk with its own header. This allows
  for removing the chunk0 field and streamlining the code. This way
  h->chunk0 becomes right_chunk(h, 0). This sets the table for further
  simplifications to come.

Signed-off-by: Nicolas Pitre <npitre@baylibre.com>
2020-06-21 19:25:35 +02:00
Nicolas Pitre e2b64777e5 sys_heap: optimize usage of size and used flags
By storing the used flag in the LSB, it is no longer necessary to have
a size_mask variable to locate that flag. This produces smaller and
faster code.

Replace the validation check in chunk_set() to base it on the storage
type.

Also clarify the semantics of set_chunk_size() which allows for clearing
the used flag bit unconditionally which simplifies the code further.

The idea of moving the used flag bit into the LEFT_SIZE field was
raised. It turns out that this isn't as beneficial as it may seem
because the used bit is set only once i.e. when the memory is handed off
to a user and the size field becomes frozen at that point. Modifications
on the leftward chunk may still occur and extra instructions to preserve
that bit would be necessary if it were moved there.

Signed-off-by: Nicolas Pitre <npitre@baylibre.com>
2020-06-21 19:25:35 +02:00
Nicolas Pitre 54950aca01 sys_heap: provide more chunk_fields accessors
Let's provide accessors for getting and setting every field to make the
chunk header layout abstracted away from the main code. Those are:

SIZE_AND_USED: chunk_used(), chunk_size(), set_chunk_used() and
chunk_size().

LEFT_SIZE: left_chunk() and set_left_chunk_size().

FREE_PREV: prev_free_chunk() and set_prev_free_chunk().

FREE_NEXT: next_free_chunk() and set_next_free_chunk().

To be consistent, the former chunk_set_used() is now set_chunk_used().

Signed-off-by: Nicolas Pitre <npitre@baylibre.com>
2020-06-21 19:25:35 +02:00
Nicolas Pitre f97eca26e6 sys_heap: some cleanups to make the code clearer
First, some renames to make accessors more explicit:

  size() --> chunk_size()
  used() --> chunk_used()
  free_prev() --> prev_free_chunk()
  free_next() --> next_free_chunk()

Then, the return type of chunk_size() is changed from chunkid_t to
size_t, and chunk_used() from chunkid_t to bool.

The left_size() accessor is used only once and can be easily substituted
by left_chunk(), so it is removed.

And in free_list_add() the variable b is renamed to bi so to be
consistent with usage in sys_heap_alloc().

Signed-off-by: Nicolas Pitre <npitre@baylibre.com>
2020-06-21 19:25:35 +02:00
Stephanos Ioannidis 27d42f060d tests: kernel: lifo_usage: Exclude on qemu_arc_em
This test has a very high failure rate on `qemu_arc_em` and needs to be
disabled until a fix is available.

To be addressed in #26163.

Signed-off-by: Stephanos Ioannidis <root@stephanos.io>
2020-06-21 09:47:24 -04:00
Alexander Kozhinov 0f5b9ee63b boards: nucleo_h745zi_q_m7: fixed pwm bug
fixed pwm bug #26313

Signed-off-by: Alexander Kozhinov <AlexanderKozhinov@yandex.com>
2020-06-20 22:22:11 +02:00
Michael Hope 8e2c4a475d boards: arm: reduce the default drivers for the Arduino Zero
Now that the SAM0 SOC selects the appropriate SAM0 driver for a class,
reduce the drivers that are compiled in by default on the Arduino
Zero.  This reduces the size of `blink` from ~14 KiB to ~10 KiB.

Also add the supported features to arduino_zero.yaml to get more
coverage in the sanity tests.

Signed-off-by: Michael Hope <mlhx@google.com>
2020-06-19 18:59:14 +02:00
Michael Hope 5e75b21e1e soc: sam0: dynamically enable the SAM0 drivers
Change the SAM0 to match other boards by selecting the SAM0 specific
driver when a driver class is selected.

For example, automatically enable CONFIG_SPI_SAM0 when CONFIG_SPI is
enabled.

Signed-off-by: Michael Hope <mlhx@google.com>
2020-06-19 18:59:14 +02:00
Markus Fuchs 2f9b0d419b json: Add top-level array encoding support
The library supports the declaration of JSON arrays as both nested and
top-level elements. However, as the provided encoding functions
json_obj_encode() and json_obj_encode_buf() interpret all input
structures as objects, top-level arrays are encoded as

{"<field_name>":[{...},...,{...}]}

instead of

[{...},...,{...}].

Add new functions json_arr_encode() and json_arr_encode_buf() that
enable top-level JSON array encoding.

Signed-off-by: Markus Fuchs <markus.fuchs@de.sauter-bc.com>
2020-06-19 18:21:27 +02:00
Alexander Kozhinov a6786c54e0 dts: arm: st: h7: add dma peripheral support
dma1 & dma2 peripheral support added
both dma's disabled currently

Signed-off-by: Alexander Kozhinov <AlexanderKozhinov@yandex.com>
2020-06-19 18:18:57 +02:00
Alexander Kozhinov 8888d056a9 dts: arm: st: h7: add rng peripheral support
rng peripheral support added
rng peripheral currently disabled

Signed-off-by: Alexander Kozhinov <AlexanderKozhinov@yandex.com>
2020-06-19 18:18:57 +02:00
Alexander Kozhinov 0fd0d474fe boards: Add support for NUCLEO-H745ZI-Q
Added new supported board

Signed-off-by: Alexander Kozhinov <AlexanderKozhinov@yandex.com>
2020-06-19 18:18:57 +02:00
Alexander Kozhinov 54e8bda856 soc: stm32: Add support for stm32h745xx SoC
add stm32h745xx SoC and corresponding device tree

Signed-off-by: Alexander Kozhinov <AlexanderKozhinov@yandex.com>
2020-06-19 18:18:57 +02:00
Fabio Utzig 3f28f69477 doc: add --no-index-modules option to genrest.py
This add a new option `--no-index-modules` which works similarly to
`--modules` but does not generated index pages, only retains the
tweaking of how paths are displayed on symbol information pages,
showing '<title>/path/within/module/Kconfig' for paths that fall
within modules.

This is required by NCS, where there are more "modules" which we don't
want to have indexes for.

Signed-off-by: Fabio Utzig <fabio.utzig@nordicsemi.no>
2020-06-19 18:14:18 +02:00
Dominik Ermel 45ef06dc5b boards/arm: unify boot partition size for nRF boards
The DTS for nRF53 and nRF91 boards has been modified to cut the size
of boot partition from 64KiB to 48KiB, making it the same size as for
nRF52.

Resolves #25664

Signed-off-by: Dominik Ermel <dominik.ermel@nordicsemi.no>
2020-06-19 18:05:07 +02:00
Alexandre Bourdiol b8a4b9a1a0 soc: arm: st_stm32: add include of devictree.h in soc.h
Replace include of kernel_includes.h by devictree.h
Required when MPU is activated

Signed-off-by: Alexandre Bourdiol <alexandre.bourdiol@st.com>
2020-06-19 08:55:44 -05:00
Alexandre Bourdiol 6f55614222 board: arm: Enable MPU for all STM32 boards supporting it
Only boards with at least 64K Flash will activate MPU because:
MPU + UERSPACE + All switches implicity activated
(CONFIG_MPU_STACK_GUARD, CONFIG_ARM_STACK_PROTECTION ...)
will consume about 40K Flash
(value computed on nucleo_f767_zi on tests/arch/arm/arm_ramfunc/).

Signed-off-by: Alexandre Bourdiol <alexandre.bourdiol@st.com>
2020-06-19 08:55:44 -05:00
Gerard Marull-Paretas 76f0d72e5d drivers: pwm: stm32: add support for polarity
Add support for the polarity flag in the STM32 PWM driver.

STM32 boards using PWM have been updated accordingly.

Signed-off-by: Gerard Marull-Paretas <gerard@teslabs.com>
2020-06-19 15:18:50 +02:00
Gerard Marull-Paretas 528a98ba3f drivers: pwm: stm32: refactor driver using LL API
The PWM drivers has been refactored using the HAL LL API. Not only that,
but the set pin_set function is now faster, as channel output compare is
just initialized if needed.

NOTE: Has been tested using H743zi board for now.

Signed-off-by: Gerard Marull-Paretas <gerard@teslabs.com>
2020-06-19 15:18:50 +02:00
Henrik Brix Andersen e173903634 boards: arm: lpcxpresso55s16: add arduino gpio and mikrobus headers
Add devicetree nodes for the Arduino GPIO and MikroElektronika
mikroBUS headers present on the NXP LPCXpresso55S16 development board.

Signed-off-by: Henrik Brix Andersen <henrik@brixandersen.dk>
2020-06-19 15:18:16 +02:00
Henrik Brix Andersen 5e2e1ab3ea samples: shields: x_nucleo_iks0xax: exclude lpcxpresso55s16_ns board
Exclude the NXP LPCXpresso55S16 board from the X-NUCLEO-IKS0xAx
samples, since the rely on having Arduino Uno header A3 available.

On the LPCXpresso55S16, A3 is connected through a resistor (R63) which
is not mounted by default.

Signed-off-by: Henrik Brix Andersen <henrik@brixandersen.dk>
2020-06-19 15:18:16 +02:00
Grzegorz Szymaszek 0a3e3958df west: runners: stm32flash: convert start_addr to string (concatenation)
The start_addr attribute of Stm32flashBinaryRunner is an integer. It
must be converted to a string before being concatenated with a colon and
the (already converted to a string) size to erase or write.

Signed-off-by: Grzegorz Szymaszek <gszymaszek@short.pl>
2020-06-19 15:18:08 +02:00
Maciej Perkowski 0e41830728 samples: posix: eventfd: bugfix for regex check
Bugfix for regex adding "\\" before "(" and ")" for proper regex parsing

Signed-off-by: Maciej Perkowski <Maciej.Perkowski@nordicsemi.no>
2020-06-19 15:17:37 +02:00
Joakim Andersson 0f67f6cb72 Bluetooth: shell: Add phy procedure options to the shell
Add command line options to set the PHY options coding schemed and
no preference.

Signed-off-by: Joakim Andersson <joakim.andersson@nordicsemi.no>
2020-06-19 13:42:29 +02:00
Joakim Andersson 1d0b03bb37 Bluetooth: host: Add phy update procedure options
Add options for phy update procedure. User can now set no preference
option for a particular PHY as well as preference for LE Coded PHY
coding scheme.

Signed-off-by: Joakim Andersson <joakim.andersson@nordicsemi.no>
2020-06-19 13:42:29 +02:00
Andrzej Głąbek e64f75bae1 dts: nordic: Remove no longer needed peripheral aliases
Aliases defined for peripheral nodes in the nRF SoC definitions were
used in drivers to properly match the hardware instances.
After the drivers were converted to use the new DT API, these aliases
became needless.

Signed-off-by: Andrzej Głąbek <andrzej.glabek@nordicsemi.no>
2020-06-18 23:59:40 +02:00
Luiz Augusto von Dentz 0742a45ac9 Bluetooth: shell: Add support for printing the write rate
This makes the gatt metrics also available for
gatt write-without-rsp-cb so it now prints the rate of each write:

uart:~$ gatt write-without-response-cb 1e ff 10 10
Write #1: 16 bytes (0 bps)
Write #2: 32 bytes (3445948416 bps)
Write #3: 48 bytes (2596929536 bps)
Write #4: 64 bytes (6400 bps)
Write #5: 80 bytes (8533 bps)
Write #6: 96 bytes (10666 bps)
Write #7: 112 bytes (8533 bps)
Write #8: 128 bytes (9955 bps)
Write #9: 144 bytes (11377 bps)
Write #10: 160 bytes (7680 bps)
Write #11: 176 bytes (8533 bps)
Write #12: 192 bytes (9386 bps)
Write Complete (err 0)
Write #13: 208 bytes (8533 bps)
Write #14: 224 bytes (9244 bps)
Write #15: 240 bytes (9955 bps)
Write #16: 256 bytes (8000 bps)

Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
2020-06-18 21:35:12 +02:00
Luiz Augusto von Dentz 0028559860 Bluetooth: ATT: Fix using of k_fifo_{put,get}
These functions don't work with buffers that do have fragments, instead
this replaces their usage with net_buf_{put,get}.

Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
2020-06-18 21:35:12 +02:00
Luiz Augusto von Dentz 5aac983419 Bluetooth: ATT: Fix low throughput
ATT_PENDING_SENT does severely impact the throughput since multiple
packets no longer can be scheduled at same time, so instead of always
setting it regardless of the bearer/channel it is now only used for
EATT since that cannot set its own callbacks.

Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
2020-06-18 21:35:12 +02:00
Luiz Augusto von Dentz 3ae926c0f1 Bluetooth: ATT: Fix not returning error
bt_l2cap_send_cb may fail if there are no context available which means
that the request would not be sent, also due to the use of custom
callback it cannot be queued either so the only option is to return the
error and let the application handle it.

Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
2020-06-18 21:35:12 +02:00
Luiz Augusto von Dentz bc7ce86ac5 Bluetooth: ATT: Fix not processing pending requests
Since the TX semaphore is used for all types of PDUs a request may have
to be put on the request list while there is no pending request pending
which means no response will be generated to trigger att_process,
previously this condition was handled by setting the request as
currently pending and append its buffer to tx_queue but this is no
longer efficient since there could be more than one channel active the
code should try all of them before queueing back to request list.

To fix this the request list will now be processed each time a PDU has
been sent.

Fixes #26070

Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
2020-06-18 21:35:12 +02:00
Luiz Augusto von Dentz 4418ba76a5 Bluetooth: ATT: Fix overwritting sent callback
ATT channel sent callback shall not be overwritting until the
operation completes as it can result in breaking flow control when
CONFIG_BT_ATT_ENFORCE_FLOW is enabled.

Fixes #25964
Fixes #26071

Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
2020-06-18 21:35:12 +02:00
Robert Lubos 44c1101e93 net: lwm2m: Make Registration Update ahead time configurable
Allow to configure, how long before registration timeout should the
Registration Update be sent. The fixed 6 seconds used so far, might
not be enough in slower networks (like NB-IoT), resulting in frequent
re-registrations at LWM2M level.

Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
2020-06-18 19:38:19 +02:00
Martí Bolívar 1af73a66ab sys/util.h: remove deprecated MACRO_MAP()
Since this is an experimental API and MACRO_MAP() was deprecated in
favor of FOR_EACH() in zephyr v2.3.0, we are within our rights to just
remove it without notice now. Do so and mention it in the release
notes.

Signed-off-by: Martí Bolívar <marti.bolivar@nordicsemi.no>
2020-06-18 19:38:10 +02:00
Martí Bolívar 67ac768415 doc: release-notes: add sys/util.h to 2.4 release notes
Add a line item under "API Changes"

Signed-off-by: Martí Bolívar <marti.bolivar@nordicsemi.no>
2020-06-18 19:38:10 +02:00
Martí Bolívar 04df8124ac api: promote sys/util.h to experimental
This file contains definitions for macros which are integral to
significant Zephyr use cases, such as CONTAINER_OF() and various
macros used by devicetree.h internally.

As such, in practice we expect at least advanced (if not intermediate)
users to understand it, so the fact that it's not formally documented
as an API with a stability level is a problem.

Fix that by giving the docstrings a once-over and adding new ones
where they are missing. Move all the remaining non-API macros to
util_internal.h.

Add a Sphinx API page for this header, and include it in the API
overview at "experimental" stability level.

Signed-off-by: Martí Bolívar <marti.bolivar@nordicsemi.no>
2020-06-18 19:38:10 +02:00