Commit Graph

52613 Commits

Author SHA1 Message Date
Daniel Leung 8fd3d18b40 tests: kernel/common: incorrect use of k_poll in timeout order
In the timeout order test, the usage of k_poll() assumes that it
only returns after all events are ready. However, that is not
the case, as k_poll() returns when non-zero number of events are
ready. This means the check for all semaphore being ready after
k_poll() will not always pass. So instead of using k_poll(),
simply wait a bit for timers to fire, then check results.

Also add some bits to clean up at the end of test.

Fixes #34585

Signed-off-by: Daniel Leung <daniel.leung@intel.com>
2021-05-25 07:34:59 -05:00
Robert Lubos 33043dca93 manifest: Update OpenThread revision
Update OpenThread revision, to introduce fixes for the OpenThread
configuration cache variables behaviour, making them up-to-date
with the actual Kconfig configuration.

Fixes #34233

Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
2021-05-25 07:34:42 -05:00
Maureen Helm 6866724aed samples: display: Limit lvgl sample execution to boards with shield
Similar to commit c6ff61220e, use a
harness config to limit execution of the adafruit_2_8_tft_touch_v2
sample variant to boards that have this shield attached.

Signed-off-by: Maureen Helm <maureen.helm@nxp.com>
2021-05-25 07:07:55 -05:00
Maciej Perkowski 87bb385134 tests: pwm: led: Fix pwm_led sample
The PR fixes the pwm_led sample:
- now test doesn't rely on any specific device name
- Logs which are scanned with regex in the test are printed
  only after a command passes (before failures were not
  affecting the test verdict)
- If 1 sec cycle is not supported appropriate info is printed
  and won't cause the test to failed
- Changed second "Turned off" msg so regex doesn't mix it with the
  the first one.

Fixes #35524

Signed-off-by: Maciej Perkowski <Maciej.Perkowski@nordicsemi.no>
2021-05-25 08:07:25 -04:00
Carlo Caione 6fed3fdb61 cache: Do not warn on unused parameters
Silence the compiler complaining about unused parameters.

Signed-off-by: Carlo Caione <ccaione@baylibre.com>
2021-05-25 07:05:22 -05:00
Watson Zeng dba0f8d8dc arc: hsdk: add compiler options without check
some mwdt compiler options not support cmake function
check_c_compiler_flag, let's add mwdt compiler options for
hsdk boards without check.

Signed-off-by: Watson Zeng <zhiwei@synopsys.com>
2021-05-25 07:04:32 -05:00
Andrzej Głąbek 457a28bf78 drivers: nrf_rtc_timer: Remove unnecessary locking
As per description of the sys_clock_elapsed() function, "the kernel
will call this with appropriate locking, the driver needs only provide
an instantaneous answer". Remove then the unnecessary locking from the
function, as it only adds an undesirable delay.

Signed-off-by: Andrzej Głąbek <andrzej.glabek@nordicsemi.no>
2021-05-24 23:53:18 -04:00
Andrzej Głąbek 59b21a29aa kernel: timeout: Fix adding of an absolute timeout
Correct the way the relative ticks value is calculated for an absolute
timeout. Previously, elapsed() was called twice and the returned value
was first subtracted from and then added to the ticks value. It could
happen that the HW counter value read by elapsed() changed between the
two calls to this function. This caused the test_timeout_abs test case
from the timer_api test suite to occasionally fail, e.g. on certain nRF
platforms.

Signed-off-by: Andrzej Głąbek <andrzej.glabek@nordicsemi.no>
2021-05-24 23:53:18 -04:00
Andy Ross 851d14afc8 kernel/sched: Remove "cooperative scheduling only" special cases
The scheduler has historically had an API where an application can
inform the kernel that it will never create a thread that can be
preempted, and the kernel and architecture layer would use that as an
optimization hint to eliminate some code paths.

Those optimizations have dwindled to almost nothing at this point, and
they're now objectively a smaller impact than the special casing that
was required to handle the idle thread (which, obviously, must always
be preemptible).

Fix this by eliminating the idea of "cooperative only" and ensuring
that there will always be at least one preemptible priority with value
>=0.  CONFIG_NUM_PREEMPT_PRIORITIES now specifies the number of
user-accessible priorities other than the idle thread.

The only remaining workaround is that some older architectures (and
also SPARC) use the CONFIG_PREEMPT_ENABLED=n state as a hint to skip
thread switching on interrupt exit.  So detect exactly those platforms
and implement a minimal workaround in the idle loop (basically "just
call swap()") instead, with a big explanation.

Note that this also fixes a bug in one of the philosophers samples,
where it would ask for 6 cooperative priorities but then use values -7
through -2.  It was assuming the kernel would magically create a
cooperative priority for its idle thread, which wasn't correct even
before.

Fixes #34584

Signed-off-by: Andy Ross <andrew.j.ross@intel.com>
2021-05-24 23:38:16 -04:00
David Leach a7c732db2b boards: mimxrt1010_evk: Point SRAM to OCRAM
Point the SRAM reference to the larger OCRAM memory block.

Fixes: #33726

Signed-off-by: David Leach <david.leach@nxp.com>
2021-05-24 23:31:46 -04:00
Watson Zeng fa41ec052d tests: mem_alloc: workaround aggressive optimization
As we don't use memory allocated in test_calloc, test_no_mem_malloc,
and test_no_mem_realloc. malloc call can be optimized away (that really
happens with ARC MWDT toolchain). That breaks the test. So disable
optimization for these functions.

Signed-off-by: Watson Zeng <zhiwei@synopsys.com>
2021-05-24 23:31:10 -04:00
Jukka Rissanen 0f69123897 net: tcp2: Ack any data received in FIN_WAIT_1 state
If we receive any data in FIN_WAIT_1, then ack it even if we
are discarding it.

Fixes #33986

Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
Signed-off-by: Jim Paris <jim@jim.sh>
2021-05-24 23:30:36 -04:00
Jukka Rissanen c53d483b6d net: sockets: Do not hijack k_fifo API name
The k_fifo_ prefix is meant for kernel API functions, and
not to our socket helper. So remove the k_ prefix in order
to avoid confusion.

Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2021-05-24 23:30:18 -04:00
Jukka Rissanen 20a51b49a0 net: sockets: Release the socket lock if needed
If we are waiting all the data i.e., the MSG_WAITALL flag is set,
then if we have not yet received all the data at the end of the
receive loop. We must use the condition variable to get the signal
when the data is ready to be received. Otherwise the receive loop
will not release the socket lock and receive_cb will not be able
to indicate that data is received.

Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2021-05-24 23:30:18 -04:00
Jukka Rissanen 1184089d54 net: sockets: Add locking to receive callback
Fix a regression when application is waiting data but does
not notice that because socket layer is not woken up.

This could happen because application was waiting condition
variable but the signal to wake the condvar came before the
wait started. Normally if there is constant flow of incoming
data to the socket, the signal would be given later. But if
the peer is waiting that Zephyr replies, there might be a
timeout at peer.

The solution is to add locking in socket receive callback so
that we only signal the condition variable after we have made
sure that the condition variable is actually waiting the data.

Fixes #34964

Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2021-05-24 23:30:18 -04:00
Joakim Andersson 7986cae05c Bluetooth: host: Remove cancel sync from database hash commit
Fix deadlock when db_hash_commit has to wait for the delayed work to
finish. This creates a deadlock if the delayed work for database hash
calculation needs to store the hash since the settings API is locked
when calling the commit callback.
Remove call to k_work_cancel_delayable_sync from db_hash_commit in order
to avoid the deadlock. Instead move comparing of the stored hash to the
delayed work and reschedule the work with no wait.

Signed-off-by: Joakim Andersson <joakim.andersson@nordicsemi.no>
2021-05-24 23:29:52 -04:00
Jukka Rissanen 46efe3ed70 net: packet: Do not drop net_pkt immediately
If there are no sockets in the system, then do not drop the
packet immediately as there can be other L2 network handlers
like gPTP in the system. This will also allow ICMP messages
to pass to local handler.

Fixes #34865

Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2021-05-24 23:29:24 -04:00
Jennifer Williams 9b2d8e8226 cmake: extensions.cmake: use blocklist instead in comment
There is a comment which needed to be rephrased for inclusive
language. This commit replaces it with the recommended
replacement.

Signed-off-by: Jennifer Williams <jennifer.m.williams@intel.com>
2021-05-24 23:16:28 -04:00
Maksim Masalski d6c9d40ee0 userspace: remove dead code
File userspace.c contains dead code in function char *otype_to_str()
Remove "return NULL" and replace with "ret = NULL".

Found as a coding guideline violation (MISRA R2.1) by static
coding scanning tool.

Signed-off-by: Maksim Masalski <maksim.masalski@intel.com>
2021-05-24 22:35:03 -04:00
Anas Nashif ae4fb20f67 doc: kernel: add documentation for queues
Add missing introduction to queues which are basically FIFOs and in
zephyr are used to implement both FIFO and LIFO objects.

Fixes #35199

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2021-05-24 14:20:01 -04:00
Lauren Murphy f492636aa9 samples: tensorflow: remove requirements.txt from magic wand sample
Removes the requirements.txt from the training directory of the
magic wand sample as it is causing issues in CI. Updates README.md
to explicitly state the Python packages listed in requirements.txt.

Signed-off-by: Lauren Murphy <lauren.murphy@intel.com>
2021-05-24 14:18:08 -04:00
Anas Nashif 3b19598dae sof: do not get mainmenu from SOF project
Do not get the mainmenu title from SOF by splitting Kconfig the same way
we do it in Zephyr.

Fixes #35553

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2021-05-24 13:06:59 -05:00
Henrik Brix Andersen 374629af90 canbus: isotp: remove unused work queue
Remove unused local work queue.

Fixes #34862

Signed-off-by: Henrik Brix Andersen <henrik@brixandersen.dk>
2021-05-22 08:14:35 -05:00
Kevin Townsend 1470ef67aa tests: test_build: Exclude lpcxpresso55s69_ns from debug builds
When CONFIG_TFM_BL2 is enabled on the LPC55S69 there isn't
enough memory left for TF-M to perform a debug build. Exludes this
platform from this specific test case.

Signed-off-by: Kevin Townsend <kevin.townsend@linaro.org>
2021-05-21 20:12:23 -05:00
Johann Fischer fca499100d samples: usb-audio: add app.overlay and remove board specific overlays
USB audio class samples are generic and can be built for any
board that supports USB device and isochronous endpoints.
Add app.overlay that uses aliases and remove board specific overlays.

Note: USB audio is still experimental and even though the sample can
be built for specific platform, it does not mean that it can be run
on it without issues.

Fixes: #25313

Signed-off-by: Johann Fischer <johann.fischer@nordicsemi.no>
2021-05-21 18:16:25 -04:00
Johann Fischer b4242a8dab boards: add USB node aliases
USB devicetree nodes in Zephyr have different names,
mostly derived from the designations in data sheets.
We also have an USB audio sample which has a kind of
experimental approach to configure audio devices, that
are not real hardware, via devicetree.
Sample itself is generic and can be run on any board with
USB device controller and isochronous endpoints support.

Add usbd0 alias to specific USB node to allow generic
USB audio sample to be build on nRF and i.MX RT boards.

Signed-off-by: Johann Fischer <johann.fischer@nordicsemi.no>
2021-05-21 18:16:25 -04:00
Maksim Masalski 0f5aab1182 drivers: change suffix ull to ULL
Replace suffix ull to ULL to increase code readability and prevent
unexpected behaviours, because the lowercase character l shall not be
used in a literal suffix

Found as a coding guideline violation (MISRA R7.3) by static
coding scanning tool.

Signed-off-by: Maksim Masalski <maksim.masalski@intel.com>
2021-05-21 18:13:01 -04:00
Martí Bolívar e5cc8540e4 Kconfig.zephyr: fix MISRA_SANE location
This belongs under "Compiler Options", not "Boot Options" where it
currently is.

Signed-off-by: Martí Bolívar <marti.bolivar@nordicsemi.no>
2021-05-21 18:11:26 -04:00
Martí Bolívar 095c9a3e92 doc: link-roles: fix :zephyr_file: default revision
This needs to use 'main' for its default now.

Without this patch, GitHub redirects to main, but displays a banner
that says 'Branch not found, redirected to default branch' at the top.

Signed-off-by: Martí Bolívar <marti.bolivar@nordicsemi.no>
2021-05-21 18:10:13 -04:00
Maksim Masalski 5a9e9e8fd1 logging: remove dead code enum
Remove dead code enum tracing_log_id
Not used anywhere in the code. Also it caused MISRA rule 8.12
violation.

Signed-off-by: Maksim Masalski <maksim.masalski@intel.com>
2021-05-21 18:09:23 -04:00
Gerson Fernando Budke 97e1d60f66 boards: arm: arduino_nano_33_ble: Add boot partition
Define missing bossac boot_partition.

Signed-off-by: Gerson Fernando Budke <nandojve@gmail.com>
2021-05-21 21:20:58 +02:00
Gerson Fernando Budke 8d0b3983fb boards: arm: arduino_nano_33_ble: Fix bossac mode
This board uses an old bootloader version.  The bootloader
always relocate code due to flash bootloader.  This imply
a wrong behaviour when using --offset.  This is fixed using
bossac legacy mode.

Signed-off-by: Gerson Fernando Budke <nandojve@gmail.com>
2021-05-21 21:20:58 +02:00
Gerson Fernando Budke f3a7f041bf scripts: runners: bossac: Add legacy mode
Add compatibility mode with old sam-ba flash bootloaders that don't have
offset capabilities.  These bootloaders flash to a pre-defined flash
region.  At end, bossac will suppress --offset parameter.

Signed-off-by: Gerson Fernando Budke <nandojve@gmail.com>
2021-05-21 21:20:58 +02:00
Carles Cufi 0e26836c8a Bluetooth: controller: Add conn creation param checks
Coverity detected that a zero divisor can be passed to
ll_create_connection() without parameter sanitization. Conditionally
check the connection creation parameters according to spec.

Fixes #35343.

Signed-off-by: Carles Cufi <carles.cufi@nordicsemi.no>
2021-05-21 18:50:22 +02:00
Gerard Marull-Paretas 5e06397269 doc: doxygen: treat warnings as errors
Treat warnings as errors. Since we already disable warnings for
undocumented members (the major source of warnings), reported warnings
are in all cases real problems that should be fixed.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2021-05-21 12:17:04 -04:00
Gerard Marull-Paretas a4025ebaff net: dns_resolve: fix doxygen parameter names
Parameter names were not correct.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2021-05-21 12:17:04 -04:00
Gerard Marull-Paretas 1b8e2bad63 sys: p4wq: add missing docstring to K_P4WQ_ARRAY_DEFINE
flg parameter was not documented.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2021-05-21 12:17:04 -04:00
Gerard Marull-Paretas e0b4c9753c linker: devicetree_regions: escape special characters
Escape characters <> (generate warnings for the HTML build).

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2021-05-21 12:17:04 -04:00
Gerard Marull-Paretas bb38c558c5 bluetooth: l2cap: fix doxygen references
References to BT_L2CAP_BUF_SIZE were not working.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2021-05-21 12:17:04 -04:00
Gerard Marull-Paretas da2816bab8 sys: arch_interface: fix doxygen groups
1. functions can only belong to one group, use arch-timing (already
   defined)
2. group was not properly terminated

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2021-05-21 12:17:04 -04:00
Gerard Marull-Paretas 2f12d53f9a device: fix unbalanced doxygen group
An extra @} was present, remove it.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2021-05-21 12:17:04 -04:00
Krzysztof Kopyściński 58460f9273 Bluetooth: gatt: cancel all prepared writes on invalid write response
On sending write request we should check write response.
If data prepaired to be written by peer or offset are not equal
to the data and offset we sent, we shall send Execute Write
Request with Request Flag set to 0x00 (Cancel All Prepared Writes).

This was affecting GATT/CL/GAW/BI-32-C and GATT/CL/GAW/BI-37-C

Signed-off-by: Krzysztof Kopyściński <krzysztof.kopyscinski@codecoup.pl>
2021-05-21 18:50:26 +03:00
Erik Brockhoff 6ce0f2ee66 Bluetooth: controller: add apto/appto reset for peripheral
For peripheral the apto/appto_expire are now reset on adv start

Signed-off-by: Erik Brockhoff <erbr@oticon.com>
2021-05-21 15:17:20 +02:00
Vinayak Kariappa Chettimada d999d5eb64 Bluetooth: controller: Fix missing HCI event data len limit check
Fix the missing HCI event data len limit check when encoding
incomplete advertising data report.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2021-05-21 13:39:22 +02:00
Andrzej Kaczmarek 9835888a91 Bluetooth: controller: Fix data length calculation in adv report
Max data length has to be adjusted for subevent code, otherwise we'll
hit an assert when trying to add data to event due to insufficient
free space.

Signed-off-by: Andrzej Kaczmarek <andrzej.kaczmarek@codecoup.pl>
2021-05-21 13:39:22 +02:00
Johann Fischer de974efebb drivers: eth_enc424j600: explicitly disable INTIE after reset
After system reset (SETETHRST) interrupt enable register (EIE)
has the default value 0x8010 and global interrupt enable flag (INTIE)
is set. This is not desired and the INTIE flag should be set only at
the end of the initialization.

Disable INTIE flag and set desired interrupts sources in
a single write command just right after system reset.

Resolves: #35091

Reported-by: Jamie McCrae <jamie.mccrae@lairdconnect.com>
Signed-off-by: Johann Fischer <johann.fischer@nordicsemi.no>
2021-05-21 07:35:19 -04:00
Johann Fischer 6de9c18f03 drivers: eth_enc424j600: terminate driver thread only when debugging
The controller has several interrupt sources which are signaled
via a single INT pin. Only the interrupt sources that are explicitly
switched on during controller initialization may generate an interrupt
signal. Currently there are only PHY Link Status Change Interrupt
and RX Packet Pending Interrupt enabled. So there is no other reason why
an interrupt can be triggered.

Terminate interrupt handling thread on unknown interrupt
only when debugging, as there are concerns that stopping
thread in the field is going too far.

Signed-off-by: Johann Fischer <johann.fischer@nordicsemi.no>
2021-05-21 07:35:19 -04:00
Kevin Hilman d7f47296c9 doc: porting guide: minor grammar fixups
Fix some minor grammar issues for readability.

Signed-off-by: Kevin Hilman <khilman@baylibre.com>
2021-05-21 07:25:27 -04:00
Gerard Marull-Paretas baf11138c5 doc: css: fix versions menu style
Versions menu dl > dt background color was not correct.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2021-05-21 06:22:24 -05:00
Gerard Marull-Paretas ad7e3e1281 doc: css: remove images black border
Remove the black border present on images.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2021-05-21 06:22:24 -05:00