Commit graph

93278 commits

Author SHA1 Message Date
Alberto Escolar Piedras 8000c7073f boards native_posix_64: Remove hwmv1 compatible board definition
To use this functionality one must now use the native_posix//64
(variant) version. The old hwmv1 compatible name for the board
was left provisionally while all tests in tree were ported.
That being now done, this old name can be removed.

After this change one cannot build anymore
targeting native_posix_64, but must instead build
targeting native_posix/[native]/64.
For twister tests the old name is already not valid.

Signed-off-by: Alberto Escolar Piedras <alberto.escolar.piedras@nordicsemi.no>
2024-03-27 10:26:31 +00:00
Henrik Brix Andersen dd0923d7ad boards: nxp: mr_canhubk3: add ssd1306 display devicetree node
Add devicetree node for the accompanying, ssd1306-based display board
connected to connector P4.

Signed-off-by: Henrik Brix Andersen <henrik@brixandersen.dk>
2024-03-26 21:30:29 -04:00
Reto Schneider ddb075c398 net: buf: Add support for 40 bit data type
This enables pulling and pushing values in 40 bit format.

Signed-off-by: Reto Schneider <reto.schneider@husqvarnagroup.com>
2024-03-26 19:32:27 -04:00
Reto Schneider 8918247f37 net: buf_simple: Add support for 40 bit data type
This enables pulling and pushing values in 40 bit format.

Signed-off-by: Reto Schneider <reto.schneider@husqvarnagroup.com>
2024-03-26 19:32:27 -04:00
Reto Schneider f45b48fc51 sys: byteorder: Add 40 bit variants
This adds sys_*_*40 functions that operation on a 40 bits values.

Signed-off-by: Reto Schneider <reto.schneider@husqvarnagroup.com>
2024-03-26 19:32:27 -04:00
Ederson de Souza df916387f1 tests/subsys/llext: Add syscall tests
Check if syscalls can be accessed from both kernel and userspace, and if
optimised away ones indeed point to NULL.

Signed-off-by: Ederson de Souza <ederson.desouza@intel.com>
2024-03-26 19:31:56 -04:00
Ederson de Souza 8a2262431f arch/arm/core: Export z_arm_thread_is_in_user_mode for extensions
This call is used by syscalls machinery, and needs to be available for
extensions that use syscalls on ARM.

Signed-off-by: Ederson de Souza <ederson.desouza@intel.com>
2024-03-26 19:31:56 -04:00
Ederson de Souza 62b19ef65c syscalls: llext: Export z_impl symbols so they are available to kernel
commit 67bb6db3f8 ("syscall: Export all emitted syscalls, enabling
them for extensions") exports all emitted syscalls, however, it does
that only for the `z_mrsh` symbols, effectively only available for
userspace. If an extension running at kernel level tries to use a
syscall, it will fail to load.

This patch fixes that by exposing the `z_impl` symbols instead. However,
this is not as straightforward as the `z_mrsh` ones. As, in their
signatures, they can basically contain any type, it's not just a matter
of emitting `EXPORT_SYMBOL(z_impl_<syscall>)`, as the compiler will
complain about the undefined types. Here, there are a few approaches.

One of them is to have the `EXPORT_SYMBOL` being generated on the same
files where the syscall is implemented - injecting it there would allow
it to access all known symbols. But changing a lot of files is
undesirable, and it was one of the nice points of first patch.

Another one would be to reconstruct - or simply use the absolute path -
for the includes where the syscalls are defined. Reconstruct the paths
seems fragile and I'm not sure using absolute paths is portable.

Finally, the approach used in this patch is to declare, on a different
generated file, all `z_impl_` symbols as `void *` - after all, only the
address (and the name) to the function is relevant to EXPORT_SYMBOL. By
living in an compilation unit that doesn't include any header which
would expose any of the syscalls, there shouldn't be any conflicts. And
to account for the possibility that a syscall is not compiled - due
being configured out via Kconfig - all those symbols are also weak
aliases to a pointer to NULL. This file is then included in
`llext_export.c` (which should naturally not include any conflicting
header).

Signed-off-by: Ederson de Souza <ederson.desouza@intel.com>
2024-03-26 19:31:56 -04:00
Ederson de Souza 321e395a8f linker: Include libkernel.a in the whole-archive when llext is enabled
Differently from other libraries, which are included whole in the final
Zephyr ELF, libkernel.a itself isn't. Assuming this is intended to
enable optimisations (if it isn't, this patch will break things) - linker
can remove parts of the kernel that are not used by the application.

However, when considering Linkable Loadable Extensions (llext), this
optimisations can be counterproductive: for instance, syscalls that are
not used by the application won't be available for extensions. It won't
matter if someone "EXPORT_SYMBOL" for them, or even try to keep them
using LINKER_KEEP, they'll be gone.

To avoid that, this patches includes, when CONFIG_LLEXT=y, libkernel.a
inside the linker "whole-archive" block. This ends up making it consider
libkernel.a as a library whose all symbols should be kept. Note this
doesn't mean that all symbols will be there - things compiled out via
Kconfig will naturally still be out.

Signed-off-by: Ederson de Souza <ederson.desouza@intel.com>
2024-03-26 19:31:56 -04:00
Reto Schneider a924c87dc2 tests: net: buf: Test zero-sized clone
This commit ensures that copying a zero-sized buffer works.

Signed-off-by: Reto Schneider <reto.schneider@husqvarnagroup.com>
2024-03-26 19:31:21 -04:00
Reto Schneider 9b2312d055 net: buf: Fix cloning of zero-sized buffers
For zero sized buffers, instead of pointing to a buffer, net_buf->__buf
is NULL. For this reason, when cloning a buffer, the code needs to check
__buf before dereferencing it.

Signed-off-by: Reto Schneider <reto.schneider@husqvarnagroup.com>
2024-03-26 19:31:21 -04:00
Declan Snyder 0c7325e3ef doc: board_porting: Update hierarchy presentation
Update the presentation of the hardware hierarchy description so that it
does not appear to have missing words at the end of the bullet points,
by using a paragraph instead. And tweak the wording slightly.

Signed-off-by: Declan Snyder <declan.snyder@nxp.com>
2024-03-26 19:29:33 -04:00
Lukasz Mrugala 3fb11e260a scripts: tests: Blackbox test expansion - addon
Adds tests related to the addon flags:
*     --enable-ubsan
*     --enable-lsan
*     --enable-asan
*     --enable-valgrind
*     --allow-installed-plugin
*     --pytest-args
* -x, --extra-args
* extra test args for the binary

Signed-off-by: Lukasz Mrugala <lukaszx.mrugala@intel.com>
2024-03-26 18:08:31 -05:00
Kamil Paszkiet ff5780fcc7 scripts: tests: Blackbox test expansion - coverage
Adds tests related to coverage flags:
--gcov-tool
--coverage-platform

Signed-off-by: Kamil Paszkiet <kamilx.paszkiet@intel.com>
2024-03-26 18:08:02 -05:00
Peter Mitsis 87ca079e49 tests: z_test_1cpu_start() makes only CPU0 active
When z_test_1cpu_start() is called to ensure that only a single CPU
on an SMP system is available for use in a test, this commit will
ensure that that CPU is the primary CPU--CPU0. This is done because
some timer drivers only have the timer interrupt processed by one CPU.

A bit of a song and dance is performed to achieve this without enabling
the CPU mask/affinity pinning API. If the cpuhold thread is found to
be executing on CPU0, then a new copy of cpuhold thread is created. Once
the new copy is executing (incidentally guaranteed to be on another CPU)
then it informs the original copy and busy waits until it the original
copy is switched out of CPU0. At this point, we can create the next
cpuhold thread to occupy another CPU if needed.

During this song and dance, it is critical that the 'copy' not pend. If
it pends, we can not guarantee which CPU it will execute on when it
unpends. As the cpuhold threads have the highest priority, nothing is
going to cause them to execute on another CPU for as long as they do
not pend.

Signed-off-by: Peter Mitsis <peter.mitsis@intel.com>
2024-03-26 18:07:41 -05:00
Henrik Brix Andersen 2faec62202 boards: nxp: mr_canhubk3: add devicetree nodes for CAN LEDs
Add devicetree nodes for the six red CAN LEDs present on the NXP
MR-CANHUBK344 board.

Signed-off-by: Henrik Brix Andersen <hebad@vestas.com>
2024-03-26 18:07:17 -05:00
Dominik Ermel d52a7ef31a tests: subsys: settings: Increase stack size
Fixes #62324

Signed-off-by: Dominik Ermel <dominik.ermel@nordicsemi.no>
2024-03-26 17:34:25 -04:00
Kapil Bhatt 6e6f53dc8e net: wifi: Fix disconnect reason codes
The shell is printing "connected" while passing
the wrong password to connect command. If the status
value is 0, then only shell will print "connected."
The wrong password will disconnect the connection
with an unspecified reason code.

If the default value of the unspecified disconnect
reason code is 0, then status will print "connected."
By changing the default value to WIFI_STATUS_CONN_LAST_STATUS,
it will print the correct reason, like a failed request
with reason code.

Signed-off-by: Kapil Bhatt <kapil.bhatt@nordicsemi.no>
2024-03-26 17:24:34 -04:00
Chauncy Liu 58733f4682 include: Avoid compiler warning about unused variables
Use ARG_UNUSED on unused variable.

Signed-off-by: Chauncy Liu <chauncy@beechwoods.com>
2024-03-26 16:39:39 -04:00
Mahesh Mahadevan 384e8b6af1 tests: spi: Add support for NXP MCXN947
Add support for NXP MCXN947

Signed-off-by: Mahesh Mahadevan <mahesh.mahadevan@nxp.com>
2024-03-26 16:39:18 -04:00
Mahesh Mahadevan f4bad0a49c boards: frdm_mcxn947: Add support for SPI and DMA
Add support for SPI and DMA

Signed-off-by: Mahesh Mahadevan <mahesh.mahadevan@nxp.com>
2024-03-26 16:39:18 -04:00
Mahesh Mahadevan 8b7cff7d33 drivers: spi: Use the NXP Flexcomm driver for interrupt handling
The Low Power Flexcomm driver manages the interrupt handling
and provides an API to register interrupt callbacks.
Register the NXP LPSPI interrupt handler.

Signed-off-by: Mahesh Mahadevan <mahesh.mahadevan@nxp.com>
2024-03-26 16:39:18 -04:00
Mahesh Mahadevan e5ecc96b3c dts: spi: Interrupts in NXP LPSPI is no longer a required property
Some NXP SoC's have a FlexComm interface that manages the
interrupts.

Signed-off-by: Mahesh Mahadevan <mahesh.mahadevan@nxp.com>
2024-03-26 16:39:18 -04:00
Mahesh Mahadevan 7c431dde18 drivers: spi: NXP LPSPI driver sometimes uses instance number
Update the driver to account for variations in the SDK driver
when it uses the instance number instead of the base address.

Signed-off-by: Mahesh Mahadevan <mahesh.mahadevan@nxp.com>
2024-03-26 16:39:18 -04:00
Mahesh Mahadevan d5b58a527d dts: mcxn947: Add edma nodes
Add the EDMA nodes.

Signed-off-by: Mahesh Mahadevan <mahesh.mahadevan@nxp.com>
2024-03-26 16:39:18 -04:00
Mahesh Mahadevan 804cfbe21c west.yml: Pull in NXP SDK file for SPI and DMA support on MXCN947
Get the SDK files for SPI and DMA support on NXP MCXN947

Signed-off-by: Mahesh Mahadevan <mahesh.mahadevan@nxp.com>
2024-03-26 16:39:18 -04:00
Mahesh Mahadevan 55abfcb31e drivers: dma: Update NXP EDMA driver for version 4
1. Update EDMA driver for version 4
2. The DMAMux module is not always present. Use the
   feature define to make this optional.
3. Use the EDMA_SetChannelMux API for SoC's that supports
   this feature.

Signed-off-by: Mahesh Mahadevan <mahesh.mahadevan@nxp.com>
2024-03-26 16:39:18 -04:00
Alberto Escolar Piedras f9e3084daf scripts/checkpatch: Limit which feature test macros we prevent
Unfortunately this check as it is today is causing trouble, while
not checking too well for what it intended. Let's reduce its scope
until a better solution has been found.

Background:
This check intends to ensure coding guidelines Rules A.4 and A.5
are followed, but how it is implemented it does not work well enough.
1. These rules only apply to the kernel and some other parts of the
embedded codebase respectively, but this check is performed on the
whole tree.
2. This check works under the assumption that any attempt to set
these macros in source files is a violation of these rules, while
this is not necessary the case, as there are legitimate uses for these.
(Specially for _POSIX_C_SOURCE and _XOPEN_SOURCE)

This check also fails to detect these macros being set in cmake files,
so if users are faced with this failure they can trivially bypass it.

Having a CI check which produces too many false positives, while
at the same time being very easy to bypass is not a desirable situation
as that can result in lack of trust for this type of checks,
and an overall tendency to override these CI faults,
and overlooking actual violations of these rules by reviewers.

This check was originally added in
b021dece98

Signed-off-by: Alberto Escolar Piedras <alberto.escolar.piedras@nordicsemi.no>
2024-03-26 16:21:02 -04:00
David Leach b668f41424 maintainers: Move JiafeiPan as NXP MPU maintainer
Move JiafeiPan as NXP MPU maintainer. Move dleach02 down to
collaborators.

Signed-off-by: David Leach <david.leach@nxp.com>
2024-03-26 16:20:25 -04:00
Grzegorz Swiderski 9dabce43d2 scripts: Ignore duplicate roots in list_boards/hardware
When iterating over `--arch-root`, `--board-root`, and `--soc-root`,
treat them as collections of absolute paths with no repeats, to ensure
that no input root has to be handled more than once.

Signed-off-by: Grzegorz Swiderski <grzegorz.swiderski@nordicsemi.no>
2024-03-26 16:20:08 -04:00
Grzegorz Swiderski 4acb615c14 cmake: boards: Error out if multiple boards use the same name
Detecting this requires `boards.cmake` being able to handle multi-line
output from `list_boards.py`. Implement a similar line reading loop to
the one used in `hwm_v2.cmake`.

Failing to handle this could result in an incorrectly parsed list of
valid board qualifiers. Here's the expected list for `nrf52_bsim`:

  - "native"

and here's what would happen if two copies of that board were found:

  - "native\nNAME"
  - "nrf52_bsim"
  - "native"

Instead of that, there would now be a proper error message listing all
board directories which contain `nrf52_bsim`.

Signed-off-by: Grzegorz Swiderski <grzegorz.swiderski@nordicsemi.no>
2024-03-26 16:20:08 -04:00
Torsten Rasmussen 88d8b23836 scripts: remove board name from the qualifiers in list_boards.py
Fixes: #69329

The board name was printed as part of printing board qualifiers because
those was being concatenated in the `board_v2_qualifiers()` method.

Keep the qualifiers separated from the board name and let the caller
concatenate the strings when required.

Completion scripts are also updated to handle the corrected behaviour.

Signed-off-by: Torsten Rasmussen <Torsten.Rasmussen@nordicsemi.no>
(cherry picked from commit 66b475a3aa)
2024-03-26 16:20:08 -04:00
Jonathan Rico 08ba810ffe doc: Bluetooth: LE host touch-ups
Addresses review comments on text I only moved.

Signed-off-by: Jonathan Rico <jonathan.rico@nordicsemi.no>
2024-03-26 16:19:30 -04:00
Jonathan Rico 629795d1ad doc: Bluetooth: add LE Host page
We now have Classic activity in the tree.
Make the distinction clearer.

Signed-off-by: Jonathan Rico <jonathan.rico@nordicsemi.no>
2024-03-26 16:19:30 -04:00
Jonathan Rico 89b64f8210 doc: Bluetooth: Audio -> LE Audio
We now have BT Classic audio activity, we should be more specific.

Signed-off-by: Jonathan Rico <jonathan.rico@nordicsemi.no>
2024-03-26 16:19:30 -04:00
Jonathan Rico e701188bce doc: Bluetooth: Change ordering of sections
It makes more sense that way:
A developer wants to know in order:
- what features we have
- if they are qualified/qualifiable
- how the stack is architected / what parts are where
- how to develop an app
- tools to develop said apps (+ shell)

Signed-off-by: Jonathan Rico <jonathan.rico@nordicsemi.no>
2024-03-26 16:19:30 -04:00
Jonathan Rico 698a0c3193 doc: Bluetooth: Remove "Bluetooth" from titles
It adds unnecessary noise in the navigation pane.

We don't do this for other chapters (e.g. kernel services don't say
"Kernel Services System Threads" in the title, just "System Threads").

Signed-off-by: Jonathan Rico <jonathan.rico@nordicsemi.no>
2024-03-26 16:19:30 -04:00
Jonathan Rico e043f06fb7 doc: Bluetooth: Rename overview.rst and add links
This page only ever had one section: supported features.
Added links to the relevant sections for each layer.

Signed-off-by: Jonathan Rico <jonathan.rico@nordicsemi.no>
2024-03-26 16:19:30 -04:00
Jonathan Rico b6aefe9a67 doc: Bluetooth: move -pics.rst into ics/ folder
Less clutter.

Signed-off-by: Jonathan Rico <jonathan.rico@nordicsemi.no>
2024-03-26 16:19:30 -04:00
Jonathan Rico c44cbaf868 doc: Bluetooth: Add ToC to bluetooth-tools.rst
Also capitalize title like the other pages.

Signed-off-by: Jonathan Rico <jonathan.rico@nordicsemi.no>
2024-03-26 16:19:30 -04:00
Jonathan Rico 89d05bbc76 doc: Bluetooth: organize API page in sections
Makes it easier to find what you're looking for.

Signed-off-by: Jonathan Rico <jonathan.rico@nordicsemi.no>
2024-03-26 16:19:30 -04:00
Jonathan Rico d14baba122 doc: Bluetooth: add sections and links to -dev
Add sections and links for `bluetooth-dev.rst`

Signed-off-by: Jonathan Rico <jonathan.rico@nordicsemi.no>
2024-03-26 16:19:30 -04:00
Jonathan Rico fbe91cd654 doc: Bluetooth: move btmon instructions
Move so both sections referring to btmon are on the same page.

Signed-off-by: Jonathan Rico <jonathan.rico@nordicsemi.no>
2024-03-26 16:19:30 -04:00
Lukasz Madej a64a64b3c2 drivers: charger: charger_max20355: handle thermistor mode
Allow to configure thermistor monitoring mode.

Signed-off-by: Lukasz Madej <l.madej@grinn-global.com>
2024-03-26 16:18:31 -04:00
Lukasz Madej bda4c18fc9 drivers: charger: charger_max20355: handle recharge threshold
Allow to configure recharge threshold.

Signed-off-by: Lukasz Madej <l.madej@grinn-global.com>
2024-03-26 16:18:31 -04:00
Lukasz Madej e8788deafa dts: battery: add property
Add `re-charge-voltage-microvolt` property allowing to set
limit to automatically start charging again.

Signed-off-by: Lukasz Madej <l.madej@grinn-global.com>
2024-03-26 16:18:31 -04:00
Lukasz Madej f1b35a5c78 drivers: charger: charger_max20335: handle minimum system voltage
Allow to configure minimum system voltage threshold parameter.

Signed-off-by: Lukasz Madej <l.madej@grinn-global.com>
2024-03-26 16:18:31 -04:00
Lukasz Madej e43f6f5d2a drivers: charger: charger_max20335: rename register related macros
Rename macros related to charger harware registers to make them
consistent.

Signed-off-by: Lukasz Madej <l.madej@grinn-global.com>
2024-03-26 16:18:31 -04:00
Lukasz Madej c7c168b378 drivers: charger: charger_max20335: rename macro to reduce ambiguity
The ILimCntl name can be understood as both register name and its field
name. Therefore it is better to change macro name so it contains both
register and field name. Second field of this register will be also
utilized by this driver in the future and new code will be aligned to
this naming convention.

Signed-off-by: Lukasz Madej <l.madej@grinn-global.com>
2024-03-26 16:18:31 -04:00
Lukasz Madej b2c460f274 drivers: charger: charger_max20335: fix linear range usage
Fix validation of `linear_range_get_index()` results.
The function can resturn both 0 or -ERANGE but -EINVAL is never
returned. Use comparison against 0 to make the validation robust.

Use valid maximum index for the linear range. The 0x0C is reserved
value and should not be used. Therefore replace it with 0x0B.

Signed-off-by: Lukasz Madej <l.madej@grinn-global.com>
2024-03-26 16:18:31 -04:00