Compare commits

..

139 Commits

Author SHA1 Message Date
Christopher Friedt
3f826560aa release: Zephyr 2.7.0
LTS2 Release \o/

Set version to 2.7.0

Signed-off-by: Christopher Friedt <chrisfriedt@gmail.com>
2021-10-16 21:59:47 -04:00
Christopher Friedt
21008182be doc: release: 2.7: add list of closed issues
This change adds the list of closed issue as per the release
process.

Signed-off-by: Christopher Friedt <chrisfriedt@gmail.com>
2021-10-16 21:49:58 -04:00
Christopher Friedt
5e578e5967 doc: release: 2.7: summarize major enhancements
This change adds a summary of major enhancements introduced
in v2.7.0 . There were so many it was difficult to narrow
them down!

Great work everyone!

Signed-off-by: Christopher Friedt <chrisfriedt@gmail.com>
2021-10-16 08:35:00 -04:00
Alexander Wachter
88487a2dee doc: release-notes-2.7: Added CAN release notes
This commit adds the CAN specific release-notes for the 2.7
release.

Signed-off-by: Alexander Wachter <alexander@wachter.cloud>
2021-10-15 12:17:26 -04:00
Christopher Friedt
f2cae5145d doc: release: 2.7: dns-sd service type enumeration
Added release note for DNS-SD Services Type Enumeration

Signed-off-by: Christopher Friedt <chrisfriedt@gmail.com>
2021-10-15 09:21:21 -04:00
Christopher Friedt
9366238a33 doc: release: 2.7: remove duplicate IPM entry
Remove duplicate IPM entry.

Signed-off-by: Christopher Friedt <chrisfriedt@gmail.com>
2021-10-15 09:21:21 -04:00
Torsten Rasmussen
33f30745a5 doc: updated occurrences of GNU ARM Embedded to GNU Arm Embedded
Updated the doc to use GNU Arm Embedded which is the correct term
according to the official Arm documentation at the time of this commit.

Signed-off-by: Torsten Rasmussen <Torsten.Rasmussen@nordicsemi.no>
2021-10-15 09:20:08 -04:00
Torsten Rasmussen
275dc8275f doc: Arm Compiler 6 description added to the 3rd party toolchain page
This commit adds description on how to use the Arm Compiler 6 / armclang
toolchain with Zephyr.

Signed-off-by: Torsten Rasmussen <Torsten.Rasmussen@nordicsemi.no>
2021-10-15 09:20:08 -04:00
Henrik Brix Andersen
ae757fb704 actions: exclude Python 3.6 tests on macos-latest
Python 3.6 support is no longer available on macos-latest. Exclude it.

Signed-off-by: Henrik Brix Andersen <henrik@brixandersen.dk>
2021-10-15 06:10:54 -04:00
Christopher Friedt
5e1dc921b0 release: Zephyr 2.7.0-rc5
Set version to 2.7.0-rc5

Signed-off-by: Christopher Friedt <chrisfriedt@gmail.com>
2021-10-12 12:51:48 -04:00
Bradley Bolen
5ccffff5b0 doc: release: 2.7: Add release note for aarch32
Mention the addition of MPU support for Cortex-R.

Signed-off-by: Bradley Bolen <bbolen@lexmark.com>
2021-10-12 11:51:58 -04:00
David Leach
dd460a9410 doc: release: 2.7: Add NXP SoC changes
Documents significant changes to NXP SoC platforms in the
2.7.0 release.

Signed-off-by: David Leach <david.leach@nxp.com>
2021-10-12 11:51:42 -04:00
Piotr Pryga
7e5ac1bfe6 Bluetooth: controller: df: fix handling of max count of IQ reports
There was an error in handling of max number of IQ reports
generated by controller. Accordin to BT Core Spec 5.1 the host
may request a number of CTEs to be sampled and reported by
controller while enable IQ sampling. The max_cte_count value
set to zero means sample all CTEs in a periodic advertising chain.

The commit fixes wrong handling of the max_cte_count provided
value to generate expected number of IQ reports.

Signed-off-by: Piotr Pryga <piotr.pryga@nordicsemi.no>
2021-10-12 09:35:40 -04:00
Peter Mitsis
f215361e1c tracing: fix k_thread_abort tracing references
Fixes undefined references to sys_port_trace_k_thread_abort_enter()
and sys_port_trace_k_thread_abort_enter().

Signed-off-by: Peter Mitsis <peter.mitsis@intel.com>
2021-10-12 09:35:16 -04:00
Andrzej Głąbek
7e7d71ebda drivers: pwm_nrfx: Fix handling of zero length periods
When the driver was called to set the period length for a channel
to 0, it set the COUNTERTOP register in the PWM peripheral to 0,
what resulted in an undefined behavior of the peripheral (and lack
of the STOPPED event sometimes).
The PWM API does not precise how should a zero length period be
handled; some drivers return the -EINVAL error in such case, some
do not. This patch fixes the pwm_nrfx driver so that it does not
change the previously used COUNTERTOP register value when the period
length is set to 0, and because the pulse cycles are always limited
by the driver to period cycles (so 0 in this case), in result the
relevant channel is simply deactivated. This allows users to switch
off a channel by requesting the pulse width to be set to 0 without
providing a non-zero period in such call.

Signed-off-by: Andrzej Głąbek <andrzej.glabek@nordicsemi.no>
2021-10-12 09:34:51 -04:00
Piotr Pryga
6939183a58 Bluetooth: controller: Make per adv filtering by CTE cond compilable
The filtering of periodic advertisements by scanner may be not needed
in certain situations e.g. while use of periodic advertising by BT ISO.
To make the code smaller and avoid execution of not needed code the
functionality will be conditionally compilable. It may be enabled
or disabled by use of CONFIG_BT_CTLR_SYNC_PERIODIC_CTE_TYPE_FILTERING
Kconfig option.

Signed-off-by: Piotr Pryga <piotr.pryga@nordicsemi.no>
2021-10-12 09:34:44 -04:00
Piotr Pryga
6f045c1166 tests: Bluetooth: bsim_test_iso: Change wait time in BIG receiver
The receiver and transmitter in the test are synchronized by
use of sleep functions. The change in handling of periodic
advertising synchronized event caused missmach in waiting
times. Receiver is notified about established synchronization
later that it was in the past. Due to that the wait for end
of transmitter operation was too long.

Temporary fix for the problem is decrease of receiver sleep
time by one periodic advertising interval.

Signed-off-by: Piotr Pryga <piotr.pryga@nordicsemi.no>
2021-10-12 09:34:44 -04:00
Piotr Pryga
d9eb21aa1e Bluetooth: controller: Add per sync filt by CTE type for SOC w/o DFE
First implementation of periodic advertising sync filtering
requires existence of Direction Finding Extension in Radio
peripheral.
To add the filtering support for other Nodric SOCs software
based PDU traversing for CTEInfo should be implemented.

In case there is no DFE in Radio peripheral, actual filtering
is done in ULL.

The commit provides necessary changes to previous solution.

Signed-off-by: Piotr Pryga <piotr.pryga@nordicsemi.no>
2021-10-12 09:34:44 -04:00
Piotr Pryga
2b8079aa38 samples: Bluetooth: df: enable filtering of per adv by CTE type
Enable filtering of periodic advertisements to synchronize
with advertisenemts that include CTE.

Signed-off-by: Piotr Pryga <piotr.pryga@nordicsemi.no>
2021-10-12 09:34:44 -04:00
Piotr Pryga
81136cbc79 Bluetooth: controller: ULL: add per sync filtering by CTE type
Follow up on changes in lower link layer to add filtering
of periodic advertisements synchronization by CTE type.

The NODE_RX_TYPE_SYNC is used to transport information that:
- Sync is established. In such situation the node_rx
  includes data related with received PDU
- Sync scanning is terminated.
In first case ULL will generate NODE_RX_TYPE_SYNC_REPORT
after sending NODE_RX_TYPE_SYNC.

Also EVENT_DONE_EXTRA_TYPE_SYNC handling has additional
execution path that terminates sync scanning if requested
by lower link layer. In other case it adjusts sync scan
window and maintains timeout as usual.

Signed-off-by: Piotr Pryga <piotr.pryga@nordicsemi.no>
2021-10-12 09:34:44 -04:00
Piotr Pryga
42276f5bbd Bluetooth: controller: rework per scan lll to allow filt by CTE type
Periodic advertisement synchronization may be filtered by CTE type.
If particular CTE type is not allowed then depening on filtering policy:
- if filtering policy is off synchronization if terminated
- if filtering policy is on synchronization is continued to
  synchonize with another device from allowed adverisements list.
If synchronization is established and peer device changes CTE type
to one that is not allowed, synchronization should be maintained.

There are two new execution paths. First one is executed when
synchronization is created. In this case CTEILINE is enabled
to parse PDU for CTEInfo field. In this execution path CTE
type is verified. Second execution path does not include
parsing PDU for CTEInfo and verification of CTE type.

Information about sync allowed is added to node_rx instance
that transports received PDU data. In case the sync has to be
terminated the node_rx will not hold PDU data.

Also done event is extended with information about sync
termination if CTE type is not allowed and filtering
policy is off.

Signed-off-by: Piotr Pryga <piotr.pryga@nordicsemi.no>
2021-10-12 09:34:44 -04:00
Piotr Pryga
36bec3599d Bluetooth: radio: move radio_df_cte_inline_set_enabled to radio.c
To enable runtime parsing of PDU to find CTEInfo field CTEINLINE mode
has to be enabled. Thanks to that it is possible to verify if the PDU
has allowed CTE type e.g. for periodic advertising synchornization.
To run CTEInfo parsing other parametrers of CTEINLINE are not relevant.
If Radio is set to disable after PDU END event the CTE sampling
will not be processed.

The commit moves the radio_df_cte_inline_set_enable function to make
it accessible even the direction finding features are disabled.

Signed-off-by: Piotr Pryga <piotr.pryga@nordicsemi.no>
2021-10-12 09:34:44 -04:00
Piotr Pryga
587ad45686 Bluetooth: hci: Add handling of allowed CTE types for per sync create
Add missing code responsible for handling of allowed CTE types
in HCI_LE_Periodic_Advertising_Create_Sync command.

Signed-off-by: Piotr Pryga <piotr.pryga@nordicsemi.no>
2021-10-12 09:34:44 -04:00
Piotr Pryga
169b85c1e3 Bluetooth: hci: Add helper macros for ver of disallowed CTE types
The commit adds helper macros for verification of disallowed
CTE types when periodic advertising synchornization is created.

The macros are added here, because they are directly related
with values specified by BT Core 5.1 specification.

Signed-off-by: Piotr Pryga <piotr.pryga@nordicsemi.no>
2021-10-12 09:34:44 -04:00
Flavio Ceolin
a9aba82522 pm: Fix device resume order
Devices need to be resumed in the reverse order they are suspended.
e.g: devA +---> devB ---> devD
          |
          +---> devC

They are initialized in the following order, devA -> devB -> devC ->
devD, and suspended starting from the end of the list, devD -> devC ->
devB -> devA. When they are suspended they are temporary put in a list
that is used later to resume them.

This list has to be iterated from the end to the beginning, otherwise a
device may be resumed before its parent.

Signed-off-by: Flavio Ceolin <flavio.ceolin@intel.com>
2021-10-12 09:33:41 -04:00
Robert Melchers
e7df33e8b7 net: ethernet: ARP addresses being filled with mcast addresses
Fixes #38994, ARP messages were being sent to IPvXmcast MAC addresses
rather than the expected source MAC address or the broadcast address.

Signed-off-by: Robert Melchers <rmelch@hotmail.com>
2021-10-12 09:33:31 -04:00
Christopher Friedt
29b52a81c9 net: mdns + dns_sd: fix regression that breaks ptr queries
While adding support for service type enumeration, a regression was
introduced which prevented mDNS ptr query responses.

1. There was an off-by-one error with label size checking
2. Valid queries were failing to match in `dns_rec_match()` due to
   not checking for either NULL or 0 "wildcard" port

Fixes #39284

Signed-off-by: Christopher Friedt <chrisfriedt@gmail.com>
2021-10-12 09:32:31 -04:00
Flavio Ceolin
af4c3bc983 doc: release: 2.7: add release notes for PM
Update V2.7.0 release notes document with noticeable changes
related to power management.

Signed-off-by: Flavio Ceolin <flavio.ceolin@intel.com>
2021-10-12 09:02:17 -04:00
Maureen Helm
257df9a236 doc: release: Add sensor release notes for v2.7.0
Documents significant changes to sensor drivers in the v2.7.0 release,
including new drivers added and existing drivers modified.

Signed-off-by: Maureen Helm <maureen.helm@intel.com>
2021-10-12 09:01:45 -04:00
Andrzej Głąbek
b60b5b97a2 doc: release: Add release notes for ADC, DMIC, I2S, and PWM drivers
Update v2.7 release notes with entries for added ADC, DMIC, I2S,
and PWM drivers.

Signed-off-by: Andrzej Głąbek <andrzej.glabek@nordicsemi.no>
2021-10-12 09:00:24 -04:00
Kumar Gala
8a97c83040 arm: aarch32: mpu: Fix build issue with assert
The assert log of z_priv_stacks_ram_start failed to build due to passing
&z_priv_stacks_ram_start instead of just z_priv_stacks_ram_start.

Fixes #39190

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2021-10-07 14:02:58 -05:00
Evgeniy Paltsev
42144217be doc: release notes: ARC
2.7 release notes for ARC related changes

Signed-off-by: Eugeniy Paltsev <Eugeniy.Paltsev@synopsys.com>
Signed-off-by: Evgeniy Paltsev <PaltsevEvgeniy@gmail.com>
2021-10-06 21:24:06 -04:00
Evgeniy Paltsev
4ba168dc4d DOC: ARC: update arc status page
We support ARCv3 HS6x SMP systems now - let's update the
status in the documentation.

Signed-off-by: Eugeniy Paltsev <Eugeniy.Paltsev@synopsys.com>
Signed-off-by: Evgeniy Paltsev <PaltsevEvgeniy@gmail.com>
2021-10-06 21:24:06 -04:00
Flavio Ceolin
d760c5e322 doc: release: 2.7: add release notes for security
Update V2.7.0 release notes document with vulnerabilities fixes.

Signed-off-by: Flavio Ceolin <flavio.ceolin@intel.com>
2021-10-06 21:23:54 -04:00
Flavio Ceolin
7b880f11f8 doc: security: Update information about CVE-2021-3436
Update old CVE the proper information.

Signed-off-by: Flavio Ceolin <flavio.ceolin@intel.com>
2021-10-06 21:23:54 -04:00
Flavio Ceolin
592c6b1db2 doc: security: Update information about CVE-2021-3510
Update old CVE the proper information.

Signed-off-by: Flavio Ceolin <flavio.ceolin@intel.com>
2021-10-06 21:23:54 -04:00
Flavio Ceolin
f52dce1ee3 doc: security: Update information about CVE-2021-3625
Update CVE that left embargo with the proper information.

Signed-off-by: Flavio Ceolin <flavio.ceolin@intel.com>
2021-10-06 21:23:54 -04:00
Flavio Ceolin
7f3562bfe4 doc: security: Update information about CVE-2021-3319
Update old CVE the proper information.

Signed-off-by: Flavio Ceolin <flavio.ceolin@intel.com>
2021-10-06 21:23:54 -04:00
Flavio Ceolin
fcc69bf015 doc: security: Update information about CVE-2021-3581
Update CVE that left embargo with the proper information.

Signed-off-by: Flavio Ceolin <flavio.ceolin@intel.com>
2021-10-06 21:23:54 -04:00
Benedikt Schmidt
c140604510 docs: Improve documentation of bootloader usage
Describes the necessity to specify the code partition as the chosen one.

Signed-off-by: Benedikt Schmidt <benedikt.schmidt@embedded-solutions.at>
2021-10-06 21:23:09 -04:00
Carles Cufi
d229d45ddd doc: release notes: Add Bluetooth relnotes for 2.7.0
I have excluded most fixes from this release notes, since it is
difficult to identify those that are worth documenting. Intead I have
focused on new features and major refactoring.

Signed-off-by: Carles Cufi <carles.cufi@nordicsemi.no>
2021-10-06 21:21:24 -04:00
Evgeniy Paltsev
8790789c5f ARC: HS6x: nSIM: drop unsupported dcache_uncached_region from mdb.args
HS6x nSIM doesn't have dcache_uncached_region property. Its presence
in configs (mdb.args) causes issues with 2021.06 nSIM, so let's
drop this property as it isn't used anyway.

Signed-off-by: Eugeniy Paltsev <Eugeniy.Paltsev@synopsys.com>
Signed-off-by: Evgeniy Paltsev <PaltsevEvgeniy@gmail.com>
2021-10-06 20:22:53 -04:00
Johann Fischer
7bc1deeeae doc: release-notes-2.7: add release notes for USB
Add release notes for USB.

Signed-off-by: Johann Fischer <johann.fischer@nordicsemi.no>
2021-10-06 20:22:23 -04:00
Johann Fischer
6c4fc0226d doc: usb: add CDC ACM device support documentation
Add CDC ACM device support documentation.

Co-authored-by: Carles Cufí <carles.cufi@nordicsemi.no>
Signed-off-by: Johann Fischer <johann.fischer@nordicsemi.no>
2021-10-06 20:22:23 -04:00
Johann Fischer
31dbdca2ab doc: usb: refactor USB device support documentation structure
Move related areas to their own files and order
documentation logically from lower to upper layer.
Fix gross errors and inconsistencies.

Co-authored-by: Carles Cufí <carles.cufi@nordicsemi.no>
Signed-off-by: Johann Fischer <johann.fischer@nordicsemi.no>
2021-10-06 20:22:23 -04:00
Johann Fischer
3bceb73861 doc: release-notes-2.7: add release notes for MODBUS
Add release notes for MODBUS.

Signed-off-by: Johann Fischer <johann.fischer@nordicsemi.no>
2021-10-06 20:22:04 -04:00
Johann Fischer
79bf23c5ac doc: release-notes-2.7: update release notes for disk drivers
Update release notes for disk drivers.

Signed-off-by: Johann Fischer <johann.fischer@nordicsemi.no>
2021-10-06 20:22:04 -04:00
Andy Ross
7fec8b280d tests/msgq_usage: Correct memory usage for cache-incoherent platforms
When CONFIG_KERNEL_COHERENCE=y (e.g on the various intel_adsp
platforms under SMP) it's not legal to share stack memory between
CPUs, because the stack is cached, and the L1 cache is incoherent.
The kernel will automatically detect the mistake when the memory
contains a kernel object (spinlock, IPC object, etc...).  But here the
test was just passing async buffers into the msgq layer, and nothing
watches that.

The fix is simple: make them static.

Fixes #35857

Signed-off-by: Andy Ross <andrew.j.ross@intel.com>
2021-10-06 20:21:29 -04:00
Vinayak Kariappa Chettimada
706104bdf8 tests: Bluetooth: mesh: Remove explicit disable of CSA#2
Remove explicit disable of Channel Selection Algorithm #2
in the mesh tests that use Extended Advertising.

Fixes #39188.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2021-10-06 16:44:51 -05:00
Kumar Gala
a39340a1f8 samples/subsys/mgmt/osdp: Fix build issues
The samples/subsys/mgmt/osdp utilize GPIO so having it set in the
prj.conf is needed since not all platforms enable GPIO by default.

To address the 'No SOURCES given to Zephyr library: drivers__gpio'
add a 'depends on gpio' to the sample.yaml to only build this on
platforms that have GPIO driver support.

Fixes #39180

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2021-10-06 16:44:41 -05:00
Anas Nashif
7a2b9586fa tests: logging: remove definition of SYS_CLOCK_HW_CYCLES_PER_SEC
This is not needed for the test and is very HW specific.

Fixes #39185

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2021-10-06 16:43:19 -05:00
Igor Knippenberg
708ba30959 samples: sensors: fdc2x1x: fixed bugs in pm_info()
Both ARG_UNUSED in pm_info(), cause errors when using PM_DEVICE=y.
Added a default case in pm_info(), to fix warnings.

Signed-off-by: Igor Knippenberg <igor.knippenberg@gmail.com>
2021-10-05 19:30:32 -04:00
Igor Knippenberg
903b5d78d8 drivers: sensors: fdc2x1x: removed unused fdc2x1x_data
Removing two unused "struct fdc2x1x_data" to fix warnings
when compiling with PM_DEVICE=y.

Signed-off-by: Igor Knippenberg <igor.knippenberg@gmail.com>
2021-10-05 19:30:32 -04:00
Vinayak Kariappa Chettimada
2df7257bec manifest: EDTT: Update revision
Update revision of EDTT tools.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2021-10-05 13:28:34 -04:00
Vinayak Kariappa Chettimada
9f903eeb50 tests: Bluetooth: bsim: Use separate DUT and TST EDTT builds
Use separate DUT and TST builds in EDTT HCI tests so that
the tester can send Data Length Requests with txOctets and
maxTxTime as required by the test specification. TST build
has HCI parameter checks disabled.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2021-10-05 13:28:34 -04:00
Vinayak Kariappa Chettimada
886d04860f Bluetooth: Controller: Fix HCI command parameter check failures
Fix assorted HCI command parameter check failures faced
during conformance testing.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2021-10-05 13:28:34 -04:00
Lauren Murphy
311aeef4d5 doc: misc fixes
Makes miscellaneous fixes to kernel and usermode documentation,
such as fixing broken links and adding clarifying wording.

Signed-off-by: Lauren Murphy <lauren.murphy@intel.com>
2021-10-04 20:25:01 -04:00
Tim Lin
8dacd0f873 ITE: drivers/i2c: returning negative values for error
Fixes: #38959

Currently, the I2C driver returns I2C status register value as error
code when error happen. This PR fixes returning system number and
the return values is negative for error.

Signed-off-by: Tim Lin <tim2.lin@ite.corp-partner.google.com>
2021-10-04 20:24:19 -04:00
Vinayak Kariappa Chettimada
2d0d093627 Bluetooth: Controller: Fix assertion failed [evdone]
When there are radio events with time reservations lower
than the preemption timeout of 1.5 ms, the pipeline has to
account for the maximum radio events that can be enqueued
during the preempt timeout duration. All these enqueued
events could be aborted in case of late scheduling needing
as many done event buffers.

During continuous scanning, there can be 1 active radio
event, 1 scan resume and 1 new scan prepare. If there are
peripheral prepares in addition, and due to late scheduling
all these will abort needing 4 done buffers.

If Extended Scanning is supported, then an additional
auxiliary scan event's prepare could be enqueued in the
pipeline during the preemption duration.

Fixes #36381.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2021-10-04 20:22:09 -04:00
Erwan Gouriou
0689e106c6 boards: b_u585i_iot02a: Fix ref man reference
Reference manual link was pointing to the wrong board.
Fix this.

Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
2021-10-04 20:21:28 -04:00
Szymon Janc
0d81d97bb0 tests: bluetooth: tester: Add support for L2CAP channel reconfiguration
This allows UT to reconfigure MTU of a channel and get notfied when
channel configuration changed.

Signed-off-by: Szymon Janc <szymon.janc@codecoup.pl>
2021-10-04 20:21:03 -04:00
Szymon Janc
cb2ea25e14 bluetooth: Add support for reconfiguring L2CAP channels
This allows application to increase channel's MTU and (in some cases)
MPS. When channel gets reconfigured dedicated callback is called to
inform application.

Signed-off-by: Szymon Janc <szymon.janc@codecoup.pl>
2021-10-04 20:21:03 -04:00
Martí Bolívar
50d357d77e doc: devicetree release notes for 2.7
There's enough meat here to split the content up into areas:
devicetree.h itself, Python tooling changes, and bindings changes.

I also reworked the section describing vendor prefix fixes to use a
table, which I find more readable on a second pass through it.

Signed-off-by: Martí Bolívar <marti.bolivar@nordicsemi.no>
2021-10-04 20:19:58 -04:00
Martí Bolívar
9877834c95 device: add fudge factor for handle padding
When CONFIG_USERSPACE is enabled, the ELF file from linker pass 1 is
used to create a hash table that identifies kernel objects by address.
We therefore can't allow the size of any object in the pass 2 ELF to
change in a way that would change those addresses, or we would create
a garbage hash table.

Simultaneously (and regardless of CONFIG_USERSPACE's value),
gen_handles.py must transform arrays of handles from their pass 1
values to their pass 2 values; see the file's docstring for more
details on that transformation.

The way this works is that gen_handles.py just pads out each pass 2
array so its length is the same as its pass 1 value. The padding value
is a repeated run of DEVICE_HANDLE_ENDS values. This value is the
terminator which we look for at runtime in places like
device_required_handles_get(), so there must be at least one, and we
error out in gen_handles.py if there's no room in the pass 2 array for
at least one such value. (If there is extra room, we just keep
inserting extra DEVICE_HANDLE_ENDS values to pad the array to its
original length.)

However, it is possible that a device has more direct dependencies in
the pass 2 handles array than its corresponding devicetree node had in
the pass 1 array. When this happens, users have no recourse, so that's
a potential showstopper.

To work around this possibility for now, add a new config option,
CONFIG_DEVICE_HANDLE_PADDING, whose value defaults to 0.

When nonzero, it is a count of padding handles that are inserted into
each device handles array. When gen_handles.py errors out due to lack
of room, its error message now tells the user how much to increase
CONFIG_DEVICE_HANDLE_PADDING by to work around the problem.

It looks like a real fix for this is to allocate kernel objects whose
addresses are required for hash tables in CONFIG_USERSPACE=y
configurations *before* the handle arrays. The handle arrays could
then be resized as needed in pass 2, which saves ROM by avoiding
unnecessary padding, and would avoid the need for
CONFIG_DEVICE_HANDLE_PADDING altogether.

However, this 'real fix' is not available and we are facing a deadline
to get a temporary solution in for Zephyr v2.7.0, so this is a good
enough workaround for now.

Signed-off-by: Martí Bolívar <marti.bolivar@nordicsemi.no>
2021-10-04 15:08:55 -04:00
Martí Bolívar
ea2bbb8b9e Revert "device: simplify structure of handles array"
This reverts commit ec331c6fe2.

Although it's a valid simplification under the assumption that we're
going to be padding the array out anyway, it would use extra ROM if we
fix the build system issues that are currently forcing gen_handles.py
to introduce extra padding in the handles arrays for linker pass 2.

On the (perhaps optimistic) assumption that we're going to fix the
build system, let's get rid of a commit that would get in the way. The
extra "complexity" in device_required_handles_get() is trivial.

This gets rid of a comment describing the linker passes, but the
structure of the comment is a bit misleading (and it contains
incorrect information for the results of pass 2: the terminator at the
end is DEVICE_HANDLE_ENDS, not DEVICE_HANDLE_NULL).

Signed-off-by: Martí Bolívar <marti.bolivar@nordicsemi.no>
2021-10-04 15:08:55 -04:00
Martí Bolívar
b0667a80b1 Revert "device: iterable supported devices"
This reverts commit 0c6588ff47.

It's not clear that the supported devices are being properly computed,
so let's revert this for v2.7.0 until we've had more time to think
it through.

Signed-off-by: Martí Bolívar <marti.bolivar@nordicsemi.no>
2021-10-04 15:08:55 -04:00
Martí Bolívar
e2ae4ec78c Revert "device: supported devices visitor API"
This reverts commit b01e41ccdd.

It's not clear that the supported devices are being properly computed,
so let's revert this for v2.7.0 until we've had more time to think
it through.

Signed-off-by: Martí Bolívar <marti.bolivar@nordicsemi.no>
2021-10-04 15:08:55 -04:00
Martí Bolívar
1f09c9269d Revert "tests: devicetree: test supported devices API"
This reverts commit 4c32e21fc7 with some
manual conflict resolution.

It's not clear that the supported devices are being properly computed,
so let's revert this for v2.7.0 until we've had more time to think
it through.

Signed-off-by: Martí Bolívar <marti.bolivar@nordicsemi.no>
2021-10-04 15:08:55 -04:00
Christopher Friedt
aa8c3fa22e release: Zephyr 2.7.0-rc4
Set version to 2.7.0-rc4

Signed-off-by: Christopher Friedt <chrisfriedt@gmail.com>
2021-10-01 21:55:17 -04:00
Christopher Friedt
5a5eaa3c58 tests: net: dns_sd, mdns: support service type enumeration
Tests for DNS-SD Service Type Enumeration.

Fixes #38673

Signed-off-by: Christopher Friedt <chrisfriedt@gmail.com>
2021-10-01 20:40:14 -04:00
Christopher Friedt
efd77e0958 net: dns_sd, mdns: support service type enumeration
Support DNS-SD Service Type Enumeration in the dns_sd library
and mdns_responder sample application.

For more information, please see Section 9, "Service Type
Enumeration" in RFC 6763.

https://datatracker.ietf.org/doc/html/rfc6763

Fixes #38673

Signed-off-by: Christopher Friedt <chrisfriedt@gmail.com>
2021-10-01 20:40:14 -04:00
Torsten Rasmussen
b3affe6b94 devicetree: remove support for DTC_OVERLAY_FILE in environment
Setting of DTC_OVERLAY_FILE as an environment setting was deprecated
before Zephyr 1.14 LTS.

This commit remove the support for this possibility and thus cleans up
the build system.

Signed-off-by: Torsten Rasmussen <Torsten.Rasmussen@nordicsemi.no>
2021-10-01 20:39:40 -04:00
Aleksander Wasaznik
5969c3b941 Bluetooth: Host: Fix resource leak in bt_gatt_unsubscribe
There are two simmilar functions for unsubscribing from GATT handles.

 - `gatt_sub_remove`, which is called on disconnect for every
 subscription will free the `subscriptions` entry when the entry
 represents no subscriptions.

 - `bt_gatt_unsubscribe`, called by the application, which forgets to
 free the `subscriptions` entry.

If all subscriptions grouped in a `subscriptions` entry are removed
using `bt_gatt_unsubscribe` before disconnect, there are no
subscriptions left to call `gatt_sub_remove` on. The `subscriptions`
entry is then never freed.

The above results in a resource leak of a `subscriptions` entry.

This fix makes explicit and enforces the invariant that there should not
be entries in `subscriptions` with an empty subscription list.

Fixes #38688

Signed-off-by: Aleksander Wasaznik <aleksander.wasaznik@nordicsemi.no>
2021-10-01 20:37:56 -04:00
Piotr Pryga
6db7778c81 tests: Bluetooth: df: Add test to verify correctness of relase of PDUs
Add unit tests that will ensure the CTE disable operation does not
cause breaking of LLL operations by too early release of chained PDUs.
The tests verify if numbers of PDUs in free PDUs fifo and free PDUs
memory pool are correct.

Signed-off-by: Piotr Pryga <piotr.pryga@nordicsemi.no>
2021-10-01 20:37:32 -04:00
Piotr Pryga
bd6523195c Bluetooth: controller: Fix ASSERT caused by ULL releasing chain PDUs
When CTE is enabled for periodic advertising and number of CTE is
greater than number of PDUs in a chain, that are needed to transport
advertising data, there are additional empty PDUs used for transport
CTE.

CTE transmission may be disabled when periodic advertising event is
pending in LLL. rem_cte_info_from_per_adv_chain removed CTEInfo field
from extended advertising header in chained PDUs. When there were found
empty PDUs (created to transport CTE only), they were released from
the chain that was currently used by LLL. That caused an assert in
isr_tx handler due to broken advertising chain.

The rem_cte_info_from_per_adv_chain may not relese PDUs that are in
use by LLL. The PDUs may be released by LLL in prepare step when
advertising pdu double buffer is swapped by lll_adv_sync_data_latest-
_get.

This PR fixes that issue.

Signed-off-by: Piotr Pryga <piotr.pryga@nordicsemi.no>
2021-10-01 20:37:32 -04:00
Vinayak Kariappa Chettimada
701c560901 Bluetooth: Controller: Fix assert on aux LLL scheduled chain reception
Fix asserted in ULL due to incorrect resumption of scan
window when auxiliary channel chain PDU is LLL scheduled by
a ULL scheduled auxiliary channel PDU reception.

The issue is solved by having `is_chain_sched` flag in the
auxiliary channel scan context and using the already present
`is_aux_sched` in the primary channel scan context to
differentiate if the auxiliary PDU Rx ISR is to return back
to primary channel scan window or to close the auxiliary
chain PDU reception radio event.

Relates to #38146.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2021-10-01 20:37:12 -04:00
Vinayak Kariappa Chettimada
b24bbad815 Bluetooth: Controller: Fix to ignore aux ptr in scannable advertising
Fix to ignore aux pointer struct in scanning advertising, to
avoid ULL scheduling from setting up ticker to receive chain
PDUs while LLL is receiving scan response PDU.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2021-10-01 20:37:12 -04:00
Daniel Leung
a7baa3628d doc: release: 2.7: add release notes for IPM
Add release notes for IPM drivers based on commit history.

Signed-off-by: Daniel Leung <daniel.leung@intel.com>
2021-10-01 20:35:45 -04:00
Daniel Leung
7aee51ea82 doc: release: 2.7: add release notes for PCI/PCIe
Add release notes for PCI/PCIe based on commit history.

Signed-off-by: Daniel Leung <daniel.leung@intel.com>
2021-10-01 20:35:27 -04:00
Daniel Leung
7c62429a75 doc: release: 2.7: add release notes for serial
Add release notes for serial/UART drivers based on commit
history.

Signed-off-by: Daniel Leung <daniel.leung@intel.com>
2021-10-01 20:35:11 -04:00
Erwan Gouriou
82f3165b79 doc: release notes: Shields updates for v2.7.0
Update V2.7.0 release notes document with noticeable changes
related to shields.

Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
2021-10-01 20:34:50 -04:00
Erwan Gouriou
e858321f83 doc: release notes: STM32 updates for v2.7.0
Update V2.7.0 release notes document with noticeable changes
related to STM32.

Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
2021-10-01 20:34:50 -04:00
Erwan Gouriou
d2c5f05b1b boards: stm32u5: Fix instructions to use openocd
Instructions to use openocd on stm32u5 based platforms were missing
an instruction on the branch to use.
Also, the console excerpt were not rendering correctly, so fix
them.

Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
2021-10-01 20:34:34 -04:00
Vinayak Kariappa Chettimada
708951ecd2 Bluetooth: Controller: Use defines for scanning state types
Use defines for scanning state types of passive, active,
initiator and synchronization state.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2021-10-01 20:34:18 -04:00
Vinayak Kariappa Chettimada
ad2b77e7f8 Bluetooth: Controller: Allow resolving list update during passive scan
Allow resolving list update  when passive scanning,
otherwise deny if advertising, active scanning, initiating
or periodic sync create is active.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2021-10-01 20:34:18 -04:00
Torsten Rasmussen
eb85f9a47e Revert "drivers: pinmux: build as static library"
This reverts commit 43309296b8.

Fixes: #38403

The referred commit introduced `zephyr_library()` for pinmux drivers but
also resulting in #38403 because several boards has `CONFIG_PINMUX=y`
without selecting any pinmux drivers from `drivers/pinmux` thus
generating the following warning:
> No SOURCES given to Zephyr library: drivers__pinmux
>
> Excluding target from build.

This commit reverts the changes so that this warning disappears.
This results in pinmux drivers from `drivers/pinmux` to be located in
libzephyr.a which is messy, but has been so for a long time, even before
Zephyr 1.14 LTS.

The future pinctrl API will be designed in such a way that this problem
will not occur. Thus the old behavior is acceptable until the transition
to pinctrl API has completed.

Signed-off-by: Torsten Rasmussen <Torsten.Rasmussen@nordicsemi.no>
2021-10-01 20:33:36 -04:00
Agata Ponitka
9ad64e8809 Bluetooth: Tester: Add the OOB Authentication method
Adding support for automatic testing OOB Authentication method.

Signed-off-by: Agata Ponitka <agata.ponitka@codecoup.pl>
2021-10-01 20:33:00 -04:00
Torsten Rasmussen
cf112e2a06 drivers: console: remove unused CONSOLE selection
Fixes: #38403

Removing unneeded `CONFIG_CONSOLES=y` occurrences where no console
driver is selected.

Such selection results in an empty drivers__console zephyr library,
which again results in the following warning message.

> No SOURCES given to Zephyr library: drivers__console
>
> Excluding target from build.

Signed-off-by: Torsten Rasmussen <Torsten.Rasmussen@nordicsemi.no>
2021-10-01 20:22:03 -04:00
Torsten Rasmussen
0ad4b4438a drivers: gpio: remove unused GPIO selection
Fixes: #38403

Removing unneeded `imply GPIO` and `CONFIG_GPIO=y` occurrences where no
files are added to the gpio zephyr library.

Also removed `CONFIG_GPIO=y` occurences where this is handled by
defconfigs for the soc or board.

Selection of GPIO without selecting any drivers results in the warning:

> No SOURCES given to Zephyr library: drivers__gpio
>
> Excluding target from build.

Signed-off-by: Torsten Rasmussen <Torsten.Rasmussen@nordicsemi.no>
2021-10-01 20:22:03 -04:00
Torsten Rasmussen
f7d0ae5e6c drivers: ethernet: remove dedicated drivers__ethernet__native_posix lib
Fixes: #38403

The two eth_native_posix.c and eth_native_posix_adapt.c are now added
to the common drivers__ethernet Zephyr library.

Instead of creating a dedicated library for just two files those files
are now added to the common ethernet library, see also #8826.
Instead, the dedicated compile definitions required for those files are
specified using COMPILE_DEFINITIONS on the source files.

This also avoids the following warning as the ethernet library is no
longer empty.

> No SOURCES given to Zephyr library: drivers__ethernet
>
> Excluding target from build.

Signed-off-by: Torsten Rasmussen <Torsten.Rasmussen@nordicsemi.no>
2021-10-01 20:22:03 -04:00
Torsten Rasmussen
a084ec5483 modules: hal_nxp: removing always empty zephyr_library
No sources were ever added to the `zephyr_library()` defined in
modules/hal_nxp/usb/CMakeLists.txt, thus removing this lib to avoid
the warning:

> No SOURCES given to Zephyr library: modules__hal_nxp__usb
>
> Excluding target from build.

Signed-off-by: Torsten Rasmussen <Torsten.Rasmussen@nordicsemi.no>
2021-10-01 20:22:03 -04:00
Torsten Rasmussen
c3fac651ee drivers: net: adding NET_DRIVERS menuconfig
Fixes: #38403

Adding NET_DRIVERS menuconfig so that network drivers are grouped
together in its own menu entry under drivers, similar to most other
drivers.

This further has the advantages that `CONFIG_NET_DRIVERS` can be used
for testing to determine if network drivers has been selected.

This changed revealed a dependency loop where both `select` (for SLIP)
and `depends` (for PPP) which both depends on NET_DRIVERS` where in use
in the dependency tree for Qemu networking, especially NET_SLIP_TAP.

This is handled by defaulting `NET_DRIVERS` to `y` when building for a
Qemu target.
`SLIP` had a dependency to `!QEMU_TARGET || NET_QEMU_SLIP`. This is
changed so that SLIP prompt depends on `!QEMU_TARGET` which provides
full user control in hardware but makes the symbol promptless on Qemu
targets.

Signed-off-by: Torsten Rasmussen <Torsten.Rasmussen@nordicsemi.no>
2021-10-01 20:22:03 -04:00
Torsten Rasmussen
30eadf758a drivers: create BT_DRIVERS Kconfig entry
Fixes: #38403

Changing Bluetooth drivers from being a menu into a menuconfig.
This aligns the Bluetooth driver configuration with other driver
configurations as well as provides a setting which identifies if
Bluetooth drivers has been enable.

This further helps to avoid empty Zephyr libraries for bluetooth
samples.

Signed-off-by: Torsten Rasmussen <Torsten.Rasmussen@nordicsemi.no>
2021-10-01 20:22:03 -04:00
Emil Gydesen
1a42926317 Bluetooth: ISO: Remove bt_conn_unref for ISO deferred work
Removed the bt_conn_unref from the deferred_work function.
For ISO, the conn unref for the peripheral will happen in
the bt_iso_disconnected function. For the central, the
unref shall only happen when the CIG is terminated.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2021-10-01 07:42:40 -04:00
Vinayak Kariappa Chettimada
30b24920e8 Bluetooth: Controller: Fix multiple peripheral connection deadlock
Fix deadlock in multiple peripheral connection in a device
due to redundant double reservation of node rx buffer during
crossover scenario in Data Length Update procedure.

Data Length Update resize state was reset back to response
wait state when peripheral received an acknowledgment to
local initiated Data Length Request PDU after having already
transitioned to resize state.

Implementation is designed to transition to resize state
under both Data Length Response reception and crossover
scenario of Data Length Request reception when procedure is
local initiated.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2021-10-01 07:37:31 -04:00
Alexandre Bourdiol
41654b0dba tests: kernel: sched: schedule_api: enlarge timeslice criterion
From time to time, measured slice time is one less/more than requested.
Fixes #35793

Signed-off-by: Alexandre Bourdiol <alexandre.bourdiol@st.com>
2021-10-01 04:49:50 -04:00
Joakim Andersson
17c5a7c89e Bluetooth: host: Access local IRKs consistently
Change the way the local IRKs are accessed to be consistent with the
all other uses.
Coverity thinks using the pointer to the array is suspicious in this
case.

Fixes: #38130

Signed-off-by: Joakim Andersson <joakim.andersson@nordicsemi.no>
2021-09-30 20:21:38 -04:00
Joakim Andersson
0d4db6b952 Bluetooth: host: Verify valid local identity loaded from settings
Verify that the local identity loaded from the settings key is
valid for the current configuration.

Signed-off-by: Joakim Andersson <joakim.andersson@nordicsemi.no>
2021-09-30 20:21:38 -04:00
Vinayak Kariappa Chettimada
e24df5272a Bluetooth: Controller: Separate address get and read functions
Have separate Bluetooth Device address get and read
functions, remove use of function just to return Extended
Advertising Random address and replace with simple
assignment statement.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2021-09-30 20:21:14 -04:00
Vinayak Kariappa Chettimada
a3e8f83e6b Bluetooth: Controller: Use defines for aux pointer offset unit value
Use defines for aux pointer offset unit value.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2021-09-30 20:21:14 -04:00
Vinayak Kariappa Chettimada
e8929c3360 Bluetooth: Controller: Fix Extended Advertising channel use
Add implementation defined channel index in the auxiliary
pointer of the common extended payload format in the primary
channel PDUs and the same be used in the transmission of
auxiliary PDUs.

Fixes #35668.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2021-09-30 20:21:14 -04:00
Vinayak Kariappa Chettimada
7597eef8b3 Bluetooth: Controller: Add FIXME for Per Adv chain channel use
Add FIXME comments for missing use of channel selection
algorithm for Periodic Advertising chained PDUs.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2021-09-30 20:21:14 -04:00
Vinayak Kariappa Chettimada
9ff7cb60fc Bluetooth: Controller: Add advertiser clock accuracy value
Add implementation to set correct Advertiser's clock
accuracy value in the auxiliary pointer field in the common
extended payload format.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2021-09-30 20:21:14 -04:00
Vinayak Kariappa Chettimada
71420c6b76 Bluetooth: controller: Fix populate offset in latest advertising PDU
Fix implementation to populate the aux, and sync offset
in the latest PDU. If both the current and latest of the
double buffer has been filled and LLL did not pick the
latest PDU, then the offset should be filled into the latest
PDU (and not into the first/current PDU).

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2021-09-30 20:21:14 -04:00
Vinayak Kariappa Chettimada
519f412ce8 Bluetooth: Controller: Minor indentation fixes
Minor indentation fixes.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2021-09-30 20:21:14 -04:00
Vinayak Kariappa Chettimada
c0e44d9462 Bluetooth: Controller: Explicitly typecast void return for memcpy calls
Explicitly typecast void return for memcpy calls.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2021-09-30 20:21:14 -04:00
Vinayak Kariappa Chettimada
47f4ddafdd Bluetooth: Controller: Minor rename of ULL internal function
Rename ULL internal helper function to get the random
address.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2021-09-30 20:21:14 -04:00
Szymon Janc
1a15d367e2 tests: bluetooth: tester: Add support for L2CAP Credits command
This allows IUT to return credits on specified L2CAP channel when
requested by Upper Tester.

Signed-off-by: Szymon Janc <szymon.janc@codecoup.pl>
2021-09-30 20:20:49 -04:00
Andrzej Głąbek
7ac8c2f51b drivers: i2s_nrfx: Fix a few minor fixes
- correct the names of buffers used by message queues so that it
  is possible to have multiple instances of the driver (in case
  such need appears in the future)
- make `stop` and `discard_rx` normal structure members, not bit
  fields, as they are modified in the interrupt handler and that
  could lead to overwriting of other bit fields located in the
  same memory unit
- add a log message providing the actual frame clock (WS) frequency
  (i.e. PCM rate) that the driver was able to configure (due to
  hardware limitations, it is not always possible to achieve the
  exact requested frequency and the driver selects the closest one
  available, so make it more visible to users

Signed-off-by: Andrzej Głąbek <andrzej.glabek@nordicsemi.no>
2021-09-30 20:20:26 -04:00
Andrzej Głąbek
4c52fb9fd1 drivers: i2s_nrfx: Do not enforce two channels for I2S format
Remove unnecessary condition that effectively limits the usability
of the I2S format to two channels mode only.
Although the description of the `i2s_config` structure contains
a remark that for the I2S format the specified number of channels
is ignored and always two are used, in fact only one other in-tree
driver (i2s_sam_ssc) applies such limitation.
The nRF I2S hardware has no problem with handling the I2S format
with audio data for only one channel, so there is no need for having
this limitation in the driver, and without such mode of operation of
the driver it is impossible to feed it with PCM data directly from
the PDM peripheral working in one channel mode.

Signed-off-by: Andrzej Głąbek <andrzej.glabek@nordicsemi.no>
2021-09-30 20:20:26 -04:00
Gerard Marull-Paretas
cb657057b3 tests: pm: power_mgmt: use PM_STATE_SUSPEND_TO_IDLE
Since the tests expects devices to change states, PM_STATE_RUNTIME_IDLE
can't be used. The first state that cares about devices is
PM_STATE_SUSPEND_TO_IDLE.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2021-09-30 20:20:04 -04:00
Gerard Marull-Paretas
69996900c8 pm: stop handling devices on PM_STATE_RUNTIME_IDLE
According to the state documentation, this state does not need to handle
devices:

> Runtime idle is a system sleep state in which all of the cores enter
deepest possible idle state and wait for interrupts, no requirements for
the devices, leaving them at the states where they are.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2021-09-30 20:20:04 -04:00
Robert Lubos
70979b9047 doc: release: 2.7: Add release notes for networking
Add networking relase notes based on commit history, for commits
including "net" phrase in the title.

Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
2021-09-30 20:19:25 -04:00
Peter Mitsis
e601ca8e11 doc: Add deadline scheduling information
Adds information to the kernel scheduling documentation explaining
how a thread's deadline is used to determine the thread's relative
priority.

Signed-off-by: Peter Mitsis <peter.mitsis@intel.com>
2021-09-30 20:16:41 -04:00
Peter Mitsis
369d5d038f kernel: fix deadline typo
Corrects the spelling of "dealine" to "deadline".

Signed-off-by: Peter Mitsis <peter.mitsis@intel.com>
2021-09-30 20:16:41 -04:00
Chen Peng1
27a2271093 timer: mask interrupts in timer's timeout handler.
before running timer's timeout function, we need to make
sure that those threads waiting on this timer have been
added into the timer's wait queue, so add operations to
use timer lock to mask interrupts in z_timer_expiration_handler
function to synchronize timer's wait queue.

Signed-off-by: Chen Peng1 <peng1.chen@intel.com>
2021-09-29 14:51:01 -04:00
Vinayak Kariappa Chettimada
f4a03dfa32 Bluetooth: Controller: Update Bluetooth version to 5.3
Update the Bluetooth HCI Version to 5.3.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2021-09-29 13:11:05 -04:00
Vinayak Kariappa Chettimada
192cad6cda Bluetooth: Controller: Fix imprecise data bus error in periodic sync
Fix imprecise data bus error when receiving Periodic
Advertising Report caused due to uninitialized `extra` field
member in the node rx struct passed from ULL to LL thread
context.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2021-09-29 13:10:14 -04:00
Vinayak Kariappa Chettimada
1e2c698e95 Bluetooth: Controller: Fix repeated per sync drift compensations
Fix repeated periodic sync drift compensation invoked when
receiving chain PDUs which caused memory corruptions and
bus faults.

Use `is_aux_sched` flag in Periodic Sync's LLL context to
differentiate between the first AUX_SYNC_IND PDU followed by
use of LLL scheduling to receive following AUX_CHAIN_IND PDU
versus ULL scheduling being used to receive AUX_CHAIN_IND
PDUs.

Drift compensation to be done only using the AUX_SYNC_IND
PDU and not on reception of AUX_CHAIN_IND PDU using ULL
scheduling.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2021-09-29 13:10:14 -04:00
Andrzej Głąbek
0c0a990c4b soc: nrf53: Add missing HAS_HW_NRF_* entries
A few HAS_HW_NRF_* Kconfig options for peripherals available in nRF5340
are not selected. Fix it.

Signed-off-by: Andrzej Głąbek <andrzej.glabek@nordicsemi.no>
2021-09-29 10:42:51 -04:00
Pavel Vasilyev
dbf08a18c3 Bluetooth: Mesh: Return ETIMEDOUT if k_sem_take call times out
EAGAIN is used in some other places in the code, e.g. if node is not
provisioned when a model tries to send a message. This change helps to
differentiated if the acknowledged message timed out from other failers.

Signed-off-by: Pavel Vasilyev <pavel.vasilyev@nordicsemi.no>
2021-09-29 10:42:11 -04:00
Krzysztof Chruscinski
6c4d190493 lib: os: mpsc_pbuf: Add const qualifier to API calls
Add const qualifier where it was missing. Updating
relevant code.

Signed-off-by: Krzysztof Chruscinski <krzysztof.chruscinski@nordicsemi.no>
2021-09-29 10:41:27 -04:00
Erwan Gouriou
5d0100e12c boards: nucleo_l073rz: Set LSI as LPTIM clock source
For some reason, LSE can't be used as LPTIM clock source
on nucleo_l073rz.
As a consequence, low power operations are not functional on
this platform.
Waiting for the original issue to be fixed, set LSI as LPTIM
clock source.

Partially fixes #38930

Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
2021-09-29 10:32:41 -04:00
Ramiro Merello
b11983d71a subsys/fs/nvs: nvs_write return missing documentation
- Documentation of the 0 return value for ns_write function
- Ajusted lines length limit from 80 to 100
- Fixed extra and missing parameters for nvs_fs
- Misc spelling/grammar changes

Signed-off-by: Ramiro Merello <rmerello@itba.edu.ar>
2021-09-29 09:54:45 -04:00
Joakim Andersson
8691e3e0d2 Bluetooth: host: compile out check for multiple identities
Add check that can be removed by the compiler since the rest is only
needed when multiple identities have been enabled.

Fixes: #38134

Signed-off-by: Joakim Andersson <joakim.andersson@nordicsemi.no>
2021-09-29 09:53:37 -04:00
Robert Lubos
c1fa585917 net: sockets: tls: Ignore empty iovec entries in sendmsg
According to `sendmsg()` man pages, the `struct msghdr` can contain
empty records (iov_len equal to 0). Ignore them in TLS `sendmsg()`
implementation to avoid unnecessary calls to mbed TLS.

Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
2021-09-29 09:50:58 -04:00
Robert Lubos
8a9c1e7721 net: mqtt: Handle incomplete zsock_sendmsg write
In case zsock_sendmsg did not send all of the data requested, update the
`struct msghdr` content and retry.

Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
2021-09-29 09:50:58 -04:00
Robert Lubos
8a0dc430b2 net: context: Do not overflow net_pkt when using msghdr
If data for `context_sendto()` was provided in a form of
`struct msghdr` (for instance via `sendmsg()`), it was not verified that
the provided data would actually fit into allocated net_pkt. In result,
and error could be returned in case the provided data was larger than
net_pkt allows.

Fix this, by verifying the remaining buffer length when iterating over
`struct msghdr`. Once the buffer is filled up, break the loop. In
result, functions like `sendmsg()` will return the actual length of data
sent instead of an error.

Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
2021-09-29 09:50:58 -04:00
Francois Ramu
e6638715d9 drivers: adc: stm32 adc disable causing endless loop
Setting Oversampling also applies on stm32L5 but disabling
the ADC will cause endless loop except for the stm32L0 serie.
Errata applies only on stm32G0 soc series when
writing ADC_CFGR1 register.

Signed-off-by: Francois Ramu <francois.ramu@st.com>
2021-09-29 09:49:55 -04:00
Erwan Gouriou
5b78f62138 tests/drivers: gpio_basic_api: Upudate nucleo_f103rb configuration
For some reason, provided pin configuration for nucleo_f103rb
is not able to detect gpio callback issues.
Move to other pin combination which detect pin callback issues.

Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
2021-09-29 09:49:22 -04:00
Erwan Gouriou
01be872f01 drivers/gpio: stm32f1: AFIO init should happen before GPIO inits
GPIO initialization was moved to PRE_KERNEL_1 with commit
590162a5cc.
This had the consequence of having AFIO init done after GPIO init
as a consequence, this sequence ends up with AFIO clock disabled,
and hence negative impact on AFIO expected services.

Additionally, to save some flash, compile out afio init when not
required.

Fixes #38870

Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
2021-09-29 09:49:22 -04:00
Carlo Caione
317749e1e8 reserved-memory: Fix layering violation
Move memory.h out of the way in a more "private" space
(include/linker/devicetree_reserved.h) to prevent polluting the
devicetree space.

Signed-off-by: Carlo Caione <ccaione@baylibre.com>
2021-09-29 06:13:57 -04:00
Torsten Rasmussen
7d3606a74a scripts: twister: print message from CMake verify toolchain on failures
Fixes: #38924

When the `verify-toolchain.cmake` script fails, then twister will print
a standard message to the user regardless of the reason.
> E: Variable ZEPHYR_TOOLCHAIN_VARIANT is not defined

The `verify-toolchain.cmake` already prints detailed information
regarding the cause of the failure, so twister should just pass that
message as-is.

For example, the message that is provided by verify-toolchain.cmake
when Zephyr SDK 0.13.0 is installed but 0.13.1 is required looks like:
> CMake Error at cmake/verify-toolchain.cmake:75 (find_package):
>  Could not find a configuration file for package "Zephyr-sdk" that is
>  compatible with requested version "0.13.1".
>
>  The following configuration files were considered but not accepted:
>
> /opt/zephyr-sdk-0.13.0/cmake/Zephyr-sdkConfig.cmake, version: 0.13.0

Signed-off-by: Torsten Rasmussen <Torsten.Rasmussen@nordicsemi.no>
2021-09-29 06:13:26 -04:00
Piotr Golyzniak
08917e0708 twister: Fix missing testcases with error status
If timeout error was occured during performing testsuite on QEMU or
other simulator (e.g. Renode), information about this error will be not
placed in final report. It can be fixed, by set status of testcases,
which were not performed due to this error as "BLOCK".

Simmilar solution is alredy used in DeviceHandler when Twister works
with real platform. So I think that it is resonable to use the same
approach, when tests are performed on simulators.

I move loop which iterate through all testcases and set their tests
status as BLOCK into the parent Handler class, because the same
activity is performed in each children class (BinaryHandler,
DeviceHandler and QEMUHandler).

Fixes #38756

Signed-off-by: Piotr Golyzniak <piotr.golyzniak@nordicsemi.no>
2021-09-29 06:12:35 -04:00
Enjia Mai
b868419ac7 docs: acrn: update the documentation of setting the ACRN hypervisor
Add some descriptions of hybrid scenario of ACRN hypervisor, and
completed the configurations that we are using to build ACRN. This
configuration change for ACRN hypervisor is necessary when our Zephyr
application is using over than one CPU for it.

Signed-off-by: Enjia Mai <enjia.mai@intel.com>
2021-09-28 13:09:59 -04:00
Fabio Baltieri
16efab0493 samples: modbus: update/fix samples.yaml configs
Update the sample.yaml files for the modbus samples:
- depends_on entries should just be space separated, drop the comma
- add the platform referenced in the documentation to platform_allow
- replace the deprecated dt_compat_enabled_with_alias with
  dt_enabled_alias_with_parent_compat

Signed-off-by: Fabio Baltieri <fabio.baltieri@gmail.com>
2021-09-28 06:25:43 -04:00
Fabio Baltieri
916dbab23a samples: modbus: rtu_server: drop unused variable
This has been unreferenced since:

4ff616b647 modbus: rework interface configuration

This generates a compiler warning, but it went unnoticed because the
sample test is configured incorrectly and not running.

Signed-off-by: Fabio Baltieri <fabio.baltieri@gmail.com>
2021-09-28 06:25:43 -04:00
Fabio Baltieri
62680344a6 samples: canopennode: fix the sample path
The sample code got moved in 613f1cde4a, update the old path to the
current one.

Signed-off-by: Fabio Baltieri <fabio.baltieri@gmail.com>
2021-09-28 06:25:43 -04:00
Henrik Brix Andersen
d8ee47459c twister: ignore ROM region overflows
Add ROM region to list of regions to optionally ignore overflows on.

Signed-off-by: Henrik Brix Andersen <henrik@brixandersen.dk>
2021-09-27 20:50:31 -04:00
197 changed files with 5322 additions and 1500 deletions

View File

@@ -22,6 +22,9 @@ jobs:
matrix:
python-version: [3.6, 3.7, 3.8]
os: [ubuntu-latest, macos-latest, windows-latest]
exclude:
- os: macos-latest
python-version: 3.6
steps:
- name: checkout
uses: actions/checkout@v2

View File

@@ -23,6 +23,9 @@ jobs:
matrix:
python-version: [3.6, 3.7, 3.8]
os: [ubuntu-latest, macos-latest, windows-latest]
exclude:
- os: macos-latest
python-version: 3.6
steps:
- name: checkout
uses: actions/checkout@v2

View File

@@ -2,4 +2,4 @@ VERSION_MAJOR = 2
VERSION_MINOR = 7
PATCHLEVEL = 0
VERSION_TWEAK = 0
EXTRAVERSION = rc3
EXTRAVERSION =

View File

@@ -278,7 +278,7 @@ void z_arm_configure_dynamic_mpu_regions(struct k_thread *thread)
__ASSERT((uintptr_t)&z_priv_stacks_ram_start <= guard_start,
"Guard start: (0x%lx) below privilege stacks boundary: (%p)",
guard_start, &z_priv_stacks_ram_start);
guard_start, z_priv_stacks_ram_start);
} else
#endif /* CONFIG_USERSPACE */
{

View File

@@ -14,6 +14,13 @@ config QEMU_TARGET
Mark all QEMU targets with this variable for checking whether we are
running in an emulated environment.
config NET_DRIVERS
bool
default y if QEMU_TARGET && NETWORKING
help
When building for a qemu target then NET_DRIVERS will be default
enabled to allow for easy use of SLIP or PPP
# Note: $BOARD_DIR might be a glob pattern
choice

View File

@@ -10,7 +10,6 @@
-prop=nsim_isa_vec64=1
-dcache=65536,64,2,a
-dcache_feature=2
-dcache_uncached_region
-dcache_mem_cycles=2
-icache=65536,64,4,a
-icache_feature=2

View File

@@ -10,7 +10,6 @@
-prop=nsim_isa_vec64=1
-dcache=65536,64,2,a
-dcache_feature=2
-dcache_uncached_region
-dcache_mem_cycles=2
-icache=65536,64,4,a
-icache_feature=2

View File

@@ -11,7 +11,6 @@ CONFIG_HW_STACK_PROTECTION=y
# enable peripherals
CONFIG_GPIO=y
CONFIG_SERIAL=y
CONFIG_CONSOLE=y
# enable sam-ba bootloader on legacy mode
CONFIG_BOOTLOADER_BOSSA=y

View File

@@ -255,9 +255,9 @@ Debugging
STM32U5 support is not currently supported in openocd. As a temporary workaround,
user can use `STMicroelectronics customized version of OpenOCD`_ to debug the
the B_U585I_IOT02A Discovery kit.
For this you need to fetch this repo and build openocd following the instructions
provided in the README of the project. Then, build zephyr project indicating the
openocd location in west build command.
For this you need to fetch this repo, checkout branch "openocd-cubeide-r3" and
build openocd following the instructions provided in the README of the project.
Then, build zephyr project indicating the openocd location in west build command.
Here is an example for the :ref:`blinky-sample` application.
@@ -269,24 +269,18 @@ Here is an example for the :ref:`blinky-sample` application.
Then, indicate openocd as the chosen runner in flash and debug commands:
.. zephyr-app-commands::
:zephyr-app: samples/basic/blinky
:board: b_u585i_iot02a
:gen-args: -r openocd
:goals: flash
.. zephyr-app-commands::
:zephyr-app: samples/basic/blinky
:board: nucleo_u575zi_q
:gen-args: -r openocd
:goals: debug
.. code-block:: console
$ west flash -r openocd
$ west debug -r openocd
.. _B U585I IOT02A Discovery kit website:
https://www.st.com/en/evaluation-tools/b-u585i-iot02a.html
.. _B U585I IOT02A board User Manual:
https://www.st.com/resource/en/user_manual/dm00698410.pdf
https://www.st.com/resource/en/user_manual/um2839-discovery-kit-for-iot-node-with-stm32u5-series-stmicroelectronics.pdf
.. _STM32U585 on www.st.com:
https://www.st.com/en/microcontrollers-microprocessors/stm32u575-585.html

View File

@@ -7,7 +7,6 @@
CONFIG_SOC_LPC54114_M0=y
CONFIG_SOC_SERIES_LPC54XXX=y
CONFIG_BOARD_LPCXPRESSO54114_M0=y
CONFIG_CONSOLE=y
CONFIG_USE_SEGGER_RTT=y
CONFIG_SERIAL=n
CONFIG_CORTEX_M_SYSTICK=y

View File

@@ -13,9 +13,6 @@ CONFIG_HW_STACK_PROTECTION=y
# enable GPIO
CONFIG_GPIO=y
# enable console
CONFIG_CONSOLE=y
# additional board options
CONFIG_GPIO_AS_PINRESET=y
CONFIG_NFCT_PINS_AS_GPIOS=y

View File

@@ -12,4 +12,10 @@ config SPI_STM32_INTERRUPT
default y
depends on SPI
# FIXME: LSE not working as LPTIM clock source. Use LSI instead.
choice STM32_LPTIM_CLOCK
default STM32_LPTIM_CLOCK_LSI
depends on STM32_LPTIM_TIMER
endchoice
endif # BOARD_NUCLEO_L073RZ

View File

@@ -240,9 +240,9 @@ Debugging
STM32U5 support is not currently supported in openocd. As a temporary workaround,
user can use `STMicroelectronics customized version of OpenOCD`_ to debug the
the Nucleo U575ZI Q.
For this you need to fetch this repo and build openocd following the instructions
provided in the README of the project. Then, build zephyr project indicating the
openocd location in west build command.
For this you need to fetch this repo, checkout branch "openocd-cubeide-r3" and
build openocd following the instructions provided in the README of the project.
Then, build zephyr project indicating the openocd location in west build command.
Here is an example for the :ref:`blinky-sample` application.
@@ -254,17 +254,11 @@ Here is an example for the :ref:`blinky-sample` application.
Then, indicate openocd as the chosen runner in flash and debug commands:
.. zephyr-app-commands::
:zephyr-app: samples/basic/blinky
:board: nucleo_u575zi_q
:gen-args: -r openocd
:goals: flash
.. zephyr-app-commands::
:zephyr-app: samples/basic/blinky
:board: nucleo_u575zi_q
:gen-args: -r openocd
:goals: debug
.. code-block:: console
$ west flash -r openocd
$ west debug -r openocd
.. _STM32 Nucleo-144 board User Manual:

View File

@@ -12,6 +12,3 @@ CONFIG_HW_STACK_PROTECTION=y
# Enable GPIO
CONFIG_GPIO=y
# Enable console
CONFIG_CONSOLE=y

Binary file not shown.

After

Width:  |  Height:  |  Size: 113 KiB

View File

@@ -5,6 +5,28 @@ Zephyr's is capable of running as a guest under the x86 ACRN
hypervisor (see https://projectacrn.org/). The process for getting
this to work is somewhat involved, however.
ACRN hypervisor supports a hybrid scenario where Zephyr runs in a so-
called "pre-launched" mode. This means Zephyr will access the ACRN
hypervisor directly without involving the SOS VM. This is the most
practical user scenario in the real world because Zephyr's real-time
and safety capability can be assured without influence from other
VMs. The following figure from ACRN's official documentation shows
how a hybrid scenario works:
.. figure:: ACRN-Hybrid.png
:align: center
:alt: ACRN Hybrid User Scenario
:figclass: align-center
:width: 80%
ACRN Hybrid User Scenario
In this tutorial, we will show you how to build a minimal running instance of Zephyr
and ACRN hypervisor to demonstrate that it works successfully. To learn more about
other features of ACRN, such as building and using the SOS VM or other guest VMs,
please refer to the Getting Started Guide for ACRN:
https://projectacrn.github.io/latest/tutorials/using_hybrid_mode_on_nuc.html
Build your Zephyr App
*********************
@@ -15,6 +37,10 @@ normally would, selecting an appropriate board:
west build -b acrn_ehl_crb samples/hello_world
In this tutorial, we will use the Intel Elkhart Lake Reference Board
(`EHL`_ CRB) since it is one of the suggested platform for this
type of scenario. Use ``acrn_ehl_crb`` as the target board parameter.
Note the kconfig output in ``build/zephyr/.config``, you will need to
reference that to configure ACRN later.
@@ -31,6 +57,9 @@ First you need the source code, clone from:
git clone https://github.com/projectacrn/acrn-hypervisor
We suggest that you use versions v2.5.1 or later of the ACRN hypervisor
as they have better support for SMP in Zephyr.
Like Zephyr, ACRN favors build-time configuration management instead
of runtime probing or control. Unlike Zephyr, ACRN has single large
configuration files instead of small easily-merged configuration
@@ -102,10 +131,51 @@ many CPUs in the ``<cpu_affinity>`` tag. For example:
.. code-block:: xml
<cpu_affinity>
<pcpu_id>0</pcpu_id>
<pcpu_id>1</pcpu_id>
</cpu_affinity>
<vm id="0">
<vm_type>SAFETY_VM</vm_type>
<name>ACRN PRE-LAUNCHED VM0</name>
<guest_flags>
<guest_flag>0</guest_flag>
</guest_flags>
<cpu_affinity>
<pcpu_id>0</pcpu_id>
<pcpu_id>1</pcpu_id>
</cpu_affinity>
...
<clos>
<vcpu_clos>0</vcpu_clos>
<vcpu_clos>0</vcpu_clos>
</clos>
...
</vm>
To use SMP, we have to change the pcpu_id of VM0 to 0 and 1.
This configures ACRN to run Zephyr on CPU0 and CPU1. The ACRN hypervisor
and Zephyr application will not boot successfully without this change.
If you plan to run Zephyr with one CPU only, you can skip it.
Since Zephyr is using CPU0 and CPU1, we also have to change
VM1's configuration so it runs on CPU2 and CPU3. If your ACRN set up has
additional VMs, you should change their configurations as well.
.. code-block:: xml
<vm id="1">
<vm_type>SOS_VM</vm_type>
<name>ACRN SOS VM</name>
<guest_flags>
<guest_flag>0</guest_flag>
</guest_flags>
<cpu_affinity>
<pcpu_id>2</pcpu_id>
<pcpu_id>3</pcpu_id>
</cpu_affinity>
<clos>
<vcpu_clos>0</vcpu_clos>
<vcpu_clos>0</vcpu_clos>
</clos>
...
</vm>
Note that these indexes are physical CPUs on the host. When
configuring multiple guests, you probably don't want to overlap these
@@ -228,3 +298,6 @@ command:
----- Entering VM 0 Shell -----
*** Booting Zephyr OS build v2.6.0-rc1-324-g1a03783861ad ***
Hello World! acrn
.. _EHL: https://www.intel.com/content/www/us/en/products/docs/processors/embedded/enhanced-for-iot-platform-brief.html

View File

@@ -489,10 +489,7 @@ zephyr_boilerplate_watch(CONF_FILE)
if(DTC_OVERLAY_FILE)
# DTC_OVERLAY_FILE has either been specified on the cmake CLI or is already
# in the CMakeCache.txt. This has precedence over the environment
# variable DTC_OVERLAY_FILE
elseif(DEFINED ENV{DTC_OVERLAY_FILE})
set(DTC_OVERLAY_FILE $ENV{DTC_OVERLAY_FILE})
# in the CMakeCache.txt.
elseif(APP_BOARD_DTS)
set(DTC_OVERLAY_FILE ${APP_BOARD_DTS})
elseif(EXISTS ${APPLICATION_SOURCE_DIR}/${BOARD}.overlay)

View File

@@ -8,14 +8,14 @@ external organization. Several of these are available.
.. _toolchain_gnuarmemb:
GNU ARM Embedded
GNU Arm Embedded
****************
.. warning::
Do not install the toolchain into a path with spaces.
#. Download and install a `GNU ARM Embedded`_ build for your operating system
#. Download and install a `GNU Arm Embedded`_ build for your operating system
and extract it on your file system.
.. note::
@@ -61,6 +61,57 @@ GNU ARM Embedded
- Set :envvar:`ZEPHYR_TOOLCHAIN_VARIANT` to ``gnuarmemb``.
- Set :envvar:`GNUARMEMB_TOOLCHAIN_PATH` to the brew installation directory (something like ``/usr/local``)
.. _toolchain_armclang:
Arm Compiler 6
**************
#. Download and install a development suite containing the `Arm Compiler 6`_
for your operating system.
#. :ref:`Set these environment variables <env_vars>`:
- Set :envvar:`ZEPHYR_TOOLCHAIN_VARIANT` to ``armclang``.
- Set :envvar:`ARMCLANG_TOOLCHAIN_PATH` to the toolchain installation
directory.
#. The Arm Compiler 6 needs the :envvar:`ARMLMD_LICENSE_FILE` environment
variable to point to your license file or server.
For example:
.. code-block:: console
# Linux, macOS, license file:
export ARMLMD_LICENSE_FILE=/<path>/license_armds.dat
# Linux, macOS, license server:
export ARMLMD_LICENSE_FILE=8224@myserver
# Windows, license file:
> set ARMLMD_LICENSE_FILE=c:\<path>\license_armds.dat
# Windows, license server:
> set ARMLMD_LICENSE_FILE=8224@myserver
#. If the Arm Compiler 6 was installed as part of an Arm Development Studio, then
you must set the :envvar:`ARM_PRODUCT_DEF` to point to the product definition file:
See also: `Product and toolkit configuration <https://developer.arm.com/tools-and-software/software-development-tools/license-management/resources/product-and-toolkit-configuration>`_.
For example if the Arm Development Studio is installed in:
``/opt/armds-2020-1`` with a Gold license, then set :envvar:`ARM_PRODUCT_DEF`
to point to ``/opt/armds-2020-1/gold.elmap``.
.. note::
The Arm Compiler 6 uses ``armlink`` for linking. This is incompatible
with Zephyr's linker script template, which works with GNU ld. Zephyr's
Arm Compiler 6 support Zephyr's CMake linker script generator, which
supports generating scatter files. Basic scatter file support is in
place, but there are still areas covered in ld templates which are not
fully supported by the CMake linker script generator.
Some Zephyr subsystems or modules may also contain C or assembly code
that relies on GNU intrinsics and have not yet been updated to work fully
with ``armclang``.
Intel oneAPI Toolkit
*********************
@@ -159,5 +210,6 @@ You can build toolchains from source code using crosstool-NG.
$ echo $XTOOLS_TOOLCHAIN_PATH
/Volumes/CrossToolNGNew/build/output/
.. _GNU ARM Embedded: https://developer.arm.com/open-source/gnu-toolchain/gnu-rm
.. _GNU Arm Embedded: https://developer.arm.com/open-source/gnu-toolchain/gnu-rm
.. _crosstool-ng site: http://crosstool-ng.org
.. _Arm Compiler 6: https://developer.arm.com/tools-and-software/embedded/arm-compiler/downloads/version-6

View File

@@ -41,7 +41,7 @@ Legend:
+---------------------------------------------------------------------+------------+-------------+--------+------------+
| Hardware floating point unit (FPU) | Y | Y | N | TBD |
+---------------------------------------------------------------------+------------+-------------+--------+------------+
| Symmetric multiprocessing (SMP) support, switch-based | N/A | Y | TBD | WIP |
| Symmetric multiprocessing (SMP) support, switch-based | N/A | Y | TBD | Y |
+---------------------------------------------------------------------+------------+-------------+--------+------------+
| Hardware-assisted stack checking | Y | Y | TBD | N |
+---------------------------------------------------------------------+------------+-------------+--------+------------+

View File

@@ -36,11 +36,21 @@ In order to use MCUboot with Zephyr you need to take the following into account:
1. You will need to define the flash partitions required by MCUboot; see
:ref:`flash_map_api` for details.
2. Your application's :file:`.conf` file needs to enable the
2. You will have to specify your flash parition as the chosen code partition
.. code-block:: devicetree
/ {
chosen {
zephyr,code-partition = &slot0_partition;
};
};
3. Your application's :file:`.conf` file needs to enable the
:kconfig:`CONFIG_BOOTLOADER_MCUBOOT` Kconfig option in order for Zephyr to
be built in an MCUboot-compatible manner
3. You need to build and flash MCUboot itself on your device
4. You might need to take precautions to avoid mass erasing the flash and also
4. You need to build and flash MCUboot itself on your device
5. You might need to take precautions to avoid mass erasing the flash and also
to flash the Zephyr application image at the correct offset (right after the
bootloader)

View File

@@ -210,7 +210,6 @@ Here are some ways to set it:
(``-DDTC_OVERLAY_FILE="file1.overlay;file2.overlay"``)
#. with the CMake ``set()`` command in the application ``CMakeLists.txt``,
before including zephyr's :file:`boilerplate.cmake` file
#. using a ``DTC_OVERLAY_FILE`` environment variable (deprecated)
#. create a ``boards/<BOARD>_<revision>.overlay`` file in the application
folder for the current board revision. This requires that the board supports
multiple revisions, see :ref:`porting_board_revisions`.

View File

@@ -254,6 +254,8 @@ channels (e.g. ADC or DAC channels) for conversion.
.. doxygengroup:: devicetree-io-channels
.. _devicetree-pinctrl-api:
Pinctrl (pin control)
=====================

View File

@@ -202,10 +202,11 @@ in an asynchronous manner.
.. note::
A message queue can be used to transfer large data items, if desired.
However, this can increase interrupt latency as interrupts are locked
while a data item is written or read. It is usually preferable to transfer
large data items by exchanging a pointer to the data item, rather than the
data item itself. The kernel's memory map and memory pool object types
can be helpful for data transfers of this sort.
while a data item is written or read. The time to write or read a data item
increases linearly with its size since the item is copied in its entirety
to or from the buffer in memory. For this reason, it is usually preferable
to transfer large data items by exchanging a pointer to the data item,
rather than the data item itself.
A synchronous transfer can be achieved by using the kernel's mailbox
object type.

View File

@@ -164,8 +164,7 @@ Use a pipe to send streams of data between threads.
.. note::
A pipe can be used to transfer long streams of data if desired. However
it is often preferable to send pointers to large data items to avoid
copying the data. The kernel's memory map and memory pool object types
can be helpful for data transfers of this sort.
copying the data.
Configuration Options
*********************

View File

@@ -32,12 +32,12 @@ A stack must be initialized before it can be used. This sets its queue to empty.
A data value can be **added** to a stack by a thread or an ISR.
The value is given directly to a waiting thread, if one exists;
otherwise the value is added to the LIFO's queue.
The kernel does *not* detect attempts to add a data value to a stack
that has already reached its maximum quantity of queued values.
.. note::
Adding a data value to a stack that is already full will result in
array overflow, and lead to unpredictable behavior.
If :kconfig:`CONFIG_NO_RUNTIME_CHECKS` is enabled, the kernel will *not* detect
and prevent attempts to add a data value to a stack that has already reached
its maximum quantity of queued values. Adding a data value to a stack that is
already full will result in array overflow, and lead to unpredictable behavior.
A data value may be **removed** from a stack by a thread.
If the stack's queue is empty a thread may choose to wait for it to be given.

View File

@@ -113,7 +113,7 @@ an extra 72 bytes of stack space where the callee-saved FP context can
be saved.
`Lazy Stacking
<http://infocenter.arm.com/help/index.jsp?topic=/com.arm.doc.dai0298a/DAFGGBJD.html>`_
<https://developer.arm.com/documentation/dai0298/a>`_
is currently enabled in Zephyr applications on ARM Cortex-M
architecture, minimizing interrupt latency, when the floating
point context is active.

View File

@@ -39,6 +39,15 @@ The kernel's scheduler selects the highest priority ready thread
to be the current thread. When multiple ready threads of the same priority
exist, the scheduler chooses the one that has been waiting longest.
A thread's relative priority is primarily determined by its static priority.
However, when both earliest-deadline-first scheduling is enabled
(:kconfig:`CONFIG_SCHED_DEADLINE`) and a choice of threads have equal
static priority, then the thread with the earlier deadline is considered
to have the higher priority. Thus, when earliest-deadline-first scheduling is
enabled, two threads are only considered to have the same priority when both
their static priorities and deadlines are equal. The routine
:c:func:`k_thread_deadline_set` is used to set a thread's deadline.
.. note::
Execution of ISRs takes precedence over thread execution,
so the execution of the current thread may be replaced by an ISR

View File

@@ -37,6 +37,13 @@ Any number of threads may wait on an unavailable semaphore simultaneously.
When the semaphore is given, it is taken by the highest priority thread
that has waited longest.
.. note::
You may initialize a "full" semaphore (count equal to limit) to limit the number
of threads able to execute the critical section at the same time. You may also
initialize an empty semaphore (count equal to 0, with a limit greater than 0)
to create a gate through which no waiting thread may pass until the semaphore
is incremented. All standard use cases of the common semaphore are supported.
.. note::
The kernel does allow an ISR to take a semaphore, however the ISR must
not attempt to wait if the semaphore is unavailable.

View File

@@ -245,6 +245,10 @@ A thread's initial priority value can be altered up or down after the thread
has been started. Thus it is possible for a preemptible thread to become
a cooperative thread, and vice versa, by changing its priority.
.. note::
The scheduler does not make heuristic decisions to re-prioritize threads.
Thread priorities are set and changed only at the application's request.
The kernel supports a virtually unlimited number of thread priority levels.
The configuration options :kconfig:`CONFIG_NUM_COOP_PRIORITIES` and
:kconfig:`CONFIG_NUM_PREEMPT_PRIORITIES` specify the number of priority
@@ -269,9 +273,10 @@ When enabled (see :kconfig:`CONFIG_NUM_METAIRQ_PRIORITIES`), there is a special
subclass of cooperative priorities at the highest (numerically lowest)
end of the priority space: meta-IRQ threads. These are scheduled
according to their normal priority, but also have the special ability
to preempt all other threads (and other meta-irq threads) at lower
to preempt all other threads (and other meta-IRQ threads) at lower
priorities, even if those threads are cooperative and/or have taken a
scheduler lock.
scheduler lock. Meta-IRQ threads are still threads, however,
and can still be interrupted by any hardware interrupt.
This behavior makes the act of unblocking a meta-IRQ thread (by any
means, e.g. creating it, calling k_sem_give(), etc.) into the
@@ -284,7 +289,7 @@ run before the current CPU returns into application code.
Unlike similar features in other OSes, meta-IRQ threads are true
threads and run on their own stack (which must be allocated normally),
not the per-CPU interrupt stack. Design work to enable the use of the
not the per-CPU interrupt stack. Design work to enable the use of the
IRQ stack on supported architectures is pending.
Note that because this breaks the promise made to cooperative

61
doc/reference/usb/hid.rst Normal file
View File

@@ -0,0 +1,61 @@
.. _usb_device_hid:
USB Human Interface Devices (HID) support
#########################################
Since the USB HID specification is not only used by the USB subsystem, the USB HID API
is split into two header files :zephyr_file:`include/usb/class/hid.h`
and :zephyr_file:`include/usb/class/usb_hid.h`. The second includes a specific
part for HID support in the USB device stack.
HID Item helpers
****************
HID item helper macros can be used to compose a HID Report Descriptor.
The names correspond to those used in the USB HID Specification.
Example of a HID Report Descriptor:
.. code-block:: c
static const uint8_t hid_report_desc[] = {
HID_USAGE_PAGE(HID_USAGE_GEN_DESKTOP),
HID_USAGE(HID_USAGE_GEN_DESKTOP_UNDEFINED),
HID_COLLECTION(HID_COLLECTION_APPLICATION),
HID_LOGICAL_MIN8(0),
/* logical maximum 255 */
HID_LOGICAL_MAX16(0xFF, 0x00),
HID_REPORT_ID(1),
HID_REPORT_SIZE(8),
HID_REPORT_COUNT(1),
HID_USAGE(HID_USAGE_GEN_DESKTOP_UNDEFINED),
/* HID_INPUT (Data, Variable, Absolute) */
HID_INPUT(0x02),
HID_END_COLLECTION,
};
HID items reference
*******************
.. doxygengroup:: usb_hid_items
HID types reference
*******************
.. doxygengroup:: usb_hid_types
HID Mouse and Keyboard report descriptors
*****************************************
The pre-defined Mouse and Keyboard report descriptors can be used by
a HID device implementation or simply as examples.
.. doxygengroup:: usb_hid_mk_report_desc
HID Class Device API reference
******************************
USB HID devices like mouse, keyboard, or any other specific device use this API.
.. doxygengroup:: usb_hid_device_api

View File

@@ -1,252 +1,13 @@
.. _usb_api:
USB device stack
################
USB device support
##################
.. contents::
:depth: 2
:local:
:backlinks: top
.. toctree::
:maxdepth: 1
USB Vendor and Product identifiers
**********************************
The USB Vendor ID for the Zephyr project is 0x2FE3. The default USB Product
ID for the Zephyr project is 0x100. The USB bcdDevice Device Release Number
represents the Zephyr kernel major and minor versions as a binary coded
decimal value. When a vendor integrates the Zephyr USB subsystem into a
product, the vendor must use the USB Vendor and Product ID assigned to them.
A vendor integrating the Zephyr USB subsystem in a product must not use the
Vendor ID of the Zephyr project.
The USB maintainer, if one is assigned, or otherwise the Zephyr Technical
Steering Committee, may allocate other USB Product IDs based on well-motivated
and documented requests.
Each USB sample has its own unique Product ID.
When adding a new sample, add a new entry in :file:`samples/subsys/usb/usb_pid.Kconfig`
and a Kconfig file inside your sample subdirectory.
The following Product IDs are currently used:
* :kconfig:`CONFIG_USB_PID_CDC_ACM_SAMPLE`
* :kconfig:`CONFIG_USB_PID_CDC_ACM_COMPOSITE_SAMPLE`
* :kconfig:`CONFIG_USB_PID_HID_CDC_SAMPLE`
* :kconfig:`CONFIG_USB_PID_CONSOLE_SAMPLE`
* :kconfig:`CONFIG_USB_PID_DFU_SAMPLE`
* :kconfig:`CONFIG_USB_PID_HID_SAMPLE`
* :kconfig:`CONFIG_USB_PID_HID_MOUSE_SAMPLE`
* :kconfig:`CONFIG_USB_PID_MASS_SAMPLE`
* :kconfig:`CONFIG_USB_PID_TESTUSB_SAMPLE`
* :kconfig:`CONFIG_USB_PID_WEBUSB_SAMPLE`
* :kconfig:`CONFIG_USB_PID_BLE_HCI_H4_SAMPLE`
USB device controller drivers
*****************************
The Device Controller Driver Layer implements the low level control routines
to deal directly with the hardware. All device controller drivers should
implement the APIs described in file usb_dc.h. This allows the integration of
new USB device controllers to be done without changing the upper layers.
USB Device Controller API
=========================
.. doxygengroup:: _usb_device_controller_api
USB device core layer
*********************
The USB Device core layer is a hardware independent interface between USB
device controller driver and USB device class drivers or customer applications.
It's a port of the LPCUSB device stack. It provides the following
functionalities:
* Responds to standard device requests and returns standard descriptors,
essentially handling 'Chapter 9' processing, specifically the standard
device requests in table 9-3 from the universal serial bus specification
revision 2.0.
* Provides a programming interface to be used by USB device classes or
customer applications. The APIs are described in the usb_device.h file.
* Uses the APIs provided by the device controller drivers to interact with
the USB device controller.
USB Device Core Layer API
=========================
There are two ways to transmit data, using the 'low' level read/write API or
the 'high' level transfer API.
Low level API
To transmit data to the host, the class driver should call usb_write().
Upon completion the registered endpoint callback will be called. Before
sending another packet the class driver should wait for the completion of
the previous write. When data is received, the registered endpoint callback
is called. usb_read() should be used for retrieving the received data.
For CDC ACM sample driver this happens via the OUT bulk endpoint handler
(cdc_acm_bulk_out) mentioned in the endpoint array (cdc_acm_ep_data).
High level API
The usb_transfer method can be used to transfer data to/from the host. The
transfer API will automatically split the data transmission into one or more
USB transaction(s), depending endpoint max packet size. The class driver does
not have to implement endpoint callback and should set this callback to the
generic usb_transfer_ep_callback.
.. doxygengroup:: _usb_device_core_api
USB device class drivers
************************
Zephyr USB Device Stack supports many standard classes, such as HID, MSC
Ethernet over USB, DFU, Bluetooth.
Implementing non standard USB class
===================================
Configuration of USB Device is done in the stack layer.
The following structures and callbacks need to be defined:
* Part of USB Descriptor table
* USB Endpoint configuration table
* USB Device configuration structure
* Endpoint callbacks
* Optionally class, vendor and custom handlers
For example, for USB loopback application:
.. literalinclude:: ../../../subsys/usb/class/loopback.c
:language: c
:start-after: usb.rst config structure start
:end-before: usb.rst config structure end
:linenos:
Endpoint configuration:
.. literalinclude:: ../../../subsys/usb/class/loopback.c
:language: c
:start-after: usb.rst endpoint configuration start
:end-before: usb.rst endpoint configuration end
:linenos:
USB Device configuration structure:
.. literalinclude:: ../../../subsys/usb/class/loopback.c
:language: c
:start-after: usb.rst device config data start
:end-before: usb.rst device config data end
:linenos:
The vendor device requests are forwarded by the USB stack core driver to the
class driver through the registered vendor handler.
For the loopback class driver, :c:func:`loopback_vendor_handler` processes
the vendor requests:
.. literalinclude:: ../../../subsys/usb/class/loopback.c
:language: c
:start-after: usb.rst vendor handler start
:end-before: usb.rst vendor handler end
:linenos:
The class driver waits for the :makevar:`USB_DC_CONFIGURED` device status code
before transmitting any data.
.. _testing_USB_native_posix:
Testing USB over USP/IP in native_posix
***************************************
Virtual USB controller implemented through USB/IP might be used to test USB
Device stack. Follow general build procedure to build USB sample for
the native_posix configuration.
Run built sample with:
.. code-block:: console
west build -t run
In a terminal window, run the following command to list USB devices:
.. code-block:: console
$ usbip list -r localhost
Exportable USB devices
======================
- 127.0.0.1
1-1: unknown vendor : unknown product (2fe3:0100)
: /sys/devices/pci0000:00/0000:00:01.2/usb1/1-1
: (Defined at Interface level) (00/00/00)
: 0 - Vendor Specific Class / unknown subclass / unknown protocol (ff/00/00)
In a terminal window, run the following command to attach USB device:
.. code-block:: console
$ sudo usbip attach -r localhost -b 1-1
The USB device should be connected to your Linux host, and verified with the following commands:
.. code-block:: console
$ sudo usbip port
Imported USB devices
====================
Port 00: <Port in Use> at Full Speed(12Mbps)
unknown vendor : unknown product (2fe3:0100)
7-1 -> usbip://localhost:3240/1-1
-> remote bus/dev 001/002
$ lsusb -d 2fe3:0100
Bus 007 Device 004: ID 2fe3:0100
USB Human Interface Devices (HID) support
*****************************************
HID Item helpers
================
HID item helper macros can be used to compose a HID Report Descriptor.
The names correspond to those used in the USB HID Specification.
Example of a HID Report Descriptor:
.. code-block:: c
static const uint8_t hid_report_desc[] = {
HID_USAGE_PAGE(HID_USAGE_GEN_DESKTOP),
HID_USAGE(HID_USAGE_GEN_DESKTOP_UNDEFINED),
HID_COLLECTION(HID_COLLECTION_APPLICATION),
HID_LOGICAL_MIN8(0),
/* logical maximum 255 */
HID_LOGICAL_MAX16(0xFF, 0x00),
HID_REPORT_ID(1),
HID_REPORT_SIZE(8),
HID_REPORT_COUNT(1),
HID_USAGE(HID_USAGE_GEN_DESKTOP_UNDEFINED),
/* HID_INPUT (Data, Variable, Absolute) */
HID_INPUT(0x02),
HID_END_COLLECTION,
};
.. doxygengroup:: usb_hid_items
.. doxygengroup:: usb_hid_types
HID Mouse and Keyboard report descriptors
=========================================
The pre-defined Mouse and Keyboard report descriptors can be used by
a HID device implementation or simply as examples.
.. doxygengroup:: usb_hid_mk_report_desc
HID Class Device API
********************
USB HID devices like mouse, keyboard, or any other specific device use this API.
.. doxygengroup:: usb_hid_device_api
udc.rst
uds.rst
uds_testing.rst
hid.rst
uds_cdc_acm.rst

17
doc/reference/usb/udc.rst Normal file
View File

@@ -0,0 +1,17 @@
.. _udc_api:
USB device controller driver API
################################
The USB Device Controller Driver Layer implements the low level control routines
to deal directly with the hardware. All device controller drivers should
implement the APIs described in :zephyr_file:`include/drivers/usb/usb_dc.h`.
This allows the integration of new USB device controllers to be done without
changing the upper layers.
With this API it is not possible to support more than one controller
instance at runtime.
API reference
*************
.. doxygengroup:: _usb_device_controller_api

148
doc/reference/usb/uds.rst Normal file
View File

@@ -0,0 +1,148 @@
.. _usb_device_stack:
USB device stack
################
The USB device stack is a hardware independent interface between USB
device controller driver and USB device class drivers or customer applications.
It is a port of the LPCUSB device stack and has been modified and expanded
over time. It provides the following functionalities:
* Uses the APIs provided by the device controller drivers to interact with
the USB device controller.
* Responds to standard device requests and returns standard descriptors,
essentially handling 'Chapter 9' processing, specifically the standard
device requests in table 9-3 from the universal serial bus specification
revision 2.0.
* Provides a programming interface to be used by USB device classes or
customer applications. The APIs is described in
:zephyr_file:`include/usb/usb_device.h`
The device stack has few limitations with which it is not possible to support
more than one controller instance at runtime, and only one USB device
configuration is supported.
Supported USB classes:
* USB Audio (experimental)
* USB CDC ACM
* USB CDC ECM
* USB CDC EEM
* RNDIS
* USB MSC
* USB DFU
* Bluetooth HCI over USB
* USB HID class
:ref:`List<usb-samples>` of samples for different purposes.
CDC ACM and HID samples have configuration overlays for composite configuration.
Implementing a non-standard USB class
*************************************
The configuration of USB Device is done in the stack layer.
The following structures and callbacks need to be defined:
* Part of USB Descriptor table
* USB Endpoint configuration table
* USB Device configuration structure
* Endpoint callbacks
* Optionally class, vendor and custom handlers
For example, for the USB loopback application:
.. literalinclude:: ../../../subsys/usb/class/loopback.c
:language: c
:start-after: usb.rst config structure start
:end-before: usb.rst config structure end
:linenos:
Endpoint configuration:
.. literalinclude:: ../../../subsys/usb/class/loopback.c
:language: c
:start-after: usb.rst endpoint configuration start
:end-before: usb.rst endpoint configuration end
:linenos:
USB Device configuration structure:
.. literalinclude:: ../../../subsys/usb/class/loopback.c
:language: c
:start-after: usb.rst device config data start
:end-before: usb.rst device config data end
:linenos:
The vendor device requests are forwarded by the USB stack core driver to the
class driver through the registered vendor handler.
For the loopback class driver, :c:func:`loopback_vendor_handler` processes
the vendor requests:
.. literalinclude:: ../../../subsys/usb/class/loopback.c
:language: c
:start-after: usb.rst vendor handler start
:end-before: usb.rst vendor handler end
:linenos:
The class driver waits for the :makevar:`USB_DC_CONFIGURED` device status code
before transmitting any data.
.. _testing_USB_native_posix:
USB Vendor and Product identifiers
**********************************
The USB Vendor ID for the Zephyr project is ``0x2FE3``.
This USB Vendor ID must not be used when a vendor
integrates Zephyr USB device support into its own product.
Each USB sample has its own unique Product ID.
The USB maintainer, if one is assigned, or otherwise the Zephyr Technical
Steering Committee, may allocate other USB Product IDs based on well-motivated
and documented requests.
When adding a new sample, add a new entry in :file:`samples/subsys/usb/usb_pid.Kconfig`
and a Kconfig file inside your sample subdirectory.
The following Product IDs are currently used:
* :kconfig:`CONFIG_USB_PID_CDC_ACM_SAMPLE`
* :kconfig:`CONFIG_USB_PID_CDC_ACM_COMPOSITE_SAMPLE`
* :kconfig:`CONFIG_USB_PID_HID_CDC_SAMPLE`
* :kconfig:`CONFIG_USB_PID_CONSOLE_SAMPLE`
* :kconfig:`CONFIG_USB_PID_DFU_SAMPLE`
* :kconfig:`CONFIG_USB_PID_HID_SAMPLE`
* :kconfig:`CONFIG_USB_PID_HID_MOUSE_SAMPLE`
* :kconfig:`CONFIG_USB_PID_MASS_SAMPLE`
* :kconfig:`CONFIG_USB_PID_TESTUSB_SAMPLE`
* :kconfig:`CONFIG_USB_PID_WEBUSB_SAMPLE`
* :kconfig:`CONFIG_USB_PID_BLE_HCI_H4_SAMPLE`
The USB device descriptor field ``bcdDevice`` (Device Release Number) represents
the Zephyr kernel major and minor versions as a binary coded decimal value.
API reference
*************
There are two ways to transmit data, using the 'low' level read/write API or
the 'high' level transfer API.
Low level API
To transmit data to the host, the class driver should call usb_write().
Upon completion the registered endpoint callback will be called. Before
sending another packet the class driver should wait for the completion of
the previous write. When data is received, the registered endpoint callback
is called. usb_read() should be used for retrieving the received data.
For CDC ACM sample driver this happens via the OUT bulk endpoint handler
(cdc_acm_bulk_out) mentioned in the endpoint array (cdc_acm_ep_data).
High level API
The usb_transfer method can be used to transfer data to/from the host. The
transfer API will automatically split the data transmission into one or more
USB transaction(s), depending endpoint max packet size. The class driver does
not have to implement endpoint callback and should set this callback to the
generic usb_transfer_ep_callback.
.. doxygengroup:: _usb_device_core_api

View File

@@ -0,0 +1,108 @@
.. _usb_device_cdc_acm:
USB device stack CDC ACM support
################################
The CDC ACM class is used as backend for different subsystems in Zephyr.
However, its configuration may not be easy for the inexperienced user.
Below is a description of the different use cases and some pitfalls.
The interface for CDC ACM user is :ref:`uart_api` driver API.
But there are two important differences in behavior to a real UART controller:
* Data transfer is only possible after the USB device stack has been initialized and started,
until then any data is discarded
* If device is connected to the host, it still needs an application
on the host side which requests the data
The devicetree compatible property for CDC ACM UART is
:dtcompatible:`zephyr,cdc-acm-uart`.
CDC ACM support is automatically selected when USB device support is enabled
and a compatible node in the devicetree sources is present. If necessary,
CDC ACM support can be explicitly disabled by :kconfig:`CONFIG_USB_CDC_ACM`.
About four CDC ACM UART instances can be defined and used,
limited by the maximum number of supported endpoints on the controller.
CDC ACM UART node is supposed to be child of a USB device controller node.
Since the designation of the controller nodes varies from vendor to vendor,
and our samples and application should be as generic as possible,
the default USB device controller is usually assigned an ``zephyr_udc0``
node label. Often, CDC ACM UART is described in a devicetree overlay file
and looks like this:
.. code-block:: devicetree
&zephyr_udc0 {
cdc_acm_uart0: cdc_acm_uart0 {
compatible = "zephyr,cdc-acm-uart";
label = "CDC_ACM_0";
};
};
Samples :ref:`usb_cdc-acm` and :ref:`usb_hid-cdc` have similar overlay files.
And since no special properties are present, it may seem overkill to use
devicetree to describe CDC ACM UART. The motivation behind using devicetree
is the easy interchangeability of a real UART controller and CDC ACM UART
in applications.
Console over CDC ACM UART
*************************
With the CDC ACM UART node from above and ``zephyr,console`` property of the
chosen node, we can describe that CDC ACM UART is to be used with the console.
A similar overlay file is used by :ref:`cdc-acm-console`.
If USB device support is enabled in the application, as in the console sample,
:kconfig:`CONFIG_USB_UART_CONSOLE` must be enabled,
which does nothing but change the initialization time of the console driver.
.. code-block:: devicetree
/ {
chosen {
zephyr,console = &cdc_acm_uart0;
};
};
&zephyr_udc0 {
cdc_acm_uart0: cdc_acm_uart0 {
compatible = "zephyr,cdc-acm-uart";
label = "CDC_ACM_0";
};
};
Before the application uses the console, it is recommended to wait for
the DTR signal:
.. code-block:: c
const struct device *dev = DEVICE_DT_GET(DT_CHOSEN(zephyr_console));
uint32_t dtr = 0;
if (usb_enable(NULL)) {
return;
}
while (!dtr) {
uart_line_ctrl_get(dev, UART_LINE_CTRL_DTR, &dtr);
k_sleep(K_MSEC(100));
}
printk("nuqneH\n");
CDC ACM UART as backend
***********************
As for the console sample, it is possible to configure CDC ACM UART as
backend for other subsystems by setting :ref:`devicetree-chosen-nodes`
properties.
List of few Zephyr specific chosen properties which can be used to select
CDC ACM UART as backend for a subsystem or application:
* ``zephyr,bt-c2h-uart`` used in Bluetooth,
for example see :ref:`bluetooth-hci-uart-sample`
* ``zephyr,ot-uart`` used in OpenThread,
for example see :ref:`coprocessor-sample`
* ``zephyr,shell-uart`` used by shell for serial backend,
for example see :zephyr_file:`samples/subsys/shell/shell_module`
* ``zephyr,uart-mcumgr`` used by :ref:`smp_svr_sample`

View File

@@ -0,0 +1,50 @@
.. _usb_device_testing:
Testing USB device support
##########################
Testing over USPIP in native_posix
***********************************
A virtual USB controller implemented through USBIP might be used to test the USB
Device stack. Follow the general build procedure to build the USB sample for
the native_posix configuration.
Run built sample with:
.. code-block:: console
west build -t run
In a terminal window, run the following command to list USB devices:
.. code-block:: console
$ usbip list -r localhost
Exportable USB devices
======================
- 127.0.0.1
1-1: unknown vendor : unknown product (2fe3:0100)
: /sys/devices/pci0000:00/0000:00:01.2/usb1/1-1
: (Defined at Interface level) (00/00/00)
: 0 - Vendor Specific Class / unknown subclass / unknown protocol (ff/00/00)
In a terminal window, run the following command to attach the USB device:
.. code-block:: console
$ sudo usbip attach -r localhost -b 1-1
The USB device should be connected to your Linux host, and verified with the following commands:
.. code-block:: console
$ sudo usbip port
Imported USB devices
====================
Port 00: <Port in Use> at Full Speed(12Mbps)
unknown vendor : unknown product (2fe3:0100)
7-1 -> usbip://localhost:3240/1-1
-> remote bus/dev 001/002
$ lsusb -d 2fe3:0100
Bus 007 Device 004: ID 2fe3:0100

View File

@@ -4,9 +4,9 @@ Memory Protection Design
########################
Zephyr's memory protection design is geared towards microcontrollers with MPU
(Memory Protection Unit) hardware. We do support some architectures which have
a paged MMU (Memory Management Unit), but in that case the MMU is used like
an MPU with an identity page table.
(Memory Protection Unit) hardware. We do support some architectures, such as x86,
which have a paged MMU (Memory Management Unit), but in that case the MMU is
used like an MPU with an identity page table.
All of the discussion below will be using MPU terminology; systems with MMUs
can be considered to have an MPU with an unlimited number of programmable
@@ -46,7 +46,7 @@ text/ro-data, this is sufficient for the boot time configuration.
Hardware Stack Overflow
***********************
``CONFIG_HW_STACK_PROTECTION`` is an optional feature which detects stack
:kconfig:`CONFIG_HW_STACK_PROTECTION` is an optional feature which detects stack
buffer overflows when the system is running in supervisor mode. This
catches issues when the entire stack buffer has overflowed, and not
individual stack frames, use compiler-assisted :kconfig:`CONFIG_STACK_CANARIES`

File diff suppressed because it is too large Load Diff

View File

@@ -784,6 +784,24 @@ Possible overflow in mempool
CVE-2021
========
CVE-2021-3319
-------------
DOS: Incorrect 802154 Frame Validation for Omitted Source / Dest Addresses
Improper processing of omitted source and destination addresses in
ieee802154 frame validation (ieee802154_validate_frame)
This has been fixed in main for v2.5.0
- `CVE-2020-3319 <http://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2021-3319>`_
- `Zephyr project bug tracker GHSA-94jg-2p6q-5364
<https://github.com/zephyrproject-rtos/zephyr/security/advisories/GHSA-94jg-2p6q-5364>`_
- `PR31908 fix for main
<https://github.com/zephyrproject-rtos/zephyr/pull/31908>`_
CVE-2021-3320
-------------------
Mismatch between validation and handling of 802154 ACK frames, where
@@ -938,6 +956,36 @@ This has been fixed in main for v2.6.0
- `PR 33418 fix for 1.14.2
<https://github.com/zephyrproject-rtos/zephyr/pull/33418>`_
CVE-2021-3436
-------------
Bluetooth: Possible to overwrite an existing bond during keys
distribution phase when the identity address of the bond is known
During the distribution of the identity address information we dont
check for an existing bond with the same identity address.This means
that a duplicate entry will be created in RAM while the newest entry
will overwrite the existing one in persistent storage.
This has been fixed in main for v2.6.0
- `CVE-2021-3436 <http://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2021-3436>`_
- `Zephyr project bug tracker GHSA-j76f-35mc-4h63
<https://github.com/zephyrproject-rtos/zephyr/security/advisories/GHSA-j76f-35mc-4h63>`_
- `PR 33266 fix for main
<https://github.com/zephyrproject-rtos/zephyr/pull/33266>`_
- `PR 33432 fix for 2.5
<https://github.com/zephyrproject-rtos/zephyr/pull/33432>`_
- `PR 33433 fix for 2.4
<https://github.com/zephyrproject-rtos/zephyr/pull/33433>`_
- `PR 33718 fix for 1.14.2
<https://github.com/zephyrproject-rtos/zephyr/pull/33718>`_
CVE-2021-3454
-------------
@@ -989,7 +1037,70 @@ This has been fixed in main for v2.6.0
- `PR 36105 fix for 2.4
<https://github.com/zephyrproject-rtos/zephyr/pull/36105>`_
CVE-2021-3510
-------------
Zephyr JSON decoder incorrectly decodes array of array
When using JSON_OBJ_DESCR_ARRAY_ARRAY, the subarray is has the token
type JSON_TOK_LIST_START, but then assigns to the object part of the
union. arr_parse then takes the offset of the array-object (which has
nothing todo with the list) treats it as relative to the parent
object, and stores the length of the subarray in there.
This has been fixed in main for v2.7.0
- `CVE-2021-3510 <http://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2021-3510>`_
- `Zephyr project bug tracker GHSA-289f-7mw3-2qf4
<https://github.com/zephyrproject-rtos/zephyr/security/advisories/GHSA-289f-7mw3-2qf4>`_
- `PR 36340 fix for main
<https://github.com/zephyrproject-rtos/zephyr/pull/36340>`_
- `PR 37816 fix for 2.6
<https://github.com/zephyrproject-rtos/zephyr/pull/37816>`_
CVE-2021-3581
-------------
Under embargo until 2021/09/04
HCI data not properly checked leads to memory overflow in the Bluetooth stack
In the process of setting SCAN_RSP through the HCI command, the Zephyr
Bluetooth protocol stack did not effectively check the length of the
incoming HCI data. Causes memory overflow, and then the data in the
memory is overwritten, and may even cause arbitrary code execution.
This has been fixed in main for v2.6.0
- `CVE-2021-3581 <http://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2021-3581>`_
- `Zephyr project bug tracker GHSA-8q65-5gqf-fmw5
<https://github.com/zephyrproject-rtos/zephyr/security/advisories/GHSA-8q65-5gqf-fmw5>`_
- `PR 35935 fix for main
<https://github.com/zephyrproject-rtos/zephyr/pull/35935>`_
- `PR 35984 fix for 2.5
<https://github.com/zephyrproject-rtos/zephyr/pull/35984>`_
- `PR 35985 fix for 2.4
<https://github.com/zephyrproject-rtos/zephyr/pull/35985>`_
- `PR 35985 fix for 1.14
<https://github.com/zephyrproject-rtos/zephyr/pull/35985>`_
CVE-2021-3625
-------------
Buffer overflow in Zephyr USB DFU DNLOAD
This has been fixed in main for v2.6.0
- `CVE-2021-3625 <http://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2021-3625>`_
- `Zephyr project bug tracker GHSA-c3gr-hgvr-f363
<https://github.com/zephyrproject-rtos/zephyr/security/advisories/GHSA-c3gr-hgvr-f363>`_
- `PR 36694 fix for main
<https://github.com/zephyrproject-rtos/zephyr/pull/36694>`_

View File

@@ -49,8 +49,8 @@ add_subdirectory_ifdef(CONFIG_PM_CPU_OPS pm_cpu_ops)
add_subdirectory_ifdef(CONFIG_FLASH_HAS_DRIVER_ENABLED flash)
add_subdirectory_ifdef(CONFIG_SERIAL_HAS_DRIVER serial)
add_subdirectory_ifdef(CONFIG_BT bluetooth)
add_subdirectory_ifdef(CONFIG_NETWORKING net)
add_subdirectory_ifdef(CONFIG_BT_DRIVERS bluetooth)
add_subdirectory_ifdef(CONFIG_NET_DRIVERS net)
add_subdirectory_ifdef(CONFIG_NET_L2_ETHERNET ethernet)
add_subdirectory_ifdef(CONFIG_ENTROPY_HAS_DRIVER entropy)
add_subdirectory_ifdef(CONFIG_SYS_CLOCK_EXISTS timer)

View File

@@ -409,18 +409,10 @@ static int start_read(const struct device *dev,
return err;
}
#if defined(CONFIG_SOC_SERIES_STM32G0X) || \
defined(CONFIG_SOC_SERIES_STM32G4X) || \
defined(CONFIG_SOC_SERIES_STM32H7X) || \
defined(CONFIG_SOC_SERIES_STM32L0X) || \
defined(CONFIG_SOC_SERIES_STM32L4X) || \
defined(CONFIG_SOC_SERIES_STM32L5X) || \
defined(CONFIG_SOC_SERIES_STM32WBX) || \
defined(CONFIG_SOC_SERIES_STM32WLX)
#if defined(CONFIG_SOC_SERIES_STM32G0X)
/*
* Errata: Writing ADC_CFGR1 register while ADEN bit is set
* resets RES[1:0] bitfield. We need to disable and enable adc.
* On all those stm32 devices it is allowed to write these bits only when ADEN = 0.
*/
if (LL_ADC_IsEnabled(adc) == 1UL) {
LL_ADC_Disable(adc);
@@ -436,6 +428,15 @@ static int start_read(const struct device *dev,
LL_ADC_SetResolution(adc, resolution);
#endif
#ifdef CONFIG_SOC_SERIES_STM32L0X
/*
* setting OVS bits is conditioned to ADC state: ADC must be disabled
* or enabled without conversion on going : disable it, it will stop
*/
LL_ADC_Disable(adc);
while (LL_ADC_IsEnabled(adc) == 1UL) {
}
#endif /* CONFIG_SOC_SERIES_STM32L0X */
#if defined(CONFIG_SOC_SERIES_STM32G0X) || \
defined(CONFIG_SOC_SERIES_STM32G4X) || \
defined(CONFIG_SOC_SERIES_STM32H7X) || \
@@ -444,13 +445,7 @@ static int start_read(const struct device *dev,
defined(CONFIG_SOC_SERIES_STM32L5X) || \
defined(CONFIG_SOC_SERIES_STM32WBX) || \
defined(CONFIG_SOC_SERIES_STM32WLX)
/*
* setting OVS bits is conditioned to ADC state: ADC must be disabled
* or enabled without conversion on going : disable it, it will stop
*/
LL_ADC_Disable(adc);
while (LL_ADC_IsEnabled(adc) == 1UL) {
}
switch (sequence->oversampling) {
case 0:
LL_ADC_SetOverSamplingScope(adc, LL_ADC_OVS_DISABLE);

View File

@@ -9,9 +9,13 @@
# Controller support is an HCI driver in itself, so these HCI driver
# options are only applicable if controller support hasn't been enabled.
menu "Bluetooth Drivers"
menuconfig BT_DRIVERS
bool "Bluetooth Drivers"
default y
depends on BT && !BT_CTLR
if BT_DRIVERS
if BT_HCI
source "drivers/bluetooth/hci/Kconfig"
endif
@@ -20,4 +24,4 @@ if BT_CUSTOM
# Insert here any custom (non-HCI) offload drives
endif
endmenu
endif # BT_DRIVERS

View File

@@ -26,16 +26,12 @@ zephyr_library_sources_ifdef(CONFIG_ETH_SAM_GMAC eth_sam_gmac.c)
zephyr_library_sources_ifdef(CONFIG_DSA_KSZ8XXX dsa_ksz8xxx.c)
if(CONFIG_ETH_NATIVE_POSIX)
zephyr_library_named(drivers__ethernet__native_posix)
zephyr_library_compile_definitions(
NO_POSIX_CHEATS
_BSD_SOURCE
_DEFAULT_SOURCE
)
zephyr_library_sources(
eth_native_posix.c
eth_native_posix_adapt.c
)
set(native_posix_source_files eth_native_posix.c eth_native_posix_adapt.c)
set_source_files_properties(${native_posix_source_files}
PROPERTIES COMPILE_DEFINITIONS
"NO_POSIX_CHEATS;_BSD_SOURCE;_DEFAULT_SOURCE"
)
zephyr_library_sources(${native_posix_source_files})
endif()
add_subdirectory(phy)

View File

@@ -1,5 +1,3 @@
# SPDX-License-Identifier: Apache-2.0
zephyr_library()
zephyr_library_sources_ifdef(CONFIG_PHY_GENERIC_MII phy_mii.c)

View File

@@ -692,7 +692,8 @@ GPIO_DEVICE_INIT_STM32(k, K);
#endif /* DT_NODE_HAS_STATUS(DT_NODELABEL(gpiok), okay) */
#if defined(CONFIG_SOC_SERIES_STM32F1X)
#if defined(CONFIG_SOC_SERIES_STM32F1X) && \
!defined(CONFIG_GPIO_STM32_SWJ_ENABLE)
static int gpio_stm32_afio_init(const struct device *dev)
{
@@ -716,6 +717,6 @@ static int gpio_stm32_afio_init(const struct device *dev)
return 0;
}
SYS_DEVICE_DEFINE("gpio_stm32_afio", gpio_stm32_afio_init, NULL, PRE_KERNEL_2, 0);
SYS_DEVICE_DEFINE("gpio_stm32_afio", gpio_stm32_afio_init, NULL, PRE_KERNEL_1, 0);
#endif /* CONFIG_SOC_SERIES_STM32F1X */
#endif /* CONFIG_SOC_SERIES_STM32F1X && !CONFIG_GPIO_STM32_SWJ_ENABLE */

View File

@@ -164,6 +164,33 @@ static const struct i2c_pin i2c_pin_regs[] = {
{ &GPDMRA, &GPDMRA, 0x10, 0x20},
};
static int i2c_parsing_return_value(const struct device *dev)
{
struct i2c_it8xxx2_data *data = DEV_DATA(dev);
const struct i2c_it8xxx2_config *config = DEV_CFG(dev);
if (!data->err)
return 0;
/* Connection timed out */
if (data->err == ETIMEDOUT)
return -ETIMEDOUT;
if (config->port < I2C_STANDARD_PORT_COUNT) {
/* The device does not respond ACK */
if (data->err == HOSTA_NACK)
return -ENXIO;
else
return -EIO;
} else {
/* The device does not respond ACK */
if (data->err == E_HOSTA_ACK)
return -ENXIO;
else
return -EIO;
}
}
static int i2c_get_line_levels(const struct device *dev)
{
const struct i2c_it8xxx2_config *config = DEV_CFG(dev);
@@ -835,7 +862,7 @@ static int i2c_it8xxx2_transfer(const struct device *dev, struct i2c_msg *msgs,
/* Unlock mutex of i2c controller */
k_mutex_unlock(&data->mutex);
return data->err;
return i2c_parsing_return_value(dev);
}
static void i2c_it8xxx2_isr(void *arg)

View File

@@ -27,12 +27,12 @@ struct i2s_nrfx_drv_data {
const uint32_t *last_tx_buffer;
enum i2s_state state;
enum i2s_dir active_dir;
bool stop; /* stop after the current (TX or RX) block */
bool discard_rx; /* discard further RX blocks */
volatile bool next_tx_buffer_needed;
bool tx_configured : 1;
bool rx_configured : 1;
bool stop : 1; /* stop after the current (TX or RX) block */
bool discard_rx : 1; /* discard further RX blocks */
bool request_clock : 1;
volatile bool next_tx_buffer_needed;
};
struct i2s_nrfx_drv_cfg {
@@ -81,6 +81,7 @@ static void find_suitable_clock(const struct i2s_nrfx_drv_cfg *drv_cfg,
uint32_t best_diff = UINT32_MAX;
uint8_t r, best_r = 0;
nrf_i2s_mck_t best_mck_cfg = 0;
uint32_t best_mck = 0;
for (r = 0; r < ARRAY_SIZE(ratios); ++r) {
/* Only multiples of the frame width can be used as ratios. */
@@ -110,6 +111,7 @@ static void find_suitable_clock(const struct i2s_nrfx_drv_cfg *drv_cfg,
if (diff < best_diff) {
best_mck_cfg = mck_factor * 4096;
best_mck = actual_mck;
best_r = r;
/* Stop if an exact match is found. */
if (diff == 0) {
@@ -150,6 +152,7 @@ static void find_suitable_clock(const struct i2s_nrfx_drv_cfg *drv_cfg,
if (diff < best_diff) {
best_mck_cfg = dividers[d].divider_enum;
best_mck = mck_freq;
best_r = r;
/* Stop if an exact match is found. */
if (diff == 0) {
@@ -173,6 +176,8 @@ static void find_suitable_clock(const struct i2s_nrfx_drv_cfg *drv_cfg,
config->mck_setup = best_mck_cfg;
config->ratio = ratios[best_r].ratio_enum;
LOG_INF("I2S MCK frequency: %u, actual PCM rate: %u",
best_mck, best_mck / ratios[best_r].ratio_val);
}
static bool get_next_tx_buffer(struct i2s_nrfx_drv_data *drv_data,
@@ -465,9 +470,7 @@ static int i2s_nrfx_configure(const struct device *dev, enum i2s_dir dir,
return -EINVAL;
}
if (i2s_cfg->channels == 2 ||
(i2s_cfg->format & I2S_FMT_DATA_FORMAT_MASK)
== I2S_FMT_DATA_FORMAT_I2S) {
if (i2s_cfg->channels == 2) {
nrfx_cfg.channels = NRF_I2S_CHANNELS_STEREO;
} else if (i2s_cfg->channels == 1) {
nrfx_cfg.channels = NRF_I2S_CHANNELS_LEFT;
@@ -878,8 +881,8 @@ static const struct i2s_driver_api i2s_nrf_drv_api = {
#define I2S_CLK_SRC(idx) DT_STRING_TOKEN(I2S(idx), clock_source)
#define I2S_NRFX_DEVICE(idx) \
static void *tx_msgs[CONFIG_I2S_NRFX_TX_BLOCK_COUNT]; \
static void *rx_msgs[CONFIG_I2S_NRFX_RX_BLOCK_COUNT]; \
static void *tx_msgs##idx[CONFIG_I2S_NRFX_TX_BLOCK_COUNT]; \
static void *rx_msgs##idx[CONFIG_I2S_NRFX_RX_BLOCK_COUNT]; \
static struct i2s_nrfx_drv_data i2s_nrfx_data##idx = { \
.state = I2S_STATE_READY, \
}; \
@@ -889,11 +892,11 @@ static const struct i2s_driver_api i2s_nrf_drv_api = {
nrfx_isr, nrfx_i2s_irq_handler, 0); \
irq_enable(DT_IRQN(I2S(idx))); \
k_msgq_init(&i2s_nrfx_data##idx.tx_queue, \
(char *)tx_msgs, sizeof(void *), \
CONFIG_I2S_NRFX_TX_BLOCK_COUNT); \
(char *)tx_msgs##idx, sizeof(void *), \
ARRAY_SIZE(tx_msgs##idx)); \
k_msgq_init(&i2s_nrfx_data##idx.rx_queue, \
(char *)rx_msgs, sizeof(void *), \
CONFIG_I2S_NRFX_RX_BLOCK_COUNT); \
(char *)rx_msgs##idx, sizeof(void *), \
ARRAY_SIZE(rx_msgs##idx)); \
init_clock_manager(dev); \
return 0; \
} \

View File

@@ -10,7 +10,6 @@ config MODEM_QUECTEL_BG9X
select MODEM_IFACE_UART
select MODEM_SOCKET
select NET_SOCKETS_OFFLOAD
imply GPIO
help
Choose this setting to enable quectel BG9x LTE-CatM1/NB-IoT modem
driver.

View File

@@ -11,7 +11,6 @@ config MODEM_UBLOX_SARA
select MODEM_SOCKET
select NET_OFFLOAD
select NET_SOCKETS_OFFLOAD
imply GPIO
help
Choose this setting to enable u-blox SARA-R4 LTE-CatM1/NB-IoT modem
driver.

View File

@@ -1,6 +1,11 @@
# Misc network drivers configuration options
# SPDX-License-Identifier: Apache-2.0
menuconfig NET_DRIVERS
bool "Network Drivers"
if NET_DRIVERS
#
# PPP options
#
@@ -90,8 +95,7 @@ endif # NET_PPP
# SLIP options
#
menuconfig SLIP
bool "SLIP driver"
depends on (!QEMU_TARGET || NET_QEMU_SLIP)
bool "SLIP driver" if !QEMU_TARGET
depends on NET_NATIVE
select UART_PIPE
select UART_INTERRUPT_DRIVEN
@@ -149,3 +153,5 @@ module-help = Sets log level for network loopback driver.
source "subsys/net/Kconfig.template.log_config.net"
endif
endif # NET_DRIVERS

View File

@@ -1,19 +1,17 @@
# SPDX-License-Identifier: Apache-2.0
zephyr_library()
# Board initialization
zephyr_library_sources_ifdef(CONFIG_PINMUX_CC13XX_CC26XX pinmux_cc13xx_cc26xx.c)
zephyr_library_sources_ifdef(CONFIG_PINMUX_ESP32 pinmux_esp32.c)
zephyr_library_sources_ifdef(CONFIG_PINMUX_HSDK pinmux_hsdk.c)
zephyr_library_sources_ifdef(CONFIG_PINMUX_INTEL_S1000 pinmux_intel_s1000.c)
zephyr_library_sources_ifdef(CONFIG_PINMUX_ITE_IT8XXX2 pinmux_ite_it8xxx2.c)
zephyr_library_sources_ifdef(CONFIG_PINMUX_LPC11U6X pinmux_lpc11u6x.c)
zephyr_library_sources_ifdef(CONFIG_PINMUX_MCUX pinmux_mcux.c)
zephyr_library_sources_ifdef(CONFIG_PINMUX_MCUX_LPC pinmux_mcux_lpc.c)
zephyr_library_sources_ifdef(CONFIG_PINMUX_RV32M1 pinmux_rv32m1.c)
zephyr_library_sources_ifdef(CONFIG_PINMUX_SAM0 pinmux_sam0.c)
zephyr_library_sources_ifdef(CONFIG_PINMUX_SIFIVE pinmux_sifive.c)
zephyr_library_sources_ifdef(CONFIG_PINMUX_STM32 pinmux_stm32.c)
zephyr_library_sources_ifdef(CONFIG_PINMUX_TELINK_B91 pinmux_b91.c)
zephyr_library_sources_ifdef(CONFIG_PINMUX_XEC pinmux_mchp_xec.c)
zephyr_sources_ifdef(CONFIG_PINMUX_TELINK_B91 pinmux_b91.c)
zephyr_sources_ifdef(CONFIG_PINMUX_CC13XX_CC26XX pinmux_cc13xx_cc26xx.c)
zephyr_sources_ifdef(CONFIG_PINMUX_ESP32 pinmux_esp32.c)
zephyr_sources_ifdef(CONFIG_PINMUX_HSDK pinmux_hsdk.c)
zephyr_sources_ifdef(CONFIG_PINMUX_INTEL_S1000 pinmux_intel_s1000.c)
zephyr_sources_ifdef(CONFIG_PINMUX_ITE_IT8XXX2 pinmux_ite_it8xxx2.c)
zephyr_sources_ifdef(CONFIG_PINMUX_LPC11U6X pinmux_lpc11u6x.c)
zephyr_sources_ifdef(CONFIG_PINMUX_MCUX pinmux_mcux.c)
zephyr_sources_ifdef(CONFIG_PINMUX_MCUX_LPC pinmux_mcux_lpc.c)
zephyr_sources_ifdef(CONFIG_PINMUX_RV32M1 pinmux_rv32m1.c)
zephyr_sources_ifdef(CONFIG_PINMUX_SAM0 pinmux_sam0.c)
zephyr_sources_ifdef(CONFIG_PINMUX_SIFIVE pinmux_sifive.c)
zephyr_sources_ifdef(CONFIG_PINMUX_STM32 pinmux_stm32.c)
zephyr_sources_ifdef(CONFIG_PINMUX_XEC pinmux_mchp_xec.c)

View File

@@ -169,10 +169,13 @@ static int pwm_nrfx_pin_set(const struct device *dev, uint32_t pwm,
pulse_cycles /= 2;
}
/* Check if period_cycle is either matching currently used, or
/* Check if period_cycles is either matching currently used, or
* possible to use with our prescaler options.
* Don't do anything if the period length happens to be zero.
* In such case, pulse cycles will be right below limited to 0
* and this will result in making the channel inactive.
*/
if (period_cycles != data->period_cycles) {
if (period_cycles != 0 && period_cycles != data->period_cycles) {
int ret = pwm_period_check_and_set(config, data, channel,
period_cycles);
if (ret) {

View File

@@ -485,7 +485,6 @@ static int fdc2x1x_device_pm_ctrl(const struct device *dev,
enum pm_device_action action)
{
int ret;
struct fdc2x1x_data *data = dev->data;
const struct fdc2x1x_config *cfg = dev->config;
enum pm_device_state curr_state;
@@ -613,7 +612,6 @@ static int fdc2x1x_sample_fetch(const struct device *dev,
enum sensor_channel chan)
{
#ifdef CONFIG_PM_DEVICE
struct fdc2x1x_data *data = dev->data;
enum pm_device_state state;
(void)pm_device_state_get(dev, &state);

View File

@@ -1432,15 +1432,20 @@ struct bt_hci_cp_le_ext_create_conn {
#define BT_HCI_LE_PER_ADV_CREATE_SYNC_FP_USE_LIST BIT(0)
#define BT_HCI_LE_PER_ADV_CREATE_SYNC_FP_REPORTS_DISABLED BIT(1)
#define BT_HCI_LE_PER_ADV_CREATE_SYNC_CTE_TYPE_NO_FILTERING 0
#define BT_HCI_LE_PER_ADV_CREATE_SYNC_CTE_TYPE_NO_AOA BIT(0)
#define BT_HCI_LE_PER_ADV_CREATE_SYNC_CTE_TYPE_NO_AOD_1US BIT(1)
#define BT_HCI_LE_PER_ADV_CREATE_SYNC_CTE_TYPE_NO_AOD_2US BIT(2)
#define BT_HCI_LE_PER_ADV_CREATE_SYNC_CTE_TYPE_NO_CTE BIT(3)
#define BT_HCI_LE_PER_ADV_CREATE_SYNC_CTE_TYPE_ONLY_CTE BIT(4)
/* Constants to check correctness of CTE type */
#define BT_HCI_LE_PER_ADV_CREATE_SYNC_CTE_TYPE_ALLOWED_BITS 5
#define BT_HCI_LE_PER_ADV_CREATE_SYNC_CTE_TYPE_INVALID_VALUE \
(~BIT_MASK(BT_HCI_LE_PER_ADV_CREATE_SYNC_CTE_TYPE_ALLOWED_BITS))
#define BT_HCI_OP_LE_PER_ADV_CREATE_SYNC BT_OP(BT_OGF_LE, 0x0044)
struct bt_hci_cp_le_per_adv_create_sync {
uint8_t options;
uint8_t options;
uint8_t sid;
bt_addr_le_t addr;
uint16_t skip;

View File

@@ -177,6 +177,10 @@ struct bt_l2cap_le_chan {
* @ref BT_L2CAP_SDU_RX_MTU by the stack.
*/
struct bt_l2cap_le_endpoint rx;
/** Pending RX MTU on ECFC reconfigure, used internally by stack */
uint16_t pending_rx_mtu;
/** Channel Transmission Endpoint */
struct bt_l2cap_le_endpoint tx;
/** Channel Transmission queue */
@@ -316,6 +320,16 @@ struct bt_l2cap_chan_ops {
* references to the channel object.
*/
void (*released)(struct bt_l2cap_chan *chan);
/** @brief Channel reconfigured callback
*
* If this callback is provided it will be called whenever peer or
* local device requested reconfiguration. Application may check
* updated MTU and MPS values by inspecting chan->le endpoints.
*
* @param chan The channel which was reconfigured
*/
void (*reconfigured)(struct bt_l2cap_chan *chan);
};
/** @def BT_L2CAP_CHAN_SEND_RESERVE
@@ -414,6 +428,20 @@ int bt_l2cap_br_server_register(struct bt_l2cap_server *server);
int bt_l2cap_ecred_chan_connect(struct bt_conn *conn,
struct bt_l2cap_chan **chans, uint16_t psm);
/** @brief Reconfigure Enhanced Credit Based L2CAP channels
*
* Reconfigure up to 5 L2CAP channels. Channels must be from the same bt_conn.
* Once reconfiguration is completed each channel reconfigured() callback will
* be called. MTU cannot be decreased on any of provided channels.
*
* @param chans Array of channel objects. Null-terminated. Elements after the
* first 5 are silently ignored.
* @param mtu Channel MTU to reconfigure to.
*
* @return 0 in case of success or negative value in case of error.
*/
int bt_l2cap_ecred_chan_reconfigure(struct bt_l2cap_chan **chans, uint16_t mtu);
/** @brief Connect L2CAP channel
*
* Connect L2CAP channel by PSM, once the connection is completed channel

View File

@@ -479,48 +479,8 @@ device_required_handles_get(const struct device *dev,
if (rv != NULL) {
size_t i = 0;
while (rv[i] != DEVICE_HANDLE_SEP) {
++i;
}
*count = i;
}
return rv;
}
/**
* @brief Get the set of handles that this device supports.
*
* The set of supported devices is inferred from devicetree, and does not
* include any software constructs that may depend on the device.
*
* @param dev the device for which supports are desired.
*
* @param count pointer to a place to store the number of devices provided at
* the returned pointer. The value is not set if the call returns a null
* pointer. The value may be set to zero.
*
* @return a pointer to a sequence of @p *count device handles, or a null
* pointer if @p dh does not provide dependency information.
*/
static inline const device_handle_t *
device_supported_handles_get(const struct device *dev,
size_t *count)
{
const device_handle_t *rv = dev->handles;
size_t region = 0;
size_t i = 0;
if (rv != NULL) {
/* Fast forward to supporting devices */
while (region != 2) {
if (*rv == DEVICE_HANDLE_SEP) {
region++;
}
rv++;
}
/* Count supporting devices */
while (rv[i] != DEVICE_HANDLE_ENDS) {
while ((rv[i] != DEVICE_HANDLE_ENDS)
&& (rv[i] != DEVICE_HANDLE_SEP)) {
++i;
}
*count = i;
@@ -566,42 +526,6 @@ int device_required_foreach(const struct device *dev,
device_visitor_callback_t visitor_cb,
void *context);
/**
* @brief Visit every device that @p dev directly supports.
*
* Zephyr maintains information about which devices are directly supported by
* another device; for example an I2C controller will support an I2C-based
* sensor driver. Supported devices can derive from statically-defined
* devicetree relationships.
*
* This API supports operating on the set of supported devices. Example uses
* include iterating over the devices connected to a regulator when it is
* powered on.
*
* There is no guarantee on the order in which required devices are visited.
*
* If the @p visitor function returns a negative value iteration is halted,
* and the returned value from the visitor is returned from this function.
*
* @note This API is not available to unprivileged threads.
*
* @param dev a device of interest. The devices that this device supports
* will be used as the set of devices to visit. This parameter must not be
* null.
*
* @param visitor_cb the function that should be invoked on each device in the
* support set. This parameter must not be null.
*
* @param context state that is passed through to the visitor function. This
* parameter may be null if @p visitor tolerates a null @p context.
*
* @return The number of devices that were visited if all visits succeed, or
* the negative value returned from the first visit that did not succeed.
*/
int device_supported_foreach(const struct device *dev,
device_visitor_callback_t visitor_cb,
void *context);
/**
* @brief Retrieve the device structure for a driver by name
*
@@ -762,6 +686,50 @@ static inline bool device_is_ready(const struct device *dev)
Z_DEVICE_STATE_DEFINE(node_id, dev_name) \
Z_DEVICE_DEFINE_PM_SLOT(dev_name)
/* Helper macros needed for CONFIG_DEVICE_HANDLE_PADDING. These should
* be deleted when that option is removed.
*
* This is implemented "by hand" -- rather than using a helper macro
* like UTIL_LISTIFY() -- because we need to allow users to wrap
* DEVICE_DT_DEFINE with UTIL_LISTIFY, like this:
*
* #define DEFINE_FOO_DEVICE(...) DEVICE_DT_DEFINE(...)
* UTIL_LISTIFY(N, DEFINE_FOO_DEVICE)
*
* If Z_DEVICE_HANDLE_PADDING uses UTIL_LISTIFY, this type of code
* would fail, because the UTIL_LISTIFY token within the
* Z_DEVICE_DEFINE_HANDLES expansion would not be expanded again,
* since it appears in a context where UTIL_LISTIFY is already being
* expanded. Standard C does not reexpand macros appearing in their
* own expansion; this would lead to infinite recursions in general.
*/
#define Z_DEVICE_HANDLE_PADDING \
Z_DEVICE_HANDLE_PADDING_(CONFIG_DEVICE_HANDLE_PADDING)
#define Z_DEVICE_HANDLE_PADDING_(count) \
Z_DEVICE_HANDLE_PADDING__(count)
#define Z_DEVICE_HANDLE_PADDING__(count) \
Z_DEVICE_HANDLE_PADDING_ ## count
#define Z_DEVICE_HANDLE_PADDING_10 \
DEVICE_HANDLE_ENDS, Z_DEVICE_HANDLE_PADDING_9
#define Z_DEVICE_HANDLE_PADDING_9 \
DEVICE_HANDLE_ENDS, Z_DEVICE_HANDLE_PADDING_8
#define Z_DEVICE_HANDLE_PADDING_8 \
DEVICE_HANDLE_ENDS, Z_DEVICE_HANDLE_PADDING_7
#define Z_DEVICE_HANDLE_PADDING_7 \
DEVICE_HANDLE_ENDS, Z_DEVICE_HANDLE_PADDING_6
#define Z_DEVICE_HANDLE_PADDING_6 \
DEVICE_HANDLE_ENDS, Z_DEVICE_HANDLE_PADDING_5
#define Z_DEVICE_HANDLE_PADDING_5 \
DEVICE_HANDLE_ENDS, Z_DEVICE_HANDLE_PADDING_4
#define Z_DEVICE_HANDLE_PADDING_4 \
DEVICE_HANDLE_ENDS, Z_DEVICE_HANDLE_PADDING_3
#define Z_DEVICE_HANDLE_PADDING_3 \
DEVICE_HANDLE_ENDS, Z_DEVICE_HANDLE_PADDING_2
#define Z_DEVICE_HANDLE_PADDING_2 \
DEVICE_HANDLE_ENDS, Z_DEVICE_HANDLE_PADDING_1
#define Z_DEVICE_HANDLE_PADDING_1 \
DEVICE_HANDLE_ENDS, Z_DEVICE_HANDLE_PADDING_0
#define Z_DEVICE_HANDLE_PADDING_0 EMPTY
/* Initial build provides a record that associates the device object
* with its devicetree ordinal, and provides the dependency ordinals.
@@ -770,26 +738,6 @@ static inline bool device_is_ready(const struct device *dev)
* in a distinct pass1 section (which will be replaced by
* postprocessing).
*
* Before processing in gen_handles.py, the array format is:
* {
* DEVICE_ORDINAL (or DEVICE_HANDLE_NULL if not a devicetree node),
* List of devicetree dependency ordinals (if any),
* DEVICE_HANDLE_SEP,
* List of injected dependency ordinals (if any),
* DEVICE_HANDLE_SEP,
* List of devicetree supporting ordinals (if any),
* }
*
* After processing in gen_handles.py, the format is updated to:
* {
* List of existing devicetree dependency handles (if any),
* DEVICE_HANDLE_SEP,
* List of injected dependency ordinals (if any),
* DEVICE_HANDLE_SEP,
* List of existing devicetree support handles (if any),
* DEVICE_HANDLE_NULL padding to original length (at least one)
* }
*
* It is also (experimentally) necessary to provide explicit alignment
* on each object. Otherwise x86-64 builds will introduce padding
* between objects in the same input section in individual object
@@ -818,9 +766,7 @@ BUILD_ASSERT(sizeof(device_handle_t) == 2, "fix the linker scripts");
)) \
DEVICE_HANDLE_SEP, \
Z_DEVICE_EXTRA_HANDLES(__VA_ARGS__) \
DEVICE_HANDLE_SEP, \
COND_CODE_1(DT_NODE_EXISTS(node_id), \
(DT_SUPPORTS_DEP_ORDS(node_id)), ()) \
Z_DEVICE_HANDLE_PADDING \
};
#ifdef CONFIG_PM_DEVICE

View File

@@ -1,139 +0,0 @@
/**
* @file
* @brief reserved-memory Devicetree macro public API header file.
*/
/*
* Copyright (c) 2021 Carlo Caione <ccaione@baylibre.com>
*
* SPDX-License-Identifier: Apache-2.0
*/
#ifndef ZEPHYR_INCLUDE_DEVICETREE_MEMORY_H_
#define ZEPHYR_INCLUDE_DEVICETREE_MEMORY_H_
#ifdef __cplusplus
extern "C" {
#endif
/**
* @defgroup devicetree-reserved Devicetree reserved-memory API
* @ingroup devicetree
* @{
*/
/**
* @brief Get the pointer to the reserved-memory region
*
* Example devicetree fragment:
*
* reserved: reserved-memory {
* compatible = "reserved-memory";
* ...
* n: node {
* reg = <0x42000000 0x1000>;
* };
* };
*
* Example usage:
*
* DT_RESERVED_MEM_GET_PTR(DT_NODELABEL(n)) // (uint8_t *) 0x42000000
*
* @param node_id node identifier
* @return pointer to the beginning of the reserved-memory region
*/
#define DT_RESERVED_MEM_GET_PTR(node_id) _DT_RESERVED_START(node_id)
/**
* @brief Get the size of the reserved-memory region
*
* Example devicetree fragment:
*
* reserved: reserved-memory {
* compatible = "reserved-memory";
* ...
* n: node {
* reg = <0x42000000 0x1000>;
* };
* };
*
* Example usage:
*
* DT_RESERVED_MEM_GET_SIZE(DT_NODELABEL(n)) // 0x1000
*
* @param node_id node identifier
* @return the size of the reserved-memory region
*/
#define DT_RESERVED_MEM_GET_SIZE(node_id) DT_REG_SIZE(node_id)
/**
* @brief Get the pointer to the reserved-memory region from a memory-reserved
* phandle
*
* Example devicetree fragment:
*
* reserved: reserved-memory {
* compatible = "reserved-memory";
* ...
* res0: res {
* reg = <0x42000000 0x1000>;
* label = "res0";
* };
* };
*
* n: node {
* memory-region = <&res0>;
* };
*
* Example usage:
*
* DT_RESERVED_MEM_GET_PTR_BY_PHANDLE(DT_NODELABEL(n), memory_region) // (uint8_t *) 0x42000000
*
* @param node_id node identifier
* @param ph phandle to reserved-memory region
*
* @return pointer to the beginning of the reserved-memory region
*/
#define DT_RESERVED_MEM_GET_PTR_BY_PHANDLE(node_id, ph) \
DT_RESERVED_MEM_GET_PTR(DT_PHANDLE(node_id, ph))
/**
* @brief Get the size of the reserved-memory region from a memory-reserved
* phandle
*
* Example devicetree fragment:
*
* reserved: reserved-memory {
* compatible = "reserved-memory";
* ...
* res0: res {
* reg = <0x42000000 0x1000>;
* label = "res0";
* };
* };
*
* n: node {
* memory-region = <&res0>;
* };
*
* Example usage:
*
* DT_RESERVED_MEM_GET_SIZE_BY_PHANDLE(DT_NODELABEL(n), memory_region) // (uint8_t *) 0x42000000
*
* @param node_id node identifier
* @param ph phandle to reserved-memory region
*
* @return size of the reserved-memory region
*/
#define DT_RESERVED_MEM_GET_SIZE_BY_PHANDLE(node_id, ph) \
DT_RESERVED_MEM_GET_SIZE(DT_PHANDLE(node_id, ph))
/**
* @}
*/
#ifdef __cplusplus
}
#endif
#endif /* ZEPHYR_INCLUDE_DEVICETREE_MEMORY_H_ */

View File

@@ -34,26 +34,23 @@ extern "C" {
* @brief Non-volatile Storage File system structure
*
* @param offset File system offset in flash
* @param ate_wra: Allocation table entry write address. Addresses are stored
* as uint32_t: high 2 bytes are sector, low 2 bytes are offset in sector,
* @param data_wra: Data write address.
* @param sector_size File system is divided into sectors each sector should be
* multiple of pagesize
* @param sector_count Amount of sectors in the file systems
* @param write_block_size Alignment size
* @param ate_wra Allocation table entry write address. Addresses are stored as uint32_t:
* high 2 bytes correspond to the sector, low 2 bytes are the offset in the sector
* @param data_wra Data write address
* @param sector_size File system is split into sectors, each sector must be multiple of pagesize
* @param sector_count Number of sectors in the file systems
* @param ready Flag indicating if the filesystem is initialized
* @param nvs_lock Mutex
* @param flash_device Flash Device
* @param flash_device Flash Device runtime structure
* @param flash_parameters Flash memory parameters structure
*/
struct nvs_fs {
off_t offset; /* filesystem offset in flash */
uint32_t ate_wra; /* next alloc table entry write address */
uint32_t data_wra; /* next data write address */
uint16_t sector_size; /* filesystem is divided into sectors,
* sector size should be multiple of pagesize
*/
uint16_t sector_count; /* amount of sectors in the filesystem */
bool ready; /* is the filesystem initialized ? */
off_t offset;
uint32_t ate_wra;
uint32_t data_wra;
uint16_t sector_size;
uint16_t sector_count;
bool ready;
struct k_mutex nvs_lock;
const struct device *flash_device;
const struct flash_parameters *flash_parameters;
@@ -102,10 +99,10 @@ int nvs_clear(struct nvs_fs *fs);
* @param data Pointer to the data to be written
* @param len Number of bytes to be written
*
* @return Number of bytes written. On success, it will be equal to the number
* of bytes requested to be written. On error returns -ERRNO code.
* @return Number of bytes written. On success, it will be equal to the number of bytes requested
* to be written. When a rewrite of the same data already stored is attempted, nothing is written
* to flash, thus 0 is returned. On error, returns negative value of errno.h defined error codes.
*/
ssize_t nvs_write(struct nvs_fs *fs, uint16_t id, const void *data, size_t len);
/**
@@ -130,10 +127,10 @@ int nvs_delete(struct nvs_fs *fs, uint16_t id);
* @param data Pointer to data buffer
* @param len Number of bytes to be read
*
* @return Number of bytes read. On success, it will be equal to the number
* of bytes requested to be read. When the return value is larger than the
* number of bytes requested to read this indicates not all bytes were read,
* and more data is available. On error returns -ERRNO code.
* @return Number of bytes read. On success, it will be equal to the number of bytes requested
* to be read. When the return value is larger than the number of bytes requested to read this
* indicates not all bytes were read, and more data is available. On error, returns negative
* value of errno.h defined error codes.
*/
ssize_t nvs_read(struct nvs_fs *fs, uint16_t id, void *data, size_t len);
@@ -146,15 +143,14 @@ ssize_t nvs_read(struct nvs_fs *fs, uint16_t id, void *data, size_t len);
* @param id Id of the entry to be read
* @param data Pointer to data buffer
* @param len Number of bytes to be read
* @param cnt History counter: 0: latest entry, 1:one before latest ...
* @param cnt History counter: 0: latest entry, 1: one before latest ...
*
* @return Number of bytes read. On success, it will be equal to the number
* of bytes requested to be read. When the return value is larger than the
* number of bytes requested to read this indicates not all bytes were read,
* and more data is available. On error returns -ERRNO code.
* @return Number of bytes read. On success, it will be equal to the number of bytes requested
* to be read. When the return value is larger than the number of bytes requested to read this
* indicates not all bytes were read, and more data is available. On error, returns negative
* value of errno.h defined error codes.
*/
ssize_t nvs_read_hist(struct nvs_fs *fs, uint16_t id, void *data, size_t len,
uint16_t cnt);
ssize_t nvs_read_hist(struct nvs_fs *fs, uint16_t id, void *data, size_t len, uint16_t cnt);
/**
* @brief nvs_calc_free_space
@@ -163,10 +159,9 @@ ssize_t nvs_read_hist(struct nvs_fs *fs, uint16_t id, void *data, size_t len,
*
* @param fs Pointer to file system
*
* @return Number of bytes free. On success, it will be equal to the number
* of bytes that can still be written to the file system. Calculating the
* free space is a time consuming operation, especially on spi flash.
* On error returns -ERRNO code.
* @return Number of bytes free. On success, it will be equal to the number of bytes that can
* still be written to the file system. Calculating the free space is a time consuming operation,
* especially on spi flash. On error, returns negative value of errno.h defined error codes.
*/
ssize_t nvs_calc_free_space(struct nvs_fs *fs);

View File

@@ -743,7 +743,7 @@ __syscall void k_thread_priority_set(k_tid_t thread, int prio);
* integers. The number of cycles between the "first" deadline in the
* scheduler queue and the "last" deadline must be less than 2^31 (i.e
* a signed non-negative quantity). Failure to adhere to this rule
* may result in scheduled threads running in an incorrect dealine
* may result in scheduled threads running in an incorrect deadline
* order.
*
* @note Despite the API naming, the scheduler makes no guarantees the

View File

@@ -46,14 +46,122 @@
/**
* @brief Generate region definitions for all the reserved memory regions
*/
#define DT_RESERVED_MEM_REGIONS() _RESERVED_REGION_APPLY(_RESERVED_REGION_DECLARE)
#define LINKER_DT_RESERVED_MEM_REGIONS() _RESERVED_REGION_APPLY(_RESERVED_REGION_DECLARE)
/**
* @brief Generate section definitions for all the reserved memory regions
*/
#define DT_RESERVED_MEM_SECTIONS() _RESERVED_REGION_APPLY(_RESERVED_SECTION_DECLARE)
#define LINKER_DT_RESERVED_MEM_SECTIONS() _RESERVED_REGION_APPLY(_RESERVED_SECTION_DECLARE)
/**
* @brief Generate linker script symbols for all the reserved memory regions
*/
#define DT_RESERVED_MEM_SYMBOLS() _RESERVED_REGION_APPLY(_RESERVED_SYMBOL_DECLARE)
#define LINKER_DT_RESERVED_MEM_SYMBOLS() _RESERVED_REGION_APPLY(_RESERVED_SYMBOL_DECLARE)
/**
* @brief Get the pointer to the reserved-memory region
*
* Example devicetree fragment:
*
* reserved: reserved-memory {
* compatible = "reserved-memory";
* ...
* n: node {
* reg = <0x42000000 0x1000>;
* };
* };
*
* Example usage:
*
* LINKER_DT_RESERVED_MEM_GET_PTR(DT_NODELABEL(n)) // (uint8_t *) 0x42000000
*
* @param node_id node identifier
* @return pointer to the beginning of the reserved-memory region
*/
#define LINKER_DT_RESERVED_MEM_GET_PTR(node_id) _DT_RESERVED_START(node_id)
/**
* @brief Get the size of the reserved-memory region
*
* Example devicetree fragment:
*
* reserved: reserved-memory {
* compatible = "reserved-memory";
* ...
* n: node {
* reg = <0x42000000 0x1000>;
* };
* };
*
* Example usage:
*
* LINKER_DT_RESERVED_MEM_GET_SIZE(DT_NODELABEL(n)) // 0x1000
*
* @param node_id node identifier
* @return the size of the reserved-memory region
*/
#define LINKER_DT_RESERVED_MEM_GET_SIZE(node_id) DT_REG_SIZE(node_id)
/**
* @brief Get the pointer to the reserved-memory region from a memory-reserved
* phandle
*
* Example devicetree fragment:
*
* reserved: reserved-memory {
* compatible = "reserved-memory";
* ...
* res0: res {
* reg = <0x42000000 0x1000>;
* label = "res0";
* };
* };
*
* n: node {
* memory-region = <&res0>;
* };
*
* Example usage:
*
* LINKER_DT_RESERVED_MEM_GET_PTR_BY_PHANDLE(DT_NODELABEL(n), \
* memory_region) // (uint8_t *) 0x42000000
*
* @param node_id node identifier
* @param ph phandle to reserved-memory region
*
* @return pointer to the beginning of the reserved-memory region
*/
#define LINKER_DT_RESERVED_MEM_GET_PTR_BY_PHANDLE(node_id, ph) \
LINKER_DT_RESERVED_MEM_GET_PTR(DT_PHANDLE(node_id, ph))
/**
* @brief Get the size of the reserved-memory region from a memory-reserved
* phandle
*
* Example devicetree fragment:
*
* reserved: reserved-memory {
* compatible = "reserved-memory";
* ...
* res0: res {
* reg = <0x42000000 0x1000>;
* label = "res0";
* };
* };
*
* n: node {
* memory-region = <&res0>;
* };
*
* Example usage:
*
* LINKER_DT_RESERVED_MEM_GET_SIZE_BY_PHANDLE(DT_NODELABEL(n), \
* memory_region) // (uint8_t *) 0x42000000
*
* @param node_id node identifier
* @param ph phandle to reserved-memory region
*
* @return size of the reserved-memory region
*/
#define LINKER_DT_RESERVED_MEM_GET_SIZE_BY_PHANDLE(node_id, ph) \
LINKER_DT_RESERVED_MEM_GET_SIZE(DT_PHANDLE(node_id, ph))

View File

@@ -259,7 +259,7 @@ extern char _vector_start[];
extern char _vector_end[];
#if DT_NODE_HAS_STATUS(_NODE_RESERVED, okay)
DT_RESERVED_MEM_SYMBOLS()
LINKER_DT_RESERVED_MEM_SYMBOLS()
#endif
#ifdef CONFIG_SW_VECTOR_RELAY

View File

@@ -542,7 +542,7 @@ static inline uint32_t log_msg2_get_total_wlen(const struct log_msg2_desc desc)
*
* @return Length in 32 bit words.
*/
static inline uint32_t log_msg2_generic_get_wlen(union mpsc_pbuf_generic *item)
static inline uint32_t log_msg2_generic_get_wlen(const union mpsc_pbuf_generic *item)
{
union log_msg2_generic *generic_msg = (union log_msg2_generic *)item;

View File

@@ -50,6 +50,38 @@ extern "C" {
/** RFC 1034 Section 3.1, RFC 6763 Section 7.2 */
#define DNS_SD_DOMAIN_MAX_SIZE 63
/**
* Minimum number of segments in a fully-qualified name
*
* This reqpresents FQN's of the form below
* ```
* <sn>._tcp.<domain>.
* ```
* Currently sub-types and service domains are unsupported and only the
* "local" domain is supported. Specifically, that excludes the following:
* ```
* <sub>._sub.<sn>._tcp.<servicedomain>.<parentdomain>.
* ```
* @see <a href="https://datatracker.ietf.org/doc/html/rfc6763">RFC 6763</a>, Section 7.2.
*/
#define DNS_SD_MIN_LABELS 3
/**
* Maximum number of segments in a fully-qualified name
*
* This reqpresents FQN's of the form below
* ```
* <instance>.<sn>._tcp.<domain>.
* ```
*
* Currently sub-types and service domains are unsupported and only the
* "local" domain is supported. Specifically, that excludes the following:
* ```
* <sub>._sub.<sn>._tcp.<servicedomain>.<parentdomain>.
* ```
* @see <a href="https://datatracker.ietf.org/doc/html/rfc6763">RFC 6763</a>, Section 7.2.
*/
#define DNS_SD_MAX_LABELS 4
/**
* @brief Register a service for DNS Service Discovery
*
@@ -209,6 +241,12 @@ struct dns_sd_rec {
* @internal
*/
extern const char dns_sd_empty_txt[1];
/**
* @brief Wildcard Port specifier for DNS-SD
*
* @internal
*/
extern const uint16_t dns_sd_port_zero;
/** @endcond */
@@ -223,6 +261,32 @@ static inline size_t dns_sd_txt_size(const struct dns_sd_rec *rec)
return rec->text_size;
}
/**
* @brief Check if @a rec is a DNS-SD Service Type Enumeration
*
* DNS-SD Service Type Enumeration is used by network tooling to
* acquire a list of all mDNS-advertised services belonging to a
* particular host on a particular domain.
*
* For example, for the domain '.local', the equivalent query
* would be '_services._dns-sd._udp.local'.
*
* Currently, only the '.local' domain is supported.
*
* @see <a href="https://datatracker.ietf.org/doc/html/rfc6763#section-9">Service Type Enumeration, RFC 6763</a>.
*
* @param rec the record to in question
* @return true if @a rec is a DNS-SD Service Type Enumeration
*/
bool dns_sd_is_service_type_enumeration(const struct dns_sd_rec *rec);
/**
* @brief Create a wildcard filter for DNS-SD records
*
* @param filter a pointer to the filter to use
*/
void dns_sd_create_wildcard_filter(struct dns_sd_rec *filter);
/**
* @}
*/

View File

@@ -69,7 +69,7 @@ struct mpsc_pbuf_buffer;
*
* @return Size of the packet in 32 bit words.
*/
typedef uint32_t (*mpsc_pbuf_get_wlen)(union mpsc_pbuf_generic *packet);
typedef uint32_t (*mpsc_pbuf_get_wlen)(const union mpsc_pbuf_generic *packet);
/** @brief Callback called when packet is dropped.
*
@@ -77,8 +77,8 @@ typedef uint32_t (*mpsc_pbuf_get_wlen)(union mpsc_pbuf_generic *packet);
*
* @param packet Packet that is being dropped.
*/
typedef void (*mpsc_pbuf_notify_drop)(struct mpsc_pbuf_buffer *buffer,
union mpsc_pbuf_generic *packet);
typedef void (*mpsc_pbuf_notify_drop)(const struct mpsc_pbuf_buffer *buffer,
const union mpsc_pbuf_generic *packet);
/** @brief MPSC packet buffer structure. */
struct mpsc_pbuf_buffer {
@@ -179,7 +179,7 @@ void mpsc_pbuf_commit(struct mpsc_pbuf_buffer *buffer,
* and data on remaining bits.
*/
void mpsc_pbuf_put_word(struct mpsc_pbuf_buffer *buffer,
union mpsc_pbuf_generic word);
const union mpsc_pbuf_generic word);
/** @brief Put a packet consisting of a word and a pointer.
* *
@@ -194,7 +194,8 @@ void mpsc_pbuf_put_word(struct mpsc_pbuf_buffer *buffer,
* @param data User data.
*/
void mpsc_pbuf_put_word_ext(struct mpsc_pbuf_buffer *buffer,
union mpsc_pbuf_generic word, void *data);
const union mpsc_pbuf_generic word,
const void *data);
/** @brief Put a packet into a buffer.
*
@@ -203,18 +204,20 @@ void mpsc_pbuf_put_word_ext(struct mpsc_pbuf_buffer *buffer,
*
* @param buffer Buffer.
*
* @param data First word of data must contain MPSC_PBUF_HDR with valid set.
* @param data First word of data must contain MPSC_PBUF_HDR with valid bit set.
*
* @param wlen Packet size in words.
*/
void mpsc_pbuf_put_data(struct mpsc_pbuf_buffer *buffer,
uint32_t *data, size_t wlen);
const uint32_t *data, size_t wlen);
/** @brief Claim the first pending packet.
*
* @param buffer Buffer.
*
* @return Pointer to the claimed packet or null if none available.
*/
union mpsc_pbuf_generic *mpsc_pbuf_claim(struct mpsc_pbuf_buffer *buffer);
const union mpsc_pbuf_generic *mpsc_pbuf_claim(struct mpsc_pbuf_buffer *buffer);
/** @brief Free a packet.
*

View File

@@ -156,6 +156,18 @@
*/
#define sys_port_trace_k_thread_abort(thread)
/**
* @brief Called when a thread enters the k_thread_abort routine
* @param thread Thread object
*/
#define sys_port_trace_k_thread_abort_enter(thread)
/**
* @brief Called when a thread exits the k_thread_abort routine
* @param thread Thread object
*/
#define sys_port_trace_k_thread_abort_exit(thread)
/**
* @brief Called when setting priority of a thread
* @param thread Thread object

View File

@@ -288,6 +288,22 @@ config WAITQ_DUMB
endchoice # WAITQ_ALGORITHM
config DEVICE_HANDLE_PADDING
int "Number of additional device handles to use for padding"
default 0
range 0 10
help
This is a "fudge factor" which works around build system
limitations. It is safe to ignore unless you get a specific
build system error about it.
The option's value is the number of superfluous device handle
values which are introduced into the array pointed to by each
device's 'handles' member during the first linker pass.
Each handle uses 2 bytes, so a value of 3 would use an extra
6 bytes of ROM for every device.
menu "Kernel Debugging and Metrics"
config INIT_STACKS

View File

@@ -162,11 +162,14 @@ bool z_device_ready(const struct device *dev)
return dev->state->initialized && (dev->state->init_res == 0U);
}
static int device_visitor(const device_handle_t *handles,
size_t handle_count,
device_visitor_callback_t visitor_cb,
void *context)
int device_required_foreach(const struct device *dev,
device_visitor_callback_t visitor_cb,
void *context)
{
size_t handle_count = 0;
const device_handle_t *handles =
device_required_handles_get(dev, &handle_count);
/* Iterate over fixed devices */
for (size_t i = 0; i < handle_count; ++i) {
device_handle_t dh = handles[i];
@@ -180,25 +183,3 @@ static int device_visitor(const device_handle_t *handles,
return handle_count;
}
int device_required_foreach(const struct device *dev,
device_visitor_callback_t visitor_cb,
void *context)
{
size_t handle_count = 0;
const device_handle_t *handles =
device_required_handles_get(dev, &handle_count);
return device_visitor(handles, handle_count, visitor_cb, context);
}
int device_supported_foreach(const struct device *dev,
device_visitor_callback_t visitor_cb,
void *context)
{
size_t handle_count = 0;
const device_handle_t *handles =
device_supported_handles_get(dev, &handle_count);
return device_visitor(handles, handle_count, visitor_cb, context);
}

View File

@@ -26,6 +26,7 @@ void z_timer_expiration_handler(struct _timeout *t)
{
struct k_timer *timer = CONTAINER_OF(t, struct k_timer, timeout);
struct k_thread *thread;
k_spinlock_key_t key = k_spin_lock(&lock);
/*
* if the timer is periodic, start it again; don't add _TICK_ALIGN
@@ -46,27 +47,23 @@ void z_timer_expiration_handler(struct _timeout *t)
}
if (!IS_ENABLED(CONFIG_MULTITHREADING)) {
k_spin_unlock(&lock, key);
return;
}
thread = z_waitq_head(&timer->wait_q);
if (thread == NULL) {
k_spin_unlock(&lock, key);
return;
}
/*
* Interrupts _DO NOT_ have to be locked in this specific
* instance of thread unpending because a) this is the only
* place a thread can be taken off this pend queue, and b) the
* only place a thread can be put on the pend queue is at
* thread level, which of course cannot interrupt the current
* context.
*/
z_unpend_thread_no_timeout(thread);
arch_thread_return_value_set(thread, 0);
k_spin_unlock(&lock, key);
z_ready_thread(thread);
}

View File

@@ -185,7 +185,7 @@ static union mpsc_pbuf_generic *drop_item_locked(struct mpsc_pbuf_buffer *buffer
}
void mpsc_pbuf_put_word(struct mpsc_pbuf_buffer *buffer,
union mpsc_pbuf_generic item)
const union mpsc_pbuf_generic item)
{
bool cont;
uint32_t free_wlen;
@@ -305,7 +305,8 @@ void mpsc_pbuf_commit(struct mpsc_pbuf_buffer *buffer,
}
void mpsc_pbuf_put_word_ext(struct mpsc_pbuf_buffer *buffer,
union mpsc_pbuf_generic item, void *data)
const union mpsc_pbuf_generic item,
const void *data)
{
static const size_t l =
(sizeof(item) + sizeof(data)) / sizeof(uint32_t);
@@ -327,7 +328,7 @@ void mpsc_pbuf_put_word_ext(struct mpsc_pbuf_buffer *buffer,
void **p =
(void **)&buffer->buf[buffer->tmp_wr_idx + 1];
*p = data;
*p = (void *)data;
buffer->tmp_wr_idx =
idx_inc(buffer, buffer->tmp_wr_idx, l);
buffer->wr_idx = idx_inc(buffer, buffer->wr_idx, l);
@@ -352,7 +353,7 @@ void mpsc_pbuf_put_word_ext(struct mpsc_pbuf_buffer *buffer,
} while (cont);
}
void mpsc_pbuf_put_data(struct mpsc_pbuf_buffer *buffer, uint32_t *data,
void mpsc_pbuf_put_data(struct mpsc_pbuf_buffer *buffer, const uint32_t *data,
size_t wlen)
{
bool cont;
@@ -395,7 +396,7 @@ void mpsc_pbuf_put_data(struct mpsc_pbuf_buffer *buffer, uint32_t *data,
} while (cont);
}
union mpsc_pbuf_generic *mpsc_pbuf_claim(struct mpsc_pbuf_buffer *buffer)
const union mpsc_pbuf_generic *mpsc_pbuf_claim(struct mpsc_pbuf_buffer *buffer)
{
union mpsc_pbuf_generic *item;
bool cont;

View File

@@ -3,6 +3,4 @@
#
# SPDX-License-Identifier: Apache-2.0
#
zephyr_library()
zephyr_include_directories(.)

View File

@@ -209,7 +209,8 @@ static void create_sync(void)
printk("Creating Periodic Advertising Sync...");
bt_addr_le_copy(&sync_create_param.addr, &per_addr);
sync_create_param.options = 0;
sync_create_param.options = BT_LE_PER_ADV_SYNC_OPT_SYNC_ONLY_CONST_TONE_EXT;
sync_create_param.sid = per_sid;
sync_create_param.skip = 0;
sync_create_param.timeout = 0xa;

View File

@@ -13,12 +13,12 @@
MEMORY
{
DT_RESERVED_MEM_REGIONS()
LINKER_DT_RESERVED_MEM_REGIONS()
}
SECTIONS
{
DT_RESERVED_MEM_SECTIONS()
LINKER_DT_RESERVED_MEM_SECTIONS()
}
#include <arch/arm64/scripts/linker.ld>

View File

@@ -5,7 +5,6 @@
*/
#include <zephyr.h>
#include <devicetree/memory.h>
#include <linker/linker-defs.h>
/* Variables placed in reserved sections */
@@ -18,17 +17,17 @@ void main(void)
uint32_t res_size_outer, res_size_inner;
res_ptr_outer =
DT_RESERVED_MEM_GET_PTR_BY_PHANDLE(DT_NODELABEL(sample_driver_outer),
memory_region);
LINKER_DT_RESERVED_MEM_GET_PTR_BY_PHANDLE(DT_NODELABEL(sample_driver_outer),
memory_region);
res_size_outer =
DT_RESERVED_MEM_GET_SIZE_BY_PHANDLE(DT_NODELABEL(sample_driver_outer),
memory_region);
LINKER_DT_RESERVED_MEM_GET_SIZE_BY_PHANDLE(DT_NODELABEL(sample_driver_outer),
memory_region);
printk("Reserved memory address for the outer driver: %p\n", res_ptr_outer);
printk("Reserved memory size for the outer driver: %d\n", res_size_outer);
res_ptr_inner = DT_RESERVED_MEM_GET_PTR(DT_NODELABEL(res1));
res_size_inner = DT_RESERVED_MEM_GET_SIZE(DT_NODELABEL(res1));
res_ptr_inner = LINKER_DT_RESERVED_MEM_GET_PTR(DT_NODELABEL(res1));
res_size_inner = LINKER_DT_RESERVED_MEM_GET_SIZE(DT_NODELABEL(res1));
printk("Reserved memory address for the inner driver: %p\n", res_ptr_inner);
printk("Reserved memory size for the inner driver: %d\n", res_size_inner);

View File

@@ -1,5 +1,3 @@
CONFIG_GPIO=y
CONFIG_PM=y
CONFIG_PM_DEVICE=y
CONFIG_PM_DEVICE_RUNTIME=y

View File

@@ -34,7 +34,7 @@ LEDs). The sample can be built and executed for the TWR-KE18F as
follows:
.. zephyr-app-commands::
:zephyr-app: samples/subsys/canbus/canopen
:zephyr-app: samples/modules/canopennode
:board: twr_ke18f
:goals: build flash
:compact:
@@ -53,7 +53,7 @@ LED indicators (red and green LEDs)
The sample can be built and executed for the FRDM-K64F as follows:
.. zephyr-app-commands::
:zephyr-app: samples/subsys/canbus/canopen
:zephyr-app: samples/modules/canopennode
:board: frdm_k64f
:goals: build flash
:compact:
@@ -66,7 +66,7 @@ Building and Running for boards without storage partition
The sample can be built for boards without a flash storage partition by using a different configuration file:
.. zephyr-app-commands::
:zephyr-app: samples/subsys/canbus/canopen
:zephyr-app: samples/modules/canopennode
:board: <your_board_name>
:conf: "prj_no_storage.conf"
:goals: build flash
@@ -352,7 +352,7 @@ for the FRDM-K64F as follows:
#. Rebuild the CANopen sample with MCUboot support:
.. zephyr-app-commands::
:zephyr-app: samples/subsys/canbus/canopen
:zephyr-app: samples/modules/canopennode
:board: frdm_k64f
:goals: build
:gen-args: -DCONFIG_BOOTLOADER_MCUBOOT=y
@@ -392,20 +392,20 @@ for the FRDM-K64F as follows:
Modifying the Object Dictionary
*******************************
The CANopen object dictionary used in this sample application can be
found under :zephyr_file:`samples/subsys/canbus/canopen/objdict` in
found under :zephyr_file:`samples/modules/canopennode/objdict` in
the Zephyr tree. The object dictionary can be modified using any
object dictionary editor supporting CANopenNode object dictionary code
generation.
A popular choice is the EDS editor from the `libedssharp`_
project. With that, the
:zephyr_file:`samples/subsys/canbus/canopen/objdict/objdicts.xml`
:zephyr_file:`samples/modules/canopennode/objdict/objdicts.xml`
project file can be opened and modified, and new implementation files
(:zephyr_file:`samples/subsys/canbus/canopen/objdict/CO_OD.h` and
:zephyr_file:`samples/subsys/canbus/canopen/objdict/CO_OD.c`) can be
(:zephyr_file:`samples/modules/canopennode/objdict/CO_OD.h` and
:zephyr_file:`samples/modules/canopennode/objdict/CO_OD.c`) can be
generated. The EDS editor can also export an updated Electronic Data
Sheet (EDS) file
(:zephyr_file:`samples/subsys/canbus/canopen/objdict/objdicts.eds`).
(:zephyr_file:`samples/modules/canopennode/objdict/objdicts.eds`).
.. _CANopenNode:
https://github.com/CANopenNode/CANopenNode

View File

@@ -1018,7 +1018,7 @@ The counter can be reset by writing the value 0.</description>
</CANopenObject>
</CANopenObjectList>
<other>
<file fileName="objdict.xml" fileCreator="" fileCreationDate="09-18-2019" fileCreationTime="2:52PM" fileModifedBy="" fileMotifcationDate="02-20-2020" fileModificationTime="12:28PM" fileVersion="1" fileRevision="1" exportFolder="/home/hebad/Projects/zephyrproject/zephyr/samples/subsys/canbus/canopen/objdict" EdsFile="/home/hebad/Projects/zephyrproject/zephyr/samples/subsys/canbus/canopen/objdict/objdict.eds" />
<file fileName="objdict.xml" fileCreator="" fileCreationDate="09-18-2019" fileCreationTime="2:52PM" fileModifedBy="" fileMotifcationDate="02-20-2020" fileModificationTime="12:28PM" fileVersion="1" fileRevision="1" exportFolder="samples/modules/canopennode/objdict" EdsFile="samples/modules/canopennode/objdict/objdict.eds" />
<DeviceIdentity>
<vendorName />
<vendorNumber>0</vendorNumber>

View File

@@ -14,6 +14,7 @@ CONFIG_NET_CONNECTION_MANAGER=y
# PPP networking support
CONFIG_NET_NATIVE=y
CONFIG_NET_DRIVERS=y
CONFIG_NET_PPP=y
CONFIG_NET_L2_PPP=y
CONFIG_NET_L2_PPP_TIMEOUT=10000

View File

@@ -6,6 +6,7 @@ CONFIG_MODEM=y
CONFIG_MODEM_GSM_PPP=y
# PPP networking support
CONFIG_NET_DRIVERS=y
CONFIG_NET_PPP=y
CONFIG_NET_L2_PPP=y
CONFIG_NET_NATIVE=y

View File

@@ -1,3 +1,4 @@
CONFIG_NET_DRIVERS=y
CONFIG_NET_PPP=y
CONFIG_NET_L2_PPP=y
CONFIG_NET_STATISTICS_PPP=y

View File

@@ -36,9 +36,6 @@ static void trigger_handler(const struct device *dev,
#ifdef CONFIG_PM_DEVICE
static void pm_info(enum pm_device_state state, int status)
{
ARG_UNUSED(dev);
ARG_UNUSED(arg);
switch (state) {
case PM_DEVICE_STATE_ACTIVE:
printk("Enter ACTIVE_STATE ");
@@ -49,6 +46,8 @@ static void pm_info(enum pm_device_state state, int status)
case PM_DEVICE_STATE_OFF:
printk("Enter OFF_STATE ");
break;
default:
printk("Unknown power state");
}
if (status) {

View File

@@ -4,6 +4,7 @@ sample:
tests:
sample.mgmt.osdp.control_panel:
tags: osdp
depends_on: gpio
filter: dt_enabled_alias_with_parent_compat("led0", "gpio-leds") and CONFIG_SERIAL
harness: osdp
integration_platforms:

View File

@@ -4,6 +4,7 @@ sample:
tests:
sample.mgmt.osdp.peripheral_device:
tags: osdp
depends_on: gpio
filter: dt_enabled_alias_with_parent_compat("led0", "gpio-leds") and CONFIG_SERIAL
harness: osdp
integration_platforms:

View File

@@ -18,6 +18,7 @@ CONFIG_MODEM_GSM_PPP=y
CONFIG_MODEM_GSM_APN="<Your Access Point Network>"
# PPP networking support
CONFIG_NET_DRIVERS=y
CONFIG_NET_NATIVE=y
CONFIG_NET_PPP=y
CONFIG_NET_L2_PPP=y

View File

@@ -2,5 +2,6 @@ sample:
name: Modbus RTU Client Sample
tests:
sample.modbus.rtu_client:
platform_allow: nrf52840dk_nrf52840 frdm_k64f
tags: uart modbus
depends_on: gpio, arduino_serial
depends_on: gpio arduino_serial

View File

@@ -2,8 +2,9 @@ sample:
name: Modbus RTU Server Sample
tests:
sample.modbus.rtu_server:
platform_allow: nrf52840dk_nrf52840 frdm_k64f
tags: uart modbus
filter: dt_compat_enabled_with_alias("gpio-leds", "led0") and
dt_compat_enabled_with_alias("gpio-leds", "led1") and
dt_compat_enabled_with_alias("gpio-leds", "led2")
depends_on: gpio, arduino_serial
filter: dt_enabled_alias_with_parent_compat("led0", "gpio-leds") and
dt_enabled_alias_with_parent_compat("led1", "gpio-leds") and
dt_enabled_alias_with_parent_compat("led2", "gpio-leds")
depends_on: gpio arduino_serial

View File

@@ -109,7 +109,6 @@ const static struct modbus_iface_param server_param = {
static int init_modbus_server(void)
{
const uint32_t mb_rtu_br = 19200;
const char iface_name[] = {DT_PROP(DT_INST(0, zephyr_modbus_serial), label)};
int iface;

View File

@@ -2,7 +2,8 @@ sample:
name: Modbus TCP to serial line gateway sample
tests:
sample.modbus.tcp_gateway:
platform_allow: frdm_k64f
tags: modbus
depends_on: gpio, netif, arduino_serial
depends_on: gpio netif arduino_serial
integration_platforms:
- frdm_k64f

View File

@@ -2,8 +2,9 @@ sample:
name: Modbus TCP Server Sample
tests:
sample.modbus.tcp_server:
platform_allow: frdm_k64f
tags: modbus
filter: dt_compat_enabled_with_alias("gpio-leds", "led0") and
dt_compat_enabled_with_alias("gpio-leds", "led1") and
dt_compat_enabled_with_alias("gpio-leds", "led2")
depends_on: gpio, netif
filter: dt_enabled_alias_with_parent_compat("led0", "gpio-leds") and
dt_enabled_alias_with_parent_compat("led1", "gpio-leds") and
dt_enabled_alias_with_parent_compat("led2", "gpio-leds")
depends_on: gpio netif

View File

@@ -1,7 +1,7 @@
.. _usb-samples:
USB Samples
###############
USB device support samples
##########################
.. toctree::
:maxdepth: 1

View File

@@ -246,19 +246,15 @@ def main():
hvi = 1
handle.dev_deps = []
handle.ext_deps = []
handle.dev_sups = []
hdls = handle.dev_deps
deps = handle.dev_deps
while hvi < len(hv):
h = hv[hvi]
if h == DEVICE_HANDLE_ENDS:
break
if h == DEVICE_HANDLE_SEP:
if hdls == handle.dev_deps:
hdls = handle.ext_deps
else:
hdls = handle.dev_sups
deps = handle.ext_deps
else:
hdls.append(h)
deps.append(h)
n = edt
hvi += 1
@@ -271,7 +267,6 @@ def main():
for sn in used_nodes:
# Where we're storing the final set of nodes: these are all used
sn.__depends = set()
sn.__supports = set()
deps = set(sn.depends_on)
debug("\nNode: %s\nOrig deps:\n\t%s" % (sn.path, "\n\t".join([dn.path for dn in deps])))
@@ -284,16 +279,7 @@ def main():
# forward the dependency up one level
for ddn in dn.depends_on:
deps.add(ddn)
debug("Final deps:\n\t%s\n" % ("\n\t".join([ _dn.path for _dn in sn.__depends])))
sups = set(sn.required_by)
debug("\nOrig sups:\n\t%s" % ("\n\t".join([dn.path for dn in sups])))
while len(sups) > 0:
dn = sups.pop()
if dn in used_nodes:
# this is used
sn.__supports.add(dn)
debug("\nFinal sups:\n\t%s" % ("\n\t".join([dn.path for dn in sn.__supports])))
debug("final deps:\n\t%s\n" % ("\n\t".join([ _dn.path for _dn in sn.__depends])))
with open(args.output_source, "w") as fp:
fp.write('#include <device.h>\n')
@@ -304,7 +290,6 @@ def main():
assert hs, "no hs for %s" % (dev.sym.name,)
dep_paths = []
ext_paths = []
sup_paths = []
hdls = []
sn = hs.node
@@ -315,32 +300,26 @@ def main():
dep_paths.append(dn.path)
else:
dep_paths.append('(%s)' % dn.path)
# Force separator to signal start of injected dependencies
hdls.append(DEVICE_HANDLE_SEP)
if len(hs.ext_deps) > 0:
# TODO: map these to something smaller?
ext_paths.extend(map(str, hs.ext_deps))
hdls.append(DEVICE_HANDLE_SEP)
hdls.extend(hs.ext_deps)
# Force separator to signal start of supported devices
hdls.append(DEVICE_HANDLE_SEP)
if len(hs.dev_sups) > 0:
for dn in sn.required_by:
if dn in sn.__supports:
sup_paths.append(dn.path)
else:
sup_paths.append('(%s)' % dn.path)
hdls.extend(dn.__device.dev_handle for dn in sn.__supports)
# When CONFIG_USERSPACE is enabled the pre-built elf is
# also used to get hashes that identify kernel objects by
# address. We can't allow the size of any object in the
# final elf to change. We also must make sure at least one
# DEVICE_HANDLE_ENDS is inserted.
assert len(hdls) < len(hs.handles), "%s no DEVICE_HANDLE_ENDS inserted" % (dev.sym.name,)
while len(hdls) < len(hs.handles):
padding = len(hs.handles) - len(hdls)
assert padding > 0, \
(f"device {dev.sym.name}: "
"linker pass 1 left no room to insert DEVICE_HANDLE_ENDS. "
"To work around, increase CONFIG_DEVICE_HANDLE_PADDING by " +
str(1 + (-padding)))
while padding > 0:
hdls.append(DEVICE_HANDLE_ENDS)
padding -= 1
assert len(hdls) == len(hs.handles), "%s handle overflow" % (dev.sym.name,)
lines = [
@@ -349,14 +328,9 @@ def main():
]
if len(dep_paths) > 0:
lines.append(' * Direct Dependencies:')
lines.append(' * - %s' % ('\n * - '.join(dep_paths)))
lines.append(' * - %s' % ('\n * - '.join(dep_paths)))
if len(ext_paths) > 0:
lines.append(' * Injected Dependencies:')
lines.append(' * - %s' % ('\n * - '.join(ext_paths)))
if len(sup_paths) > 0:
lines.append(' * Supported:')
lines.append(' * - %s' % ('\n * - '.join(sup_paths)))
lines.append(' * + %s' % ('\n * + '.join(ext_paths)))
lines.extend([
' */',

View File

@@ -436,6 +436,16 @@ class Handler:
proc.kill()
self.terminated = True
def add_missing_testscases(self, harness):
"""
If testsuite was broken by some error (e.g. timeout) it is necessary to
add information about next testcases, which were not be
performed due to this error.
"""
for c in self.instance.testcase.cases:
if c not in harness.tests:
harness.tests[c] = "BLOCK"
class BinaryHandler(Handler):
def __init__(self, instance, type_str):
@@ -590,6 +600,7 @@ class BinaryHandler(Handler):
else:
self.set_state("timeout", handler_time)
self.instance.reason = "Timeout"
self.add_missing_testscases(harness)
self.record(harness)
@@ -859,9 +870,7 @@ class DeviceHandler(Handler):
handler_time = time.time() - start_time
if out_state in ["timeout", "flash_error"]:
for c in self.instance.testcase.cases:
if c not in harness.tests:
harness.tests[c] = "BLOCK"
self.add_missing_testscases(harness)
if out_state == "timeout":
self.instance.reason = "Timeout"
@@ -1152,6 +1161,7 @@ class QEMUHandler(Handler):
self.instance.reason = "Timeout"
else:
self.instance.reason = "Exited with {}".format(self.returncode)
self.add_missing_testscases(harness)
def get_fifo(self):
return self.fifo_fn
@@ -1986,7 +1996,7 @@ class CMake():
log.write(log_msg)
if log_msg:
res = re.findall("region `(FLASH|RAM|ICCM|DCCM|SRAM)' overflowed by", log_msg)
res = re.findall("region `(FLASH|ROM|RAM|ICCM|DCCM|SRAM)' overflowed by", log_msg)
if res and not self.overflow_as_errors:
logger.debug("Test skipped due to {} Overflow".format(res[0]))
self.instance.status = "skipped"
@@ -2108,7 +2118,7 @@ class CMake():
else:
logger.error("Cmake script failure: %s" % (args[0]))
results = {"returncode": p.returncode}
results = {"returncode": p.returncode, "returnmsg": out}
return results
@@ -2898,7 +2908,7 @@ class TestSuite(DisablePyTestCollectionMixin):
try:
if result['returncode']:
raise TwisterRuntimeError("E: Variable ZEPHYR_TOOLCHAIN_VARIANT is not defined")
raise TwisterRuntimeError(f"E: {result['returnmsg']}")
except Exception as e:
print(str(e))
sys.exit(2)

View File

@@ -10,6 +10,7 @@ config SOC_NRF5340_CPUAPP
select CPU_HAS_FPU
select ARMV8_M_DSP
select HAS_HW_NRF_CC312
select HAS_HW_NRF_COMP
select HAS_HW_NRF_CLOCK
select HAS_HW_NRF_DPPIC
select HAS_HW_NRF_EGU0
@@ -24,6 +25,7 @@ config SOC_NRF5340_CPUAPP
select HAS_HW_NRF_I2S
select HAS_HW_NRF_IPC
select HAS_HW_NRF_KMU
select HAS_HW_NRF_LPCOMP
select HAS_HW_NRF_NFCT
select HAS_HW_NRF_NVMC_PE
select HAS_HW_NRF_PDM
@@ -76,6 +78,7 @@ config SOC_NRF5340_CPUNET
select HAS_HW_NRF_CCM
select HAS_HW_NRF_CCM_LFLEN_8BIT
select HAS_HW_NRF_DPPIC
select HAS_HW_NRF_ECB
select HAS_HW_NRF_EGU0
select HAS_HW_NRF_GPIO0
select HAS_HW_NRF_GPIO1
@@ -91,6 +94,10 @@ config SOC_NRF5340_CPUNET
select HAS_HW_NRF_RTC1
select HAS_HW_NRF_SPIM0
select HAS_HW_NRF_SPIS0
select HAS_HW_NRF_SWI0
select HAS_HW_NRF_SWI1
select HAS_HW_NRF_SWI2
select HAS_HW_NRF_SWI3
select HAS_HW_NRF_TEMP
select HAS_HW_NRF_TIMER0
select HAS_HW_NRF_TIMER1

View File

@@ -112,6 +112,8 @@ if(CONFIG_BT_LL_SW_SPLIT)
)
endif()
if(CONFIG_BT_CONN OR
(CONFIG_BT_BROADCASTER AND
CONFIG_BT_CTLR_ADV_EXT) OR
CONFIG_BT_CTLR_ADV_PERIODIC OR
CONFIG_BT_CTLR_SYNC_PERIODIC)
zephyr_library_sources(

View File

@@ -430,7 +430,7 @@ config BT_CTLR_PHY_CODED
config BT_CTLR_CHAN_SEL_2
bool "Channel Selection Algorithm #2"
depends on (BT_CONN || BT_CTLR_ADV_PERIODIC || BT_CTLR_SYNC_PERIODIC) && BT_CTLR_CHAN_SEL_2_SUPPORT
depends on (BT_CONN || (BT_BROADCASTER && BT_CTLR_ADV_EXT) || BT_CTLR_ADV_PERIODIC || BT_CTLR_SYNC_PERIODIC) && BT_CTLR_CHAN_SEL_2_SUPPORT
default y
help
Enable support for Bluetooth 5.0 LE Channel Selection Algorithm #2 in
@@ -497,6 +497,14 @@ config BT_CTLR_SYNC_PERIODIC
config BT_CTLR_SYNC_PERIODIC
bool "LE Periodic Advertising in Synchronization State [EXPERIMENTAL]" if BT_LL_SW_SPLIT
config BT_CTLR_SYNC_PERIODIC_CTE_TYPE_FILTERING
bool "LE Periodic Advertiser filtering by CTE type"
depends on BT_CTLR_SYNC_PERIODIC
default y
help
Enable filtering of periodic advertisements depending on type of
Constant Tone Extension.
config BT_CTLR_ADV_ISO
bool "LE Broadcast Isochronous Channel advertising" if !BT_LL_SW_SPLIT
depends on BT_BROADCASTER && BT_CTLR_ADV_ISO_SUPPORT

View File

@@ -26,6 +26,9 @@ config BT_CTLR_DF_ANT_SWITCH_2US_SUPPORT
config BT_CTLR_DF_ANT_SWITCH_1US_SUPPORT
bool
config BT_CTLR_CTEINLINE_SUPPORT
bool
menuconfig BT_CTLR_DF
bool "LE Direction Finding [Experimental]"
depends on BT_CTLR_DF_SUPPORT

View File

@@ -35,6 +35,7 @@ config BT_LLL_VENDOR_NORDIC
select BT_CTLR_ADV_ISO_SUPPORT
select BT_CTLR_SYNC_ISO_SUPPORT
select BT_CTLR_DF_SUPPORT if $(DT_NORDIC_RADIO_DFE_SUPPORTED)
select BT_CTLR_CTEINLINE_SUPPORT if $(DT_NORDIC_RADIO_DFE_SUPPORTED)
select BT_CTLR_CHAN_SEL_2_SUPPORT
select BT_CTLR_MIN_USED_CHAN_SUPPORT
select BT_CTLR_DTM_HCI_SUPPORT

View File

@@ -852,7 +852,7 @@ static void read_bd_addr(struct net_buf *buf, struct net_buf **evt)
rp->status = 0x00;
ll_addr_get(0, &rp->bdaddr.val[0]);
(void)ll_addr_read(0, &rp->bdaddr.val[0]);
}
#if defined(CONFIG_BT_CTLR_HCI_CODEC_AND_DELAY_INFO)
@@ -3278,17 +3278,26 @@ static void le_per_adv_create_sync(struct net_buf *buf, struct net_buf **evt)
uint8_t status;
uint16_t skip;
if (adv_cmds_ext_check(evt)) {
if (adv_cmds_ext_check(NULL)) {
*evt = cmd_status(BT_HCI_ERR_CMD_DISALLOWED);
return;
}
skip = sys_le16_to_cpu(cmd->skip);
sync_timeout = sys_le16_to_cpu(cmd->sync_timeout);
status = ll_sync_create(cmd->options, cmd->sid, cmd->addr.type,
cmd->addr.a.val, skip, sync_timeout,
cmd->cte_type);
#if defined(CONFIG_BT_CTLR_SYNC_PERIODIC_CTE_TYPE_FILTERING)
if ((cmd->cte_type & BT_HCI_LE_PER_ADV_CREATE_SYNC_CTE_TYPE_INVALID_VALUE) != 0) {
status = BT_HCI_ERR_CMD_DISALLOWED;
#else
if (cmd->cte_type != BT_HCI_LE_PER_ADV_CREATE_SYNC_CTE_TYPE_NO_FILTERING) {
status = BT_HCI_ERR_INVALID_PARAM;
#endif /* CONFIG_BT_CTLR_SYNC_PERIODIC_CTE_TYPE_FILTERING */
} else {
status = ll_sync_create(cmd->options, cmd->sid, cmd->addr.type, cmd->addr.a.val,
skip, sync_timeout, cmd->cte_type);
}
*evt = cmd_status(status);
}
@@ -3334,6 +3343,10 @@ static void le_per_adv_recv_enable(struct net_buf *buf, struct net_buf **evt)
uint16_t handle;
uint8_t status;
if (adv_cmds_ext_check(evt)) {
return;
}
handle = sys_le16_to_cpu(cmd->handle);
status = ll_sync_recv_enable(handle, cmd->enable);
@@ -5497,7 +5510,7 @@ static void le_per_adv_sync_established(struct pdu_data *pdu_data,
sep->status = se->status;
sep->handle = sys_cpu_to_le16(node_rx->hdr.handle);
if (sep->status) {
if (sep->status != BT_HCI_ERR_SUCCESS && sep->status != BT_HCI_ERR_UNSUPP_REMOTE_FEATURE) {
return;
}

View File

@@ -15,8 +15,9 @@ void ll_reset(void);
uint8_t ll_set_host_feature(uint8_t bit_number, uint8_t bit_value);
uint64_t ll_feat_get(void);
uint8_t *ll_addr_get(uint8_t addr_type, uint8_t *p_bdaddr);
uint8_t ll_addr_set(uint8_t addr_type, uint8_t const *const p_bdaddr);
uint8_t *ll_addr_get(uint8_t addr_type);
uint8_t *ll_addr_read(uint8_t addr_type, uint8_t *const bdaddr);
#if defined(CONFIG_BT_CTLR_HCI_ADV_HANDLE_MAPPING)
uint8_t ll_adv_set_by_hci_handle_get(uint8_t hci_handle, uint8_t *handle);

View File

@@ -5,7 +5,7 @@
* SPDX-License-Identifier: Apache-2.0
*/
#define LL_VERSION_NUMBER BT_HCI_VERSION_5_2
#define LL_VERSION_NUMBER BT_HCI_VERSION_5_3
#if defined(CONFIG_BT_CTLR_LE_ENC)
#define LL_FEAT_BIT_ENC BIT64(BT_LE_FEAT_BIT_ENC)

View File

@@ -34,27 +34,6 @@
static uint8_t pub_addr[BDADDR_SIZE];
static uint8_t rnd_addr[BDADDR_SIZE];
uint8_t *ll_addr_get(uint8_t addr_type, uint8_t *bdaddr)
{
if (addr_type > 1) {
return NULL;
}
if (addr_type) {
if (bdaddr) {
memcpy(bdaddr, rnd_addr, BDADDR_SIZE);
}
return rnd_addr;
}
if (bdaddr) {
memcpy(bdaddr, pub_addr, BDADDR_SIZE);
}
return pub_addr;
}
uint8_t ll_addr_set(uint8_t addr_type, uint8_t const *const bdaddr)
{
if (IS_ENABLED(CONFIG_BT_BROADCASTER)) {
@@ -81,6 +60,31 @@ uint8_t ll_addr_set(uint8_t addr_type, uint8_t const *const bdaddr)
return 0;
}
uint8_t *ll_addr_get(uint8_t addr_type)
{
if (addr_type > BT_ADDR_LE_RANDOM) {
return NULL;
}
if (addr_type) {
return rnd_addr;
}
return pub_addr;
}
uint8_t *ll_addr_read(uint8_t addr_type, uint8_t *const bdaddr)
{
uint8_t *addr;
addr = ll_addr_get(addr_type);
if (addr) {
memcpy(bdaddr, addr, BDADDR_SIZE);
}
return addr;
}
void bt_ctlr_set_public_addr(const uint8_t *addr)
{
(void)memcpy(pub_addr, addr, sizeof(pub_addr));

View File

@@ -284,6 +284,9 @@ struct node_rx_ftr {
uint8_t aux_lll_sched:1;
uint8_t aux_w4next:1;
uint8_t aux_failed:1;
#if defined(CONFIG_BT_CTLR_SYNC_PERIODIC)
uint8_t sync_status:2;
#endif /* CONFIG_BT_CTLR_SYNC_PERIODIC */
uint8_t phy_flags:1;
uint8_t scan_req:1;
@@ -400,7 +403,14 @@ struct event_done_extra {
union {
struct {
uint16_t trx_cnt;
uint8_t crc_valid;
uint8_t crc_valid:1;
#if defined(CONFIG_BT_CTLR_SYNC_PERIODIC_CTE_TYPE_FILTERING) && \
defined(CONFIG_BT_CTLR_CTEINLINE_SUPPORT)
/* Used to inform ULL that periodic advertising sync scan should be
* terminated.
*/
uint8_t sync_term:1;
#endif /* CONFIG_BT_CTLR_SYNC_PERIODIC_CTE_TYPE_FILTERING && CONFIG_BT_CTLR_CTEINLINE_SUPPORT */
#if defined(CONFIG_BT_CTLR_LE_ENC)
uint8_t mic_state;
#endif /* CONFIG_BT_CTLR_LE_ENC */

Some files were not shown because too many files have changed in this diff Show More