Commit Graph

50384 Commits

Author SHA1 Message Date
Martí Bolívar 0b4d3286bb samples: mesh: clean up
Drop device_get_binding() for microbit, using a gpio_dt_spec instead.
Rename the 'button' global to 'button_work' since it's a k_work
related to the button and does not actually represent the button
itself.

Fix a typo in the docs.

Signed-off-by: Martí Bolívar <marti.bolivar@nordicsemi.no>
2021-03-29 16:33:51 +02:00
Martí Bolívar 0af09a5772 samples: mesh: bbc_microbit SRAM improvements
Save a bit more SRAM on bbc_microbit by tuning some Kconfigs.

Mark some arrays const to try to avoid stack allocating them while
we're here.

Signed-off-by: Martí Bolívar <marti.bolivar@nordicsemi.no>
2021-03-29 16:33:51 +02:00
Martí Bolívar 1dde940f86 samples: periodic_sync: drop device_get_binding()
Use a gpio_dt_spec instead.

Signed-off-by: Martí Bolívar <marti.bolivar@nordicsemi.no>
2021-03-29 16:33:51 +02:00
Martí Bolívar b5ca2e0ec3 samples: hci_uart: drop device_get_binding()
Use DEVICE_DT_GET on the chosen node directly.

The only in-tree board using the Kconfig option is rv32m1_vega_ri5cy.
It already sets the chosen node in the application overlay, albeit
incorrectly, so just fix it there and remove the now-redundant Kconfig
setting. That in turn triggers other build errors for this board, but
they don't seem to be related to this sample.

Signed-off-by: Martí Bolívar <marti.bolivar@nordicsemi.no>
2021-03-29 16:33:51 +02:00
Martí Bolívar a68629f9a3 samples: peripheral_ht: drop device_get_binding()
Use DEVICE_DT_GET_ANY instead of hard-coding a device label property.
As far as I can tell from in-tree drivers, "TEMP_0" is nRF specific
and refers to nodes with compatible "nordic,nrf-temp", so use that and
clean up the driver Kconfig while we're here.

Signed-off-by: Martí Bolívar <marti.bolivar@nordicsemi.no>
2021-03-29 16:33:51 +02:00
Martí Bolívar efa654b67c dts: bindings: improve zephyr,bt-hci-spi-slave docs
Improve the description.

Signed-off-by: Martí Bolívar <marti.bolivar@nordicsemi.no>
2021-03-29 16:33:51 +02:00
Martí Bolívar e4c0783bfd doc: add new :dtcompatible: role / directive
This allows RST documentation to do something like this:

   See :dtcompatible:`vnd,foo` for more information.

This is transformed into a link to documentation for the "vnd,foo"
compatible.

Some devicetree compatibles may be handled by multiple bindings.
This can happen when the binding file is bus-dependent. Therefore, to
make this work, we need to change the way gen_devicetree_rest.py works
to ensure we have a good source of information for this compatible
regardless of how many bindings are associated with as follows:

- When only a single binding is associated with a compatible, the
  :dtcompatible: link goes directly to the per-binding HTML page.

- When multiple bindings are associated with a compatible, this goes
  to a new generated "disambiguation" page which links to all the
  per-binding pages.

To avoid clashes, we stick the disambiguation pages into a
compatibles/ subdirectory of the generated bindings index root
directory.

Also reorganize the generated bindings output directory into
.../bindings/subdir/binding.rst files. For example,
dts/bindings/arm/arm,dtcm.yaml now gets its generated content in
.../bindings/arm/arm,dtcm.rst.

This brings the 'category' of binding (like 'sensor', 'i2c', etc.)
into the URL, which is a useful hint.

Signed-off-by: Martí Bolívar <marti.bolivar@nordicsemi.no>
2021-03-29 16:33:51 +02:00
Martí Bolívar 005dbf1d79 device.h: DEVICE_DT_GET_ANY refactor
Rewrite this in terms of DT_COMPAT_GET_ANY_STATUS_OKAY().

Signed-off-by: Martí Bolívar <marti.bolivar@nordicsemi.no>
2021-03-29 16:33:51 +02:00
Martí Bolívar 12eece0b22 devicetree: add DT_COMPAT_GET_ANY_STATUS_OKAY()
This is a helper which allows you to skip the intricacies of instance
numbers to express the intent of "give me a random enabled node with
this compatible; I don't care which one".

Signed-off-by: Martí Bolívar <marti.bolivar@nordicsemi.no>
2021-03-29 16:33:51 +02:00
Martí Bolívar c36637b491 devicetree: make @param compat docstrings consistent
Our description of 'compat' parameters is all over the place.
Make it consistent by picking one.

Signed-off-by: Martí Bolívar <marti.bolivar@nordicsemi.no>
2021-03-29 16:33:51 +02:00
Petri Oksanen 4c88abcf7f drivers: nrf: uarte: rx flush amount calculation
The NRF UARTE has an undocumented feature that when you flush the RX
FIFO, the RXAMOUNT register is not cleared to zero if the FIFO is in
fact empty. This fix is correcting something that was most likely a
typo.

Signed-off-by: Petri Oksanen <petri@iote.ai>
2021-03-29 14:16:50 +02:00
Krzysztof Chruscinski 0e39b7d707 tests: lib: cbprintf: Update test after adding alignment parameter
Add validation of the case when package buffer is not aligned to
CBPRINTF_PACKAGE_ALIGNMENT.

Signed-off-by: Krzysztof Chruscinski <krzysztof.chruscinski@nordicsemi.no>
2021-03-29 14:08:41 +02:00
Krzysztof Chruscinski 4cbded9cc2 tests: unit: cbprintf: Update test after adding alignment parameter
Extended test to validate case when package buffer is not aligned to
CBPRINTF_PACKAGE_ALIGNMENT.

Signed-off-by: Krzysztof Chruscinski <krzysztof.chruscinski@nordicsemi.no>
2021-03-29 14:08:41 +02:00
Krzysztof Chruscinski 6ce2fe061a lib: os: cbprintf: Fix legth field in static package
Byte value was written instead of word.

Signed-off-by: Krzysztof Chruscinski <krzysztof.chruscinski@nordicsemi.no>
2021-03-29 14:08:41 +02:00
Krzysztof Chruscinski 65474d8d67 lib: os: cbprintf: Improvements for sparc
Unified define used for handling sparc case in static and
runtime packaging. Reworked macro for storing argument in
static packaging.

Signed-off-by: Krzysztof Chruscinski <krzysztof.chruscinski@nordicsemi.no>
2021-03-29 14:08:41 +02:00
Krzysztof Chruscinski c26e08a51f lib: os: cbprintf: Add alignment offset to packaging
Added parameter to CBPRINTF_STATIC_PACKAGE which indicates buffer
alignment offset compared to CBPRINTF_PACKAGE_ALIGNMENT. When offset
is set to 0, macro assumes that input buffer is aligned to
CBPRINTF_PACKAGE_ALIGNMENT. When offset is positive, macro assumes
that buffer address is shifted by given number of bytes to
CBPRINTF_PACKAGE_ALIGNMENT alignment.

Extended cbprintf_package to use len argument as alignment offset
indicator when calculating length only (package pointer is null).

Features are not available for xtensa platform which seems to
require 16 byte alignment from the package. It is only an assumption
due to lack of the documentation and may be fixed in the future.

Feature allows to avoid unnecessary padding when package is part of
a message and preceeded by a header of a known size. For example,
message header on 32 bit architecture has 12 bytes, long doubles are
not used so cbprintf requires 8 byte alignment. Without alignment
offset indicator, package containing just a string with one argument
would need 4 byte padding after the header and 4 byte padding after
the package. Message would be 32 bytes long. With alignment offset
indication both paddings are not needed and message is only 24 bytes
long.

Signed-off-by: Krzysztof Chruscinski <krzysztof.chruscinski@nordicsemi.no>
2021-03-29 14:08:41 +02:00
Daniel Leung 21f6217313 toolchain: xcc: nullify __deprecated macro
XCC does not support using the deprecated attribute for enum
as it is based on old GCC 4.2. So nullify the macro to avoid
compilation errors.

Fixes #33548

Signed-off-by: Daniel Leung <daniel.leung@intel.com>
2021-03-29 07:53:23 -04:00
Anas Nashif d8f698703b kernel: idle/z_sched_prio_cmp: match implementation to prototype
The identifiers used in the declaration and definition of a function
shall be identical [MISRAC2012-RULE_8_3-b]

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2021-03-29 07:52:42 -04:00
Anas Nashif f5a1be80cd libc: strncat: match implementation to declaration
The identifiers used in the declaration and definition of a function
shall be identical [MISRAC2012-RULE_8_3-b]

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2021-03-29 07:52:42 -04:00
Anas Nashif 841d6f3ba6 libc: malloc: match implementation to declaration
The identifiers used in the declaration and definition of a function
shall be identical [MISRAC2012-RULE_8_3-b]

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2021-03-29 07:52:42 -04:00
Anas Nashif 05d7d32122 posix: timer: match implementation to declaration
The identifiers used in the declaration and definition of a function
shall be identical [MISRAC2012-RULE_8_3-b]

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2021-03-29 07:52:42 -04:00
Anas Nashif 7c8d932e65 libc: gmtime_r: match implementation to declaration
The identifiers used in the declaration and definition of a function
shall be identical [MISRAC2012-RULE_8_3-b]

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2021-03-29 07:52:42 -04:00
Anas Nashif 8415c94ab1 libc: printf/..: match implementation to declaration
The identifiers used in the declaration and definition of a function
shall be identical [MISRAC2012-RULE_8_3-b]

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2021-03-29 07:52:42 -04:00
Anas Nashif 27af48417e libc: snprintf/..: match implementation to declaration
The identifiers used in the declaration and definition of a function
shall be identical [MISRAC2012-RULE_8_3-b]

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2021-03-29 07:52:42 -04:00
Anas Nashif 0576a3d0e6 libc: fputs/puts: match implementation to declaration
The identifiers used in the declaration and definition of a function
shall be identical [MISRAC2012-RULE_8_3-b]

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2021-03-29 07:52:42 -04:00
Anas Nashif 4f52519c7e libc: strtol/strtoul: match implementation to declaration
The identifiers used in the declaration and definition of a function
shall be identical [MISRAC2012-RULE_8_3-b]

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2021-03-29 07:52:42 -04:00
Jukka Rissanen 97bf53fdcf net: if: Add locking when setting/getting hoplimit or ttl
Locking was missing when setting or getting IPv6 hop limit
or IPv4 time-to-live values.

Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2021-03-29 07:40:24 -04:00
Jukka Rissanen b07ba6db85 net: ipv4: Discard pkt if TTL is 0
If the TTL value in the IPv4 header is 0, then the packet needs to
be discarded.

Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2021-03-29 07:40:24 -04:00
Jukka Rissanen fafb1b82f4 net: context: Print network interface index with pointer value
Makes debugging easier if interface index is printed with
the pointer.

Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2021-03-29 07:40:24 -04:00
Jukka Rissanen 362591810f net: config: Try to only use auto started interface
If the first network interface is down when the net config init
is run, then the IP addresses etc would be set to wrong network
interface. So when initializing the network, try to first find
a network interface that is auto started and use that to configure
IP addresses etc.

Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2021-03-29 07:40:24 -04:00
Jukka Rissanen fd4928aedd net: shell: Print network interface index instead of pointer
When printing network interface information print index or
index + pointer, so that the output is more user friendly.

Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2021-03-29 07:40:24 -04:00
Jukka Rissanen e2083ea099 net: if: Add function to set IPv4 ttl to interface
We had a functio to get IPv4 ttl but none for setting it.

Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2021-03-29 07:40:24 -04:00
Jukka Rissanen 5c4bcf110d net: if: Mark IPv6 address valid for point2point links
As DAD is not done for point-to-point links, we can mark them
valid immediately. If this is not done, then the address will
never be picked as a source address to a sent packet.

Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2021-03-29 07:40:24 -04:00
Jukka Rissanen e291cddb31 net: shell: Print network interface flags values
Useful to know what flags are set for the network interface
so print them in the shell by the "net iface" command.

Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2021-03-29 07:40:24 -04:00
Jukka Rissanen cf9edcd3b4 net: shell: Add command to show virtual interface information
Add "net virtual" to show virtual network interface information.

Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2021-03-29 07:40:24 -04:00
Jukka Rissanen 64b7a11ccc samples: net: echo-server: Add tunneling interface support
Add support for IP tunneling with overlay-tunnel.conf file.

Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2021-03-29 07:40:24 -04:00
Jukka Rissanen 68835f1006 samples: net: virtual: Simple app for creating virtual interfaces
The app does not do much but shows how virtual network interfaces
support can be used.

Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2021-03-29 07:40:24 -04:00
Jukka Rissanen 8ea7eb9e51 tests: net: virtual: Add unit tests for checking tunneling
Add tests to verify that IP tunneling works as expected.

Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2021-03-29 07:40:24 -04:00
Jukka Rissanen 10142ac99c net: virtual: ipip: Add IP tunneling driver
Add a IP-to-IP tunneling driver. It supports both IPv4 and IPv6.

Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2021-03-29 07:40:24 -04:00
Jukka Rissanen 36be096c43 net: virtual: Add virtual network interface support
This can be used to implement tunneling, VPN etc. The virtual
interfaces can be chained together to support multilayer
network interfaces.

Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2021-03-29 07:40:24 -04:00
Jukka Rissanen 3d34c5f4b7 net: ipv4: Add utility func to create IPv4 header
Add a function that allow caller to create IPv4 header with
possibility to set various fields in the header.

Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2021-03-29 07:40:24 -04:00
Jukka Rissanen 897698bc78 net: if: Allow app to disable IPv4 or IPv6 for the interface
Application can disable IPv4 or IPv6 later if those are not
needed nor used for a given network interface.

Fixes #14581

Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2021-03-29 07:40:24 -04:00
Daniel Leung 7ce8c77650 doc: guides: x86: how to specify extra page mappings
This adds to page on the x86 virtual memory about how to specify
extra page table mappings during build.

Signed-off-by: Daniel Leung <daniel.leung@intel.com>
2021-03-28 08:30:06 -04:00
Daniel Leung 7a27509d6f x86: gen_mmu: allow script to take extra arguments
This extends the cmake build script to take in extra arguments
for gen_mmu.py.

Signed-off-by: Daniel Leung <daniel.leung@intel.com>
2021-03-28 08:30:06 -04:00
Daniel Leung 4b477a9864 x86: mmu: allow copying page directory entries with large pages
This changes the assert when a large page is encountered to
copying the page directory entry to the new page directory.
This is needed when a large page entry is generated by
gen_mmu.py. Note that this still asserts when there are entries
of large page at higher level.

Signed-off-by: Daniel Leung <daniel.leung@intel.com>
2021-03-28 08:30:06 -04:00
Daniel Leung 51263f73aa x86: gen_mmu: allow specifying extra mappings
This extends gen_mmu.py to accept additional mappings passed via
command line.

Signed-off-by: Daniel Leung <daniel.leung@intel.com>
2021-03-28 08:30:06 -04:00
Daniel Leung 0886a73df8 x86: gen_mmu: fail if reserved page table space is too small
This makes the gen_mmu.py script to error out if the reserved space
for page table in zephyr_prebuilt.elf is not large enough to
accommodate the generated page table. Let catch this at build time
instead of mysterious hangs when loading the page table at boot.

Signed-off-by: Daniel Leung <daniel.leung@intel.com>
2021-03-28 08:30:06 -04:00
Daniel Leung 3ebcd8307e x86: mmu: add kconfig CONFIG_X86_EXTRA_PAGE_TABLE_PAGES
The whole page table is pre-allocated at build time and is
dependent on the range of address space. This kconfig allows
reserving extra pages (of size CONFIG_MMU_PAGE_SIZE) to
the page table so that gen_mmu.py can make use of these
extra pages.

Signed-off-by: Daniel Leung <daniel.leung@intel.com>
2021-03-28 08:30:06 -04:00
Bob Recny c36f0ca8af boards: arm: Add support for BMD-300-EVAL
Add support for u-blox BMD-300-EVAL. Also includes BMD-301-EVAL
and BMD-350-EVAL. All share the nRF52832, and are functionally
equivalent to the nRF52dk_nrf52832 with the exception of not
having debug-in and the shield SWD header.

Note that header pin numbers noted in index.rst are shown with
respect to the pin 1 markings on the BMD-3xx-EVAL boards, and are
flipped from the nRF52dk_nrf52832.

Tested with blinky, button, and Bluetooth peripheral_hr
Corrected type in index.rst (should be nRF52dk_nrf52832, not ..810)

Signed-off-by: Bob Recny <bob.recny@u-blox.com>
2021-03-28 08:02:28 -04:00
Peter Bigot d6567ad494 boards: particle_*: fix antenna initialization
The GPIO drivers are initialized in the POST_KERNEL level with the
default priority, so whether they're available at the time the sysinit
function requires them depends on how the linker orders the init
records.  Since we can't set a priority relative to the default
priority, hard-code the maximum priority and hope it's good enough.

Signed-off-by: Peter Bigot <peter.bigot@nordicsemi.no>
2021-03-27 08:59:25 -04:00