Compare commits

...

468 Commits

Author SHA1 Message Date
Christopher Friedt
030fa9da45 release: Zephyr 2.7.5
Set version to 2.7.5

Signed-off-by: Christopher Friedt <cfriedt@meta.com>
2023-06-01 08:08:42 -04:00
Christopher Friedt
43370b89c3 release: minor corrections to security release notes
* remove reference to other github project issue
* complete incomplete sentence

Signed-off-by: Christopher Friedt <cfriedt@meta.com>
2023-06-01 08:07:16 -04:00
Flavio Ceolin
15fa28896a release: mbedTLS: Add vulnerabilities info
Add information about vulnerabilities fixed since mbedTLS 2.26.0.

Signed-off-by: Flavio Ceolin <flavio.ceolin@intel.com>
2023-06-01 01:06:49 +09:00
Flavio Ceolin
ce3eb90a83 release: security: Add rel notes for vulnerabilities
Add information about vulnerabilities fixed in 2.7.5 release.

Signed-off-by: Flavio Ceolin <flavio.ceolin@intel.com>
2023-06-01 01:06:49 +09:00
Chris Friedt
ca24cd6c2d release: update v2.7.5 release notes
* add bugifixes to v2.7.5 release

Signed-off-by: Chris Friedt <cfriedt@meta.com>
2023-05-27 05:32:14 -04:00
Flavio Ceolin
4fc4dc7b84 release: mbedTLS: Add rel notes for mbedTLS
Release notes for mbedTLS lates update.

Signed-off-by: Flavio Ceolin <flavio.ceolin@intel.com>
2023-05-26 11:10:27 +09:00
Krzysztof Chruscinski
fb24b62dc5 logging: Fix user space crash when runtime filtering is on
Logging module data (including filters) are not accessible by
the user space. Macro for creating logs where creating local
variable with filters before checking is we are in the user
context. It was not used in that case but creating variable
was violating access writes that resulted in failure.

Removing variable creation and using filters directly in the
if clause but after checking condition that it is not the
user context. With this approach data is accessed only in
the kernel mode.

Cherry-picked with modifications from
4ee59e2cdb.

Signed-off-by: Krzysztof Chruscinski <krzysztof.chruscinski@nordicsemi.no>
2023-05-18 00:27:35 +08:00
Chris Friedt
60e7a97328 release: create outline for v2.7.5 release notes
Create a template for v2.7.5 release notes.

Signed-off-by: Chris Friedt <cfriedt@meta.com>
2023-05-18 00:07:05 +08:00
Flavio Ceolin
a1aa463783 boards: mps2_an521_ns: Remove simulation capability
This board requires TF-M which is not supported by default in the
current Zephyr release. Just remove the simulation capability to
avoid CI failures.

See: https://github.com/zephyrproject-rtos/zephyr/pull/54084

Signed-off-by: Flavio Ceolin <flavio.ceolin@intel.com>
2023-05-17 23:47:58 +08:00
Flavio Ceolin
29c1e08cf7 west: tf-m: Remove tf-m from Zephyr LTS
Zephyr mbedTLS was updated to 2.28.x which is a LTS release and
address several vulnerabilities affecting 2.26 (version that used to be
used on Zephyr LTS).

Unfortunately this mbedTLS version is not compatible with TF-M and
backporting mbedTLS fixes was not a viable solution. Due this problem
we are removing TF-M module from Zephyr's LTS. One still can go and add
it to this manifest if needed, but this is no longer "officially"
supported.

More information in:
https://github.com/zephyrproject-rtos/zephyr/issues/56071
https://github.com/zephyrproject-rtos/zephyr/pull/54084

Signed-off-by: Flavio Ceolin <flavio.ceolin@intel.com>
2023-05-17 23:47:58 +08:00
Flavio Ceolin
190f09df52 samples: tfm: Add ZEPHYR_TRUSTED_FIRMWARE_M_MODULE dependency
Only build / run these TF-M samples when TF-M module is available.

Signed-off-by: Flavio Ceolin <flavio.ceolin@intel.com>
2023-05-17 23:47:58 +08:00
Flavio Ceolin
a166290f1a tfm: boards: Add ZEPHYR_TRUSTED_FIRMWARE_M_MODULE dependency
Enable BUILD_WITH_TFM only when TF-M module is available.

Signed-off-by: Flavio Ceolin <flavio.ceolin@intel.com>
2023-05-17 23:47:58 +08:00
Flavio Ceolin
21e0870106 crypto: Bump mbedTLS to 2.28.3
Bump mbedTLS to version 2.28.3

Signed-off-by: Flavio Ceolin <flavio.ceolin@intel.com>
2023-05-17 23:47:58 +08:00
Flavio Ceolin
ebe3651f3d tests: mbedtls: Fix GCC warning about test_snprintf
Fix errors like:

inlined from ‘test_mbedtls’ at
zephyrproject/zephyr/tests/crypto/mbedtls/src/mbedtls.c:172:6:
zephyrproject/zephyr/tests/crypto/mbedtls/src/mbedtls.c:96:17: error:
‘test_snprintf’ reading 10 bytes from a region of size 1
[-Werror=stringop-overread]
   96 |                 test_snprintf(1, "", -1) != 0 ||
      |                 ^~~~~~~~~~~~~~~~~~~~~~~~

In GCC >= 11 because `ret_buf` in some calls are shorter literals

Signed-off-by: Flavio Ceolin <flavio.ceolin@intel.com>
2023-05-17 23:47:58 +08:00
Torsten Rasmussen
1b7c720c7f cmake: prefix local version of return variable
Fixes: #55490
Follow-up: #53124

Prefix local version of the return variable before calling
`zephyr_check_compiler_flag_hardcoded()`.

This ensures that there will never be any naming collision between named
return argument and the variable name used in later functions when
PARENT_SCOPE is used.

The issue #55490 provided description of situation where the double
de-referencing was not working correctly.

Signed-off-by: Torsten Rasmussen <Torsten.Rasmussen@nordicsemi.no>
(cherry picked from commit 599886a9d3)
2023-05-13 19:23:55 -04:00
Stephanos Ioannidis
58af1b51bd ci: Use organisation-level AWS secrets
This commit updates the CI workflows to use the `zephyrproject-rtos`
organisation-level AWS secrets instead of the repository-level secrets.

Using organisation-level secrets allows more centralised management of
the access keys used throughout the GitHub Actions CI infrastructure.

Note that the `AWS_*_ACCESS_KEY_ID` is now stored in plaintext as a
variable instead of a secret because it is equivalent to username and
needs to be identifiable for management and audit purposes.

Signed-off-by: Stephanos Ioannidis <root@stephanos.io>
2023-05-12 03:30:43 +09:00
Kumar Gala
70f2a4951a tests: posix: fs: disable CONFIG_EVENTFD
The test doesn't use eventfd so we can disable it to save some space.

Signed-off-by: Kumar Gala <kumar.gala@intel.com>
(cherry picked from commit 70e921dbc7)
2023-05-10 19:48:15 -04:00
Kumar Gala
650d10805a posix: eventfd: depends on polling
Have eventfd Kconfig select POLL is the code utilizes the polling
API.  We get a link error for tests/lib/fdtable/libraries.os.fdtable
when building on arm-clang without this.

Signed-off-by: Kumar Gala <kumar.gala@intel.com>
(cherry picked from commit f215e4494c)
2023-05-10 19:48:15 -04:00
Chris Friedt
25616b1021 tests: drivers: dma: loop: support 64-bit dma
The test does not appear to support 64-bit DMA
* mitigate compiler warning
* support 64-bit addressing mode with `CONFIG_DMA_64BIT`

Signed-off-by: Chris Friedt <cfriedt@meta.com>
(cherry picked from commit 8c6c96715f)
2023-05-09 08:42:19 -04:00
Chris Friedt
f72519007c tests: drivers: dma: chan_link: support 64-bit dma
The test does not appear to support 64-bit DMA
* mitigate compiler warning
* support 64-bit addressing mode with `CONFIG_DMA_64BIT`

Signed-off-by: Chris Friedt <cfriedt@meta.com>
(cherry picked from commit 7f6d976916)
2023-05-09 08:42:19 -04:00
Chris Friedt
1b2a7ec251 tests: drivers: dma: chan_blen: support 64-bit dma
The test does not appear to support 64-bit DMA
* mitigate compiler warning
* support 64-bit addressing mode with `CONFIG_DMA_64BIT`

Signed-off-by: Chris Friedt <cfriedt@meta.com>
(cherry picked from commit 5afcac5e14)
2023-05-09 08:42:19 -04:00
Chris Friedt
9d2533fc92 tests: posix: ensure that min and max priority are schedulable
Verify that threads are actually schedulable for min and max
scheduler priority for both `SCHED_RR` (preemptive) and
`SCHED_FIFO` (cooperative).

Fixes #56729

Signed-off-by: Chris Friedt <cfriedt@meta.com>
(cherry picked from commit ad71b78770)
2023-05-02 16:25:42 -04:00
Chris Friedt
e20b8f3f34 posix: sched: ensure min and max priority are schedulable
Previously, there was an off-by-one error for SCHED_RR.

Fixes #56729

Signed-off-by: Chris Friedt <cfriedt@meta.com>
(cherry picked from commit 2b2cbf8107)
2023-05-02 16:25:42 -04:00
Christopher Friedt
199d5d5448 drivers: pcie_ep: iproc: compile-out unused function based on DT
Compile-out `iproc_pcie_pl330_dma_xfer()` if there are no active
DMA users in devicetree.

Signed-off-by: Christopher Friedt <cfriedt@meta.com>
(cherry picked from commit 9ad78eb60c)
2023-05-02 12:33:46 -04:00
Chris Friedt
5db2717f06 drivers: pcie_ep: iproc: ensure config and api are const
The `config` and `api` members of `struct device` are expected
to be `const`. This also improves reliability, as `config`
and `api` are stored in rom rather than ram, which has the
potential to be corrupted at runtime in the absense of an MMU.

Signed-off-by: Chris Friedt <cfriedt@meta.com>
(cherry picked from commit 7212792295)
2023-04-27 11:18:00 -04:00
Tarun Karuturi
f3851326da drivers: pcie_ep: iproc: enable based on device tree specs
There are use cases for the pcie_ep driver where we don't
necessarily need the dma functionality. Added ifdef's around
the dma functionality so that it's only available if we
specify the dma engines in the device tree similar to

```
dmas = <&pl330 0>, <&pl330 1>;
dma-names = "txdma", "rxdma";
```

Signed-off-by: Tarun Karuturi <tkaruturi@meta.com>
Signed-off-by: Chris Friedt <cfriedt@meta.com>
(cherry picked from commit 9d95f69a87)
2023-04-27 11:18:00 -04:00
Stephanos Ioannidis
5a8d05b968 ci: labeler: Use actions/labeler@v4
This commit updates the labeler workflow to use the labeler action v4,
which is based on node.js 16 and @actions/core 1.10.0, in preparation
for the upcoming removal of the deprecated GitHub features.

Signed-off-by: Stephanos Ioannidis <root@stephanos.io>
2023-04-27 21:45:14 +09:00
Stephanos Ioannidis
eea42e38f3 ci: labeler: Use actions/labeler@v4
This commit updates the labeler workflow to use the labeler action v4,
which is based on node.js 16 and @actions/core 1.10.0, in preparation
for the upcoming removal of the deprecated GitHub features.

Signed-off-by: Stephanos Ioannidis <root@stephanos.io>
2023-04-15 15:59:20 +09:00
Chris Friedt
0388a90e7b posix: clock: fix seconds calculation
The previous method used to calculate seconds in `clock_gettime()`
seemed to have an inaccuracy that grew with time causing the
seconds to be off by an order of magnitude when ticks would roll
over.

This change fixes the method used to calculate seconds.

Signed-off-by: Chris Friedt <cfriedt@meta.com>
2023-04-07 06:29:11 -04:00
Krzysztof Chruscinski
4c62d76fb7 sys: time_units: Add Kconfig option for algorithm selection
Add maximum timeout used for conversion to Kconfig. Option is used
to determine which conversion algorithm to use: faster but overflowing
earlier or slower without early overflow.

Signed-off-by: Krzysztof Chruscinski <krzysztof.chruscinski@nordicsemi.no>
(cherry picked from commit 50c7c7b1e4)
2023-04-07 06:29:11 -04:00
Chris Friedt
6f8f9b5c7a tests: time_units: check for overflow in z_tmcvt intermediate
Prior to #41602, due to the ordering of operations (first mul,
then div), an intermediate value would overflow, resulting in
a time non-linearity.

This test ensures that time rolls-over properly.

Signed-off-by: Chris Friedt <cfriedt@meta.com>
(cherry picked from commit 74c9c0e7a3)
2023-04-07 06:29:11 -04:00
Krzysztof Chruscinski
afbc93287d lib: posix: clock: Prevent early overflows
Algorithm was converting uptime to nanoseconds which can easily
lead to overflows. Changed algorithm to use milliseconds and
nanoseconds for remainder only.

Signed-off-by: Krzysztof Chruscinski <krzysztof.chruscinski@nordicsemi.no>
2023-04-07 06:29:11 -04:00
Gerard Marull-Paretas
a28aa01a88 sys: time_units: add missing include
The header can't be fully used in standalone mode: toolchain.h has to be
included first, otherwise the ALWAYS_INLINE attribute is not defined.
Headers that can be directly included and are not self-contained should
be considered a bad practice.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2023-04-07 06:29:11 -04:00
Stephanos Ioannidis
677a374255 ci: backport_issue_check: Use ubuntu-22.04 virtual environment
This commit updates the pull request backport issue check workflow to
use the Ubuntu 22.04 virtual environment.

Signed-off-by: Stephanos Ioannidis <root@stephanos.io>
(cherry picked from commit cadd6e6fa4)
2023-03-22 03:15:40 +09:00
Stephanos Ioannidis
0389fa740b ci: manifest: Use ubuntu-22.04 virtual environment
This commit updates the manifest workflow to use the Ubuntu 22.04
virtual environment.

Signed-off-by: Stephanos Ioannidis <root@stephanos.io>
(cherry picked from commit af6d77f7a7)
2023-03-22 03:05:01 +09:00
Torsten Rasmussen
b02d34b855 cmake: fix variable de-referencing in zephyr_check_compiler_x functions
Fixes: #53124

Fix de-referencing of check and exists function arguments by correctly
de-referencing the argument references using `${<var>}`.

Signed-off-by: Torsten Rasmussen <Torsten.Rasmussen@nordicsemi.no>
(cherry picked from commit 04a27651ea)
2023-03-13 07:48:51 -04:00
Torsten Rasmussen
29e3a4865f cmake: dereference ${check} after zephyr_check_compiler_flag() call
Follow-up: #53124

The PR#53124 fixed an issue where the variable `check` was not properly
dereferenced into the correct variable name for return value storage.
This was corrected in 04a27651ea.

However, some code was passing a return argument as:
`zephyr_check_compiler_flag(... ${check})`
but checking the result like:
`if(${check})`
thus relying on a faulty behavior of code updating `check` and not the
`${check}` variable.

Fix this by updating to use `${${check}}` as that will point to the
correct return value.

Signed-off-by: Torsten Rasmussen <Torsten.Rasmussen@nordicsemi.no>
(cherry picked from commit 45b25e5508)
2023-03-10 13:32:37 -05:00
Robert Lubos
aaa6d280ce net: iface: Add NULL pointer check in net_if_ipv6_set_reachable_time
In case the IPv6 context pointer was not set on an interface (for
instance due to IPv6 context shortage), processing the RA message could
lead to a crash (i. e. NULL pointer dereference). Protect against this
by adding NULL pointer check, similarly to other functions in this area.

Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
(cherry picked from commit c6c2098255)
2023-02-28 12:36:47 -05:00
Robert Lubos
e02a3377e5 net: shell: Validate pointer provided with net pkt command
The net_pkt pointer provided to net pkt commands was not validated in
any way. Therefore it was fairly easy to crash an application by
providing invalid address.

This commit adds the pointer validation. It's checked whether the
pointer provided belongs to any net_pkt pools known to the net stack,
and if the pointer offset within the slab actually points to the
beginning of the net_pkt structure.

Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
(cherry picked from commit e540a98331)
2023-02-28 12:34:38 -05:00
Gerard Marull-Paretas
76c30dfa55 ci: doc-build: fix PDF build
New LaTeX Docker image (Debian based) uses Python 3.11. On Debian
systems, this version does not allow to install packages to the system
environment using pip.  Use a virtual environment instead.

Signed-off-by: Gerard Marull-Paretas <gerard@teslabs.com>
(cherry picked from commit e6d9ff2948)
2023-02-28 23:21:51 +09:00
Théo Battrel
c3f512d606 Bluetooth: Host: Check returned value by LE_READ_BUFFER_SIZE
`rp->le_max_num` was passed unchecked into `k_sem_init()`, this could
lead to the value being uninitialized and an unknown behavior.

To fix that issue, the `rp->le_max_num` value is checked the same way as
`bt_dev.le.acl_mtu` was already checked. The same things has been done
for `rp->acl_max_num` and `rp->iso_max_num` in
`read_buffer_size_v2_complete()` function.

Signed-off-by: Théo Battrel <theo.battrel@nordicsemi.no>
(cherry picked from commit ac3dec5212)
2023-02-24 19:48:12 -05:00
NingX Zhao
f882abfd13 tests: removing incorrect testcases of poll
These two test cases both are fault injection test cases,
and there are designed for testing some negative branches
to improve code coverage. But I find that this branch
shouldn't be tested, because the spinlock will be locked
before a procedure performs here, and then it will trigger
an assert error and the process will be rescheduled to the
handler function, and terminated the current test case,
so spinlock will never be unlocked. And it will impact
the next test case in the same test suite(the next testcase
will be never get spinlock).

Signed-off-by: NingX Zhao <ningx.zhao@intel.com>
(cherry picked from commit cb4a629bc8)
2023-02-07 12:14:38 -06:00
Lucas Dietrich
bc7300fea7 kernel: workq: Add internal function z_work_submit_to_queue()
This adds the internal function z_work_submit_to_queue(), which
submits the work item to the queue but doesn't force the thread to yield,
compared to the public function k_work_submit_to_queue().

When called from poll.c in the context of k_work_poll events, it ensures
that the thread does not yield in the context of the spinlock of object
that became available.

Fixes #45267

Signed-off-by: Lucas Dietrich <ld.adecy@gmail.com>
(cherry picked from commit 9a848b3ad4)
2023-02-03 18:37:53 -05:00
Andy Ross
8da9a76464 kernel/workq: Cleanup bespoke reschedule point
The work queue has a semi/non-standard reschedule point implemented
using k_yield(), with a check to see if the current thread is
preemptible.  Just call z_reschedule_unlocked(), it has this check
internally and is the intended API for this.

Really, this is only a half fix.  Ideally the schedule point and the
lock release should be atomic[1] via the more idiomatic
z_reschedule().  But that would take some surgery, so let's go with
the simpler cleanup first.

This also avoids having to duplicate logic that gets added to
reschedule points by an upcoming patch.

[1] So that they represent a condition variable and don't race at the
end. In this case the race is present but benign, since the only thing
we really want to know is that the queue thread gets a chance to run.
The only cost is an occasional duplicated/needless context switch if
two threads are racing on a submit.

Signed-off-by: Andy Ross <andrew.j.ross@intel.com>
(cherry picked from commit 8d94967ec4)
2023-02-03 18:37:53 -05:00
Lixin Guo
298b8ea788 kernel: work: remove unused if statement
Condition of work == NULL is checked before, so there is no need to
check it again.

Signed-off-by: Lixin Guo <lixinx.guo@intel.com>
(cherry picked from commit d4826d874e)
2023-02-03 18:37:53 -05:00
Peter Mitsis
a9aaf048e8 kernel: Fixes sys_clock_tick_get()
Fixes an issue in sys_clock_tick_get() that could lead to drift in
a k_timer handler. The handler is invoked in the timer ISR as a
callback in sys_tick_announce().
  1. The handler invokes k_uptime_ticks().
  2. k_uptime_ticks() invokes sys_clock_tick_get().
  3. sys_clock_tick_get() must call elapsed() and not
     sys_clock_elapsed() as we do not want to count any
     unannounced ticks that may have elapsed while
     processing the timer ISR.

Fixes #46378

Signed-off-by: Peter Mitsis <peter.mitsis@intel.com>
(cherry picked from commit 71ef669ea4)
2023-02-03 18:37:53 -05:00
Peter Mitsis
e2b81b48c4 kernel: fix race condition in sys_clock_announce()
Updates sys_clock_announce() such that the <announce_remaining> update
calculation is done after the callback. This prevents another core from
entering the timeout processing loop before the first core leaves it.

Signed-off-by: Peter Mitsis <peter.mitsis@intel.com>
(cherry picked from commit 3e2f30a7ef)
2023-02-03 18:37:53 -05:00
Andy Ross
45c41bc344 kernel/timeout: Cleanup/speedup parallel announce logic
Commit b1182bf83b ("kernel/timeout: Serialize handler callbacks on
SMP") introduced an important fix to timeout handling on
multiprocessor systems, but it did it in a clumsy way by holding a
spinlock across the entire timeout process on all cores (everything
would have to spin until one core finished the list).  The lock also
delays any nested interrupts that might otherwise be delivered, which
breaks our nested_irq_offload case on xtensa+SMP (where contra x86,
the "synchronous" interrupt is sensitive to mask state).

Doing this right turns out not to be so hard: take the timeout lock,
check to see if someone is already iterating
(i.e. "announce_remaining" is non-zero), and if so just increment the
ticks to announce and exit.  The original cpu will then complete the
full timeout list without blocking any others longer than needed to
check the timeout state.

Fixes #44758

Signed-off-by: Andy Ross <andrew.j.ross@intel.com>
(cherry picked from commit 0b2ed3818d)
2023-02-03 18:37:53 -05:00
Andy Ross
f570a46719 kernel/timeout: Serialize handler callbacks on SMP
On multiprocessor systems, it's routine to enter sys_clock_announce()
in parallel (the driver will generally announce zero ticks on all but
one cpu).

When that happens, each call will independently enter the loop over
the timeout list.  The access is correctly synchronized, so the list
handling is correct.  But the lock is RELEASED around the invocation
of the callback, which means that the individual callbacks may
interleave between cpus.  That means that individual
application-provided callbacks may be executed in parallel, which to
the app is indistinguishable from "out of order".

That's surprising and error-prone.  Don't do it.  Place a secondary
outer spinlock around the announce loop (but not the timeslicing
handling) to correctly serialize the timeout handling on a single cpu.

(It should be noted that this was discovered not because of a timeout
callback race, but because the resulting simultaneous calls to
sys_clock_set_timeout from separate cores seems to cause extremely
high latency excursions on intel_adsp hardware using the cavs_timer
driver.  That hardware issue is still poorly understood, but this fix
is desirable regardless.)

Signed-off-by: Andy Ross <andrew.j.ross@intel.com>
(cherry picked from commit b1182bf83b)
2023-02-03 18:37:53 -05:00
Flavio Ceolin
675a349e1b kernel: Fix timeout issue with SYSTEM_CLOCK_SLOPPY_IDLE
We can't simply use CLAMP to set the next timeout because
when CONFIG_SYSTEM_CLOCK_SLOPPY_IDLE is set, MAX_WAIT is
a negative number and then CLAMP will be called with
the higher boundary lower the lower boundary.

Fixes #41422

Signed-off-by: Flavio Ceolin <flavio.ceolin@intel.com>
(cherry picked from commit 47b7c2e931)
2023-02-03 18:37:53 -05:00
Andy Ross
16927a6cbb kernel/sched: Defer IPI sending to schedule points
The original design intent with arch_sched_ipi() was that
interprocessor interrupts were fast and easily sent, so to reduce
latency the scheduler should notify other CPUs synchronously when
scheduler state changes.

This tends to result in "storms" of IPIs in some use cases, though.
For example, SOF will enumerate over all cores doing a k_sem_give() to
notify a worker thread pinned to each, each call causing a separate
IPI.  Add to that the fact that unlike x86's IO-APIC, the intel_adsp
architecture has targeted/non-broadcast IPIs that need to be repeated
for each core, and suddenly we have an O(N^2) scaling problem in the
number of CPUs.

Instead, batch the "pending" IPIs and send them only at known
scheduling points (end-of-interrupt and swap).  This semantically
matches the locations where application code will "expect" to see
other threads run, so arguably is a better choice anyway.

Signed-off-by: Andy Ross <andrew.j.ross@intel.com>
(cherry picked from commit b4e9ef0691)
2023-02-03 18:37:53 -05:00
Andy Ross
ab353d6b7d kernel/sched: Refactor IPI signaling
Minor cleanup, we had a bunch of duplicated #if logic to send IPIs,
put it all in one place.

Signed-off-by: Andy Ross <andrew.j.ross@intel.com>
(cherry picked from commit 3267cd327e)
2023-02-03 18:37:53 -05:00
Mark Holden
951b055b7f debug: coredump: allow for coredump backends to be defined outside of tree
Move coredump_backend_api struct to public header so that custom backends
for coredump can be defined out of tree. Create simple backend in test
directory for verification.

Signed-off-by: Mark Holden <mholden@fb.com>
(cherry picked from commit 7b2b283677)
2023-02-03 18:35:56 -05:00
Nicolas Pitre
8e256b3399 scripts: gen_syscalls: fix argument marshalling with 64-bit debug builds
Let's consider this (simplified) compilation result of a debug build
using -O0 for riscv64:

|__pinned_func
|static inline int k_sem_init(struct k_sem * sem,
|                             unsigned int initial_count,
|                             unsigned int limit)
|{
|    80000ad0:   6105                    addi    sp,sp,32
|    80000ad2:   ec06                    sd      ra,24(sp)
|    80000ad4:   e42a                    sd      a0,8(sp)
|    80000ad6:   c22e                    sw      a1,4(sp)
|    80000ad8:   c032                    sw      a2,0(sp)
|        ret = arch_is_user_context();
|    80000ada:   b39ff0ef                jal     ra,80000612
|        if (z_syscall_trap()) {
|    80000ade:   c911                    beqz    a0,80000af2
|                return (int) arch_syscall_invoke3(*(uintptr_t *)&sem,
|                                    *(uintptr_t *)&initial_count,
|                                    *(uintptr_t *)&limit,
|                                    K_SYSCALL_K_SEM_INIT);
|    80000ae0:   6522                    ld      a0,8(sp)
|    80000ae2:   00413583                ld      a1,4(sp)
|    80000ae6:   6602                    ld      a2,0(sp)
|    80000ae8:   0b700693                li      a3,183
|    [...]

We clearly see the 32-bit values `initial_count` (a1) and `limit` (a2)
being stored in memory with the `sw` (store word) instruction. Then,
according to the source code, the address of those values is casted
as a pointer to uintptr_t values, and that pointer is dereferenced to
get back those values with the `ld` (load double) instruction this time.

In other words, the assembly does exactly what the C code indicates.
This is wrong for 2 reasons:

- The top half of a1 and a2 will contain garbage due to the `ld` used
  to retrieve them. Whether or not the top bits will be cleared
  eventually depends on the architecture and compiler.
- Regardless of the above, a1 and a2 would be plain wrong on a big
  endian system.
- The load of a1 will cause a misaligned trap as it is 4-byte aligned
  while `ld` expects a 8-byte alignment.

The above code happens to work properly when compiling with
optimizations enabled as the compiler simplifies the cast and
dereference away, and register content is used as is in that case.
That doesn't make the code any more "correct" though.

The reason for taking the address of an argument and dereference it as an
uintptr_t pointer is most likely done to work around the fact that the
compiler refuses to cast an aggregate value to an integer, even if that
aggregate value is in fact a simple structure wrapping an integer.

So let's fix this code by:

- Removing the pointer dereference roundtrip and associated casts. This
  gets rid of all the issues listed above.
- Using a union to perform the type transition which deals with
  aggregates perfectly well. The compiler does optimize things to the
  same assembly output in the end.

This also makes the compiler happier as those pragmas to shut up warnings
are no longer needed. It should be the same about coverity.

Signed-off-by: Nicolas Pitre <npitre@baylibre.com>
(cherry picked from commit 1db5c8b948)
2023-02-01 20:07:43 -05:00
Nicolas Pitre
74f2760771 scripts: gen_syscalls: add missing --split-type case
With CONFIG_TIMEOUT_64BIT it is both k_timeout_t and k_ticks_t that
need to be split, otherwise many syscalls returning a number of ticks
are being truncated to 32 bits.

Signed-off-by: Nicolas Pitre <npitre@baylibre.com>
(cherry picked from commit 2cdac33d39)
2023-02-01 20:07:43 -05:00
Nicolas Pitre
85e0912291 scripts: gen_syscalls: fix access validation size on extra params array
It was one below the entire array size.

Signed-off-by: Nicolas Pitre <npitre@baylibre.com>
(cherry picked from commit df80c77ed8)
2023-02-01 20:07:43 -05:00
Jim Shu
f2c582c75d gen_app_partitions: add .sdata/.sbss section into app_smem
Some architectures (e.g. RISC-V) has .sdata/.sbss section for small
data/bss. Memory partition should also manage the permission of these
sections in library so they should be put into app_smem.
(For example, newlib _impure_ptr is in .sdata section and
__malloc_top_pad is in .sbss section in RISC-V.)

Signed-off-by: Jim Shu <cwshu@andestech.com>
(cherry picked from commit 46eb3e5fce)
2023-02-01 20:07:43 -05:00
Robert Lubos
c908ee8133 net: context: Separate user data pointer from FIFO reserved space
Using the same memory as a user data pointer and FIFO reserved space
could lead to a crash in certain circumstances, those two use cases were
not completely separate.

The crash could happen for example, if an incoming TCP connection was
abruptly closed just after being established. As TCP uses the user data
to notify error condition to the upper layer, the user data pointer
could've been used while the newly allocated context could still be
waiting on the accept queue. This damaged the data area used by the FIFO
and eventually could lead to a crash.

Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
(cherry picked from commit 2ab11953e3)
2023-01-31 16:13:42 -05:00
Nicolas Pitre
175e76b302 z_thread_mark_switched_*: use z_current_get() instead of k_current_get()
k_current_get() may rely on TLS which might not yet be initialized
when those tracing functions are called, resulting in a crash.

This is different from the main branch as in that case the implementation
was completely revamped and neither k_current_get() nor z_current_get()
are used anymore. This is a much simpler fix than a backport of that
code, similar to the implication in commit commit f07df42d49 ("kernel:
make k_current_get() work without syscall").

Signed-off-by: Nicolas Pitre <npitre@baylibre.com>
2023-01-23 15:01:10 -05:00
Keith Packard
c520749a71 tests: Disable HW stack protection for some mpu tests
When active, z_libc_partition consumes an MPU region which leaves too
few for some MPU tests. Free up one by disabling HW stack protection.

Signed-off-by: Keith Packard <keithp@keithp.com>
(cherry picked from commit 19c8956946)
2023-01-11 11:02:47 -05:00
David Leach
584f52d5be tests: mem_protect: ensure allocated objects are initialized
K_OBJ_MSGQ, K_OBJ_PIPE, and K_OBJ_STACK objects have pointers
to additional memory that can be allocated. The k_obj_alloc()
returns these objects as uninitialized so when they are freed
there are random opportunities for freeing invalid memory
and causing random faults.

Signed-off-by: David Leach <david.leach@nxp.com>
(cherry picked from commit fdea2a628b)
2023-01-11 11:02:47 -05:00
David Leach
d05c3bdf36 tests: mem_protect: avoid allocating K_OBJ_MSGQ in userspace.
The K_OBJ_MSGQ object is unitialized so when the thread cleanup occurs
after an expected fault for invalid access the test case can randomly
fault again because the cleanup of the thread will sometimes attempt
to free invalid buffer_start pointer in the msgq object.

Fixes #42705

Signed-off-by: David Leach <david.leach@nxp.com>
(cherry picked from commit a0737e687c)
2023-01-11 11:02:47 -05:00
Jim Shu
3ab0c9516f tests: mem_protect: enlarge heap size of RISCV64
Because k_thread size in RISCV64 is near 512 bytes, (num_of_thread *
256) bytes heap size is not enough. Enlarge heap size in RISCV64
to the (num_of_thread * 1024) bytes like x86_64 and ARM64.

Signed-off-by: Jim Shu <cwshu09@gmail.com>
(cherry picked from commit e2d67d60ba)
2023-01-11 11:02:47 -05:00
Keith Packard
df6f0f477f tests/kernel/mem_protect: Check for thread_userspace_local_data
When using THREAD_LOCAL_STORAGE the thread_userspace_local_data stuff
isn't used, so these tests wouldn't build.

Signed-off-by: Keith Packard <keithp@keithp.com>
(cherry picked from commit b03b2e0403)
2023-01-11 11:02:47 -05:00
Nicolas Pitre
2dc30ca1fb tests: lifo_usage: make it less susceptible to SMP races
On SMP, and especially using qemu on a busy system, it is possible for
a thread with a later timeout to get ahead of another one with an
earlier timeout. The tight timeout value difference (10ms) makes it
possible albeit difficult to reproduce. The result is something like:

|START - test_timeout_threads_pend_on_lifo
| thread (q order: 2, t/o: 0, lifo 0x4001d350)
|
|    Assertion failed at main.c:140:
|test_multiple_threads_pending: (data->timeout_order not equal to ii)
| *** thread 2 woke up, expected 1

Let's make timeout values 10 times larger to make this unlikely race
even less likely.

While at it... The timeout field in struct timeout_order_data is some ms
value and not a number of ticks, so change the type accordingly.
And leverage k_cyc_to_ms_floor32() to simplify computation in
is_timeout_in_range().

Signed-off-by: Nicolas Pitre <npitre@baylibre.com>
(cherry picked from commit a1ce2fb990)
2023-01-11 11:02:47 -05:00
Daniel Leung
5cbda9f1c7 tests: kernel/smp: wait for threads to exits between tests
This adds a bunch of k_thread_join() to make sure threads spawned
for a test are no longer running between exiting that test. This
prevents interference between tests if some threads are still
running when assumed not.

Signed-off-by: Daniel Leung <daniel.leung@intel.com>
(cherry picked from commit dbe3874079)
2023-01-11 11:02:47 -05:00
Carlo Caione
711506349d tests/kernel/smp: Add SMP switch torture test
Formalize and rework the issue reproducer for #40795 and add it to the
SMP test suite.

Signed-off-by: Carlo Caione <ccaione@baylibre.com>
(cherry picked from commit 8edf9817c0)
2023-01-11 11:02:47 -05:00
Ederson de Souza
572921a44a tests/kernel/fpu_sharing: Run test with MP_NUM_CPUS=1
This test uses k_yield() to "sync" between threads, so it's implicitly
supposed to run on a single CPU. Make it explicit, to avoid issues on
platforms with more cores.

Signed-off-by: Ederson de Souza <ederson.desouza@intel.com>

FIXKFLOATDISABLE

(cherry picked from commit ab17f69a72)
2023-01-11 11:02:47 -05:00
Chris Friedt
7da64958f0 release: Zephyr 2.7.4
Set version to 2.7.4

Signed-off-by: Chris Friedt <cfriedt@meta.com>
2022-12-22 20:33:40 -05:00
Chris Friedt
49e965fd63 release: update v2.7.4 release notes
* add bugifixes to v2.7.4 release
* partial CVE notes from security

Signed-off-by: Chris Friedt <cfriedt@meta.com>
2022-12-22 19:17:19 -05:00
Flavio Ceolin
c09b95fafd net: tcp: Fix possible buffer underflow
Fix possible underflow in tcp flags parse.

Signed-off-by: Flavio Ceolin <flavio.ceolin@intel.com>
(cherry picked from commit ac2e13b9a1)
2022-12-22 12:17:46 -05:00
Andy Ross
88f09f2eac kernel/sched: Fix SMP race on pend
For historical reasons[1] suspending threads would release the
scheduler lock between pend() (which places the current thread onto a
wait queue) and z_swap() (which effects the context swtich).  This
process happens with the caller's lock held, so local interrupts are
masked.  But on SMP this opens a tiny race where another CPU could
grab the pended thread and switch to it while we were still executing
on its stack!

Fix this by elevating the "lock swap" code that already exists in the
(portable/switch-based) z_swap() code one level so that it happens in
z_pend_curr() also.  Now we hold the scheduler lock between pend and
the final context switch.

Note that this technique can't work for the older z_swap_irqlock()
implementation, which exists to vestigially support a few bits of arch
code (mostly direct interrupts) that don't work on SMP anyway.
Address with an assert to prevent future misuse.

[1] z_swap() is a historical API implemented in per-arch assembly for
    older architectures (like ARM32!).  It was designed to be called
    with what at the time was a global IRQ lock, so it doesn't
    understand the idea of a separate scheduler lock.  When we finally
    get all archictures on arch_switch() this design can be cleaned up
    quite a bit.

Signed-off-by: Andy Ross <andyross@google.com>
(cherry picked from commit c32f376e99)
2022-12-20 20:54:21 -05:00
Ian Oliver
568c09ce3a log_core: Add Kconfig symbol for init priority
Users may want to do some configuration after the kernel is up, but
before initializing the log_core. Making the log_core's init priority
configurable makes that possible.

Signed-off-by: Ian Oliver <io@amperecomputing.com>
(cherry picked from commit 1675d49b4c)
2022-12-20 15:23:12 -05:00
Chris Friedt
79f6c538c1 tests: posix: add tests for sleep() and usleep()
Previously, there was no test coverage for `sleep()` and
`usleep()`.

This change adds full test coverage.

Signed-off-by: Chris Friedt <cfriedt@meta.com>
(cherry picked from commit 027b79ecc4)
2022-12-06 12:47:16 -05:00
Chris Friedt
3400e6d9db lib: posix: update usleep() to follow the POSIX spec
The original implementation of `usleep()` was not compliant
to the POSIX spec in 3 ways.
- calling thread may not be suspended (because `k_busy_wait()`
  was previously used for short durations)
- if `usecs` > 1000000, previously we did not return -1 or set
  `errno` to `EINVAL`
- if interrupted, previously we did not return -1 or set
  `errno` to `EINTR`

This change addresses those issues to make `usleep()` more
POSIX-compliant.

Signed-off-by: Chris Friedt <cfriedt@meta.com>
(cherry picked from commit 7b95428fa0)
2022-12-06 12:47:16 -05:00
Chris Friedt
fbea9e74c2 lib: posix: sleep() should report unslept time in seconds
In the case that `sleep()` is interrupted, the POSIX spec requires
it to return the number of "unslept" seconds (i.e. the number of
seconds requested minus the number of seconds actually slept).

Since `k_sleep()` already returns the amount of "unslept" time
in ms, we can simply use that.

Signed-off-by: Chris Friedt <cfriedt@meta.com>
(cherry picked from commit dcfcc6454b)
2022-12-06 12:47:16 -05:00
Chris Friedt
4d929827ac tests: posix: clock: do not use usleep in a broken way
Using `usleep()` for >= 10000000 microseconds results
in an error, so this test was kind of defective, having
explicitly called `usleep()` for seconds.

Also, check the return values of `clock_gettime()`.

Signed-off-by: Chris Friedt <cfriedt@meta.com>
(cherry picked from commit 23a1f0a672)
2022-12-06 12:47:16 -05:00
Jamie McCrae
37b3641f00 manifest: Update mcumgr revision
Updates mcumgr to resolve an issue with the state of a firmware
update not being reset if an error occurs or if the underlying
area is erased.

Fixes #52247
Backporting commit 4c48b4f21a

Signed-off-by: Jamie McCrae <jamie.mccrae@nordicsemi.no>
2022-11-28 16:02:09 -05:00
Jamie McCrae
3d940f1d1b net: Synchronise user data size with mcumgr
Fixes an issue with 2 user data sizes being out of sync causing
CI failures.

Fixes #52591

Signed-off-by: Jamie McCrae <jamie.mccrae@nordicsemi.no>
2022-11-28 15:26:32 -05:00
Martí Bolívar
f0d2a3e2fe python-devicetree: CI hotfix
Pin the types-PyYAML version to 6.0.7. Version 6.0.8 is causing CI
errors for other pull requests, so we need this in to get other PRs
moving.

Fixes: #46286

Signed-off-by: Martí Bolívar <marti.bolivar@nordicsemi.no>
2022-11-27 16:18:59 +09:00
Stephanos Ioannidis
7d405a43b1 ci: Clone cached Zephyr repository with shared objects
In the new ephemeral Zephyr runners, the cached repository files are
located in a foreign file system and Git clone operation cannot create
hard-links to the cached repository objects, which forces the Git clone
operation to copy the objects from the cache file system to the runner
container file system.

This commit updates the CI workflows to instead perform a "shared
clone" of the cached repository, which allows the cloned repository to
utilise the object database of the cached repository.

While "shared clone" can be often dangerous because the source
repository objects can be deleted, in this case, the source repository
(i.e. cached repository) is mounted as read-only and immutable.

Signed-off-by: Stephanos Ioannidis <root@stephanos.io>
2022-11-27 16:18:59 +09:00
Stephanos Ioannidis
2dbe845f21 ci: codecov: Clone cached Zephyr repository
This commit updates the codecov workflow to pre-clone the Zephyr
repository from the runner repository cache.

Note that the `origin` remote URL is reconfigured to that of the GitHub
Zephyr repository because the checkout action attempts to delete
everything and re-clone otherwise.

Signed-off-by: Stephanos Ioannidis <root@stephanos.io>
2022-11-27 16:18:59 +09:00
Stephanos Ioannidis
4efa225daa ci: codecov: Use zephyr-runner
This commit updates the codecov workflow to use the new Kubernetes-
based zephyr-runner.

Signed-off-by: Stephanos Ioannidis <root@stephanos.io>
2022-11-27 16:18:59 +09:00
Stephanos Ioannidis
0ee1955d5b ci: clang: Remove obsolete clean-up steps
The repository clean-up steps are no longer necessary because the new
zephyr-runner is ephemeral and does not contain any files from the
previous runs.

Signed-off-by: Stephanos Ioannidis <root@stephanos.io>
2022-11-27 16:18:59 +09:00
Stephanos Ioannidis
a0eb50be3e ci: clang: Clone cached Zephyr repository
This commit updates the clang workflow to pre-clone the Zephyr
repository from the runner repository cache.

Note that the `origin` remote URL is reconfigured to that of the GitHub
Zephyr repository because the checkout action attempts to delete
everything and re-clone otherwise.

Signed-off-by: Stephanos Ioannidis <root@stephanos.io>
2022-11-27 16:18:59 +09:00
Stephanos Ioannidis
2da9d7577f ci: clang: Use zephyr-runner
This commit updates the clang workflow to use the new Kubernetes-based
zephyr-runner.

Note that the repository cache directory path has been changed for the
new runner.

Signed-off-by: Stephanos Ioannidis <root@stephanos.io>
2022-11-27 16:18:59 +09:00
Stephanos Ioannidis
d5e2a071c1 ci: twister: Remove obsolete clean-up steps
The repository clean-up steps are no longer necessary because the new
zephyr-runner is ephemeral and does not contain any files from the
previous runs.

Signed-off-by: Stephanos Ioannidis <root@stephanos.io>
2022-11-27 16:18:59 +09:00
Stephanos Ioannidis
633dd420d9 ci: twister: Clone cached Zephyr repository
This commit updates the twister workflow to pre-clone the Zephyr
repository from the runner repository cache.

Note that the `origin` remote URL is reconfigured to that of the GitHub
Zephyr repository because the checkout action attempts to delete
everything and re-clone otherwise.

Signed-off-by: Stephanos Ioannidis <root@stephanos.io>
2022-11-27 16:18:59 +09:00
Stephanos Ioannidis
780b4e08cb ci: twister: Use zephyr-runner
This commit updates the twister workflow to use the new Kubernetes-
based zephyr-runner.

Note that the repository cache directory path has been changed for the
new runner.

Signed-off-by: Stephanos Ioannidis <root@stephanos.io>
2022-11-27 16:18:59 +09:00
Stephanos Ioannidis
281185e49d ci: Use actions/cache@v3
This commit updates the CI workflows to use the latest "cache" action
v3, which is based on Node.js 16.

Note that Node.js 12-based actions are now deprecated by GitHub and may
stop working in the near future.

Signed-off-by: Stephanos Ioannidis <root@stephanos.io>
2022-11-27 16:18:59 +09:00
Stephanos Ioannidis
cb240b4f4c ci: Use actions/setup-python@v4
This commit updates the CI workflows to use the latest "setup-python"
action v4, which is based on Node.js 16.

Note that Node.js 12-based actions are now deprecated by GitHub and may
stop working in the near future.

Signed-off-by: Stephanos Ioannidis <root@stephanos.io>
2022-11-27 16:18:59 +09:00
Stephanos Ioannidis
ff5ee88ac0 ci: Use actions/upload-artifact@v3
This commit updates the CI workflows to use the latest
"upload-artifact" action v3, which is based on Node.js 16.

Note that Node.js 12-based actions are now deprecated by GitHub and may
stop working in the near future.

Signed-off-by: Stephanos Ioannidis <root@stephanos.io>
2022-11-27 16:18:59 +09:00
Stephanos Ioannidis
c3ef958116 ci: Use actions/checkout@v3
This commit updates the CI workflows to use the latest "checkout"
action v3, which is based on Node.js 16.

Note that Node.js 12-based actions are now deprecated by GitHub and may
stop working in the near future.

Signed-off-by: Stephanos Ioannidis <root@stephanos.io>
2022-11-27 16:18:59 +09:00
Stephanos Ioannidis
727806f483 ci: twister: Use output parameter file
This commit updates the workflow to use the output parameter file
(`GITHUB_OUTPUT`) instead of the stdout-based output parameter setting,
which is now deprecated by GitHub and will be removed in the near
future.

Signed-off-by: Stephanos Ioannidis <root@stephanos.io>
2022-11-27 16:18:59 +09:00
Stephanos Ioannidis
ec6c9d3637 ci: release: Use output parameter file
This commit updates the workflow to use the output parameter file
(`GITHUB_OUTPUT`) instead of the stdout-based output parameter setting,
which is now deprecated by GitHub and will be removed in the near
future.

Signed-off-by: Stephanos Ioannidis <root@stephanos.io>
2022-11-27 16:18:59 +09:00
Stephanos Ioannidis
c5e88dbbda ci: codecov: Use output parameter file
This commit updates the workflow to use the output parameter file
(`GITHUB_OUTPUT`) instead of the stdout-based output parameter setting,
which is now deprecated by GitHub and will be removed in the near
future.

Signed-off-by: Stephanos Ioannidis <root@stephanos.io>
2022-11-27 16:18:59 +09:00
Stephanos Ioannidis
c3e4d65dd1 ci: clang: Use output parameter file
This commit updates the workflow to use the output parameter file
(`GITHUB_OUTPUT`) instead of the stdout-based output parameter setting,
which is now deprecated by GitHub and will be removed in the near
future.

Signed-off-by: Stephanos Ioannidis <root@stephanos.io>
2022-11-27 16:18:59 +09:00
Stephanos Ioannidis
16207ae32f ci: footprint-tracking: Use "concurrency" to cancel previous runs
This commit adds a concurrency group to the workflow in order to ensure
that only one instance of the workflow runs for an event-ref
combination.

Signed-off-by: Stephanos Ioannidis <root@stephanos.io>
2022-11-27 16:18:59 +09:00
Stephanos Ioannidis
dbf2ca1b0a ci: footprint: Use "concurrency" to cancel previous runs
This commit adds a concurrency group to the workflow in order to ensure
that only one instance of the workflow runs for an event-ref
combination.

Signed-off-by: Stephanos Ioannidis <root@stephanos.io>
2022-11-27 16:18:59 +09:00
Stephanos Ioannidis
0e204784ee ci: codecov: Use "concurrency" to cancel previous runs
This commit adds a concurrency group to the workflow in order to ensure
that only one instance of the workflow runs for an event-ref
combination.

Signed-off-by: Stephanos Ioannidis <root@stephanos.io>
2022-11-27 16:18:59 +09:00
Stephanos Ioannidis
c44406e091 ci: clang: Use "concurrency" to cancel previous runs
This commit adds a concurrency group to the workflow in order to ensure
that only one instance of the workflow runs for an event-ref
combination.

Signed-off-by: Stephanos Ioannidis <root@stephanos.io>
2022-11-27 16:18:59 +09:00
Stephanos Ioannidis
1da82633b2 ci: twister: Use "concurrency" to cancel previous runs
This commit adds a concurrency group to the workflow in order to ensure
that only one instance of the workflow runs for an event-ref
combination.

Signed-off-by: Stephanos Ioannidis <root@stephanos.io>
2022-11-27 16:18:59 +09:00
Stephanos Ioannidis
ad6636f09c ci: bluetooth-tests: Use "concurrency" to cancel previous runs
This commit adds a concurrency group to the workflow in order to ensure
that only one instance of the workflow runs for an event-ref
combination.

Signed-off-by: Stephanos Ioannidis <root@stephanos.io>
2022-11-27 16:18:59 +09:00
Anas Nashif
8f4b366c0f ci: update cancel-workflow-action action to 0.11.0
Update action to use latest release which resolves a warning Node 12
being deprecated.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2022-11-27 16:18:59 +09:00
Stephanos Ioannidis
5f8960f5ef ci: compliance: Use upload-artifact action v3
This commit updates the "Create a release" workflow to use a specific
upload-artifact action version, v3, instead of the latest master branch
in order to prevent any potential breakages due to the newer commits.

Signed-off-by: Stephanos Ioannidis <root@stephanos.io>
2022-11-27 16:18:59 +09:00
Stephanos Ioannidis
d9200eb55d ci: issue_count: Use upload-artifact action v3
This commit updates the issue count tracker workflow to use a specific
upload-artifact action version, v3, instead of the latest master branch
in order to prevent any potential breakages due to the newer commits.

Signed-off-by: Stephanos Ioannidis <root@stephanos.io>
2022-11-27 16:18:59 +09:00
Stephanos Ioannidis
ccdc1d3777 ci: doc-build: Use upload-artifact action v3
This commit updates the documentation build workflow to use a specific
upload-artifact action version, v3, instead of the latest master branch
in order to prevent any potential breakages due to the newer commits.

Signed-off-by: Stephanos Ioannidis <root@stephanos.io>
2022-11-27 16:18:59 +09:00
Stephanos Ioannidis
197c4ddcbd ci: compliance: Use upload-artifact action v3
This commit updates the compliance check workflow to use a specific
upload-artifact action version, v3, instead of the latest master branch
in order to prevent any potential breakages due to the newer commits.

Signed-off-by: Stephanos Ioannidis <root@stephanos.io>
2022-11-27 16:18:59 +09:00
Stephanos Ioannidis
7287947535 ci: backport: Use Ubuntu 20.04 runner image
This commit updates the backport workflow to use the ubuntu-20.04
runner image because the ubuntu-18.04 image is deprecated and will
become unsupported by December 1, 2022.

Signed-off-by: Stephanos Ioannidis <root@stephanos.io>
2022-11-27 16:18:59 +09:00
Stephanos Ioannidis
b0be164419 ci: west_cmds: Use specific version of runner image
This commit updates the "West Command Tests" workflow to use a specific
runner image version (ubuntu-20.04, macos-11, windows-2022) instead of
the latest version in order to prevent any potential breakages due to
the 'latest' version change by GitHub.

Signed-off-by: Stephanos Ioannidis <root@stephanos.io>
2022-11-27 16:18:59 +09:00
Stephanos Ioannidis
fab06842d5 ci: devicetree_checks: Use specific version of runner image
This commit updates the "Devicetree script tests" workflow to use a
specific runner image version (ubuntu-20.04, macos-11, windows-2022)
instead of the latest version in order to prevent any potential
breakages due to the 'latest' version change by GitHub.

Signed-off-by: Stephanos Ioannidis <root@stephanos.io>
2022-11-27 16:18:59 +09:00
Stephanos Ioannidis
9b4eafc54a ci: twister: Use Ubuntu 20.04 runner image
This commit updates the "Run tests with twister" workflow to use a
specific runner image version, ubuntu-20.04, instead of the latest
version in order to prevent any potential breakages due to the 'latest'
version change by GitHub.

Signed-off-by: Stephanos Ioannidis <root@stephanos.io>
2022-11-27 16:18:59 +09:00
Stephanos Ioannidis
9becb117b2 ci: twister_tests: Use Ubuntu 20.04 runner image
This commit updates the Twister Testsuite workflow to use a specific
runner image version, ubuntu-20.04, instead of the latest version in
order to prevent any potential breakages due to the 'latest' version
change by GitHub.

Signed-off-by: Stephanos Ioannidis <root@stephanos.io>
2022-11-27 16:18:59 +09:00
Stephanos Ioannidis
87ab3e4d16 ci: stale_issue: Use Ubuntu 20.04 runner image
This commit updates the stale issue workflow to use a specific runner
image version, ubuntu-20.04, instead of the latest version in order to
prevent any potential breakages due to the 'latest' version change by
GitHub.

Signed-off-by: Stephanos Ioannidis <root@stephanos.io>
2022-11-27 16:18:59 +09:00
Stephanos Ioannidis
9b8305cc11 ci: release: Use Ubuntu 20.04 runner image
This commit updates the "Create a Release" workflow to use a specific
runner image version, ubuntu-20.04, instead of the latest version in
order to prevent any potential breakages due to the 'latest' version
change by GitHub.

Signed-off-by: Stephanos Ioannidis <root@stephanos.io>
2022-11-27 16:18:59 +09:00
Stephanos Ioannidis
728e5720cc ci: manifest: Use Ubuntu 20.04 runner image
This commit updates the manifest check workflow to use a specific
runner image version, ubuntu-20.04, instead of the latest version in
order to prevent any potential breakages due to the 'latest' version
change by GitHub.

Signed-off-by: Stephanos Ioannidis <root@stephanos.io>
2022-11-27 16:18:59 +09:00
Stephanos Ioannidis
6c11685863 ci: license_check: Use Ubuntu 20.04 runner image
This commit updates the license check workflow to use a specific runner
image version, ubuntu-20.04, instead of the latest version in order to
prevent any potential breakages due to the 'latest' version change by
GitHub.

Signed-off-by: Stephanos Ioannidis <root@stephanos.io>
2022-11-27 16:18:59 +09:00
Stephanos Ioannidis
0f783a4ce0 ci: issue_count: Use Ubuntu 20.04 runner image
This commit updates the issue count tracker workflow to use a specific
runner image version, ubuntu-20.04, instead of the latest version in
order to prevent any potential breakages due to the 'latest' version
change by GitHub.

Signed-off-by: Stephanos Ioannidis <root@stephanos.io>
2022-11-27 16:18:59 +09:00
Stephanos Ioannidis
02dba17a59 ci: footprint: Use Ubuntu 20.04 runner image
This commit updates the footprint delta workflow to use a specific
runner image version, ubuntu-20.04, instead of the latest version in
order to prevent any potential breakages due to the 'latest' version
change by GitHub.

Signed-off-by: Stephanos Ioannidis <root@stephanos.io>
2022-11-27 16:18:59 +09:00
Stephanos Ioannidis
860e7307bc ci: footprint-tracking: Use Ubuntu 20.04 runner image
This commit updates the footprint tracking workflow to use a specific
runner image version, ubuntu-20.04, instead of the latest version in
order to prevent any potential breakages due to the 'latest' version
change by GitHub.

Signed-off-by: Stephanos Ioannidis <root@stephanos.io>
2022-11-27 16:18:59 +09:00
Stephanos Ioannidis
7b087b8ac5 ci: errno: Use Ubuntu 20.04 runner image
This commit updates the error number check workflow to use a specific
runner image version, ubuntu-20.04, instead of the latest version in
order to prevent any potential breakages due to the 'latest' version
change by GitHub.

Signed-off-by: Stephanos Ioannidis <root@stephanos.io>
2022-11-27 16:18:59 +09:00
Stephanos Ioannidis
15f39300c0 ci: doc: Use Ubuntu 20.04 runner image
This commit updates the documentation build and publish workflows to
use a specific runner image version, ubuntu-20.04, instead of the
latest version in order to prevent any potential breakages due to the
'latest' version change by GitHub.

Signed-off-by: Stephanos Ioannidis <root@stephanos.io>
2022-11-27 16:18:59 +09:00
Stephanos Ioannidis
f6f69516ac ci: daily_test_version: Use Ubuntu 20.04 runner image
This commit updates the daily test version workflow to use a specific
runner image version, ubuntu-20.04, instead of the latest version in
order to prevent any potential breakages due to the 'latest' version
change by GitHub.

Signed-off-by: Stephanos Ioannidis <root@stephanos.io>
2022-11-27 16:18:59 +09:00
Stephanos Ioannidis
5f9dd18a87 ci: compliance: Use Ubuntu 20.04 runner image
This commit updates the compliance check workflow to use a specific
runner image version, ubuntu-20.04, instead of the latest version in
order to prevent any potential breakages due to the 'latest' version
change by GitHub.

Signed-off-by: Stephanos Ioannidis <root@stephanos.io>
2022-11-27 16:18:59 +09:00
Stephanos Ioannidis
7d8639b4a8 ci: coding_guidelines: Use Ubuntu 20.04 runner image
This commit updates the coding guidelines workflow to use a specific
runner image version, ubuntu-20.04, instead of the latest version in
order to prevent any potential breakages due to the 'latest' version
change by GitHub.

Signed-off-by: Stephanos Ioannidis <root@stephanos.io>
2022-11-27 16:18:59 +09:00
Stephanos Ioannidis
6e723ff755 ci: clang: Use Ubuntu 20.04 runner image
This commit updates the Clang workflow to use a specific runner image
version, ubuntu-20.04, instead of the latest version in order to
prevent any potential breakages due to the 'latest' version change by
GitHub.

Signed-off-by: Stephanos Ioannidis <root@stephanos.io>
2022-11-27 16:18:59 +09:00
Stephanos Ioannidis
bff97ed4cc ci: backport_issue_check: Use Ubuntu 20.04 runner image
This commit updates the backport issue check workflow to use a specific
runner image version, ubuntu-20.04, instead of the latest version in
order to prevent any potential breakages due to the 'latest' version
change by GitHub.

Signed-off-by: Stephanos Ioannidis <root@stephanos.io>
2022-11-27 16:18:59 +09:00
Stephanos Ioannidis
97e2959452 ci: bluetooth-tests: Use Ubuntu 20.04 runner image
This commit updates the Bluetooth tests workflow to use a specific
runner image version, ubuntu-20.04, instead of the latest version in
order to prevent any potential breakages due to the 'latest' version
change by GitHub.

Signed-off-by: Stephanos Ioannidis <root@stephanos.io>
2022-11-27 16:18:59 +09:00
Stephanos Ioannidis
91970658ec ci: issue_count: Fix stale reference to master branch
This commit fixes a stale reference to the 'master' branch when
downloading the issue report configuration file.

Note that the 'master' branch is no longer the default
branch -- 'main' is.

Signed-off-by: Stephanos Ioannidis <root@stephanos.io>
2022-11-27 16:18:59 +09:00
Gerard Marull-Paretas
fc2585af00 ci: doc-build: skip Kconfig docs build on pull requests
The documentation supports a special target named "html-fast" that skips
generation of all Kconfig pages. Instead, it creates a single dummy page
where a reference to all existing Kconfig options is placed. This means
that references are resolved, but content is not rendered. Since Kconfig
help is rendered as a literal, chances of breaking documentation
build due to Kconfig changes should be low. The change proposed in this
patch should speed up documentation build on pull requests while a
proper solution is found for the Kconfig docs.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2022-11-27 16:18:59 +09:00
Gerard Marull-Paretas
f95edd3a85 ci: doc-build: use concurrency group to cancel in progress builds
Add the documentation build jobs to a concurrency group so that branch
force pushes will automatically cancel in progress jobs.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2022-11-27 16:18:59 +09:00
Gerard Marull-Paretas
2b9ed76734 ci: doc-build: disable parallel build
When an error happens during the Sphinx build (e.g. due to a broken
reference), the process hangs on CI when run with both `-j auto`
(parallel build) and `-W` (warnings as errors) options. The root cause
of the issue is unknown, and does not seem to happen locally. Parallel
builds are experimental on Sphinx, so they have been disabled on CI for
now.  Because CI runner is a single core machine, the build time should
remain equal or similar. The option is still left as default, so local
builds will continue to benefit from parallelization.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2022-11-27 16:18:59 +09:00
Gerard Marull-Paretas
5a041bff3d ci: doc-build: set timeout to 30 minutes
Give documentation build up to 30 minutes to finish. This should improve
the user experience when Sphinx hangs due to broken references, a
problem that needs some investigation.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2022-11-27 16:18:59 +09:00
Chris Friedt
f61664c6f8 tests: kernel: mutex: move race timeout test to mutex_api
Previously, this change was added to `mutex_error_case`.

That worked fine in `main`, but once the change was backported to
`v2.7-branch`, the test would fail because it *did not* cause a
failure. The reason for that, was that the `mutex_error_case`
suite has `CONFIG_ZTEST_FATAL_HOOK=y`.

With the newer ztest API, it allowed a separate suite to be used,
allowing the test to pass (although it did not really fit in with
the rest of the testsuite).

The solution is to simply merge it with the `mutex_api` suite
which uses non-inverted success logic.

This change will also have to be cherry-picked for the backport
in #49031.

Fixes #48056.

Signed-off-by: Chris Friedt <cfriedt@meta.com>
2022-11-18 17:33:10 -05:00
Qi Yang
e2f05e9328 kernel: mutex: fix races when lock timeout
Say threadA holds a mutex and threadB tries
to lock it with a timeout, a race would occur
if threadA unlock that mutex after threadB
got unpended by sys_clock and before it gets
scheduled and calls k_spin_lock.

This patch fixes this issue by checking the
mutex's status again after k_spin_lock calls.

Fixes #48056

Signed-off-by: Qi Yang <qi.yang@cmind-semi.com>
(cherry picked from commit 89c4a074dc)
2022-11-18 17:33:10 -05:00
Jamie McCrae
ea0b53b150 mgmt: mcumgr: Fix Bluetooth transport issues
This fixes issues with the Bluetooth SMP transport whereby deadlocks
could arise from connection references being held in long-lasting
mcumgr command processing functions.

Note: Heavily modified from original PR due to differences in MCUmgr
operation since the Zephyr 2.7 release.

Fixes #51846

Signed-off-by: Jamie McCrae <jamie.mccrae@nordicsemi.no>
(cherry picked from commit 2aca1242f7)
2022-11-17 18:41:57 -05:00
Stephanos Ioannidis
56664826b2 ci: doc: Publish pull request docs to builds.zephyrproject.io
This commit updates the CI documentation build workflow to upload the
HTML pull request documentation builds to the S3 builds.zephyrproject.io
bucket so that they are directly accessible from the web.

Signed-off-by: Stephanos Ioannidis <root@stephanos.io>
(cherry picked from commit 1dd92ec865)
2022-11-16 04:23:46 +09:00
Chris Friedt
bbb49dec38 net: sockets: socketpair: do not allow blocking IO in ISR context
Using a socketpair for communication in an ISR is not a great
solution, but the implementation should be robust in that case
as well.

It is not acceptible to block in ISR context, so robustness here
means to return -1 to indicate an error, setting errno to `EAGAIN`
(which is synonymous with `EWOULDBLOCK`).

Fixes #25417

Signed-off-by: Chris Friedt <cfriedt@meta.com>
(cherry picked from commit d832b04e96)
2022-11-15 12:12:40 -05:00
Stephanos Ioannidis
8211ebf759 ci: Limit workflow scope to v2.7-branch
This commit updates the CI workflows to limit their event trigger scope
to the v2.7-branch in order to prevent the workflows from running when
the backport branches are pushed.

Signed-off-by: Stephanos Ioannidis <root@stephanos.io>
2022-11-02 03:12:21 +09:00
Jay Vasanth
1f3121b6b2 soc arm: MEC172x soc.h - Include custom IRQn_Type
Fix for issue #41012 to allow compiler to treat
IRQn_Type to be more than 8-bit. This will ensure NVIC numbers
more than 127 (required for MEC172x device) will work
correctly with irq_enable() API

Signed-off-by: Jay Vasanth <jay.vasanth@microchip.com>
(cherry picked from commit 4495f43dca)
2022-10-11 20:17:47 -04:00
Jamie McCrae
d7820faf7c drivers: counter: Update counter_set_channel_alarm documentation
Adds the -EBUSY return code to the documentation of the
counter_set_channel_alarm function which is returned when an alarm
is already active.

Signed-off-by: Jamie McCrae <jamie.mccrae@nordicsemi.no>
(cherry picked from commit c607599068)
2022-10-07 18:23:58 -04:00
Jordan Yates
5d29d52445 scripts: zspdx: fix writing custom license IDs
The builtin list function `.sort()` sorts the list in-place and returns
None. As this is an invalid type for iteration, use the builtin `sorted`
function, which returns a sorted copy of the list, which we can iterate
over.

Signed-off-by: Jordan Yates <jordan.yates@data61.csiro.au>
(cherry picked from commit 06aae61019)
2022-10-04 09:09:14 -07:00
Yong Cong Sin
be11187e09 mgmt/hawkbit: Print hrefs only if there's an update
If the is no update from the server, the _links will be NULL.
Check if it is NULL before trying to LOG these strings.

Signed-off-by: Yong Cong Sin <yongcong.sin@gmail.com>
2022-10-04 07:43:25 -07:00
Ruud Derwig
9044091e21 ARC: fx possible memory corruption with userspace
Use  Z_KERNEL_STACK_BUFFER instead of
Z_THREAD_STACK_BUFFER for initial stack.

Fixes #50467

Signed-off-by: Ruud Derwig <Ruud.Derwig@synopsys.com>
(cherry picked from commit 9bccb5cc4b)
2022-09-23 13:57:53 -04:00
Daniel Leung
170ba8dfcb soc: esp32: use Z_KERNEL_STACK_BUFFER instead of...
...Z_THREAD_STACK_BUFFER.

This is currently a symbolic change as Z_THREAD_STACK_BUFFER
is simply an alias to Z_KERNEL_STACK_BUFFER without userspace,
and Xtensa does not support userspace at the moment.

Signed-off-by: Daniel Leung <daniel.leung@intel.com>
(cherry picked from commit b820cde7a9)
2022-09-23 13:57:40 -04:00
Daniel Leung
e3f1b6fc54 soc: intel_adsp: use Z_KERNEL_STACK_BUFFER instead of...
...Z_THREAD_STACK_BUFFER.

This is currently a symbolic change as Z_THREAD_STACK_BUFFER
is simply an alias to Z_KERNEL_STACK_BUFFER without userspace,
and Xtensa does not support userspace at the moment.

Signed-off-by: Daniel Leung <daniel.leung@intel.com>
(cherry picked from commit 74df88d8f5)
2022-09-23 13:57:40 -04:00
Daniel Leung
7ac05528ca tests: coredump: skip acrn_ehl_crb
The coredump tests output quite a large amount of data into
the console. However, the ACRN console only has very limited
history (comparatively), such that twister is unable to
match the necessary strings to consider the tests passed.
So skip those tests on acrn_ehl_crb.

Fixes #40887

Signed-off-by: Daniel Leung <daniel.leung@intel.com>
(cherry picked from commit c1ac125068)
2022-09-20 17:06:00 +01:00
Martí Bolívar
64f411f0fb edtlib: remove python 3.5 workaround
Remove a yaml monkeypatch. It is no longer needed since we support 3.6
or later on Zephyr v2.7 LTS and 3.8 or later on what will become v3.2.

Signed-off-by: Martí Bolívar <marti.bolivar@nordicsemi.no>
(cherry picked from commit 7ef9c4b20e)
2022-09-18 08:32:31 -04:00
Anas Nashif
2e2dd96ae4 actions: west/devicetree: exclude python 3.6 on windows
This version of python is not available anymore. Excluding for now to
unblock CI.

Fixes: #49139

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
Signed-off-by: Martí Bolívar <marti.bolivar@nordicsemi.no>
(cherry picked from commit 773242cbb7)
2022-09-18 08:32:31 -04:00
Torsten Rasmussen
a311291294 cmake: kconfig: preserved quotes for Kconfig string values
Fixes: #49569

Kconfig requires quoted strings in its configuration files, like this:
> CONFIG_A_STRING="foo bar"

But CMake requires expects that strings are without additional qoutes,
and therefore qoutes are stripped when loading Kconfig config filers
into CMake.

This is particular important when the string in Kconfig is a path to a
file. In this case, not stripping the quotes leads to an error as the
file cannot be found.

When users pass a string to Kconfig through CMake, they are expected to
pass it so that qoutes are correct seen from Kconfig, that is:
> cmake -DCONFIG_A_STRING=\"foo bar\"

In CMake, those qoutes are written as-is to Kconfig extra config file,
and then removed in the CMake cache.
After Kconfig processing, the Kconfig settings are read back to CMake
but without quotes. Settings that was passed through the CMake cache,
for example using `-D` are written back to the cache, but this time
without the qoutes. This results in Kconfig errors on sub-sequent CMake
runs.

Instead of writing the Kconfig value setting back to the CMake cache,
introduce an internal shadow symbol in the cache prefixed with `CLI_`.
This allows the CMake cache to keep the value correctly formatted for
Kconfig extra config creation, while at the same time keep existing
behavior for CONFIG_ symbols read from Kconfig.

Signed-off-by: Torsten Rasmussen <Torsten.Rasmussen@nordicsemi.no>
2022-08-31 06:26:03 -04:00
Gerard Marull-Paretas
5221787303 scripts: west_commands: runners: jlink: support pylink >= 0.14.2
It looks like the latest release, 0.14.2, changed the contents of
JLINK_SDK_NAME as it was before 0.14.0 release. That means that the
previous fix is only applicable to a couple of releases: 0.14.0/0.14.1.

Fixes #49564

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
(cherry picked from commit 2d712c6c55)
2022-08-31 06:24:41 -04:00
Gerard Marull-Paretas
63d0c7fcae scripts: west_commands: runners: jlink: support pylink >= 0.14
pylink 0.14.0 changed the class variable where JLink DLL library name
(libjlinkarm) is stored. This patch adds support for new pylink
libraries while keeping backwards compatibility.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
(cherry picked from commit a57001347f)
2022-08-31 06:24:41 -04:00
Yong Cong Sin
8abef50e97 subsys/mgmt/hawkbit: Set ai_socktype if IPV4/IPV6
Follows the implementation of updatehub and set the
`ai_socktype` only if IPV4/IPV6

Signed-off-by: Yong Cong Sin <yongcong.sin@gmail.com>
(cherry picked from commit dd9d6bbb44)
2022-08-30 13:01:23 -04:00
Yong Cong Sin
0306e75a5f subsys/mgmt/hawkbit: Init the hints struct to a known value
Initialize the `hints` struct to a known value so that it won't
cause undetermined behavior when used in `getaddrinfo()`.

Signed-off-by: Yong Cong Sin <yongcong.sin@gmail.com>
(cherry picked from commit 2ed88e998a)
2022-08-30 13:01:23 -04:00
Christopher Friedt
003de78ce0 release: Zephyr 2.7.3
Set version to 2.7.3

Fixes #49354

Signed-off-by: Christopher Friedt <cfriedt@fb.com>
2022-08-22 12:12:49 -04:00
Flavio Ceolin
9502d500b6 release: security: Notes for 2.7.3
Add security release notes for 2.7.3

Signed-off-by: Flavio Ceolin <flavio.ceolin@intel.com>
2022-08-22 10:54:58 -04:00
Christopher Friedt
2a88e08296 release: update v2.7.3 release notes
* add bugifixes to v2.7.3 release
* awating CVE notes from security

Fixes #49310

Signed-off-by: Christopher Friedt <cfriedt@fb.com>
2022-08-22 10:54:58 -04:00
Jamie McCrae
e1ee34e55c drivers: sensor: sm351lt: Fix global thread triggering bug
This fixes a bug in the sm351lt driver whereby global triggering will
cause an MPU fault due to an unset pointer.

Signed-off-by: Jamie McCrae <jamie.mccrae@nordicsemi.no>
2022-08-03 19:05:58 -04:00
Szymon Janc
2ad1ef651b Bluetooth: host: Fix L2CAP reconfigure response with invalid CID
When an L2CAP_CREDIT_BASED_RECONFIGURE_REQ packet is received with
invalid parameters, the recipient shall send an
L2CAP_CREDIT_BASED_RECONFIGURE_RSP PDU with a non-zero Result field
and not change any MTU and MPS values.

This fix incorrectly reconfiguring valid channels while responding with
0x003 (Reconfiguration failed - one or more Destination CIDs invalid)
result code.

Signed-off-by: Szymon Janc <szymon.janc@codecoup.pl>
(cherry picked from commit 253070b76b)
2022-08-02 12:36:44 -04:00
Szymon Janc
089675af45 Bluetooth: host: Fix L2CAP reconfigure response with invalid MTU
TSE18813 clarified IUT behavior and rejecting reconfiguration which
would result in MTU decrease is enough. There is no need to disconnect
L2CAP channel(s).

This was affecting L2CAP/ECFC/BI-03-C qualification test case
(TCRL 2022-2).

Signed-off-by: Szymon Janc <szymon.janc@codecoup.pl>
(cherry picked from commit 266394dea4)
2022-08-02 12:36:44 -04:00
Andriy Gelman
03ff0d471e net: route: Fix pkt leak if net_send_data() fails
If the call to net_send_data() fails, for example if the forwading
interface is down, then the pkt will leak. The reference taken by
net_pkt_shallow_clone() will never be released. Fix the problem
by dropping the rerefence count in the error path.

Signed-off-by: Andriy Gelman <andriy.gelman@gmail.com>
(cherry picked from commit a3cdb2102c)
2022-08-02 10:41:52 -04:00
Erwan Gouriou
cd96136bcb boards: nucleo_wb55rg: Fix documentation about BLE binary compatibility
Rather than stating a version information that will get out of date
at each release, refer to the source of information located in hal_stm32
module.

Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
(cherry picked from commit 6656607d02)
2022-07-25 05:54:23 -04:00
Henrik Brix Andersen
567fda57df tests: drivers: can: api: add test for RTR filter matching
Add test for CAN RX filtering of RTR frames.

Signed-off-by: Henrik Brix Andersen <hebad@vestas.com>
2022-07-19 12:07:14 -04:00
Henrik Brix Andersen
b14f356c96 drivers: can: loopback: check frame ID type and RTR bit in filters
Check the frame ID type and RTR bit when comparing loopback CAN frames
against installed RX filters.

Fixes: #47904

Signed-off-by: Henrik Brix Andersen <hebad@vestas.com>
2022-07-19 12:07:14 -04:00
Henrik Brix Andersen
874d77bc75 drivers: can: mcux: flexcan: fix handling of RTR frames
When installing a RX filter, the driver uses "filter->rtr &
filter->rtr_mask" for setting the filter mask. It should just be using
filter->rtr_mask, otherwise filters for non-RTR frames will match RTR
frames as well.

When transmitting a RTR frame, the hardware automatically switches the
mailbox used for TX to RX in order to receive the reply. This, however,
does not match the Zephyr CAN driver model, where mailboxes are
dedicated to either RX or TX. Attempting to reuse the TX mailbox (which
was automatically switched to an RX mailbox by the hardware) fails on
the first call, after which the mailbox is reset and can be reused for
TX. To overcome this, the driver must abort the RX mailbox operation
when the hardware performs the TX to RX switch.

Fixes: #47902

Signed-off-by: Henrik Brix Andersen <hebad@vestas.com>
2022-07-19 12:07:14 -04:00
Henrik Brix Andersen
ec0befb938 drivers: can: mcan: acknowledge all received frames
The Bosch M_CAN IP does not support RX filtering of the RTR bit, so the
driver handles this bit in software.

If a recevied frame matches a filter with RTR enabled, the RTR bit of
the frame must match that of the filter in order to be passed to the RX
callback function. If the RTR bits do not match the frame must be
dropped.

Improve the readability of the the logic for determining if a frame
should be dropped and add a missing FIFO acknowledge write for dropped
frames.

Fixes: #47204

Signed-off-by: Henrik Brix Andersen <hebad@vestas.com>
2022-07-19 12:07:14 -04:00
Christopher Friedt
273e90a86f scripts: release: list_backports: use older python dict merge method
In Python versions >= 3.9, dicts can be merged with the `|` operator.

This is not the case for python versions < 3.9, and the simplest way
is to use `dict_c = {**dict_a, **dict_b}`.

Signed-off-by: Christopher Friedt <cfriedt@fb.com>
(cherry picked from commit 3783cf8353)
2022-07-19 01:30:16 +09:00
Christopher Friedt
59dc65a7b4 ci: backports: check if a backport PR has a valid issue
This is an automated check for the Backports project to
require one or more `Fixes #<issue>` items in the body
of the pull request.

Fixes #46164

Signed-off-by: Christopher Friedt <cfriedt@fb.com>
(cherry picked from commit aa4e437573)
2022-07-18 23:32:19 +09:00
Christopher Friedt
8ff8cafc18 scripts: release: list_backports.py
Created list_backports.py to examine prs applied to a backport
branch and extract associated issues. This is helpful for
adding to release notes.

The script may also be used to ensure that backported changes
also have one or more associated issues.

Signed-off-by: Christopher Friedt <cfriedt@fb.com>
(cherry picked from commit 57762ca12c)
2022-07-18 23:32:19 +09:00
Christopher Friedt
ba07347b60 scripts: release: use GITHUB_TOKEN and start_date in scripts
Updated bug_bash.py and list_issues.py to use the GITHUB_TOKEN
environment variable for consistency with other scripts.

Updated bug_bash.py to use `-s / --start-date` instead of
`-b / --begin-date`.

Signed-off-by: Christopher Friedt <cfriedt@fb.com>
(cherry picked from commit 3b3fc27860)
2022-07-18 23:32:19 +09:00
Christopher Friedt
e423902617 tests: posix: pthread: test for pthread descriptor leaks
Add a simple test to ensure that we can create and join a
single thread `CONFIG_MAX_PTHREAD_COUNT` * 2 times. If
there are leaks, then `pthread_create()` should
eventually return `EAGAIN`. If there are no leaks, then
the test should pass.

Fixes #47609

Signed-off-by: Christopher Friedt <cfriedt@fb.com>
(cherry picked from commit d37350bc19)
2022-07-12 16:02:26 -04:00
Christopher Friedt
018f836c4d posix: pthread: consider PTHREAD_EXITED state in pthread_create
If a thread is joined using `pthread_join()`, then the
internal state would be set to `PTHREAD_EXITED`.

Previously, `pthread_create()` would only consider pthreads
with internal state `PTHREAD_TERMINATED` as candidates for new
threads. However, that causes a descriptor leak.

We should be able to reuse a single thread an infinite number
of times.

Here, we also consider threads with internal state
`PTHREAD_EXITED` as candiates in `pthread_create()`.

Fixes #47609

Signed-off-by: Christopher Friedt <cfriedt@fb.com>
(cherry picked from commit da0398d198)
2022-07-12 16:02:26 -04:00
Stephanos Ioannidis
f4466c4760 tests: cpp: cxx: Add qemu_cortex_a53 as integration platform
This commit adds the `qemu_cortex_a53`, which is an MMU-based platform,
as an integration platform for the C++ subsystem tests.

This ensures that the `test_global_static_ctor_dynmem` test, which
verifies that the dynamic memory allocation service is functional
during the global static object constructor invocation, is tested on
an MMU-based platform, which may have a different libc heap
initialisation path.

In addition to the above, this increases the overall test coverage
ensuring that the C++ subsystem is functional on an MMU-based platform
in general.

Signed-off-by: Stephanos Ioannidis <root@stephanos.io>
(cherry picked from commit 8e6322a21a)
2022-07-12 12:05:56 -04:00
Stephanos Ioannidis
9a5cbe3568 tests: cpp: cxx: Test with various types of libc
This commit changes the C++ subsystem test, which previously was only
being run with the minimal libc, to be run with all the mainstream C
libraries (minimal libc, newlib, newlib-nano, picolibc).

Signed-off-by: Stephanos Ioannidis <root@stephanos.io>
(cherry picked from commit 03f0693125)
2022-07-12 12:05:56 -04:00
Stephanos Ioannidis
5b7b15fb2d tests: cpp: cxx: Add dynamic memory availability test for static init
This commit adds a test to verify that the dynamic memory allocation
service (the `new` operator) is available and functional when the C++
static global object constructors are invoked called during the system
initialisation.

Signed-off-by: Stephanos Ioannidis <root@stephanos.io>
(cherry picked from commit dc4895b876)
2022-07-12 12:05:56 -04:00
Stephanos Ioannidis
e5a92a1fab tests: cpp: cxx: Add static global constructor invocation test
This commit adds a test to verify that the C++ static global object
constructors are invoked called during the system initialisation.

Signed-off-by: Stephanos Ioannidis <root@stephanos.io>
(cherry picked from commit 6e0063af29)
2022-07-12 12:05:56 -04:00
Stephanos Ioannidis
74f0b6443a lib: libc: newlib: Initialise libc heap during POST_KERNEL phase
This commit changes the invocation of the newlib malloc heap
initialisation function such that it is executed during the POST_KERNEL
phase instead of the APPLICATION phase.

This is necessary in order to ensure that the application
initialisation functions (i.e. the functions called during the
APPLICATIION phase) can make use of the libc heap.

Signed-off-by: Stephanos Ioannidis <root@stephanos.io>
(cherry picked from commit 43e1c28a25)
2022-07-12 12:05:56 -04:00
Stephanos Ioannidis
6c16b3492b lib: libc: minimal: Initialise libc heap during POST_KERNEL phase
This commit changes the invocation of the minimal libc malloc
initialisation function such that it is executed during the POST_KERNEL
phase instead of the APPLICATION phase.

This is necessary in order to ensure that the application
initialisation functions (i.e. the functions called during the
APPLICATIION phase) can make use of the libc heap.

Signed-off-by: Stephanos Ioannidis <root@stephanos.io>
(cherry picked from commit db0748c462)
2022-07-12 12:05:56 -04:00
Christopher Friedt
1831431bab lib: posix: semaphore: use consistent timebase in sem_timedwait
In the Zephyr implementation, `sem_timedwait()` uses a
potentially wildly different timebase for comparison via
`k_uptime_get()` (uptime in ms).

The standard specifies `CLOCK_REALTIME`. However, the real-time
clock can be modified to an arbitrary value via clock_settime()
and there is no guarantee that it will always reflect uptime.

This change ensures that `sem_timedwait()` uses a more
consistent timebase for comparison.

Fixes #46807

Signed-off-by: Christopher Friedt <chrisfriedt@gmail.com>
(cherry picked from commit 9d433c89a2)
2022-07-06 07:30:37 -04:00
Torsten Rasmussen
765f63c6b9 cmake: remove xtensa workaround in Zephyr toolchain code.
Remove xtensa specific workaround as this code is now present in Zephyr
SDK cmake code.

Signed-off-by: Torsten Rasmussen <Torsten.Rasmussen@nordicsemi.no>
(cherry picked from commit 92a1ca61eb)
2022-06-28 12:37:43 -04:00
Torsten Rasmussen
062306fc0b cmake: zephyr toolchain code cleanup
With the revert of commit 820d327b46 then
some additional code can be cleaned up.

This removes the final left-overs from Zephyr SDK 0.11.1 support and
older.

It further aligns message printing when including Zephyr SDK toolchain
to other toolchain message printing.

Signed-off-by: Torsten Rasmussen <Torsten.Rasmussen@nordicsemi.no>
(cherry picked from commit fb3a113eb8)
2022-06-28 12:37:43 -04:00
Torsten Rasmussen
8fcf7f1d78 Revert "cmake: Zephyr sdk backward compatibility with 0.11.1 and 0.11.2"
This reverts commit 820d327b46.

Commit b973cdc9e8 updated the minimum
required Zephyr SDK version to 0.13.

Therefore revert commit 820d327b46 as
backward support for 0.11.1 and 0.11.2 is no longer required.

Signed-off-by: Torsten Rasmussen <Torsten.Rasmussen@nordicsemi.no>
(cherry picked from commit e747fe73cd)
2022-06-28 12:37:43 -04:00
Vinayak Kariappa Chettimada
f06b3d922c Bluetooth: Controller: Fix PHY update for unsupported PHY
Fix PHY update procedure to handle unsupported PHY requested
by peer central device. PHY update complete will not be
generated to Host, connection is maintained on the old
PHY and the Controller will not respond to PDUs received on
the unsupported PHY.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
(cherry picked from commit 620a5524a5)
2022-06-28 11:39:37 -04:00
Francois Ramu
b75c012c55 drivers: spi: stm32 spi with dma must enable cs after periph
When using DMA to transfer over the spi, the spi_stm32_cs_control
is done after enabling the SPI. The same sequence applies
in the transceive_dma function as in transceive function

Signed-off-by: Francois Ramu <francois.ramu@st.com>
2022-06-28 11:39:17 -04:00
Stephanos Ioannidis
1efe6de3fe drivers: i2c: Fix infinite recursion in driver unregister function
This commit fixes an infinite recusion in the
`z_vrfy_i2c_slave_driver_unregister` function.

Signed-off-by: Stephanos Ioannidis <root@stephanos.io>
(cherry picked from commit 745b7d202e)
2022-06-21 13:00:55 -04:00
Pavel Vasilyev
39270ed4a0 Bluetooth: Mesh: Fix segmentation when sending proxy message
Previous check in the if-statement would never allow to send last
segment if msg->len + 2 == MTU * x.

Signed-off-by: Pavel Vasilyev <pavel.vasilyev@nordicsemi.no>
(cherry picked from commit 1efce43a00)
2022-06-21 12:17:16 -04:00
Pavel Vasilyev
81ffa550ee Bluetooth: Mesh: Check SegN when receiving Transaction Start PDU
When receiving Transaction Start PDU, assure that number of segments
needed to send a Provisioning PDU with TotalLength size is equal to SegN
value provided in the Transaction Start PDU.

Signed-off-by: Pavel Vasilyev <pavel.vasilyev@nordicsemi.no>
(cherry picked from commit a63c515679)
2022-06-20 11:31:10 -04:00
Aleksandr Khromykh
8c2965e017 Bluetooth: Mesh: add check for rx buffer overflow in pb adv
There is potential buffer overflow in pb adv.
If Transaction Continuation PDU comes before
Transaction Start PDU the last segment number is set to 0xff.
The current implementation has a strictly limited buffer size.
It is possible to receive malformed frame with wrong segment
number. All segments with number 2 and above will be stored
in the memory behind Rx buffer.

Signed-off-by: Aleksandr Khromykh <Aleksandr.Khromykh@nordicsemi.no>
(cherry picked from commit 6896075b62)
2022-06-20 11:25:30 -04:00
Alexander Wachter
7aa38b4ac8 drivers: can: m_can: fix alignmed issues
Make sure that all access to the msg_sram
is 32 bit aligned.

Signed-off-by: Alexander Wachter <alexander@wachter.cloud>
2022-06-10 21:01:47 -07:00
Christopher Friedt
6dd320f791 release: update v2.7.2 release notes
* add backported bugfixes
* add backported fix for CVE-2021-3966

Signed-off-by: Christopher Friedt <chrisfriedt@gmail.com>
2022-05-24 12:13:21 -04:00
Alexej Rempel
ecac165d36 logging: shell: fix shell stats null pointer dereference
If CONFIG_SHELL_STATS is disabled, shell->stats is NULL and
must not be dereferenced. Guard against it.

Fixes #44089

Signed-off-by: Alexej Rempel <Alexej.Rempel@de.eckerle-gruppe.com>
(cherry picked from commit 476d199752)
2022-05-24 12:12:22 -04:00
Michał Narajowski
132d90d1bc tests/bluetooth/tester: Refactor Read UUID callback
ATT_READ_BY_TYPE_RSP returns Attribute Data List so handle it in the
application.

This affects GATT/CL/GAR/BV-03-C.

Signed-off-by: Michał Narajowski <michal.narajowski@codecoup.pl>
(cherry picked from commit 54cd46ac68)
2022-05-17 18:33:37 +02:00
Mark Holden
58356313ac coredump: adjust mem_region find in gdbstub
Adjust get_mem_region to not return region when address == end
as there will be nothing to read there. Also, a subsequent region
may have that address as a start address and would be a more appropriate
selection.

Signed-off-by: Mark Holden <mholden@fb.com>
(cherry picked from commit d04ab82943)
2022-05-17 18:06:16 +02:00
Piotr Pryga
99cfd3e4d7 Bluetooth: Controller: Fix per adv scheduling issue
sw_switch implementation uses two parallel groups of
PPIs connecting radio and timer tasks and events.
The groups are used interchaneably, one is set for
following radio TX/RX event while the other is in use
(enabled).

The group should be disabled by timer compare event that
starts Radio to TX/RX a PDU. The timer is responsible for
maintenance of TIFS/TMAFS. The disabled group collects
all PPIs required to maintain the TIFS/TMASF. After
the time is reached Radio is started and the group is
disabled. It will be enabled again by software radio
swich during next call.

If the group is not disabled then it will work in parallel
to other one. That causes issues in correct maintenance of
instant when radio shoudl be started for next TX/RX  event
e.g. radio may be enabled to early.

In case the PHY CODED was enabled and periodic advertising
included chained PDUs, that are transmitted back-to-back,
there was missing group delay disable. The missing case was
sw_switch function called with dir_curr and dir_next set
to SW_SWITCH_TX.

Signed-off-by: Piotr Pryga <piotr.pryga@nordicsemi.no>
2022-05-16 10:07:40 +02:00
Andrei Emeltchenko
780588bd33 edac: ibecc: Add support for EHL SKU13, SKU14, SKU15
Add support for missing EHL SKUs. The information about SKUs is
already public and available in Linux kernel:
https://github.com/torvalds/linux/blob/
38f80f42147ff658aff218edb0a88c37e58bf44f/drivers/edac/
igen6_edac.c#L197-L208

Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
(cherry picked from commit f6069aa8fa)
2022-05-10 20:03:44 -04:00
Christopher Friedt
38de9b0156 release: Zephyr 2.7.2
Set version to 2.7.2

Signed-off-by: Christopher Friedt <chrisfriedt@gmail.com>
2022-04-22 12:24:33 -04:00
Flavio Ceolin
3a21dff459 doc: release: Update release notes with CVE
Update 2.7.1 release notes with information about CVE fixed.

Signed-off-by: Flavio Ceolin <flavio.ceolin@intel.com>
2022-04-22 11:02:44 -04:00
Stephanos Ioannidis
b98ec9e0db x86: Initialise FPU regs during thread creation for eager FPU sharing
When "eager FPU sharing" mode is enabled, FPU registers must be
initialised at the time of thread creation because the floating-point
context is always active and no further FPU initialisation is performed
later.

Note that, in case of the "lazy FPU sharing" mode, floating-point
context is inactive by default and the FPU is initialised when the
first floating-point instruction is executed.

Refer to the issue #44902 for more details.

Signed-off-by: Stephanos Ioannidis <root@stephanos.io>
(cherry picked from commit f9a3f02b86)
2022-04-19 18:08:22 +02:00
Christopher Friedt
8f2d164674 release: Bump release to 2.7.2-rc1
Bump version to 2.7.2-rc1

Signed-off-by: Christopher Friedt <chrisfriedt@gmail.com>
2022-04-19 06:18:23 -04:00
Jamie McCrae
6b61b219ea doc: Add link to J-Link virtual MSD disable for SMP
Virtual MSD J-Link support on some development boards has caused an
issue with SMP due to limiting the maximum size of UART data via the CDC
endpoint, add a link to the SMP documentation and smp_svr sample
application on how to disable MSD functionality and resolve the issue.

Signed-off-by: Jamie McCrae <jamie.mccrae@lairdconnect.com>
2022-04-14 20:21:06 -04:00
Jaxson Han
8822f85ef9 board: arm64: fvp_baser_aemv8r_smp: Increase CONFIG_MAX_THREAD_BYTES
Increase CONFIG_MAX_THREAD_BYTES to 3 to fix the build issue on
tests/drivers/build_all/modem/ test case.

Signed-off-by: Jaxson Han <jaxson.han@arm.com>
Change-Id: I6a26955bdd7e8b176894fa8246aec63a3a3db05f
(cherry picked from commit a483828d46)
2022-04-14 20:19:22 -04:00
Jaxson Han
0bc81c82ab board: arm64: fvp_baser_aemv8r: Update the version requirement
The current minimum required version of "Armv8-R AEM FVP" is 11.16.16.

Signed-off-by: Jaxson Han <jaxson.han@arm.com>
Change-Id: Iaaf1ec7fd432753371b58d13fdd29b1278f6c997
(cherry picked from commit 3875a1e787)
2022-04-14 20:19:22 -04:00
Jaxson Han
32c49d04b0 cmake: armfvp: Add FVP min version check
After the fix of FVP_BaseR_AEMv8R booting issue, the minimum required
version of FVP will be 11.16.16. Add an FVP minimal required version
check in building time.

When the ARMFVP_MIN_VERSION is set in board cmake file, the version
check will be enabled and print a warning.

Signed-off-by: Jaxson Han <jaxson.han@arm.com>
Change-Id: Ibbade0c328b5e91b8830fb35cba6917f08aabbda
(cherry picked from commit 3c1f3197e2)
2022-04-14 20:19:22 -04:00
Jaxson Han
02c32316fc arm64: Fix booting issue with FVP V8R >= 11.16.16
In the Armv8R AArch64 profile[1], the Armv8R AArch64 is always in secure
mode. But the FVP_BaseR_AEMv8R before version 11.16.16 doesn't strictly
follow this rule. It still has some non-secure registers
(e.g. CNTHP_CTL_EL2).

Since version 11.16.16, the FVP_BaseR_AEMv8R has fixed this issue. The
CNTHP_XXX_EL2 registers have been changed to CNTHPS_XXX_EL2. So the
FVP_BaseR_AEMv8R (version >= 11.16.16) cannot boot Zephyr. This patch
will fix it.

[1] https://developer.arm.com/documentation/ddi0600/latest/

Signed-off-by: Jaxson Han <jaxson.han@arm.com>
Change-Id: If986f34dc080ae7a8b226bba589b6fe616a4260b
(cherry picked from commit fd231e32e9)
2022-04-14 20:19:22 -04:00
Tomasz Bursztyka
9bf571808d net/tcp: Use highest priority for TCP internal work queue
Reason why the prority was at its lowest is unknown, but now that it may
be used to send local packets (which used to be sent right away),
it seems to affect TCP scheduling in loopback mode. Raising the prority
so it matches how it was previously (i.e. sent right away) should fix
things. (Note however that this issue was not broadly present, only
sockets.tls test seemed to be affected.)

Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2022-04-13 14:38:15 -04:00
Tomasz Bursztyka
4eec9d95ef test/net: Make sure the tls server socket is accepting before connect
Client thread might run before the server gets to put itself on accept.
Leading to the server waiting forever.

Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2022-04-13 14:38:15 -04:00
Tomasz Bursztyka
32a593396d tests/net: Put the context down and not only the tcp part in tcp2 test
This will clean up the context properly and call net_tcp_put()
relevantly.

Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2022-04-13 14:38:15 -04:00
Tomasz Bursztyka
066dcd6119 tests/net: Switch k_msleep to k_yield for tcp packet scheduling
TCP work queue is of higher priority so k_yield should do the trick, and
the test will not be affected by any timing.

Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2022-04-13 14:38:15 -04:00
Tomasz Bursztyka
ffcc1d3c92 tests/net: TLS test requires more RX PKT and buffers
Due to the previous change on when to send TCP packet on local IP, pkt
may be held in a queue which is to run on a k_work. This changes the
scheduling, and due to that one of the test is failing to allocate a
RX net_pkt at the time it wants to. (previous TCP connection is not yet
fully closed and still own PKT that new connection cannot get then).

Of course all those waiting paquets require buffers so raising them.

It was verified that there is no leak, adding net_pkt_print() at
tcp_conn_unref() shows that when all tcp connection are finally unrefed:
all net_pkt get freed as well.

Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2022-04-13 14:38:15 -04:00
Tomasz Bursztyka
2d49a4c8b9 net/context: Close TCP connection properly
Closing a connection, thus calling net_context_put() will not close a
TCP connection properly, and will leak tcp connection memory.

This is because: net_context_put calls net_context_unref which calls
net_tcp_unref which leads to unref tcp connection and thus sets
ctx->tcp to NULL. Back to net_context_put, that one finally calls
net_tcp_put: but that bails out directly since ctx->tcp is NULL.

Fixing it by inverting net_tcp_put() and net_context_unref() calls
within net_context_put().

Fixes #38598

Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2022-04-13 14:38:15 -04:00
Tomasz Bursztyka
9d229e0bb5 net/tcp: Stop TCP state machine breaking when sending locally
On any target, running a TCP server and a net shell can show the issue:
net tcp connect local_ip port

will fail. Usally it ends up by consumming all tcp connection memory.

This is because in tcp_in(), state changes will most of the time lead to
sending SYN/ACK/etc... packets under the same thread, which will run all
through net_send_data(), back to tcp_in(). Thus a forever loop on SYN ->
SYN|ACK -> SYN -> SYN|ACK until tcp connection cannot be allocated
anymore.

Fixing it by scheduling any local packet to be sent on the queue.

Fixes #38576

Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2022-04-13 14:38:15 -04:00
Jamie McCrae
74c00d0b4e boards: bl654_usb: Fix non-mcuboot builds not limiting size
This limits non-mcuboot builds to have a maximum size of 892KB to
prevent code being placed over the top of the bootloader's flash area.

Signed-off-by: Jamie McCrae <jamie.mccrae@lairdconnect.com>
2022-04-12 16:40:58 -04:00
Michael Schmidt
2a09d5e53f drivers: virt_ivshmem: Allow multiple instances of ivShMem devices.
- Supporting multiple instances of ivShMem virtual devices.
- Introduces DT based configuration for ivShMem devices.
- Add DTS overlay file to test new multiple ivshmem instance capability.
- Enable BDF unspecified device initialization.
  (limited to one instance. An improved version of pcie_bdf_lookup()
  will come soon that fixes this limitation)
- Make PCIE DTS file macros available for a proper ivshmem device
  properties parsing.

Sample for dts file:
pcie0 {
	label = "PCIE_0";
	#address-cells = <1>;
	#size-cells = <1>;
	compatible = "intel,pcie";
	ranges;
    ivshmem0: ivshmem@800 {
	    compatible = "qemu,ivshmem";
	    reg = <PCIE_BDF_NONE PCIE_ID(0x1af4,0x1110)>;
	    label = "IVSHMEM";
	    status = "okay";
    };
};

Signed-off-by: Michael Schmidt <michael1.schmidt@intel.com>
2022-04-12 16:40:25 -04:00
Jamie McCrae
ad4e9934de samples: subsys: mgmt: smp_svr: Fix dupicate fs mgmt registration
This fixes an issue with the filesystem mcumgr being registered twice
in the sample application which resolves an issue with an endless loop
if a mcumgr handler is used which is not registered.

Signed-off-by: Jamie McCrae <jamie.mccrae@lairdconnect.com>
2022-04-12 16:39:15 -04:00
Alexandre Bourdiol
f133449cf5 boards: arm: stm32l562e_dk and nucleo_l552ze_q add openocd support
OpenOCD was partially implemented in board.cmake,
it is now functional.

Signed-off-by: Alexandre Bourdiol <alexandre.bourdiol@st.com>
2022-04-12 12:04:07 -04:00
Gerard Marull-Paretas
33318bfb45 doc: css: update code documentation directives style
New Sphinx version (or docutils) has slightly changed the output format
for code documentation directives. These changes try to mimic previous
behavior, even though it does not achieve 100% equal result. In some
cases the new default style does not require further tweaks, and in some
others styling as before is not possible.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2022-04-07 05:30:04 -04:00
Gerard Marull-Paretas
3497031e3e doc: update requirements
breathe: for simplicity, require versions > 4.30 (lower versions have
known issues, so do not take risks).
Sphinx: start requiring versions >=4.x. Keep with compatible versions,
since Sphinx major updrages can easily break extensions, themes, etc.
sphinx_rtd_theme: upgrade to >=1.x. Again, keep with compatible versions
since we have style customizations that can likely break on major
upgrades.
pygments: Allow any version >=2.9 (version that introduced DT support).
We do not have strong compatibility requirements here.
sphinx-notfound-page: Remove any requirements, we do not have strong
requirements for this one.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2022-04-07 05:30:04 -04:00
Erwan Gouriou
57a1be33ff boards: nucleo_wb55rg: Add stm32cubeprogrammer runner
Use of stm32cubeprogrammer runner makes life easier
on test bench for this device.
Though, keep openocd as default.

Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
2022-04-05 12:10:33 -04:00
Erwan Gouriou
652eb37b4d scripts/pylib/twister: Add sn option to stm32cubeprogrgammer runner
In order to enable use of stm32cubeprogrammer runner with twister,
add "sn" tool specific option which allows to provide target serial
number and hence select the target to flash when multiple ones are
connected to the host.

Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
2022-04-05 12:08:40 -04:00
Szymon Janc
9e4edaec21 tests/bluetooth/tester: Add support for auto connection establishment
autopts was updated to properly require support for Accept Filter List
in Auto Connection Establishment Procedure related tests. This patch
enabled support for it and adds required BTP support.

This was affecting following qualification test cases:
GAP/CONN/ACEP/BV-03-C
GAP/CONN/ACEP/BV-04-C

Signed-off-by: Szymon Janc <szymon.janc@codecoup.pl>
2022-03-29 18:07:48 +02:00
Kweh Hock Leong
9b18f4a730 net: gptp: Fix type mismatch calculation error in gptp_mi
NSEC_PER_SEC is an unsigned integer macro. Thus, -NSEC_PER_SEC will be
treated as unsigned integer as well which lead to calculation error on
64bits integer variables. Added the correct type casting into the formula
to fix the calculation error.

Signed-off-by: Kweh Hock Leong <hock.leong.kweh@intel.com>
2022-03-29 12:07:20 -04:00
Flavio Ceolin
3f958347c2 test: pm: device: Fix build options
The test is using device and device runtime power management. Just
including them to the test build.

Signed-off-by: Flavio Ceolin <flavio.ceolin@intel.com>
2022-03-29 18:04:54 +02:00
Flavio Ceolin
041653662b pm: Remove unused fields in pm_device
Several fields on struct pm_device are just necessary when
built with PM_DEVICE_RUNTIME.

Signed-off-by: Flavio Ceolin <flavio.ceolin@intel.com>
2022-03-29 18:04:54 +02:00
Evgeniy Paltsev
6da71d7c2f ARC: nSIM: fix missing core numbers for mdb-hw runner args
We don't set core numbers for mdb-hw runner for nSIM
board, so it defaults to 1, so mdb-hw runner doesn't work with
SMP boards.

Fix that.

Signed-off-by: Eugeniy Paltsev <Eugeniy.Paltsev@synopsys.com>
Signed-off-by: Evgeniy Paltsev <PaltsevEvgeniy@gmail.com>
2022-03-23 05:58:54 -04:00
Robert Lubos
52a68bec73 net: tcp: Verify accept callback before use
Closing a listening socket will set the accept callback to NULL.
This could lead to a crash, in case an already received packet,
finalizing the connection handshake, was processed after the socket was
closed. Thereby, it's needed to verify if the callback is actually set
before processing it.

Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
2022-03-22 20:17:36 -04:00
Robert Lubos
6324e997e1 net: sockets: Fix userspace accept() verification
The verification function for accept() did not take into account that
addr and addrlen pointers provided could be NULL.

Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
2022-03-22 20:17:36 -04:00
Yong Cong Sin
e9eed0015f subsys/mgmt/hawkbit: update http response handling
Following the merge of #42646, the http body handling can be simplified.

Signed-off-by: Yong Cong Sin <yongcong.sin@gmail.com>
2022-03-22 20:13:09 -04:00
Jordan Yates
a3e7047ad5 wifi: esp_at: claim net_context in rx
Claim the net_context mutext associated with a socket before claiming
the socket mutex. The receive callback claims the net_context mutex
internally, which will now always succeed immediately.

The TX path claims the net_context mutex before the socket mutex, and if
we don't use the same order, we can end up in a deadlock.

Fixes #43470.

Signed-off-by: Jordan Yates <jordan.yates@data61.csiro.au>
2022-03-22 20:12:42 -04:00
Robert Lubos
50a24d6782 net: sockets: Retry net_context_sendmsg if EAGAIN is reported
TCP module can report EAGAIN in case TX window is full. This should not
be forwarded to the application, as blocking socket is not supposed to
return EAGAIN.

Fix this for sendmsg by implementing the same mechanism for handling TX
errors as for regular send/sendto operations.

Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
2022-03-22 20:08:35 -04:00
Szymon Janc
9c3be1212f tests/bluetooth/tester: Enable security validation for GATT subsciption
This was affecting following qualification test cases:
GAP/SEC/SEM/BV-56-C
GAP/SEC/SEM/BV-57-C
GAP/SEC/SEM/BV-58-C
GAP/SEC/SEM/BV-59-C
GAP/SEC/SEM/BV-60-C
GAP/SEC/SEM/BV-61-C

Signed-off-by: Szymon Janc <szymon.janc@codecoup.pl>
2022-03-22 20:08:06 -04:00
Szymon Janc
e2c96814ce Bluetooth: Host: Validate security on GATT subscription
Core Specification 5.3 clarified security requirements for GATT client
when handling incoming notifications and indications.

Vol 3: Part C: 10.3.2.2:
"...Since the configuration is persistent across a disconnection and
reconnection, the client shall check the security requirements against
the configuration upon a reconnection before processing any indications
or notifications from the server. Any notifications received before
the security requirements are met shall be ignored. Any indications
received before the security requirements are met shall be confirmed
and then discarded. ..."

Signed-off-by: Szymon Janc <szymon.janc@codecoup.pl>
2022-03-22 20:08:06 -04:00
Andrzej Głąbek
3c64ed4e77 drivers: spi_nrfx_spi: Fix compilation error
Fix a copy/paste mistake introduced by commit
fdc25cd44c.

Signed-off-by: Andrzej Głąbek <andrzej.glabek@nordicsemi.no>
2022-03-22 17:06:09 +01:00
Jordan Yates
e78a6ab2cd spi: nrfx_spi*: only run uninit if configured
Only run the `uninit` function if the SPI instance has previously been
configured. This stops an assertion in the HAL drivers from triggering
due to running `uninit` without a previous `init`.

Fixes #42299.

Signed-off-by: Jordan Yates <jordan.yates@data61.csiro.au>
2022-03-22 17:06:09 +01:00
Piotr Pryga
6bbf1e7e7a Bluetooth: controller: Add missing NULL assign to df_cfg in ll_adv_set
ll_adv_set stores poitner to direction finding TX configuration.
When ll_reset is executed the pointer was not NULL assigned.
That lead to erroneous behavior e.g. df_cfg->is_enabled was set
to TRUE even the functionality was not enabled.
DF configuration is stored in memory pool. The memory pool uses
free elements to store its internal data. On reset whole pool is
expected to be free, so ll_adv_set->df_cfg may not point to any
element allocated from memory pool.

Signed-off-by: Piotr Pryga <piotr.pryga@nordicsemi.no>
2022-03-17 13:19:53 +01:00
Tomasz Bursztyka
063dbecb23 arch/x86: Fix MSI MAP destination
When Zephyr runs directly on actual hardware, it will be always
directing MSI messages to BSP (BootStrap Processor). This was fine until
Zephyr could be ran on virtualizor that may NOT run it on BSP.

So directing MSI messages on current processor. If Zephyr runs on actual
hardware, it will be BSP since such setup is always made at boot time by
the BSP. On other use case it will be whatever is relevant at that time.

Fixes #43853

Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2022-03-16 11:45:25 -04:00
Tomasz Bursztyka
a807fff085 arch/x86: Add a CPUID function to get initial APIC ID
Depending on whether X2APIC is enabled or not, it will be safer to grab
such ID from the right place.

Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2022-03-16 11:45:25 -04:00
Tomasz Bursztyka
b4b474cb4b arch/x86: Have a dedicated place for CPUID related functions
This will centralize CPUID related accessors. There was no need for it
so far, but this is going to change.

Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2022-03-16 11:45:25 -04:00
Szymon Janc
175ae83c78 tests/bluetooth/tester: Allocate L2CAP channel only when needed
This fix leaking channels when autorization or key size are tested.

Signed-off-by: Szymon Janc <szymon.janc@codecoup.pl>
2022-03-16 11:07:30 -04:00
Szymon Janc
22ab715ad8 test/bluetooth/tester: Don't clear auth requirements on L2CAP server
We have single server but it can accept multiple connections so
keep same requirements for all connection attempts.

Signed-off-by: Szymon Janc <szymon.janc@codecoup.pl>
2022-03-16 11:07:30 -04:00
Szymon Janc
dff6cf2694 tests/bluetooth/tester: Add support for multiple GATT subscriptions
This is required by GATT/CL/GAI/BI-01-C qualification test.

Signed-off-by: Szymon Janc <szymon.janc@codecoup.pl>
2022-03-16 11:07:09 -04:00
Szymon Janc
d4a1231cd4 tests/bluetooth/tester: Fix possible buffer overflow
Make sure we have enough space for notification data.

Signed-off-by: Szymon Janc <szymon.janc@codecoup.pl>
2022-03-16 11:07:09 -04:00
Szymon Janc
88249c470e tests/bluetooth/tester: Add support for rejecting connection parameters
This is required for GAP/CONN/CPUP/BV-05-C qualification test.

Signed-off-by: Szymon Janc <szymon.janc@codecoup.pl>
2022-03-16 11:06:43 -04:00
Carlo Caione
265cd286f2 gen_relocate_app: Create files from scratch, do not append
The problem with append is that when doing incremental (non-clean)
build, the content of these files are appended each time to the previous
leftover content.

Example:

 # west build -p -b qemu_cortex_m3 \
 	samples/application_development/code_relocation/

 #   // disable for example CONFIG_XIP

 # west build -b qemu_cortex_m3 \
        samples/application_development/code_relocation/

at this point the content of the generated files (i.e.
linker_relocate.ld) is wrong.

Signed-off-by: Carlo Caione <ccaione@baylibre.com>
2022-03-16 10:38:09 +01:00
Krzysztof Chruscinski
4bc2808291 lib: os: mpsc_pbuf: Add const to mpsc_pbuf_free argument
Added const qualifier to argument in a function.

Signed-off-by: Krzysztof Chruscinski <krzysztof.chruscinski@nordicsemi.no>
2022-03-15 20:28:31 -04:00
Francois Ramu
feb1630492 dts: arm: stm32l0 LSI clock freq is 37kHz
Corrects the LSI clock freq for stm32l0x mcus
especially stm32l0x1 stm32l0x2 stm32l0x3 series

Signed-off-by: Francois Ramu <francois.ramu@st.com>
2022-03-15 20:27:14 -04:00
Chen Peng1
59a491efd6 cmake: save eh_frame section in output with CONFIG_EXCEPTIONS.
.eh_frame section should not be removed directly in the
hex format and bin format output, it should be based on
whether we need exception handler feature.

Signed-off-by: Chen Peng1 <peng1.chen@intel.com>
2022-03-15 20:27:00 -04:00
Rene Bredlau
51e7ee4711 modem: hl7800: use correct timeouts on KTCPSND to avoid internal deadlock
The response of a KTCPSND has two phases. According to documentation by
wireless the timeout is 60 seconds. The fix respects the timeout on the
second phase, too (waiting for OK or errors from modem). Previously only
the first phase used 60 seconds and the second phase used 5 seconds.

Without this fix the hl7800 will lock the tcp stack for the current
socket indefinitely if another socket operation is performed before the
response from the modem is received.

Additionally all timeouts are adjusted to be at least one second longer
as the documented timeout from wireless. This avoids races between the
hl7800 and the driver.

Signed-off-by: Rene Bredlau <git@unrelated.de>
2022-03-15 20:22:56 -04:00
Johann Fischer
5883e897ba usb: bluetooth: check buffer tailroom before copying
If HCI packet length is greater than endpoint MPS or currently
received data block (over USB), next block could be larger
than allocated net_buf buffer.

Check buffer tailroom before copying data using net_buf_add_mem().

Signed-off-by: Johann Fischer <johann.fischer@nordicsemi.no>
2022-03-08 12:30:24 -05:00
Johann Fischer
20899f9f7e bluetooth: hci_raw: avoid possible memory overflow in bt_buf_get_tx()
Function bt_buf_get_tx(), which is used to allocate buffer from
fixed-size pool, does not check size argument before copying
the data with the length size into fixed-size buffer, wich may
not be large enough.

Check immediately before copying if the tailroom of the buffer
is large enough.

Signed-off-by: Johann Fischer <johann.fischer@nordicsemi.no>
2022-03-08 12:30:24 -05:00
Christopher Friedt
3e41a7810d tests: pthread: cond: check return from pthread_cond_wait()
The expectation is that this call succeeeds in order for
the test to pass.

Signed-off-by: Christopher Friedt <chrisfriedt@gmail.com>
2022-03-08 11:46:56 -05:00
Christopher Friedt
de5fc723eb pthread: cond: fix pthread_cond_wait always returning ETIMEDOUT
It was noted that `pthread_cond_wait()` would always return
ETIMEDOUT, even when successful (and no timeout should ever
occur with `K_FOREVER`).

The z_sched_wake() / z_sched_wake_all() / z_sched_wait() API
are used here with a swap return value of 0 to indicate
success.

Fixes #41284

Signed-off-by: Christopher Friedt <chrisfriedt@gmail.com>
2022-03-08 11:46:56 -05:00
Gerard Marull-Paretas
6fa562e805 ci: split Bluetooth workflow
Split Bluetooth tests workflow into 2 steps:

- One that runs the actual tests and stored results
- A second one that fecthes and uploads tests results

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2022-03-08 11:16:09 -05:00
Gerard Marull-Paretas
df7a1f3cf6 ci: make git credentials non-persistent
With this setting enabled, Git credentials are not kept after checkout.
Credentials are not necessary after the checkout step since we do not
do any further manual push/pull operations.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2022-03-08 11:15:38 -05:00
Georgij Cernysiov
798cca3d61 include: drivers: clock_control: stm32: fix xtpre
Correct DT property to set correct STM32_PLL_XTPRE value.
The driver bindings defined `xtpre` instead of used `xtre`
in the `DT_PROP` macro.
That allows to use F1 PLL clock with division by 2.

Signed-off-by: Georgij Cernysiov <geo.cgv@gmail.com>
2022-03-02 09:52:56 -05:00
Andrea Campanella
58b8290163 drivers: serial: stm32: Add Line Break Detection
The current driver doesn't handle the LBD flag, this leads
uart_stm32_err_check to return always true if a Line Break
is detected.

This PR adds Line Break Detection and the related flag clearing,
F0 series it's excluded from the changes.

Fixes zephyrproject-rtos#41339

Signed-off-by: Andrea Campanella <andrea.campanella@helvar.com>
2022-03-02 09:26:14 -05:00
Thomas Stranger
9c6ed8ff95 tests: drivers: flash: change integration_platforms
drivers.flash.nrf_qspi_nor and drivers.flash.soc_flash_nrf:
keep nrf52840dk_nrf52840 as integration_platform

drivers.flash.default:
Use mimxrt1060_evk instead as integration_platform,
this is the only platform allowed.

drivers.flash.stm32:
Add a bunch of boards as integration_platforms for
this test configuration.

Signed-off-by: Thomas Stranger <thomas.stranger@outlook.com>
2022-03-02 09:23:36 -05:00
Thomas Stranger
fcf027ef93 drivers: flash: stm32g0: dual bank handling
This commit fixes dual bank flash handling on stm32g0 targets.
In contrast to other Series (G4, L5) the flash page size does not change
in single bank configuration (2KiB in both configurations).

nSWAP_BANK:
While the reference manual(RM) only documents:
"This bit selects the bank that is the subject of empty check upon boot"
as expected, this behaves similar to BFB2 on G4 and SWAP_BANK on L5.
It has been observed that this bit swaps the address mapping of bank1
and bank2, regardless of DUAL_BANK bit being set or not.
As documented in the RM the nSWAP_BANK bit is ignored when the BOOT_LOOK
bit is set. This applies to the empty check as well as the address
mapping.

On this Series FLASH_CR_BKER must be set in single-bank as well as
dual-bank configuration for erase operations on bank2 regardless of
the swap status.

On a G0B1RE (dev-id: 0x467) I could not observe a difference between
DUAL_BANK flash option bit set and not.
It this may be different on 256KiB Flash targets.
The HAL indicates that "FLASH_SALES_TYPE_0" only uses a single bank if
OB_DUAL_BANK_VALUE is not set, but as I don't know which SoC this is
and I can't test the behaviour and the driver does not take this into
account.

Signed-off-by: Thomas Stranger <thomas.stranger@outlook.com>
2022-03-02 09:23:36 -05:00
Thomas Stranger
d8ad569d33 drivers: flash: stm32g0: preparation for dual bank handling
This commit makes no functional changes, it only refactors the
driver such that dual bank flash handling can be easily added.

Instead of using HAL macros directly in the code, new macros
with STM32G0 prefix are defined.
The erase_page function gets passed the offset instead of the page,
and the FLASH CR reg is written once with all erase parameters.
flash_stm32_wait_flash_idle is already called before each
write to CR, consequently it is also made sure CFGBSY flag
is not set.

Signed-off-by: Thomas Stranger <thomas.stranger@outlook.com>
2022-03-02 09:23:36 -05:00
Thomas Stranger
a04de78971 drivers: flash: stm32: wait for CFGBSY & BSY2 in wait_flash_idle
Some series (namely g0, u5, wb, wl, ?) use CFGBSY to indicate
that FLASH_CR is not ready to be modfied.

This commit adds this flag additionally to other the flash busy flags,
in flash_stm32_wait_flash_idle such that the driver waits before
trying to modify PG, PNB[6:0], PER, and MER bits in FLASH_CR.

Additionally, dual bank variants of STM32G0 have a seperarate BSY2 flag
for flash bank two.
Until now this was not yet checked in flash_stm32_wait_flash_idle.

Signed-off-by: Thomas Stranger <thomas.stranger@outlook.com>
2022-03-02 09:23:36 -05:00
Thomas Stranger
9b1dfd6568 flash: stm32: fix g0 error flags and move ifdef-ery to header
In STM32G0 HAL FLASH_FLAG_xxx defines don't follow the pattern of
other Series to simply redefine the FLASH_SR_xxx Msk.
Instead an ID for the SR reg and the position of the Error flag
are defined.

As a result error checking in flash_stm32_check_status was not working
until this fix on stm32g0 series.

In order to avoid complexity in the driver, the ifdef-ery of the flags
was moved to the header file.
Other series except g0 use FLASH_FLAG_xxx defines, because those
are valid for both cores in dual core(wl) and in secure/non-secure
targets(l5,u5).
FLASH_STM32_SR_ERRORS mask is introduced to check for any active error
in the SR.

The flags for SIZERR, MISERR, FASTERR are newly introduced.
the latter two are only required once fast programming is used,
which is not yet the case for any series.

The FLASH_SR_OPTVERR flag (option validity flag) is also present
in the SR, but is not added.
Also ecc errors are generally not checked, but these are in a different
register.

Signed-off-by: Thomas Stranger <thomas.stranger@outlook.com>
2022-03-02 09:23:36 -05:00
Thomas Stranger
c2898af367 drivers: flash: stm32: mv security-mode dependent defines to header
An attempt to simplify the ifdef-ery around FLASH_SR is made.
Define Registers and flags in the header file instead of including
several individual operations in the driver.

FLASH_FLAG_BSY is not only defined for STM32L5, but also other series.
Therefore use this flag instead of FLASH_SR_BSY.
Only the g0 series definition is not valid in our context,
therefore use FLASH_SR_BSY1 instead.

No functional changes, only refactoring.

Signed-off-by: Thomas Stranger <thomas.stranger@outlook.com>
2022-03-02 09:23:36 -05:00
Yong Cong Sin
5933705d0c driver: serial: uart_stm32: Calculate suitable PRESCALER value
Current driver set a fixed prescaler value for the lpuart
that caused certain baudrate configurations to fail due to
LPUARTDIV overflow the LPUART_BRR register.

This PR attempt to calculate a suitable PRESCALER for the
selected baudrate, throws error and return if it couldn't get
an optimal one.

Signed-off-by: Yong Cong Sin <yongcong.sin@gmail.com>
2022-03-02 09:23:25 -05:00
Julien D'ascenzio
f77cb92075 drivers/uart: stm32: don't call k_yield on poll_out
Some tests like:
    tests/kernel/sched/metairq/kernel.scheduler.metairq
    tests/kernel/profiling/profiling_api/kernel.common.profiling
    tests/kernel/sched/schedule_api/kernel.scheduler
    tests/kernel/sched/schedule_api/kernel.scheduler.multiq
    tests/kernel/profiling/profiling_api/kernel.common.profiling
    tests/kernel/workq/work_queue/kernel.workqueue

don't support that the current thread change when writing a message with
printk (which uses poll_out). So, we remove the call to k_yield which is
useful only for optimizing cpu usage by forcing a thread change if the
usart send stack is full.

Signed-off-by: Julien D'ascenzio <julien.dascenzio@paratronic.fr>
2022-03-02 09:22:57 -05:00
Julien D'ascenzio
d340ff111f drivers/uart: stm32: fix dead lock on poll_out
A dead lock could happen if 2 threads with differents priorities use
poll_out. In fact, the lock data->tx_lock could be lock by a thread with
lower priority and then a thread with higher priority can't take the
lock. There was a race condition here:

/* Wait for TXE flag to be raised */
while (1) {
	if (atomic_cas(&data->tx_lock, 0, 1)) {
		/* !!!!!!!! RACE CONDITION !!!!!!!!!!!!!!
		if (LL_USART_IsActiveFlag_TXE(UartInstance)) {
			break;
		}
		atomic_set(&data->tx_lock, 0);
	}
}

To fix race condition, the interrupts are locked in poll_out.

Signed-off-by: Julien D'ascenzio <julien.dascenzio@paratronic.fr>
2022-03-02 09:22:57 -05:00
Julien D'ascenzio
c9b24cf07d uart_stm32: Fix conflit between poll_out and irq API
A lock was added to manage situation where the API poll_out and irq API
are used in same time.

Signed-off-by: Julien D'ascenzio <julien.dascenzio@paratronic.fr>
2022-03-02 09:22:57 -05:00
Kweh Hock Leong
1c71036236 net: shell: Fix parser error on net ping command
The strtol() function use errno to return error code.
However, it is not being initialized in the parser_arg()
function before calling the strtol(). Thus, hitting error
when performing net ping command with -c / -i parameters.

Signed-off-by: Kweh Hock Leong <hock.leong.kweh@intel.com>
2022-03-02 07:34:24 -05:00
Chris Reed
fe53adec8e arm: cortex-m: initialise ptr_esf in get_esf() in fault.c.
This was producing a -Wsometimes-uninitialized warning.

Signed-off-by: Chris Reed <chris.reed@arm.com>
2022-03-02 07:33:24 -05:00
Robert Lubos
9b3a68b7d5 net: mqtt: Fix SOCKS5 setsockopt error handling
Transports should close the socket in case of `setsockopt()` failure,
otherwise we end up with a leaked socket, as it won't be closed
elsewhere.

Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
2022-03-02 07:32:29 -05:00
Robert Lubos
8546159275 net: arp: Fix ARP retransmission source address selection
There was a problem with source address selection for ARP
retransmissions, when an ARP entry was already pending. In such case,
the `entry` value passed to `arp_prepare()` is NULL, which in result
caused the `current_ip` variable being used as the source value. The
problem with this approach is, that the `current_ip` is only set in
IPv4 autoconf, the Ethernet L2 does not set this variable. In result,
every retransmission of an ARP packet was sent with unspecified source
address, preventing the response from being handled.

Fix this by partially restoring the behaviour of the ARP source address
assignment from before IPv4 autoconf was introduced. If the ARP is sent
by the IPv4 autoconf, use the `current_ip` value provided. If entry is
not set, use the source IPv4 address set in the actual data packet.
Otherwise, search for a source address on the interface corresponding to
the `entry`.

Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
2022-03-02 07:12:37 -05:00
Daniel Nejezchleb
49f35f3a00 net: sockets: Fixes net_pkt leak in accept
Fix net_pkt leak by increasing net_context the reference count earlier
in the zsock_accepted_cb() with instalment of the
zsock_received_cb() callback.

And consequently flushing recv_q and decrement net_context
reference count if zsock_accept_ctx() fails.

Signed-off-by: Daniel Nejezchleb <dnejezchleb@hwg.cz>
2022-03-02 07:12:28 -05:00
Daniel Nejezchleb
13571c4155 lib/os: fdtable: add locking to posix api
Added locking to posix read(), write(), close()
for additional protection.

In read() missing lock would create uneven calls to locking
mechanism in sockets.c after k_condvar_wait().
That results in socket lock not ever being unlocked

Signed-off-by: Daniel Nejezchleb <dnejezchleb@hwg.cz>
2022-03-02 07:12:17 -05:00
Daniel Nejezchleb
14d87fcb63 net: tcp: Fix possible deadlock in tcp_conn_unref()
This reverts commit e7489d8de7.

And fixes the deadlock by allowing only 1 thread to actualy clean up
the connection when the ref_count is 0.

Signed-off-by: Daniel Nejezchleb <dnejezchleb@hwg.cz>
2022-03-02 07:12:17 -05:00
Daniel Nejezchleb
f7f21cbc5f net: tcp: Fixed forever loop in tcp_resend_data
Increments send retry every time
after the tcp_send_data when resending.
That way unhandled return values can time
out after set amount of tcp_retries.

Signed-off-by: Daniel Nejezchleb <dnejezchleb@hwg.cz>
2022-03-02 07:12:09 -05:00
Krzysztof Chruscinski
98e79516bd net: ip: route: Fix log_strdup misuse
Log_strdup was used in NET_ASSERT macro which is not logging.
As a result linking fails when logging is disabled but asserts
are enabled.

Signed-off-by: Krzysztof Chruscinski <krzysztof.chruscinski@nordicsemi.no>
2022-03-02 07:11:51 -05:00
Tomasz Bursztyka
ad2d8fea73 net/icmpv4: Do not send error on a packet that was broadcasted
For instance, DHCP (UDP protocol) can send broadcasted packet and if we
no not serve the requested destination port, let's not send an error
back.

Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2022-03-02 07:11:34 -05:00
Tomasz Bursztyka
24b30abc65 net/icmpv4: Fix logging messagse
Invert src/dst strings, the icmpv4 error is sent from the dst (us) to
src (sender of the ipv4 packet that generated the error).

Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2022-03-02 07:11:34 -05:00
Ryan McClelland
c9f11ff697 cmake: fix multiple shield parsing
When multiple shields are defined, only the shield last in the -DSHIELD
list gets defined in `.config`. This is due to too many backslashes
used defining it for an env setting.

Signed-off-by: Ryan McClelland <ryanmcclelland@fb.com>
2022-03-02 07:11:23 -05:00
Binu Jacob
d52b43826e libc: newlibc: Fix recursive gettimeofday() calls on non-Posix systems
Calling gettimeofday() from _gettimeofday() in a non-Posix build
environment can result in a recursive call loop, causing a stack
overflow. Modify _gettimeofday() to return -1 for non-posix systems
(the previous behaviour that was added in #22508).

Fixes #41095

Signed-off-by: Binu Jacob <bjj@planetinnovation.com.au>
2022-03-02 07:11:08 -05:00
Szymon Janc
7cdc791b51 Bluetooth: L2CAP: Fix checking if LTK is present
This fix a typo where incorrect member of bt_keys was used for
checking if LTK is present. This was resulting in bogus results
depending on connection role and current identity used.

This was affecting L2CAP/LE/CFC/BV-25-C qualification test case.

Fixes: #42862

Signed-off-by: Szymon Janc <szymon.janc@codecoup.pl>
2022-03-02 07:09:41 -05:00
Keith Packard
6a8023a18c arm: Use correct macro for z_interrupt_stacks declaration in stack.h
There are two macros for declaring stack arrays:

K_KERNEL_STACK_ARRAY_DEFINE:

	Defines the array, allocating storage and setting the section name

K_KERNEL_STACK_ARRAY_EXTERN

	Declares the name of a stack array allowing code to reference
	the array which must be defined elsewhere

arch/arm/include/aarch32/cortex_m/stack.h was mis-using
K_KERNEL_STACK_ARRAY_DEFINE to declare z_interrupt_stacks by sticking
'extern' in front of the macro use. However, when this macro also set
the object file section for the symbol, having two of those caused a
conflict in the compiler due to the automatic unique name mechanism used
for sections to allow unused symbols to be discarded during linking.

This patch makes the header use the correct macro.

Signed-off-by: Keith Packard <keithp@keithp.com>
2022-03-02 07:09:26 -05:00
Michel Haber
229f0e259f timing: use runtime cycles for cortex-m systick
Use sys_clock_hw_cycles_per_sec() instead of
CONFIG_SYS_CLOCK_HW_CYCLES_PER_SEC to determine clock cycles.

Signed-off-by: Michel Haber <michel-haber@hotmail.com>
2022-03-02 07:06:40 -05:00
Alexander Mihajlovic
6f6a77a492 drivers: adc: stm32: Clear ADRDY before waiting
Clear ADRDY before enabling ADC to ensure the subsequent
wait for ADRDY does not stop prematurely in case ADRDY
was already set.

The "ADC on-off control" sections of the following reference manuals
were consulted. That gives at least one instance per series affected
by this change, even if not every affected MCU is covered.

- RM0438 (STM32L552xx and STM32L562xx)
- RM0351 (STM32L47xxx, STM32L48xxx, STM32L49xxx and STM32L4Axxx)
- RM0434 (STM32WB55xx and STM32WB35xx)
- RM0454 (STM32G0x0)
- RM0440 (STM32G4 Series)
- RM0399 (STM32H745/755 and STM32H747/757)
- RM0433 (STM32H742, STM32H743/753 and STM32H750)
- RM0453 (STM32WL5x)

Signed-off-by: Alexander Mihajlovic <a@abxy.se>
2022-03-02 03:53:20 -05:00
Alexander Mihajlovic
bdbab499b5 drivers: adc: stm32: Add function to enable ADC consistently
Use a wrapper for LL_ADC_Enable that also waits for ADRDY if required
by the SoC to make sure it's properly enabled everywhere this is done.

Signed-off-by: Alexander Mihajlovic <a@abxy.se>
2022-03-02 03:53:20 -05:00
Francois Ramu
532806e063 drivers: adc: driver setting the oversampling for stm32wl
RM 0453: the sw is allowed to write the Oversampling
ratio or shift of the ADC Config.Reg.2 only when ADSTART = 0
(no conversion is on-going). So disabling it will be stopped.

Signed-off-by: Francois Ramu <francois.ramu@st.com>
2022-03-02 03:53:20 -05:00
Francois Ramu
aecbdb7285 drivers: adc: driver setting the resolution for stm32wl
RM 0453: the sw is allowed to write the Data Resolution bits
of the ADC Config.Reg.1 only when ADEN = 0 (ADC disable).

Signed-off-by: Francois Ramu <francois.ramu@st.com>
2022-03-02 03:53:20 -05:00
Pete Dietl
8369a0a3eb drivers: adc: stm32: Disable ADC before calibration
The STM32 docs state that the ADC may not be calibrated unless
the ADC is disabled (ADEN=0). This commit implements this constraint

Fixes #40936

Signed-off-by: Pete Dietl <petedietl@gmail.com>
2022-03-02 03:53:20 -05:00
Robert Lubos
73d79674d7 net: sockets: tls: Fix ZSOCK_POLLHUP detection
The previous approach to detect if the underlying transport was closed
(by checking the return value of `mbedtls_ssl_read()` was not right,
since the function call does not request any data - therefore 0 as a
return value is perfectly fine.

Instead, rely on the underlying transport ZSOCK_POLLHUP event - if it
reports that the connection ended, forward the event to the application.

Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
2022-02-24 11:22:18 -05:00
Robert Lubos
7654997990 net: sockets: Report ZSOCK_POLLHUP when socket is in EOF state
Report ZSOCK_POLLHUP event if peer closed the connection, and thus the
socket is in EOF state.

Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
2022-02-24 11:22:18 -05:00
Krzysztof Chruscinski
cf58352c22 logging: Fix counting of buffered messages
When message is dropped then log_process is called with
bypass flag set and additionally z_log_dropped() is called.
In both functions counter of buffered messages was decremented.
That resulted in counter being decremented twice. It resulted
in logging misbehavior after messages being dropped (delayed
processing). Fixing it by decrementing the counter in log_process
only when bypass flag is not set.

Signed-off-by: Krzysztof Chruscinski <krzysztof.chruscinski@nordicsemi.no>
2022-02-24 11:21:16 -05:00
Krzysztof Chruscinski
a618d6ff81 logging: Improve algorithm for waking up the thread
Use value returned by atomic_inc to decide on action.
Previously direct value was used and that could lead to
delays in logging processing because thread waking up
could be mishandled.

Signed-off-by: Krzysztof Chruscinski <krzysztof.chruscinski@nordicsemi.no>
2022-02-24 11:21:16 -05:00
Guillaume Lager
02275d8013 drivers: console: gsm_mux: fix length indicator
The MSB and LSB were inverted for length > 127
Fixes #41077

Signed-off-by: Guillaume Lager <g.lager@innoseis.com>
2022-02-24 11:20:30 -05:00
Yong Cong Sin
3d61857d2f kernel: workq: Fix type errors in delayable work handlers
A common pattern here was to take the work item as the subfield of a
containing object. But the contained field is not a k_work, it's a
k_work_delayable.

Things were working only because the work field was first, so the
pointers had the same value. Do things right and fix things to
produce correct code if/when that field ever moves within delayable.

Signed-off-by: Yong Cong Sin <yongcong.sin@gmail.com>
2022-02-24 11:19:15 -05:00
Robert Lubos
0d70ee6017 net: sockets: Use struct timeval provided by libc
Instead of redefining own `struct zsock_timeval` type at the socket
layer, use a standard type provided by libc. This prevents the
compliation errors when application includes both, `net/socket.h` and
standard C header defining `struct timeval` (sys/time.h).

Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
2022-02-24 11:18:52 -05:00
Robert Lubos
43e116e496 net: route: Verify if neighbor entry is in use when iterating
Verify the `ref` value of the neighbor entry in `net_route_foreach()`,
so that it only executes the callback on routes in use. Otherwise, the
function could call the callback for the route that has already been
deleted.

This could be encountered when executing `net route` shell command,
which printed the already deleted routes along the existing ones.

Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
2022-02-24 11:18:22 -05:00
Robert Lubos
d4d569b334 net: route: Fix struct net_route_nexthop leak
When new route is allocated, a corresponding NBR entry (containing
`struct net_route_nexthop` data) is allocated from
`net_route_nexthop_pool`. When the route was deleted however, the entry
was not freed - only the "core" neighbor entry from the neighbor
management module (nbr.c) was dereferenced. This lead to a resource
leak, effecitevly leaking one `net_route_nexthop_pool` entry for each
deleted route.

Fix this, by defreferencing the NBR entry corresponding to the `struct
net_route_nexthop` data of the deleted route when route is removed.

Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
2022-02-24 11:18:22 -05:00
Robert Lubos
c4bb210f4a net: sockets: Simplify common getsockname() implementation
Simplify common `getsockname()` implementation by using VTABLE_CALL()
macro, in the same way as other socket calls do. This additionally
allows to cover the case, when `getsockname()` is not implemnented by
particular socket implementation, preventing the crash.

Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
2022-02-24 11:17:48 -05:00
Andrei Emeltchenko
8f24184e1b net: tcp: Remove unneeded declaration
Remove unneeded declaration and change include logic.

Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
2022-02-24 11:17:29 -05:00
Andrei Emeltchenko
728ed5e4a6 net: tcp: Remove redundant TCP option definitions
Use the same TCP option definitions.

Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
2022-02-24 11:17:29 -05:00
Jukka Rissanen
203ec2a124 net: tcp2: Send our MSS to peer
Send our MSS to peer when sending SYN or SYN-ACK.

Fixes #30367

Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2022-02-24 11:17:29 -05:00
Marius Scholtz
e34b8d5b58 modbus: serial: Fix incomplete transmission issue
This patch is to fix an issue where the transceiver chip is
disabled before it has transmitted all data. This causes the
message to be corrupted because the last few bytes are missing.

The fix adds a check to make sure the transmission is completed
before disabling the transceiver.

Signed-off-by: Marius Scholtz <mariuss@ricelectronics.com>
2022-02-24 11:16:51 -05:00
Guillaume Lager
f7358ea85a driver: modem: Fix mux device name comparison
CONFIG_UART_MUX_DEVICE_NAME is used as a prefix for the uart muxes
name. Pointer comparison will always return false

Fix #39774

Signed-off-by: Guillaume Lager <g.lager@innoseis.com>
2022-02-24 11:15:43 -05:00
Robert Lubos
1d61b94eb2 net: sockets: getaddrinfo: Fix possible crash when callback is delayed
In case system workqueue processing is delayed for any reason, and
resolver callback is executed after getaddrinfo() call already timed
out, the system would crash as the callback makes use of the user data
allocated on the stack within getaddrinfo() function.

Prevent that, by cancelling the DNS request explicitly from the
getaddrinfo() context, therefore preventing the resolver callback
from being executed after the getaddrinfo() call ends.

Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
2022-02-24 11:15:20 -05:00
Robert Lubos
8bc6f2cf34 net: http_client: Set body_start pointer unconditionally
Set `body_start` pointer regardless of the body position in the recv
buffer. In result, the pointer shall indicate correctly position of the
body for each fragment, it's also explicit now that if the pointer is
not set for a fragment, there's no body in that particular fragment.

Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
2022-02-24 11:14:40 -05:00
Yong Cong Sin
1a7fc79c75 net: mgmt: Use mutex for net_mgmt_lock
Conceptually the net_mgmt_lock should be a mutex instead of a
semaphore. It is easier to identify the owner of a mutex and
debug when deadlock happens, so convert it.

Signed-off-by: Yong Cong Sin <yongcong.sin@gmail.com>
2022-02-23 10:59:43 -05:00
Sylvio Alves
b805164907 soc: esp32: use PYTHON_EXECUTABLE from build system
ESP32 build is failing after f-string is added into python
files. This sets esp32 build to use Zephyr's build system python
version.

Signed-off-by: Sylvio Alves <sylvio.alves@espressif.com>
2022-02-22 10:28:20 +01:00
Vinayak Kariappa Chettimada
54dc715b8d Bluetooth: Controller: Fix Periodic Adv EVENT_OVERHEAD_START_US jitter
As EVENT_OVERHEAD_START_US offset is used in ticks unit in
LLL, ULL scheduling using ticker should also use ticks unit
for EVENT_OVERHEAD_START_US when reducing the first Periodic
Advertising event preparation.

Relates to commit 858dc7fab4 ("Bluetooth: controller: Fix
EVENT_OVERHEAD_START_US jitter").

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2022-02-09 13:26:36 +01:00
Christopher Friedt
96cfb7ac9f doc: spinlock: ensure spinlock api is added to doxygen
Previously, `k_spin_lock()` and friends had broken links
in html docs.

Fixes #42373

Signed-off-by: Christopher Friedt <chrisfriedt@gmail.com>
2022-02-09 06:28:50 -05:00
Krzysztof Chruscinski
8a1d3a0a40 tests: logging: log_api: Add test for LOG_PRINTK
Added test that validates CONFIG_LOG_PRINTK option where
printk is redirected to logging.

Signed-off-by: Krzysztof Chruscinski <krzysztof.chruscinski@nordicsemi.no>
2022-02-09 06:26:13 -05:00
Krzysztof Chruscinski
533d284bd3 tests: logging: log_core_additional: Add panic handler for test backend
Backend implemented in the test did not implemented panic
function and test crashed when log_panic was used.

Signed-off-by: Krzysztof Chruscinski <krzysztof.chruscinski@nordicsemi.no>
2022-02-09 06:26:13 -05:00
Krzysztof Chruscinski
5b690c698e logging: log_output: Fix immediate output for big endian
Pointer to int was passed to a function which expected pointer to
uint8_t. There was an unexpected content for big endian as the
highest byte was read instead of the lowest which contained valid char.

Signed-off-by: Krzysztof Chruscinski <krzysztof.chruscinski@nordicsemi.no>
2022-02-09 06:26:13 -05:00
Krzysztof Chruscinski
139f200992 logging: printk: Fix LOG_PRINTK for v2
Fixed a dependency from printk.h to logging headers which in
certain configurations could lead to circular dependencies.
Cleaned up printk.c to call z_log_vprintk from vprintk.

Signed-off-by: Krzysztof Chruscinski <krzysztof.chruscinski@nordicsemi.no>
2022-02-09 06:26:13 -05:00
Krzysztof Chruscinski
753b1d7f23 lib: os: printk: Minor refactoring
Refactoring to remove code redundancy caused by splitted
handling based on USERSPACE enabled.

Signed-off-by: Krzysztof Chruscinski <krzysztof.chruscinski@nordicsemi.no>
2022-02-09 06:26:13 -05:00
Jordan Yates
f51223b449 doc: guides: index: document Doxygen linking
Document the existance of `zephyr.tag` by providing a link on the main
documentation guide page. Also include an example of how to use this
file in an external project.

Implements #41529.

Signed-off-by: Jordan Yates <jordan.yates@data61.csiro.au>
2022-02-09 06:24:23 -05:00
Jordan Yates
2cf6ae69fc doc: generate Doxygen tag file
Generate the Doxygen tag file to static html sources directory so that
external documentation can use it as a source for linking. See:
    https://www.doxygen.nl/manual/external.html

Signed-off-by: Jordan Yates <jordan.yates@data61.csiro.au>
2022-02-09 06:24:23 -05:00
Gerard Marull-Paretas
13dfae7410 doc: conf: specify which variable is used for output directory
This is needed so that it can be re-used by other Doxygen configuration
entries.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2022-02-09 06:24:23 -05:00
Gerard Marull-Paretas
262497f3a8 doc: extensions: doxyrunner: do not modify extension config
After the introduction of #41688, doxyrunner extension modifies the
fmt_vars content (from a variable defined in `conf.py`) when the output
directory variable is defined. This means that Sphinx will always get an
outdated environment and so will always perform a full build instead of
an incremental build. This patch makes a copy first to prevent this
situation.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2022-02-09 06:24:23 -05:00
Gerard Marull-Paretas
4bde9471c9 doc: extensions: doxyrunner: add doxyrunner_outdir_var option
The doxyrunner_outdir_var option allows to specify which variable (if
any) is used to represent the output directory (as used by
OUTPUT_DIRECTORY). This makes sure that other options referencing it are
processed correctly, since the output directory is not passed as a
variable.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2022-02-09 06:24:23 -05:00
Jordan Yates
17c54a0072 lora: sx126x: don't re-enable interrupt in sleep
Don't re-enable the DIO1 interrupt when the modem is in sleep mode. This
fixes the power regression introduced in Zephyr v2.7.0 #41026.

Signed-off-by: Jordan Yates <jordan.yates@data61.csiro.au>
2022-02-09 06:23:10 -05:00
Jeremy Wood
3ebd567041 drivers: can: m_can: fix reconfiguring bitrate
Set enable configuration change bit in can_mcan_set_timing() because
the NBTP register can only be changed if we're in init mode AND
configuration change bit is set, per MCU docs.

Signed-off-by: Jeremy Wood <jeremy@bcdevices.com>
2022-02-08 12:11:41 -05:00
Krzysztof Chruscinski
822b82faf0 logging: Fix tracking of buffered messages
Algorithm was failing in case when overflow mode was enabled
but allocation of new message failed. It could happen if message
size exceeded buffer size. Losing track of buffered messages
can lead to logging processing freeze.

Signed-off-by: Krzysztof Chruscinski <krzysztof.chruscinski@nordicsemi.no>
2022-02-08 12:10:45 -05:00
Krzysztof Chruscinski
750b212ac8 logging: Fix tracking of active messages
A variable is tracking number of buffered messages. This is used
to trigger processing thread in certain cases. Counter was not
handled correctly when message was dropped. In certain cases that
can lead to hanging of log processing.

Added counter decrementation in the callback called whenever
message is dropped.

Signed-off-by: Krzysztof Chruscinski <krzysztof.chruscinski@nordicsemi.no>
2022-02-08 12:10:45 -05:00
Erwan Gouriou
1903793c89 boards: h747/h745: Update dual core flash and debug instructions
Review flashing and debugging instructions on these dual core boards.

Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
2022-02-02 16:02:18 -05:00
Emil Lindqvist
8f539523b6 logging: fix timestamp func overwrite on log2
When LOG2 is enabled, timestamp func which was just set
according to various conditions, is overwritten using sysclock.
Since sysclock is very fast, it will cause uint32_t to wrap very
fast and cause the time to start over from 0 often.

This commit combines the two statements doing the same thing,
to one statement.

Signed-off-by: Emil Lindqvist <emil@lindq.gr>
2022-01-26 07:22:42 -05:00
NingX Zhao
22fc985376 poll: modify the function z_vrfy_k_poll
Removing the 'U' to avoid the type of num_events changed.
And make sure it is meaningful Z_SYSCALL_VERIFY micro.

Fixed #40614

Signed-off-by: NingX Zhao <ningx.zhao@intel.com>
2022-01-25 14:05:49 -05:00
Carlo Caione
3cb83d1bbe kernel: Reset the switch_handler only in the arch code
Avoid setting the switch_handler in the z_get_next_switch_handle() code
when the context is not fully saved yet to avoid a race against other
cores waiting on wait_for_switch().

See issue #40795 and discussion in #41840

Signed-off-by: Carlo Caione <ccaione@baylibre.com>
2022-01-25 10:52:54 -05:00
Johann Fischer
e23cd666c3 drivers: ssd16xx: fix driver initialization
ssd16xx driver is not well designed and does not pass configuration
via device->config but via struct ssd16xx_data, this was not taken
into account in the commit 4d6d50e2bc
("display: ssd16xx: convert to spi_dt_spec").

Signed-off-by: Johann Fischer <johann.fischer@nordicsemi.no>
2022-01-15 12:28:25 -05:00
Johann Fischer
1630dac971 include: usb: add alignment attribute to macro USBD_CFG_DATA_DEFINE
It could be observed on native_posix_64 platform that
without alignment attribute the usb_cfg_data structures
are placed with a gap or padding in specified RAM section.
This breaks the possibility to iterate over the structures.

Signed-off-by: Johann Fischer <johann.fischer@nordicsemi.no>
2022-01-15 12:28:15 -05:00
Patric Karlström
f21e74cb07 posix: Make clock_settime/gettime REALTIME thread-safe
Fixes #23419

Signed-off-by: Patric Karlström <pakar@imperialnet.org>
2022-01-15 12:27:47 -05:00
Gerson Fernando Budke
dfb5ef29ef riscv: linker.ld: Fix undefined reference linker error
The commit a28830b aligned the data and rename some symbols.  However
there are two symbols at riscv linker script that were missing, which
causes below linker error:

kernel/xip.c:28: undefined reference to `__itcm_load_start'
kernel/xip.c:43: undefined reference to `__dtcm_data_load_start'

Rename below symbols to fix the issues.

__itcm_rom_start -> __itcm_load_start
__dtcm_data_rom_start -> __dtcm_data_load_start

Signed-off-by: Gerson Fernando Budke <nandojve@gmail.com>
2022-01-15 12:23:44 -05:00
Yong Cong Sin
419583697e drivers: watchdog: STM32G0X: clock DBGMCU before configuring
Enable the clock for the DBGMCU peripherals so that it can be
configured.

Signed-off-by: Yong Cong Sin <yongcong.sin@gmail.com>
2022-01-15 12:22:02 -05:00
Fabio Baltieri
dddb9f14d5 boards: nucleo_h745zi_q: enable POWER_SUPPLY_DIRECT_SMPS
The board is fitted with the SMPS components and have no path from
VDD_MCU to VDD_LDO.

The stm32h7_init code used to default to SMPS on supported SoC but has
been changed in 22186c7c51 to only use SMPS if explicitly configured to
do so. This is causing the board to become unresponsive after a power
cycle when flashed with the current defconfig, and needs to be started
pulling BOOT0 high to be recovered.

Setting CONFIG_POWER_SUPPLY_DIRECT_SMPS restores the intended behavior.

Signed-off-by: Fabio Baltieri <fabio.baltieri@gmail.com>
2022-01-15 12:15:32 -05:00
Dominik Ermel
d10cb9b25b mgmt/mcumgr: Fix serial packet length not including CRC16
The length field of packet has not been including the length of
CRC16 field.

Fixes #39546

Signed-off-by: Dominik Ermel <dominik.ermel@nordicsemi.no>
2022-01-15 12:07:35 -05:00
Dominik Ermel
f9dee5613a mgmt/mcumgr: Correct packet length information
The packet length should include length of CRC16.

Signed-off-by: Dominik Ermel <dominik.ermel@nordicsemi.no>
2022-01-15 12:07:35 -05:00
Henrik Brix Andersen
8af83eac4f drivers: can: change can_tx_callback_t function signature
Change the can_tx_callback_t function signature to use an "int" (not an
uint32_t) for representing transmission errors.

The "error" callback function parameter is functionally equivalent to
the return value from can_send() and thus needs to use the same data
type and needs to be able to hold negative errno values.

Signed-off-by: Henrik Brix Andersen <hebad@vestas.com>
2022-01-15 12:01:35 -05:00
Alexandre Bourdiol
956bb90b08 boards: arm: stm32h7: select direct SMPS for both disco boards
Direct SMPS is the default configuration out of the box of:
* stm32h474i_disco
* stm32h735g_disco

Fixes #34732

Signed-off-by: Alexandre Bourdiol <alexandre.bourdiol@st.com>
2022-01-06 17:39:00 -05:00
Gennady Kovalev
2f24663c38 drivers: clock_control: More power supply modes for STM32H7
STM32H7 has different power supply modes but now Zephyr supports just
LDO and direct SMPS. This commit introduses POWER_SUPPLY_CHOICE
configuration parameter and add support for missed power supply modes.

Signed-off-by: Gennady Kovalev <gik@bigur.com>

Fixes #40730.
2022-01-05 13:11:32 -05:00
Erwan Gouriou
af35240cdd include/drivers/clock_control: stm32h7: Add missing symbol PLL SRC CSI
Symbol STM32_PLL_SRC_CSI was missing and was preventing the config
to be used.

Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
2022-01-05 07:32:45 -05:00
Manojkumar Subramaniam
e00e2b8754 soc: arm: st_stm32: use SMPS power supply only if enabled
Use SMPS power supply only if enabled.

The default power supply configuration for the
NUCLEO board with -Q subfix is SMPS,
so it's essential to match with hardware configuration
to avoid deadlocks due to mismatch.

if a custom board with LDO configuration is in use,
then no need to enable `CONFIG_POWER_SUPPLY_SMPS`

Signed-off-by: Manojkumar Subramaniam <manoj@electrolance.com>
2022-01-05 07:29:00 -05:00
Manojkumar Subramaniam
9e2bb08928 drivers: clock_control: stm32h7: Add logic to handle SMPS config
Some STM32 SoC supports an internal SMPS

Signed-off-by: Manojkumar Subramaniam <manoj@electrolance.com>
2022-01-05 07:29:00 -05:00
Manojkumar Subramaniam
357d9d3220 soc: arm: st_stm32: add kconfig entry for STM32 SMPS
Add support for SMPS

Signed-off-by: Manojkumar Subramaniam <manoj@electrolance.com>
2022-01-05 07:29:00 -05:00
Christopher Friedt
e4da3e5280 release: Bump release to 2.7.1
Bump version to 2.7.1

Signed-off-by: Christopher Friedt <chrisfriedt@gmail.com>
2021-12-15 11:34:12 -05:00
Christopher Friedt
604b40118f release: additional entries in release notes
* Bluetooth Host qualification in 2.7 (#39882)
* sensor: qdec_nrfx: PM callback.. (#39687)
* drivers: ieee802154_dw1000: use dedicated wq (#41237)
* spi: slave: division by zero in timeout calculation (#39609)
* Possible bug or undocumented behaviour of spi_write (#39594)

Signed-off-by: Christopher Friedt <chrisfriedt@gmail.com>
2021-12-15 11:34:12 -05:00
Krzysztof Kopyściński
7eb6869b24 bluetooth: tester: allow to set DisplayYesNo IO capability
This allows us to run SCPK tests with it.

signed-off-by: Krzysztof Kopyściński <krzysztof.kopyscinski@codecoup.pl>
2021-12-15 10:50:07 -05:00
Andrzej Głąbek
5c08f183f2 drivers: spi_context: Correct alignment of LOG_DBG() parameters
so that the call looks nicer.

Signed-off-by: Andrzej Głąbek <andrzej.glabek@nordicsemi.no>
2021-12-15 10:49:27 -05:00
Andrzej Głąbek
a74b652d52 drivers: spi_context: Fix handling of zero-length buffers
In some cases, it is quite useful to have the possibility to also
include zero-length buffers in a buffer set used in transfers
(for example, when frames in a protocol consist of several parts,
of which some are optional). So far, the behavior of spi_context
update functions was that the transfer in a given direction was
finished when a zero-length buffer was encountered in the buffer
set. Change those functions to simply skip such buffers. Correct
in the same way also the spi_context_buffers_setup() function.

Signed-off-by: Andrzej Głąbek <andrzej.glabek@nordicsemi.no>
2021-12-15 10:49:27 -05:00
Andrzej Głąbek
5db25d9882 drivers: spi_context: Do not use transfer timeout in slave mode
Do not use any timeout in the slave mode, as in this case it is not
known when the transfer will actually start and what the frequency
will be.

Signed-off-by: Andrzej Głąbek <andrzej.glabek@nordicsemi.no>
2021-12-15 10:49:27 -05:00
Johann Fischer
525c112ac3 drivers: ieee802154_dw1000: use dedicated workqueue
Driver has dedicated workqueue for IRQ processing.
Submit work to dedicated workqueue intead of system workqueue.
It also fixes driver functionality when NET_TC_TX_COUNT is set to 0.

Signed-off-by: Johann Fischer <johann.fischer@nordicsemi.no>
2021-12-15 10:08:11 -05:00
Gerard Marull-Paretas
38bd485a59 sensor: qdec_nrfx: fix PM callback signature
The PM action callback had an incorrect signature, probably a leftover
from the actions conversion.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2021-12-15 09:55:43 -05:00
Christopher Friedt
18b08740e7 release: v2.7.1 release notes
Release notes for 2.7.1 with list of fixed bugs.

Signed-off-by: Christopher Friedt <chrisfriedt@gmail.com>
2021-12-15 08:27:56 -05:00
Evgeniy Paltsev
edd1612388 tests: tracing.osawareness.openocd cleanup
Move all config options to prj.conf. No functional
changes intended.

Signed-off-by: Eugeniy Paltsev <Eugeniy.Paltsev@synopsys.com>
Signed-off-by: Evgeniy Paltsev <PaltsevEvgeniy@gmail.com>
2021-12-14 09:11:16 -05:00
Evgeniy Paltsev
142be60c2a tests: fix tracing.osawareness.openocd when thread names disabled
tracing.osawareness.openocd relies on the CONFIG_THREAD_NAME is
enabled, however we don't enable it in test config.

Fix that.

Signed-off-by: Eugeniy Paltsev <Eugeniy.Paltsev@synopsys.com>
Signed-off-by: Evgeniy Paltsev <PaltsevEvgeniy@gmail.com>
2021-12-14 09:11:16 -05:00
Evgeniy Paltsev
b0618e11fc tests: fix tracing.osawareness.openocd for SMP platforms
The tracing.osawareness.openocd doesn't support executing
on multicore Zephyr. However we disable multiple CPUs
usage in two different ways for this test:
 - by setting CONFIG_MP_NUM_CPUS to 1
 - by setting CONFIG_SMP to n

It's not correct for all SMP platforms to disable SMP. As
it is also excessive (we can guarantee the execution on
single core by setting CONFIG_MP_NUM_CPUS=1) let's drop
SMP disabling.

Signed-off-by: Eugeniy Paltsev <Eugeniy.Paltsev@synopsys.com>
Signed-off-by: Evgeniy Paltsev <PaltsevEvgeniy@gmail.com>
2021-12-14 09:11:16 -05:00
Henrik Brix Andersen
05318b5349 drivers: can: fix can_configure() when CAN-FD is enabled
Currently, can_configure() pass a hard-coded 0 for the data bitrate
(which is only used for CAN-FD), breaking this API for CAN-FD enabled
applications.

Instead pass in the provided bitrate for both arbitration phase and data
phase.

Fixes: #34375

Signed-off-by: Henrik Brix Andersen <hebad@vestas.com>
2021-12-09 20:01:00 -05:00
Szymon Janc
a14b830775 test/bluetooth/tester: Re-pair on lost bond
If IUT is acting as a central device and peer lost bond we need
to re-pair to restore bond. PTS is not sending any WID for this
so bonding needs to be initiated implicitly by IUT.

This was affecting GAP/SEC/AUT/BV-25-C qualification test case.

Signed-off-by: Szymon Janc <szymon.janc@codecoup.pl>
2021-12-08 09:12:58 -05:00
Daniel DeGrasse
644ebe5494 drivers: mcux_flexspi: Default logging to disabled when XIP is used
Program flow will behave incorrectly (memory and instruction fetches
return invalid data) if Flexspi is accessed by the Flexspi driver while
being used as XIP memory by the Cortex M7.

Set logging to disabled by when XIP mode is used in the memc and
flexspi drivers, and warn the user if they attempt to enable it.

Fixes #40133

Signed-off-by: Daniel DeGrasse <daniel.degrasse@nxp.com>
2021-12-08 08:57:39 -05:00
Christopher Friedt
d80eaa357a tests: libc: minimal: Add tests for qsort()
This change adds tests for qsort().

Signed-off-by: Christopher Friedt <chrisfriedt@gmail.com>
2021-12-08 08:40:32 -05:00
Christopher Friedt
f66b26e28d libc: minimal: add qsort to the minimal libc
This change implements qsort() for the minimal libc via Heapsort.

Heapsort time complexity is O(n log(n)) in the best, average,
and worst cases. It is O(1) in space complexity (i.e. sorts
in-place) and is iterative rather than recursive. Heapsort is
not stable (i.e. does not preserve order of identical elements).

On cortex-m0, this implementation occupies ~240 bytes.

Fixes #28896

Signed-off-by: Christopher Friedt <chrisfriedt@gmail.com>
2021-12-08 08:40:32 -05:00
Daniel DeGrasse
078269364a soc: rt6xx: Default flexspi logging to disabled
RT600 uses the mcux flexspi driver, which can produce RWW hazards when
calling code linked into flash (such as the logging subsystem). Disable
logging in flexspi driver by default for RT600 series.

Fixes #40744

Signed-off-by: Daniel DeGrasse <daniel.degrasse@nxp.com>
2021-12-06 08:11:23 -05:00
Anas Nashif
9039be480b tests: m2gl025_miv: exclude slow platform from some tests
This platform is slow on some tests and times out on non-hardware
related tests, so exclude it or increase timeout for some of the tests
to avoid false negatives in the test results due to timeouts.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2021-12-03 08:40:59 -05:00
Stephanos Ioannidis
f9cafd218f tests: cpp: libcxx: Set minimum RAM requirement for full newlib test
This commit sets the minimum RAM requirement for the full newlib test
(`cpp.libcxx.newlib`) to 24 KiB so that only the target platforms that
can provide sufficient RAM area for the newlib heap are selected.

In case of the newlib full variant, the minimum required newlib heap
size, specified by CONFIG_NEWLIB_LIBC_MIN_REQUIRED_HEAP_SIZE, is 8192.

Signed-off-by: Stephanos Ioannidis <root@stephanos.io>
2021-12-03 08:40:35 -05:00
Stephanos Ioannidis
9c23f6a2c9 riscv: Fix C++ exception handling info linking
The RISC-V architecture linker script was including `cplusplus-ram.ld`
linker script before `__data_region_start`, and this caused the content
of `.gcc_except_table` section to be not copied to the RAM by the
`z_data_copy` function; leading to the C++ exception handling
malfunction.

This commit relocates the `cplusplus-ram.ld` linker script inclusion
such that the contents of the relevant sections are properly copied by
the `z_data_copy` function.

Signed-off-by: Stephanos Ioannidis <root@stephanos.io>
2021-12-03 08:40:35 -05:00
Torsten Rasmussen
9118a7a8be twister: remove CMAKE_EXPORT_COMPILE_COMMANDS=1
The -DCMAKE_EXPORT_COMPILE_COMMANDS=1 is removed from twisterlib.py as
it is now always set by the Zephyr build system.

Signed-off-by: Torsten Rasmussen <Torsten.Rasmussen@nordicsemi.no>
2021-12-03 07:37:54 -05:00
Torsten Rasmussen
1d67f68ee1 scripts: support compile_commands.json in gen_app_partitions.py
Fixes: #40590

This commit updates gen_app_partitions.py to include only files present
in the current build by extracting the information from the CMake
generated `compile_commands.json` file.

This ensures that object files in sub-projects, such as `empty_cpu0`,
will not be considered by the script.

Using the compile_commands.json instead of walking the whole build tree
for finding object files also improves performance:

Time of executing `gen_app_partitions.py` (Old):
__________________________
Executed in  480.06 millis
   usr time  425.83 millis
   sys time   49.55 millis

Time of executing `gen_app_partitions.py` (New):
________________________________________________________
Executed in   76.22 millis
   usr time   49.00 millis
   sys time   24.59 millis

Signed-off-by: Torsten Rasmussen <Torsten.Rasmussen@nordicsemi.no>
2021-12-03 07:37:54 -05:00
Anas Nashif
f3169352fd scripts: gen_app_partitions: do not load empty files
Do not load empty files through the ELF parser and raise exception when
magic number of ELF is not matched.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2021-12-02 23:53:10 -05:00
Anas Nashif
d98d138b4b actions: twister: remove existing ccache directory
if .ccache exists, remove it and replace it with new .ccache directory.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2021-12-02 23:53:10 -05:00
Anas Nashif
ea7c9116e6 actions: twister: determine nodes in python script
Improve calculation of matrix and move calculations from workflow to the
testplan script. We now generate a file that can be parsed by the action
with the data needed to start twister with the right number of nodes.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2021-12-02 23:53:10 -05:00
Anas Nashif
ce3e0c9a42 actions: fix filtering for clang action
Do not invoke --integration when dealing with one platform only and
generate testplan only for the needed platforms.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2021-12-02 23:53:10 -05:00
Anas Nashif
7df4bffa19 ci: test_plan: fix pylint warnings
Fix some of the warnings reported by pylint.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2021-12-02 23:53:10 -05:00
Anas Nashif
72f8d81d57 actions: twister: limit daily job to 60 builders
Keep some builders available for pull requests.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2021-12-02 23:53:10 -05:00
Anas Nashif
43274af272 actions: twister: do not schedule on non main branches
We do not want to schedule jobs on branches other than the main branch.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2021-12-02 23:53:10 -05:00
Anas Nashif
0abe60b1c2 actions: twister: upload testplan as an artifact
Upload test plan file as an artifact for later verification.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2021-12-02 23:53:10 -05:00
Anas Nashif
c9e1bf4509 actions: twister: load modules from cache
We have a local cache, so tell west to clone modules from cache if
available.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2021-12-02 23:53:10 -05:00
Anas Nashif
7c69cbc153 actions: twister: run tests on all platforms when changed
When tests are changes, run them on all supported platformed, not only
integration platforms.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2021-12-02 23:53:10 -05:00
Anas Nashif
748bee1180 actions: twister: apply a new strategy from smaller test plans
When the number of tests is smaller, but not too small, we still run on
10 builders, if the test is small enough however, we will determine the
number of builders automatically.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2021-12-02 23:53:10 -05:00
Jamie McCrae
d8171312a4 boards: arm: bt610: Rename from bt6x0
The BT6x0 board configuration is only valid for the BT610 device,
therefore rename the boards file to BT610

Signed-off-by: Jamie McCrae <jamie.mccrae@lairdconnect.com>
2021-12-02 11:09:16 -05:00
Szymon Janc
652f04f6ca tests: bluetooth: tester: Fix memory corruption in reconfigured_cb
Pass proper length when memsetting struct.

Signed-off-by: Szymon Janc <szymon.janc@codecoup.pl>
2021-12-02 11:08:48 -05:00
Szymon Janc
d72602d95b bluetooth: ATT: Ignore signed writes on EATT bearer
Core Specification 5.3 Vol 3. Part G. 4.2:
The Signed Write Without Response sub-procedure shall only be supported
on the LE Fixed Channel Unenhanced ATT bearer.

This was affecting GATT/SR/GAW/BI-38-C qualification test.

Signed-off-by: Szymon Janc <szymon.janc@codecoup.pl>
2021-11-30 21:30:09 -05:00
Szymon Janc
b156e0fadc Bluetooth: Disconnect L2CAP channel if peer sent too much data
This was affecting L2CAP/LE/CFC/BV-26-C, L2CAP/LE/CFC/BV-27-C,
L2CAP/ECFC/BV-33-C and L2CAP/ECFC/BV-34-C qualification test cases.

Signed-off-by: Szymon Janc <szymon.janc@codecoup.pl>
2021-11-30 07:19:53 -05:00
Daniel N. Hansten
422546623d drivers: led: pca9633: add support for multiple devices
PCA9633 driver does not cunnetly support multiple devices.
Updated the driver to use DT_INST_FOREACH_STATUS_OKAY to
configure all devices defined in the device tree.
Convert driver to use `i2c_dt_spec` helpers.

Fixes #40076

Signed-off-by: Daniel N. Hansten <dnh2000@gmail.com>
2021-11-30 07:19:23 -05:00
Ilya Makarov
07680b27d5 Bluetooth: host: Fix MIC generation in Bluetooth CCM encryption
bt_ccm_encrypt only works when encrypting in place. To fix this
ccm_auth() inside bt_ccm_encrypt() must take plaintext instead of
enc_data, to not rely on assumption that plain and cypher data are the
same memory.

Signed-off-by: Ilya Makarov <ilya.makarov.592@gmail.com>

Fixes: #40069
2021-11-30 07:18:59 -05:00
Vinayak Kariappa Chettimada
96d62441c3 Bluetooth: Controller: Fix DTM HCI command returned error codes
Fix DTM HCI command returned error codes.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2021-11-30 07:17:57 -05:00
Vinayak Kariappa Chettimada
136fc6ff28 Bluetooth: Controller: Fix missing DTM Tx/Rx reset on HCI Reset Command
Fix missing implementation to reset DTM Tx/Rx reset on HCI
Reset Command.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2021-11-30 07:17:57 -05:00
Piotr Pryga
fde888685f Bluetooth: controller: enable missing RSSI while periodic adv sync
The RSSI measurement was not enabled while receiving periodic
advertising. The function responsible for enable the feature
in radio was called, but it was done too early.
It was overwritten by radio_switch_XXX function that assigns
a value to RADIO->SHORTS register.

Signed-off-by: Piotr Pryga <piotr.pryga@nordicsemi.no>
2021-11-30 07:17:46 -05:00
Piotr Pryga
6a7cfe1a5f Bluetooth: host: Add handling of failures in per sync established evt
Handling of HCI_LE_Periodic_Advertising_Sync_Established didn't
have implemented handling of possible failures of periodic
advertising synchronization.
There are two situations definded by BT 5.3 Core spec:
- There is no AUX_SYNC_IND pdu within 6 periodic advertising events.
  If that happens, status of the command is set to (0x3E) Connection
  Failed To Be Established / Synchronization Timeout.
- Periodic advertising has wrong CTE type while periodic advertising
  list is not used to determine the advertiser to listen.
  In this case status of the command is set to (0x1A) Unsupported
  Remote Feature.

The commit provides missing functionality.
In case of error, the periodic advertising will be deleted and
application will be notified by call to terminated callback.
The callback data were extended by err member. It provides
information why periodic advertising was terminated.

Signed-off-by: Piotr Pryga <piotr.pryga@nordicsemi.no>
2021-11-30 07:17:10 -05:00
Johann Fischer
c8baa85fee usb: function_rndis: do not force USB_COMPOSITE_DEVICE for IAD
Just always prove interface association descriptor for RNDIS
function instead of forcing it via Kconfig USB_COMPOSITE_DEVICE
option.

Signed-off-by: Johann Fischer <johann.fischer@nordicsemi.no>
2021-11-30 07:16:49 -05:00
Johann Fischer
7fde6f8ac2 usb: function_rndis: align rndis_cmd_pool to request buffer size
Set reasonable range for the request buffer in case RNDIS
function is used. Align net_buf size from rndis_cmd_pool to
request buffer size since request is copied there before
it is queued.

Signed-off-by: Johann Fischer <johann.fischer@nordicsemi.no>
2021-11-30 07:16:49 -05:00
Szymon Janc
7a8a9b6c99 tests: bluetooth: tester: Add support for advertising with target RPA
This allows to do directed advertising with peer address set to RPA.
To do this according to specification IUT must first read Central
Address Resolution characteristic to check if peer supports it.

This is affecting GAP/CONN/DCON/BV-05-C qualification test.

Signed-off-by: Szymon Janc <szymon.janc@codecoup.pl>
2021-11-30 07:16:29 -05:00
Szymon Janc
9a6cb39c96 tests: bluetooth: tester: Adjust Directed Advertising to latest BTP
This makes implementation in sync with autopts.

Signed-off-by: Szymon Janc <szymon.janc@codecoup.pl>
2021-11-30 07:16:29 -05:00
Ilhan Ates
d290393388 Bluetooth: tester: Add directed adv support
GAP/CONN/DCON/BV-01-C test case needs directed advertising
support.

Signed-off-by: Ilhan Ates <ilhan.ates@nordicsemi.no>
2021-11-30 07:16:29 -05:00
Szymon Janc
28956534cd tests: bluetooth: tester: Add support for security_changed callback
This allows to track security levels and check for lost bond of peer
peripherals.

This was affecting GAP/SEC/AUT/BV-21-C qualification test.

Signed-off-by: Szymon Janc <szymon.janc@codecoup.pl>
2021-11-30 07:16:29 -05:00
Szymon Janc
ea9a59f287 tests: bluetooth: tester: Increase ATT prepare write buffers count
GATT/SR/GAW/BV-10-C requires more buffers as it tests nested long
writes.

Signed-off-by: Szymon Janc <szymon.janc@codecoup.pl>
2021-11-30 07:16:29 -05:00
Szymon Janc
374d2d031a tests: bluetooth: tester: Add support for pairing failed event
This event is sent if pairing failed.

Signed-off-by: Szymon Janc <szymon.janc@codecoup.pl>
2021-11-30 07:16:29 -05:00
Szymon Janc
98bd6534a3 bluetooth: host: Add support for SMP error code 0x0f
This error code informs that peer device rejected key during
keys distribution phase.

Signed-off-by: Szymon Janc <szymon.janc@codecoup.pl>
2021-11-30 07:16:29 -05:00
Szymon Janc
9fe9ff18ee tests: bluetooth: tester: Add support for L2CAP channels options
This allows for better control over IUT behaviour by Upper Tester.

PTS and TS require inconsistent behaviour in terms of how IUT should
return credits. Some tests require return on explicit UT request and
some require that IUT returns credits autonomously.

Signed-off-by: Szymon Janc <szymon.janc@codecoup.pl>
2021-11-30 07:16:29 -05:00
Daniel Leung
fe8405271a toolchain: xcc: add macro __in_section_unique_named()
XCC doesn't like having quotes in the section name, so
workaround it by overriding __in_section_unique_named()
similar to __in_section_unique().

Signed-off-by: Daniel Leung <daniel.leung@intel.com>
2021-11-30 07:15:47 -05:00
Marek Pieta
a153645d46 bluetooth: att: Fix indication handling
Zephyr device that is not a GATT Client, should ignore indication.

An Android device may send an indication even if Zephyr
device does not support GATT Client role. In that case, the sent
error response was improperly matched to subsequent GATT request
of the Android device which caused issues.

Signed-off-by: Marek Pieta <Marek.Pieta@nordicsemi.no>
2021-11-30 07:11:55 -05:00
Martin Jäger
89c052e1e5 task_wdt: fix overflow in current_ticks making wdt get stuck
The task_wdt was getting stuck after approx. 36 hours on e.g. nRF52840,
which has a SysTick with 32768 Hz. This corresponds to an overflow of
the uint32_t current_ticks in schedule_next_timeout.

This commit fixes the accidentally introduced narrowing conversion.

Fixes #40152

Signed-off-by: Martin Jäger <martin@libre.solar>
2021-11-30 07:09:58 -05:00
Sylvio Alves
faf0e21a66 samples: shell_module: fix missing qsort reference
PR #39980 added qsort to minimal libc but caused
shell_modules sample to fail building.

Signed-off-by: Sylvio Alves <sylvio.alves@espressif.com>
2021-11-30 07:09:38 -05:00
Anas Nashif
95c41f6889 actions: twister: remove cleanup job
We now cleanup at the beginning.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2021-11-26 06:43:38 -05:00
Anas Nashif
82e255bf2a actions: check of testplan exists
Check if test plan exist before trying to read it.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2021-11-26 06:43:38 -05:00
Anas Nashif
552a0e1524 actions: twister/clang: cleanup test plan generation
Merged 3 files used to generate the test plan per PR based on the
changes. 2 python scripts and a shell script are now all merged into 1
python script that generates the input file for twister based on a list
of changed files by the PR.

This remove lots of old and obsolete code and simplifies things a bit,
no need anymore for an intermediate script to call twister, we call it
directly in the workflow and use the new test_plan script to generate
the test plan.

This also reenables the recently disabled tag based filtering which had
a bug, bug is resolved in this new implementation.

On push events, we now run twister without the --integration option to
catch any issues in the main branch that were not caught in PRs. PRs
continue to run with --integration enabled. This event (push) is now run
on 15 builders due to the increased size.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2021-11-26 06:43:38 -05:00
Anas Nashif
17e4ed1fd7 doc: replace buildkite with github actions
Update CI docs and the badge with links pointing to GH actions rather
than buildkite.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2021-11-26 06:43:38 -05:00
Anas Nashif
0b91e56939 actions: twister: adapt events to branch
Adapt events and cron to the 2.7 branch.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2021-11-26 06:43:38 -05:00
Anas Nashif
e1e9fa6670 actions: twister: add a cancel job very early on
Cancel using GH runner for faster execution.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2021-11-26 06:43:38 -05:00
Anas Nashif
fe8efca309 actions: clang: add branch name to ccache key
Add branch name to the ccache key to avoid cache contamination from old
branches.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2021-11-26 06:43:38 -05:00
Anas Nashif
328df98c40 actions: run twister using github action
This action replaces current buildkite workflow and uses github actions
to build and run tests in the zephyr tree using twister. The main
differences to current builtkite workflow:

- the action handles all 3 events: pull requests, push and schedule

- the action determines size of matrix (number of build hosts) based on
  the change with a minimum of 1 builder. If more tests are built/run
  due to changes to boards or tests/samples, the matrix size is
  increased. This will avoid timeouts when running over capacity due to
  board/test changes.

- We use ccache and store cache files on amazon S3 for more flexibility

- Results are collected per build host and merged in the final step and
  failures are posted into github action check runs.

- It runs on more powerful instances that can handle more load.
  Currently we have 10 build hosts per run (that can increase depending
  on number of tests run) and can deliver results within 1 hour.

- the action can deal with non code changes and will not allocate more
  than required to deal with changes to documentation and other files
  that do not require running twister

The goal long-term is better integrate this workflow with other actions
and not run unncessarily if other workflows have failed, for example, if
commit message is bogus, we should stop at that check, to avoid wasting
resources given that the commit message will have to be fixed anyways
which would later trigger another run on the same code.

Currently there is 1 open issue with this action related to a github
workflow bug where the final results are not posted to the same workflow
and might appear under other workflows. Github is working on this bug.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2021-11-26 06:43:38 -05:00
Alexandre Bourdiol
7e2e9d612d drivers: clock_control: stm32u5: set voltage scaling VOS for MSIS
In case of MSIS selected as system clock source it is necessary
to set Voltage scaling (VOS) when freqency is greater than 24MHz

Signed-off-by: Alexandre Bourdiol <alexandre.bourdiol@st.com>
2021-11-24 14:20:09 -05:00
Alexandre Bourdiol
6242d56255 drivers: clock_control: stm32u5: keep reset values of MSI trimming
When MSI trimming values where set to 0,
and MSIS is used as system core clock and MSI > 4 MHz,
it causes uart to fail.
There is no need to set thoses trimming values.
So keep the default reset value. (keep ST Factory calibration)

Signed-off-by: Alexandre Bourdiol <alexandre.bourdiol@st.com>
2021-11-24 14:20:09 -05:00
Alexandre Bourdiol
8bb53d7dc8 drivers: clock_control: stm32u5: rework MSIS as system clock source
Because on stm32u5 MSIS is the default clock after reset,
changing MSIS range means immediate frequency change.
Thus it is important to do it after flash latency change
in case of higher new frequency.

Signed-off-by: Alexandre Bourdiol <alexandre.bourdiol@st.com>
2021-11-24 14:20:09 -05:00
Alexandre Bourdiol
7ae9f2fadb include: drivers: clock_control: stm32u5 missing MSIS define
Missing definition of STM32_SYSCLK_SRC_MSIS
especially needed for STM32U5

Signed-off-by: Alexandre Bourdiol <alexandre.bourdiol@st.com>
2021-11-24 14:20:09 -05:00
Johan Lundin
78fc03b07b Bluetooth: Host: Set SID in bt_le_per_adv_sync_recv_info
Sets SID in bt_le_per_adv_sync_recv_info when host receives
a Periodic Advertising Report

Signed-off-by: Johan Lundin <johan.lundin@nordicsemi.no>
2021-11-20 23:15:15 -05:00
Szymon Janc
93e0cc85f7 tests: bluetooth: tester: Fix not marking chan as unused on disconnect
This fix not being able to re-connect channel after disconnect.

Signed-off-by: Szymon Janc <szymon.janc@codecoup.pl>
2021-11-18 19:32:17 -05:00
Szymon Janc
5f4707abe3 bluetooth: Fix L2CAP CoC response code if LTK is present
If an LTK or an STK is available and encryption is required
(LE security mode 1) but encryption is not enabled, the
service request shall be rejected with the error code
"Insufficient Encryption".

This is affecting L2CAP/LE/CFC/BV-25-C and L2CAP/ECFC/BV-32-C
qualification test cases.

Signed-off-by: Szymon Janc <szymon.janc@codecoup.pl>
2021-11-18 19:29:58 -05:00
Anas Nashif
758bfe43da ci: hotfix: disable test exclusion by tags
Many tests and CI activties are being missed by excluding tests
mistakingly when running twister.
This is visibile when you change one or more tests in kernel/ for
example, twister does not run those tests that have changed at all and
marking the PR as tested and ready to be merged.

Temporary fix for #40235.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2021-11-18 19:16:08 -05:00
Anas Nashif
cdb27db36c actions: clang: set reporting before calling twister
Otherwise reporting is skipped and failures are not recorded.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2021-11-18 19:16:08 -05:00
Anas Nashif
9ff7a43035 actions: clang: use ccache
Use ccache to speed up builds.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2021-11-18 19:16:08 -05:00
Anas Nashif
be9d5426d7 actions: retry west update on various workflows
Retry west when update fails and use update.narrow configuration.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2021-11-18 19:16:08 -05:00
Anas Nashif
ebee866639 actions: clang: fix typo
Add missing ")".

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2021-11-18 19:16:08 -05:00
Anas Nashif
d4dc4a9714 actions: clang: do not rebase, use commit range
Avoid rebasing and instead use the commit range. This avoids issues with
trees having intermediate rebase data after a reboot (due to
cancellation).

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2021-11-18 19:16:08 -05:00
Anas Nashif
faf03b0092 actions: run code coverage only on main tree
Run code coverage reporting on main zephyr repo only.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2021-11-18 19:16:08 -05:00
Anas Nashif
126896153b actions: follow namespace for job names
To avoid conflicts in reporting.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2021-11-18 19:16:08 -05:00
Anas Nashif
bcc700d732 actions: conflict: update version
Use released version instead of master.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2021-11-18 19:16:08 -05:00
Anas Nashif
075ca208a0 actions: compliance: minor improvements
Namespace job names and retry west update if something goes wrong the
first time.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2021-11-18 19:16:08 -05:00
Anas Nashif
8d9ac1c5a5 actions: bluetooth: rename action and make it obvious
Rename to make action file name obvious referring to bluetooth, rather
than the tool used.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2021-11-18 19:16:08 -05:00
Anas Nashif
85dd671855 actions: bluetooth: fix job names and description
Misc fixes including:
- unique job names
- Change description to mention Bluetooth
- Retry west update
- Use latest unit test publication action

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2021-11-18 19:16:08 -05:00
Anas Nashif
04b994883b action: codecov: do not run on weekends
No need to run on weekends, nothing much happens, so lets save some
resources.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2021-11-18 19:16:08 -05:00
Anas Nashif
2e89d2c73b actions: fix typo in clang action
Fix a minor typo in action and always set variable controlling reports.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2021-11-18 19:16:08 -05:00
Anas Nashif
83c12581c4 action: configure git user
Configure git for rebase by setting user name, email.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2021-11-18 19:16:08 -05:00
Anas Nashif
84dd113165 actions: optimize clang actions
- use zephyr runner
- reduce number of builders and adapt matrix to be platform based
- check for changed files and optimize run accordingly, should reduce
  build times depending on what has changed
- If no source has changed, skip twister completely.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2021-11-18 19:16:08 -05:00
Anas Nashif
827e397988 ci: add code coverage action
Add a code coverage collection action that triggers based on a schedule
on the main branch and posts results to

 https://app.codecov.io/gh/zephyrproject-rtos/zephyr

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2021-11-18 19:16:08 -05:00
Henrik Brix Andersen
a9a563fa55 boards: arm: waveshare_open103z: disable CAN bus tests
Disable CAN bus tests since can1 is disabled by default due to an IRQ
conflict with the USB controller.

Signed-off-by: Henrik Brix Andersen <hebad@vestas.com>
2021-11-18 10:17:34 -05:00
Robert Lubos
0efda1c06f tests: net: all: Add LwM2M to build all test
LwM2M was not covered by networking build all test, leaving an opening
for possible regression in modules that are not enabled by default in
the sample.

Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
2021-11-17 10:08:23 -05:00
Robert Lubos
e2fe23a7cc net: lwm2m: Fix removed engine_observer_list usage
`engine_remove_observer_by_path()` was not updated during some recent
LwM2M observer changes, still using the `engine_observer_list` which got
moved into the `lwm2m_context` structure. Update the function to align
with these changes.

Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
2021-11-17 10:08:23 -05:00
Andrzej Głąbek
3f24e7ddf5 samples: hci_spi: Decrease maximum number of BT connections
With the maximum number set to 20, the sample fails to build for
both platforms set as allowed for this sample and mentioned in its
documentation, i.e. 96b_carbon_nrf51 and nrf51dk_nrf51422 (a build
attempt ends up with an SRAM region overflow). Use a lower number
to prevent this failure and set both those boards as integration
platforms, so that such problem, if it was to appear again, could be
caught by CI.

Signed-off-by: Andrzej Głąbek <andrzej.glabek@nordicsemi.no>
2021-11-17 09:06:03 -05:00
Henrik Brix Andersen
3aff490e33 drivers: pwm: mcux: ftm: return -EBUSY if PWM capture in progress
Return -EBUSY (not 0) from pwm_pin_enable_capture() if PWM capture is
already in progress.

Fixes: #39817

Signed-off-by: Henrik Brix Andersen <hebad@vestas.com>
2021-11-17 09:05:10 -05:00
Robert Lubos
9d31c46861 net: sockets: tls: Fix TCP disconnect detection in poll()
`ztls_socket_data_check()` function ignored a fact when
`mbedtls_ssl_read()` indicated that the underlying TCP connection was
closed. Fix this by returning `-ENOTCONN` in such case, allowing
`poll()` to detect such event.

Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
2021-11-17 09:04:47 -05:00
Rafał Kuźnia
27201bb1ad drivers: ieee802154: nrf5: fix NULL pointer dereference
When a frame is sent with a cleared ACK request bit, the transmit
metadata contains a NULL pointer to the ACK frame.

The pointer must not be dereferenced in such case.

Signed-off-by: Rafał Kuźnia <rafal.kuznia@nordicsemi.no>
2021-11-17 09:04:16 -05:00
Lucas Dietrich
9727a2143f drivers: can: Fixed timeout values comparison
Trivial fix of compilation error "invalid operands to binary "
when CONFIG_CAN_AUTO_BUS_OFF_RECOVERY = n

Fixes #40290

Signed-off-by: Lucas Dietrich <ld.adecy@gmail.com>
2021-11-17 08:54:47 -05:00
Francois Ramu
84abb58886 drivers: uart stm32 flushing Rx register once the RXNE irq is enabled
When the "Read data register not empty" irq occurs,
this commit is cleaning the RXNE flag by flushing the RX register
since the Receive Data Reg. (USART_RDR) has not be read previously
This could be the case when aborting a Rx for example.

Signed-off-by: Francois Ramu <francois.ramu@st.com>
2021-11-17 08:53:47 -05:00
Piotr Pryga
7bdf17756c Bluetooth: controller: ULL: fix dequeue of IQ samples reports
Dequeue and  scheduling IQ samples report towards host
was working by accident. IQ samples were casted to
pointer to struct pdu_adv. Then type of PDU was checked.
Fortunately the IQ samples hadn't got PDU_ADV_TYPE_EXT_IND
in memory pointed by struct pdu_adv->type.

NODE_RX_TYPE_IQ_SAMPLE_REPORT must have separate execution
path in rx_demux_rx.

Signed-off-by: Piotr Pryga <piotr.pryga@nordicsemi.no>
2021-11-11 19:21:33 -05:00
Piotr Pryga
961ee2115f BLuetooth: controller: hci: fix wrong sync handle in IQ samples report
There were no assignment to iq_report->hdr.handle in the code
hence all IQ samples reports had the same handle value which
was zero.

Since the handle is related with ll_sync_set pointer the handle
value may not be set in LLL.

The best place to set handle value is thread context where
bt_hci_evt_le_connectionless_iq_report is prepared.

Signed-off-by: Piotr Pryga <piotr.pryga@nordicsemi.no>
2021-11-11 19:21:33 -05:00
Krzysztof Chruscinski
053dc75720 kernel: timer: Call user handler without spinlock
Add spinlock unlocking before calling timer expiration
handler. Locking was introduced by dde3d6c.

Signed-off-by: Krzysztof Chruscinski <krzysztof.chruscinski@nordicsemi.no>
2021-11-11 07:21:44 -05:00
Robert Lubos
b7954c9991 samples: net: http_get: Update root CA certificate
The root CA used so far (GlobalSign R2) is about to expire soon
(December 2021) and Google have switched to a new certificate, signed by
GlobalSign R1 (valid until 2028). Therefore we need to replace the
root CA used by the sample to the new one, in order to establish secure
connection to with google.com.

Additionally, the new certificate chain sent by Google is larger again,
so it's needed to increase mbed TLS max content length parameter in
order to process it correctly. This also implies an increase in heap
usage, so increase the heap size as well.

Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
2021-11-10 08:25:56 -05:00
Jacob Siverskog
3a39b7824e bluetooth: host: avoid freeing structure that's part of a linked list
see https://github.com/zephyrproject-rtos/zephyr/pull/39507 for
context.

Signed-off-by: Jacob Siverskog <jacob@teenage.engineering>
2021-11-09 13:45:01 -05:00
Jacob Siverskog
9247efaba8 bluetooth: host: reset channel request on send failure
make sure channel request reference is cleared if send fails. without
this change this could happen when att_handle_rsp was called:

1. reqs before call:
head: 0x2000f8e8, tail: 0x2000f8c0, elements:
- addr 0x2000f8e8, function pointer NULL
- addr 0x2000f8c0, function pointer 0x35c1d

2. att_handle_rsp called, calling bt_att_req_free with address
0x2000f8e8

3. reqs after call:
head: 0x2000f8e8, tail:	0x2000f8c0, elements:
- addr 0x2000f8e8, function pointer NULL
- addr 0x2000f8d4, function pointer NULL
- addr 0x2000f8ac, function pointer NULL
- addr 0x2000f898, function pointer NULL
- addr 0x2000f884, function pointer NULL
- addr 0x2000f870, function pointer 0xd92b7e7c
- addr 0x2000f85c, function pointer 0x462a03a9
- addr 0x2000f848, function pointer 0xf77b2f4b
- addr 0x2000f834, function pointer 0x33714775
- addr 0x2000f820, function pointer 0x31ba37f8
- addr 0x2000f80c, function pointer 0x5fda8494
- addr 0x2000f7f8, function pointer 0xbcff174e
- addr 0x2000f7e4, function pointer 0x341393f
- addr 0x2000f7d0, function pointer 0xbcfee8b8
- addr 0x2000f7bc, function pointer 0x1e73d9e5

which obviously is broken.

closes #39506.

Signed-off-by: Jacob Siverskog <jacob@teenage.engineering>
2021-11-09 13:45:01 -05:00
Szymon Janc
2fbb10c394 tests: bluetooth: tester: Fix NULL pointer dereference in error path
bt_conn_unref() requires valid conn pointer but could be called with
NULL in case valid connection was not found in disconnect_eatt_chans().

Fixes #39851

Signed-off-by: Szymon Janc <szymon.janc@codecoup.pl>
2021-11-09 13:41:31 -05:00
Lingao Meng
2f9ae20c60 [backport v2.7-branch] bluetooth: mesh: Fix incorrect return value
Should be continue when client->type not equal PROXY.

Signed-off-by: Lingao Meng <menglingao@xiaomi.com>
2021-11-09 11:15:27 -05:00
Enjia Mai
8188fd3b5e tests: subsys: libcxx: extend the timeout for cpp.libcxx.newlib_nano
Extend the timeout to prevent the cpp.libcxx.newlib_nano testcase runs
failed in acrn_ehl_crb, ehl_crb and up_squared. We need to give these
boards more time to finish the testcase's automation.

Fixes #36852

Signed-off-by: Enjia Mai <enjia.mai@intel.com>
2021-11-08 17:56:18 -05:00
Julien D'ascenzio
8bc60390d0 drivers/uart: stm32: fix a bug during transmission
If a transmission is made with poll_out and immediately after an other
transmission is made with interrupt api the transmission is locked.
We fix this behavior by clearing the tx_poll_stream_on flag during the
irq_tx_enable function

Signed-off-by: Julien D'ascenzio <julien.dascenzio@paratronic.fr>
2021-11-08 17:55:50 -05:00
Francois Ramu
f5d4fb40b5 drivers: clock control disable AHB3 clock in stm32_clock_control_off
This commit is fixing the error on clock control for the AHB3
in the stm32_clock_control_off function.

Signed-off-by: Francois Ramu <francois.ramu@st.com>
2021-11-05 15:15:24 -04:00
Lingao Meng
c90e0c1197 Bluetooth: Mesh: Fix missing enable adv thread
When user only use pb-gatt provisioning, which unable to
send out connectable advertising, due to adv thread not started.

Signed-off-by: Lingao Meng <menglingao@xiaomi.com>
2021-11-05 15:15:05 -04:00
Marcin Niestroj
53d9e942cf samples: sockets: http_get: increase main thread stack size
After commit eeb15aa393 ("timer: hpet: enable 64 bit mode for
better usages") was applied, main thread stack usage on qemu_x86
platform increased from 984 to 1040 bytes.

Default stack size, which is 1024, is no longer enough. Change that to
1536 to make sure this sample runs correctly on qemu_x86.

Signed-off-by: Marcin Niestroj <m.niestroj@emb.dev>
2021-11-05 15:14:38 -04:00
Pieter De Gendt
dd435b011f net: openthread: Fix alarm timers reference calculation
The OpenThread stack uses uint32_t to calculate expiry time for
alarms, while comparing to zephyr's uint64_t uptime.

This commit fixes broken milliseconds alarms after ~49.7 days of
uptime.

Fixes #39704

Signed-off-by: Pieter De Gendt <pieter.degendt@basalte.be>
2021-11-05 15:14:22 -04:00
Andy Ross
6a851f1f48 kernel/sched: Fix race with thread return values
There was a brief (but seen in practice on real apps on real
hardware!) race with the switch-based z_swap() implementation.  The
thread return value was being initialized to -EAGAIN after the
enclosing lock had been released.  But that lock is supposed to be
atomic with the thread suspend.

This opened a window for another racing thread to come by and "wake
up" our pending thread (which is fine on its own), set its return
value (e.g. to 0 for success) and then have that value clobbered by
the thread continuing to suspend itself outside the lock.

Melodramatic aside: I continue to hate this
arch_thread_return_value_set() API; it needs to die.  At best it's a
mild optimization on a handful of architectures (e.g. x86 implements
it by writing to the EAX register save slot in the context block).
Asynchronous APIs are almost always worse than synchronous ones, and
in this case it's an async operation that races against literal
context switch code that can't use traditional locking strategies.

Fixes #39575

Signed-off-by: Andy Ross <andrew.j.ross@intel.com>
2021-10-29 12:36:58 -04:00
Krzysztof Chruscinski
68a6a3e5c3 logging: Cleaning references to tracing in logging
There were some leftovers in logging after attempt to use
logging as tracing backend. Removing all references since it
lead to test compilation failures.

Signed-off-by: Krzysztof Chruscinski <krzysztof.chruscinski@nordicsemi.no>
2021-10-26 18:22:47 -04:00
Dominik Ermel
dff331a40c west.yml: Update mcumgr to backport fix for issue #38502
The commit updates mcumgr revision to include backport of
   345caab img_mgmt: fix callback parameter values
           (backport-upstream-137-to-v2.7-branch)

Signed-off-by: Dominik Ermel <dominik.ermel@nordicsemi.no>
2021-10-26 17:53:55 -04:00
Timo Teräs
96a7b32e85 drivers: uart_ns16550: Fix dts hw_flow_control mapping to config
DT_INST_NODE_HAS_PROP() returns true always since the boolean
tag is valid. Use DT_INST_PROP_OR() to get the real value.

Fixes: baecd7e55a drivers: uart_ns16550: Remove CMake-based templating
Signed-off-by: Timo Teräs <timo.teras@iki.fi>
2021-10-25 19:20:29 -04:00
Martin Jäger
6f11b2d7f2 task_wdt: ensure hw wdt is started before being fed
If a fallback hardware watchdog is used, it is fed together with the
task watchdog in task_wdt_feed. However, the hardware watchdog was
not yet set up before the first call to task_wdt_feed.

This commit fixes the order of wdt_setup and task_wdt_feed calls.

Fixes #39523

Signed-off-by: Martin Jäger <martin@libre.solar>
2021-10-22 06:50:56 -04:00
Henrik Brix Andersen
5166ff9fb1 drivers: can: flexcan: fix timing parameter limits
Fix the limits for the timing parameter calculations.

The lower limit for the phase_seg2 value is wrongly specified as 1 to 7,
but 1U is substracted before writing it to the CTRL1:PSEG2 register
field. This results in register field values between 0 and 6, but 0 is
an invalid value for the PSEG2 register field.

The upper limits for several of the timing parameters are wrong as well,
but this does not result in invalid register field values being
calculated. It can, however, result in not being able to meet CAN timing
requirements.

The confusion in specifying the limits likely stems from the timing
calculations and timing limits using the "physical" values, whereas the
registers fields all use the "physical" value minus 1. When the
datasheet says "The valid programmable values are 1-7", the
corresponding limits should be set to 2 to 8 to take the "minus 1" into
account.

Fixes: #39541

Signed-off-by: Henrik Brix Andersen <hebad@vestas.com>
2021-10-22 06:50:04 -04:00
Ryan Erickson
16e3655739 modem: hl7800: fix IPv6 socket creation
When creating a socket, be sure to check the address
family and set the correct address family option in
the AT command.

Signed-off-by: Ryan Erickson <ryan.erickson@lairdconnect.com>
2021-10-19 22:43:27 -04:00
Jakub Rzeszutko
b757110019 shell: fix assert in panic mode
In panic mode, the function: z_shell_fprintf is expected to be
called from an interrupt context. Therefore, the dedicated assert
cannot be checked in this case.

Fixes #38612

Signed-off-by: Jakub Rzeszutko <jakub.rzeszutko@nordicsemi.no>
2021-10-19 18:23:30 -04:00
Torsten Rasmussen
61730131c7 cmake: CMake compile features support
Fixes: #36558 #32577

This commit introduces CMAKE_C_COMPILE_FEATURES and
CMAKE_CXX_COMPILE_FEATURES.

This allows users to use the `target_compile_features()` in their own
code.

In Zephyr, the CMAKE_C/CXX_COMPILE_FEATURES are defined based on the
compiler and the Kconfig / CSTD setting.
Doing so ensures that a user compiling Zephyr with c99 and specifies
`target_compile_features(<target> ... c_std_11)` will get an error.
And similar if building Zephyr with C++ support and c++11, but testing
for `target_compile_features(<target> ... cxx_std_17)`.

For example in the C++ case, the user must ensure that Zephyr is
compiled with C++17, that is: CPLUSPLUS=y and STD_CPP17=y, in which case
the CMAKE_CXX_COMPILE_FEATURES will contain support for C++17 and thus
the `target_compile_features(<target> ... cxx_std_17)` will succeed.

Signed-off-by: Torsten Rasmussen <Torsten.Rasmussen@nordicsemi.no>
2021-10-19 18:21:50 -04:00
Maureen Helm
5455bf4ba7 soc: arm: Configure serial driver init priority for NXP SoCs
Configures the default serial driver initialization priority for NXP
SoCs to ensure that serial drivers initialize after clock control
drivers.

Signed-off-by: Maureen Helm <maureen.helm@intel.com>
2021-10-18 09:46:52 -04:00
Maureen Helm
c65645cc39 drivers: serial: Refactor drivers to use shared init priority Kconfig
Refactors all of the serial drivers to use a shared driver class
initialization priority configuration, CONFIG_SERIAL_INIT_PRIORITY, to
allow configuring serial drivers separately from other devices. This is
similar to other driver classes like I2C and SPI.

The default is set to CONFIG_KERNEL_INIT_PRIORITY_DEVICE to preserve the
existing default initialization priority for most drivers. The one
exception is uart_lpc11u6x.c which previously used
CONFIG_KERNEL_INIT_PRIORITY_OBJECTS.

This change was motivated by an issue on the frdm_k64f board where the
serial driver was incorrectly initialized before the clock control
driver.

Signed-off-by: Maureen Helm <maureen.helm@intel.com>
2021-10-18 09:46:52 -04:00
Henrik Brix Andersen
cef9cbeb60 runners: canopen: poll for flash ready
Poll the flash status instead of just reading the flash status once. Add
support for controlling the number of SDO retries and the SDO timeouts.

These changes allows for greater control of the CANopen program
download, which is especially useful on noisy or congested CAN networks
and on devices with slower flash access.

Fixes: #39409

Signed-off-by: Klaus H. Sorensen <khso@vestas.com>
Signed-off-by: Henrik Brix Andersen <hebad@vestas.com>
2021-10-17 11:52:36 -04:00
Evgeniy Paltsev
ac0477f17c ARC: forbid FIRQ or multiple register banks w/ 1 IRQ priority level
Don't allow to enable multiple register banks / fast
interrupts if we have only one interrupt priority level.

NOTE: we duplicate some checks by adding dependencies to ARC
Kconfig and adding build-time checks in C code. We do it
intentionally as for some reason we can violate dependencies
in architecture-level Kconfig by adding incorrect default in
SoC-level Kconfig. Such violation happens without any
warnings / errors from the Kconfig.

Signed-off-by: Eugeniy Paltsev <Eugeniy.Paltsev@synopsys.com>
Signed-off-by: Evgeniy Paltsev <PaltsevEvgeniy@gmail.com>
2021-10-17 11:52:12 -04:00
Jamie McCrae
cb4ed62d98 boards: arm: bl5340_dvk: Fix broken image
This updates the broken image for the BL5340 board to a working one

Signed-off-by: Jamie McCrae <jamie.mccrae@lairdconnect.com>
2021-10-17 11:51:51 -04:00
Manivannan Sadhasivam
df0c972787 modules: loramac-node: Fix the build issue for US915 and AU915 regions
These 2 regions depends on the RegionBaseUS.c file.

Fixes: #39297

Signed-off-by: Manivannan Sadhasivam <manivannan.sadhasivam@linaro.org>
2021-10-17 11:51:15 -04:00
454 changed files with 7097 additions and 2957 deletions

View File

@@ -9,7 +9,7 @@ on:
jobs:
backport:
runs-on: ubuntu-18.04
runs-on: ubuntu-20.04
name: Backport
steps:
- name: Backport

View File

@@ -0,0 +1,30 @@
name: Backport Issue Check
on:
pull_request_target:
branches:
- v*-branch
jobs:
backport:
name: Backport Issue Check
runs-on: ubuntu-22.04
steps:
- name: Check out source code
uses: actions/checkout@v3
- name: Install Python dependencies
run: |
sudo pip3 install -U setuptools wheel pip
pip3 install -U pygithub
- name: Run backport issue checker
env:
GITHUB_TOKEN: ${{ secrets.ZB_GITHUB_TOKEN }}
run: |
./scripts/release/list_backports.py \
-o ${{ github.event.repository.owner.login }} \
-r ${{ github.event.repository.name }} \
-b ${{ github.event.pull_request.base.ref }} \
-p ${{ github.event.pull_request.number }}

View File

@@ -0,0 +1,29 @@
name: Publish Bluetooth Tests Results
on:
workflow_run:
workflows: ["Bluetooth Tests"]
types:
- completed
jobs:
bluetooth-test-results:
name: "Publish Bluetooth Test Results"
runs-on: ubuntu-20.04
if: github.event.workflow_run.conclusion != 'skipped'
steps:
- name: Download artifacts
uses: dawidd6/action-download-artifact@v2
with:
workflow: bluetooth-tests.yaml
run_id: ${{ github.event.workflow_run.id }}
- name: Publish Bluetooth Test Results
uses: EnricoMi/publish-unit-test-result-action@v1
with:
check_name: Bluetooth Test Results
comment_mode: off
commit: ${{ github.event.workflow_run.head_sha }}
event_file: event/event.json
event_name: ${{ github.event.workflow_run.event }}
files: "bluetooth-test-results/**/bsim_results.xml"

View File

@@ -1,7 +1,7 @@
name: Bluetooth Tests
on:
pull_request_target:
pull_request:
paths:
- "west.yml"
- "subsys/bluetooth/**"
@@ -10,17 +10,13 @@ on:
- "soc/posix/**"
- "arch/posix/**"
concurrency:
group: ${{ github.workflow }}-${{ github.event_name }}-${{ github.head_ref || github.ref }}
cancel-in-progress: true
jobs:
bsim-build-cancel:
runs-on: ubuntu-latest
steps:
- name: Cancel Previous Runs
uses: styfle/cancel-workflow-action@0.6.0
with:
access_token: ${{ github.token }}
bsim-build:
runs-on: ubuntu-latest
needs: bsim-build-cancel
bluetooth-test:
runs-on: ubuntu-20.04
container:
image: zephyrprojectrtos/ci:v0.18.4
options: '--entrypoint /bin/bash'
@@ -38,19 +34,16 @@ jobs:
echo "$HOME/.local/bin" >> $GITHUB_PATH
- name: checkout
uses: actions/checkout@v2
with:
ref: ${{ github.event.pull_request.head.sha }}
fetch-depth: 0
uses: actions/checkout@v3
- name: west setup
run: |
west init -l . || true
west update
west config --global update.narrow true
west update 2>&1 1> west.update.log || west update 2>&1 1> west.update2.log
- name: Run Bluetooth Tests with BSIM
run: |
#source zephyr-env.sh
export ZEPHYR_BASE=${PWD}
WORK_DIR=${ZEPHYR_BASE}/bsim_bt_out tests/bluetooth/bsim_bt/compile.sh
RESULTS_FILE=${ZEPHYR_BASE}/${bsim_bt_test_results_file} \
@@ -58,28 +51,17 @@ jobs:
- name: Upload Test Results
if: always()
uses: actions/upload-artifact@v2
uses: actions/upload-artifact@v3
with:
name: Bluetooth Test Results
path: ./bsim_bt_out/bsim_results.xml
name: bluetooth-test-results
path: |
./bsim_bt_out/bsim_results.xml
${{ github.event_path }}
publish-test-results:
name: "Publish Unit Tests Results"
needs: bsim-build
runs-on: ubuntu-20.04
# the build-and-test job might be skipped, we don't need to run this job then
if: success() || failure()
steps:
- name: Download Artifacts
uses: actions/download-artifact@v2
- name: Upload Event Details
if: always()
uses: actions/upload-artifact@v3
with:
path: artifacts
- name: Publish Unit Test Results
uses: EnricoMi/publish-unit-test-result-action@v1.12
with:
check_name: Bluetooth Test Results
github_token: ${{ secrets.GITHUB_TOKEN }}
files: "**/bsim_results.xml"
comment_on_pr: false
name: event
path: |
${{ github.event_path }}

View File

@@ -2,47 +2,59 @@ name: Build with Clang/LLVM
on: pull_request_target
concurrency:
group: ${{ github.workflow }}-${{ github.event_name }}-${{ github.head_ref || github.ref }}
cancel-in-progress: true
jobs:
clang-build-cancel:
runs-on: ubuntu-latest
steps:
- name: Cancel Previous Runs
uses: styfle/cancel-workflow-action@0.6.0
with:
access_token: ${{ github.token }}
clang-build:
runs-on: ubuntu-latest
needs: clang-build-cancel
runs-on: zephyr-runner-linux-x64-4xlarge
container:
image: zephyrprojectrtos/ci:v0.18.4
options: '--entrypoint /bin/bash'
volumes:
- /repo-cache/zephyrproject:/github/cache/zephyrproject
strategy:
fail-fast: false
matrix:
subset: [1, 2, 3, 4, 5]
platform: ["native_posix"]
env:
ZEPHYR_SDK_INSTALL_DIR: /opt/toolchains/zephyr-sdk-0.13.1
CLANG_ROOT_DIR: /usr/lib/llvm-12
MATRIX_SIZE: 5
COMMIT_RANGE: ${{ github.event.pull_request.base.sha }}..${{ github.event.pull_request.head.sha }}
BASE_REF: ${{ github.base_ref }}
outputs:
report_needed: ${{ steps.twister.outputs.report_needed }}
steps:
- name: Cancel Previous Runs
uses: styfle/cancel-workflow-action@0.6.0
with:
access_token: ${{ github.token }}
- name: Update PATH for west
- name: Clone cached Zephyr repository
continue-on-error: true
run: |
echo "$HOME/.local/bin" >> $GITHUB_PATH
git clone --shared /github/cache/zephyrproject/zephyr .
git remote set-url origin ${GITHUB_SERVER_URL}/${GITHUB_REPOSITORY}
- name: checkout
uses: actions/checkout@v2
- name: Checkout
uses: actions/checkout@v3
with:
ref: ${{ github.event.pull_request.head.sha }}
fetch-depth: 0
persist-credentials: false
- name: west setup
- name: Environment Setup
run: |
pip3 install GitPython
echo "$HOME/.local/bin" >> $GITHUB_PATH
git config --global user.email "bot@zephyrproject.org"
git config --global user.name "Zephyr Bot"
git rebase origin/${BASE_REF}
git log --pretty=oneline | head -n 10
west init -l . || true
west update
west config --global update.narrow true
# In some cases modules are left in a state where they can't be
# updated (i.e. when we cancel a job and the builder is killed),
# So first retry to update, if that does not work, remove all modules
# and start over. (Workaround until we implement more robust module
# west caching).
west update --path-cache /github/cache/zephyrproject 2>&1 1> west.log || west update --path-cache /github/cache/zephyrproject 2>&1 1> west2.log || ( rm -rf ../modules && west update --path-cache /github/cache/zephyrproject)
- name: Check Environment
run: |
@@ -51,40 +63,76 @@ jobs:
gcc --version
ls -la
- name: Run Tests with Twister
- name: Prepare ccache timestamp/data
id: ccache_cache_timestamp
shell: cmake -P {0}
run: |
string(TIMESTAMP current_date "%Y-%m-%d-%H;%M;%S" UTC)
string(REPLACE "/" "_" repo ${{github.repository}})
string(REPLACE "-" "_" repo2 ${repo})
file(APPEND $ENV{GITHUB_OUTPUT} "repo=${repo2}\n")
- name: use cache
id: cache-ccache
uses: nashif/action-s3-cache@master
with:
key: ${{ steps.ccache_cache_timestamp.outputs.repo }}-${{ github.ref_name }}-clang-${{ matrix.platform }}-ccache
path: /github/home/.ccache
aws-s3-bucket: ccache.zephyrproject.org
aws-access-key-id: ${{ vars.AWS_CCACHE_ACCESS_KEY_ID }}
aws-secret-access-key: ${{ secrets.AWS_CCACHE_SECRET_ACCESS_KEY }}
aws-region: us-east-2
- name: ccache stats initial
run: |
test -d github/home/.ccache && rm -rf /github/home/.ccache && mv github/home/.ccache /github/home/.ccache
ccache -M 10G -s
- name: Run Tests with Twister
id: twister
run: |
#source zephyr-env.sh
export ZEPHYR_BASE=${PWD}
export ZEPHYR_TOOLCHAIN_VARIANT=llvm
./scripts/twister --inline-logs -M -N -v -p native_posix --subset ${{matrix.subset}}/${MATRIX_SIZE} --retry-failed 3
# check if we need to run a full twister or not based on files changed
python3 ./scripts/ci/test_plan.py --platform ${{ matrix.platform }} -c origin/${BASE_REF}..
# We can limit scope to just what has changed
if [ -s testplan.csv ]; then
echo "report_needed=1" >> $GITHUB_OUTPUT
# Full twister but with options based on changes
./scripts/twister --inline-logs -M -N -v --load-tests testplan.csv --retry-failed 2
else
# if nothing is run, skip reporting step
echo "report_needed=0" >> $GITHUB_OUTPUT
fi
- name: ccache stats post
run: |
ccache -s
- name: Upload Unit Test Results
if: always()
uses: actions/upload-artifact@v2
if: always() && steps.twister.outputs.report_needed != 0
uses: actions/upload-artifact@v3
with:
name: Unit Test Results (Subset ${{ matrix.subset }})
name: Unit Test Results (Subset ${{ matrix.platform }})
path: twister-out/twister.xml
publish-test-results:
clang-build-results:
name: "Publish Unit Tests Results"
needs: clang-build
runs-on: ubuntu-20.04
# the build-and-test job might be skipped, we don't need to run this job then
if: success() || failure()
if: (success() || failure() ) && needs.clang-build.outputs.report_needed != 0
steps:
- name: Download Artifacts
uses: actions/download-artifact@v2
with:
path: artifacts
- name: Display structure of downloaded files
run: ls -R
- name: Publish Unit Test Results
uses: EnricoMi/publish-unit-test-result-action@v1.12
uses: EnricoMi/publish-unit-test-result-action@v1
if: always()
with:
check_name: Unit Test Results
github_token: ${{ secrets.GITHUB_TOKEN }}
files: "**/twister.xml"
comment_on_pr: false
comment_mode: off

166
.github/workflows/codecov.yaml vendored Normal file
View File

@@ -0,0 +1,166 @@
name: Code Coverage with codecov
on:
schedule:
- cron: '25 */3 * * 1-5'
concurrency:
group: ${{ github.workflow }}-${{ github.event_name }}-${{ github.head_ref || github.ref }}
cancel-in-progress: true
jobs:
codecov:
runs-on: zephyr-runner-linux-x64-4xlarge
container:
image: zephyrprojectrtos/ci:v0.18.4
options: '--entrypoint /bin/bash'
volumes:
- /repo-cache/zephyrproject:/github/cache/zephyrproject
strategy:
fail-fast: false
matrix:
platform: ["native_posix", "qemu_x86", "unit_testing"]
env:
ZEPHYR_SDK_INSTALL_DIR: /opt/toolchains/zephyr-sdk-0.13.1
CLANG_ROOT_DIR: /usr/lib/llvm-12
steps:
- name: Update PATH for west
run: |
echo "$HOME/.local/bin" >> $GITHUB_PATH
- name: Clone cached Zephyr repository
continue-on-error: true
run: |
git clone --shared /github/cache/zephyrproject/zephyr .
git remote set-url origin ${GITHUB_SERVER_URL}/${GITHUB_REPOSITORY}
- name: checkout
uses: actions/checkout@v3
with:
fetch-depth: 0
- name: west setup
run: |
west init -l . || true
west update 1> west.update.log || west update 1> west.update-2.log
- name: Check Environment
run: |
cmake --version
${CLANG_ROOT_DIR}/bin/clang --version
gcc --version
ls -la
- name: Prepare ccache keys
id: ccache_cache_prop
shell: cmake -P {0}
run: |
string(REPLACE "/" "_" repo ${{github.repository}})
string(REPLACE "-" "_" repo2 ${repo})
file(APPEND $ENV{GITHUB_OUTPUT} "repo=${repo2}\n")
- name: use cache
id: cache-ccache
uses: nashif/action-s3-cache@master
with:
key: ${{ steps.ccache_cache_prop.outputs.repo }}-${{github.event_name}}-${{matrix.platform}}-codecov-ccache
path: /github/home/.ccache
aws-s3-bucket: ccache.zephyrproject.org
aws-access-key-id: ${{ vars.AWS_CCACHE_ACCESS_KEY_ID }}
aws-secret-access-key: ${{ secrets.AWS_CCACHE_SECRET_ACCESS_KEY }}
aws-region: us-east-2
- name: ccache stats initial
run: |
test -d github/home/.ccache && mv github/home/.ccache /github/home/.ccache
ccache -M 10G -s
- name: Run Tests with Twister (Push)
continue-on-error: true
run: |
export ZEPHYR_BASE=${PWD}
export ZEPHYR_TOOLCHAIN_VARIANT=zephyr
mkdir -p coverage/reports
./scripts/twister -N -v --filter runnable -p ${{ matrix.platform }} --coverage -T tests
- name: Generate Coverage Report
run: |
mv twister-out/coverage.info lcov.pre.info
lcov -q --remove lcov.pre.info mylib.c --remove lcov.pre.info tests/\* \
--remove lcov.pre.info samples/\* --remove lcov.pre.info ext/\* \
--remove lcov.pre.info *generated* \
-o coverage/reports/${{ matrix.platform }}.info --rc lcov_branch_coverage=1
- name: ccache stats post
run: |
ccache -s
- name: Upload Coverage Results
if: always()
uses: actions/upload-artifact@v3
with:
name: Coverage Data (Subset ${{ matrix.platform }})
path: coverage/reports/${{ matrix.platform }}.info
codecov-results:
name: "Publish Coverage Results"
needs: codecov
runs-on: ubuntu-latest
# the codecov job might be skipped, we don't need to run this job then
if: success() || failure()
steps:
- name: checkout
uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Download Artifacts
uses: actions/download-artifact@v2
with:
path: coverage/reports
- name: Move coverage files
run: |
mv ./coverage/reports/*/*.info ./coverage/reports
ls -la ./coverage/reports
- name: Generate list of coverage files
id: get-coverage-files
shell: cmake -P {0}
run: |
file(GLOB INPUT_FILES_LIST "coverage/reports/*.info")
set(MERGELIST "")
set(FILELIST "")
foreach(ITEM ${INPUT_FILES_LIST})
get_filename_component(f ${ITEM} NAME)
if(FILELIST STREQUAL "")
set(FILELIST "${f}")
else()
set(FILELIST "${FILELIST},${f}")
endif()
endforeach()
foreach(ITEM ${INPUT_FILES_LIST})
get_filename_component(f ${ITEM} NAME)
if(MERGELIST STREQUAL "")
set(MERGELIST "-a ${f}")
else()
set(MERGELIST "${MERGELIST} -a ${f}")
endif()
endforeach()
file(APPEND $ENV{GITHUB_OUTPUT} "mergefiles=${MERGELIST}\n")
file(APPEND $ENV{GITHUB_OUTPUT} "covfiles=${FILELIST}\n")
- name: Merge coverage files
run: |
sudo apt-get install -y lcov
cd ./coverage/reports
lcov ${{ steps.get-coverage-files.outputs.mergefiles }} -o merged.info --rc lcov_branch_coverage=1
- name: Upload coverage to Codecov
if: always()
uses: codecov/codecov-action@v2
with:
directory: ./coverage/reports
env_vars: OS,PYTHON
fail_ci_if_error: false
verbose: true
files: merged.info

View File

@@ -4,17 +4,17 @@ on: pull_request
jobs:
compliance_job:
runs-on: ubuntu-latest
runs-on: ubuntu-20.04
name: Run coding guidelines checks on patch series (PR)
steps:
- name: Checkout the code
uses: actions/checkout@v2
uses: actions/checkout@v3
with:
ref: ${{ github.event.pull_request.head.sha }}
fetch-depth: 0
- name: cache-pip
uses: actions/cache@v1
uses: actions/cache@v3
with:
path: ~/.cache/pip
key: ${{ runner.os }}-doc-pip

View File

@@ -1,14 +1,14 @@
name: Compliance
name: Compliance Checks
on: pull_request
jobs:
maintainer_check:
runs-on: ubuntu-latest
runs-on: ubuntu-20.04
name: Check MAINTAINERS file
steps:
- name: Checkout the code
uses: actions/checkout@v2
uses: actions/checkout@v3
with:
ref: ${{ github.event.pull_request.head.sha }}
fetch-depth: 0
@@ -19,8 +19,8 @@ jobs:
run: |
python3 ./scripts/get_maintainer.py path CMakeLists.txt
compliance_job:
runs-on: ubuntu-latest
check_compliance:
runs-on: ubuntu-20.04
name: Run compliance checks on patch series (PR)
steps:
- name: Update PATH for west
@@ -28,13 +28,13 @@ jobs:
echo "$HOME/.local/bin" >> $GITHUB_PATH
- name: Checkout the code
uses: actions/checkout@v2
uses: actions/checkout@v3
with:
ref: ${{ github.event.pull_request.head.sha }}
fetch-depth: 0
- name: cache-pip
uses: actions/cache@v1
uses: actions/cache@v3
with:
path: ~/.cache/pip
key: ${{ runner.os }}-doc-pip
@@ -57,7 +57,7 @@ jobs:
# debug
git log --pretty=oneline | head -n 10
west init -l . || true
west update
west update 2>&1 1> west.update.log || west update 2>&1 1> west.update2.log
- name: Run Compliance Tests
continue-on-error: true
@@ -72,7 +72,7 @@ jobs:
./scripts/ci/check_compliance.py -m Codeowners -m Devicetree -m Gitlint -m Identity -m Nits -m pylint -m checkpatch -m Kconfig -c origin/${BASE_REF}..
- name: upload-results
uses: actions/upload-artifact@master
uses: actions/upload-artifact@v3
continue-on-error: True
with:
name: compliance.xml

View File

@@ -8,7 +8,7 @@ jobs:
conflict:
runs-on: ubuntu-latest
steps:
- uses: mschilde/auto-label-merge-conflicts@master
- uses: mschilde/auto-label-merge-conflicts@v2
with:
CONFLICT_LABEL_NAME: "has conflicts"
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

View File

@@ -12,15 +12,15 @@ on:
jobs:
get_version:
runs-on: ubuntu-latest
runs-on: ubuntu-20.04
if: github.repository == 'zephyrproject-rtos/zephyr'
steps:
- name: Configure AWS Credentials
uses: aws-actions/configure-aws-credentials@v1
with:
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID_TESTING }}
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY_TESTING }}
aws-access-key-id: ${{ vars.AWS_TESTING_ACCESS_KEY_ID }}
aws-secret-access-key: ${{ secrets.AWS_TESTING_SECRET_ACCESS_KEY }}
aws-region: us-east-1
- name: install-pip
@@ -28,7 +28,7 @@ jobs:
pip3 install gitpython
- name: checkout
uses: actions/checkout@v2
uses: actions/checkout@v3
with:
fetch-depth: 0

View File

@@ -6,10 +6,14 @@ name: Devicetree script tests
on:
push:
branches:
- v2.7-branch
paths:
- 'scripts/dts/**'
- '.github/workflows/devicetree_checks.yml'
pull_request:
branches:
- v2.7-branch
paths:
- 'scripts/dts/**'
- '.github/workflows/devicetree_checks.yml'
@@ -21,20 +25,22 @@ jobs:
strategy:
matrix:
python-version: [3.6, 3.7, 3.8]
os: [ubuntu-latest, macos-latest, windows-latest]
os: [ubuntu-20.04, macos-11, windows-2022]
exclude:
- os: macos-latest
- os: macos-11
python-version: 3.6
- os: windows-2022
python-version: 3.6
steps:
- name: checkout
uses: actions/checkout@v2
uses: actions/checkout@v3
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v1
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
- name: cache-pip-linux
if: startsWith(runner.os, 'Linux')
uses: actions/cache@v1
uses: actions/cache@v3
with:
path: ~/.cache/pip
key: ${{ runner.os }}-pip-${{ matrix.python-version }}
@@ -42,7 +48,7 @@ jobs:
${{ runner.os }}-pip-${{ matrix.python-version }}
- name: cache-pip-mac
if: startsWith(runner.os, 'macOS')
uses: actions/cache@v1
uses: actions/cache@v3
with:
path: ~/Library/Caches/pip
# Trailing '-' was just to get a different cache name
@@ -51,7 +57,7 @@ jobs:
${{ runner.os }}-pip-${{ matrix.python-version }}-
- name: cache-pip-win
if: startsWith(runner.os, 'Windows')
uses: actions/cache@v1
uses: actions/cache@v3
with:
path: ~\AppData\Local\pip\Cache
key: ${{ runner.os }}-pip-${{ matrix.python-version }}

View File

@@ -5,10 +5,10 @@ name: Documentation Build
on:
schedule:
- cron: '0 */3 * * *'
- cron: '0 */3 * * *'
push:
tags:
- v*
- v*
pull_request:
paths:
- 'doc/**'
@@ -34,18 +34,23 @@ env:
jobs:
doc-build-html:
name: "Documentation Build (HTML)"
runs-on: ubuntu-latest
runs-on: ubuntu-20.04
timeout-minutes: 30
concurrency:
group: doc-build-html-${{ github.ref }}
cancel-in-progress: true
steps:
- name: checkout
uses: actions/checkout@v2
uses: actions/checkout@v3
- name: install-pkgs
run: |
sudo apt-get install -y ninja-build doxygen graphviz
- name: cache-pip
uses: actions/cache@v1
uses: actions/cache@v3
with:
path: ~/.cache/pip
key: pip-${{ hashFiles('scripts/requirements-doc.txt') }}
@@ -69,38 +74,71 @@ jobs:
DOC_TAG="development"
fi
DOC_TAG=${DOC_TAG} SPHINXOPTS="-q -W -j auto" make -C doc html
if [[ "${{ github.event_name }}" == "pull_request" ]]; then
DOC_TARGET="html-fast"
else
DOC_TARGET="html"
fi
DOC_TAG=${DOC_TAG} SPHINXOPTS="-q -W" make -C doc ${DOC_TARGET}
- name: compress-docs
run: |
tar cfJ html-output.tar.xz --directory=doc/_build html
- name: upload-build
uses: actions/upload-artifact@master
uses: actions/upload-artifact@v3
with:
name: html-output
path: html-output.tar.xz
- name: process-pr
if: github.event_name == 'pull_request'
run: |
REPO_NAME="${{ github.event.repository.name }}"
PR_NUM="${{ github.event.pull_request.number }}"
DOC_URL="https://builds.zephyrproject.io/${REPO_NAME}/pr/${PR_NUM}/docs/"
echo "${PR_NUM}" > pr_num
echo "::notice:: Documentation will be available shortly at: ${DOC_URL}"
- name: upload-pr-number
uses: actions/upload-artifact@v3
if: github.event_name == 'pull_request'
with:
name: pr_num
path: pr_num
doc-build-pdf:
name: "Documentation Build (PDF)"
runs-on: ubuntu-latest
runs-on: ubuntu-20.04
container: texlive/texlive:latest
timeout-minutes: 30
concurrency:
group: doc-build-pdf-${{ github.ref }}
cancel-in-progress: true
steps:
- name: checkout
uses: actions/checkout@v2
uses: actions/checkout@v3
- name: install-pkgs
run: |
apt-get update
apt-get install -y python3-pip ninja-build doxygen graphviz librsvg2-bin
apt-get install -y python3-pip python3-venv ninja-build doxygen graphviz librsvg2-bin
- name: cache-pip
uses: actions/cache@v1
uses: actions/cache@v3
with:
path: ~/.cache/pip
key: pip-${{ hashFiles('scripts/requirements-doc.txt') }}
- name: setup-venv
run: |
python3 -m venv .venv
. .venv/bin/activate
echo PATH=$PATH >> $GITHUB_ENV
- name: install-pip
run: |
pip3 install -U setuptools wheel pip
@@ -123,7 +161,7 @@ jobs:
DOC_TAG=${DOC_TAG} SPHINXOPTS="-q -j auto" LATEXMKOPTS="-quiet -halt-on-error" make -C doc pdf
- name: upload-build
uses: actions/upload-artifact@master
uses: actions/upload-artifact@v3
with:
name: pdf-output
path: doc/_build/latex/zephyr.pdf

63
.github/workflows/doc-publish-pr.yml vendored Normal file
View File

@@ -0,0 +1,63 @@
# Copyright (c) 2020 Linaro Limited.
# Copyright (c) 2021 Nordic Semiconductor ASA
# SPDX-License-Identifier: Apache-2.0
name: Documentation Publish (Pull Request)
on:
workflow_run:
workflows: ["Documentation Build"]
types:
- completed
jobs:
doc-publish:
name: Publish Documentation
runs-on: ubuntu-20.04
if: |
github.event.workflow_run.event == 'pull_request' &&
github.event.workflow_run.conclusion == 'success' &&
github.repository == 'zephyrproject-rtos/zephyr'
steps:
- name: Download artifacts
uses: dawidd6/action-download-artifact@v2
with:
workflow: doc-build.yml
run_id: ${{ github.event.workflow_run.id }}
- name: Load PR number
run: |
echo "PR_NUM=$(<pr_num/pr_num)" >> $GITHUB_ENV
- name: Check PR number
id: check-pr
uses: carpentries/actions/check-valid-pr@v0.8
with:
pr: ${{ env.PR_NUM }}
sha: ${{ github.event.workflow_run.head_sha }}
- name: Validate PR number
if: steps.check-pr.outputs.VALID != 'true'
run: |
echo "ABORT: PR number validation failed!"
exit 1
- name: Uncompress HTML docs
run: |
tar xf html-output/html-output.tar.xz -C html-output
- name: Configure AWS Credentials
uses: aws-actions/configure-aws-credentials@v1
with:
aws-access-key-id: ${{ vars.AWS_BUILDS_ZEPHYR_PR_ACCESS_KEY_ID }}
aws-secret-access-key: ${{ secrets.AWS_BUILDS_ZEPHYR_PR_SECRET_ACCESS_KEY }}
aws-region: us-east-1
- name: Upload to AWS S3
env:
HEAD_BRANCH: ${{ github.event.workflow_run.head_branch }}
run: |
aws s3 sync --quiet html-output/html \
s3://builds.zephyrproject.org/${{ github.event.repository.name }}/pr/${PR_NUM}/docs \
--delete

View File

@@ -2,23 +2,21 @@
# Copyright (c) 2021 Nordic Semiconductor ASA
# SPDX-License-Identifier: Apache-2.0
name: Publish Documentation
name: Documentation Publish
on:
workflow_run:
workflows: ["Documentation Build"]
branches:
- main
- v*
tags:
- v*
- main
- v*
types:
- completed
- completed
jobs:
doc-publish:
name: Publish Documentation
runs-on: ubuntu-latest
runs-on: ubuntu-20.04
if: ${{ github.event.workflow_run.conclusion == 'success' }}
steps:
@@ -34,8 +32,8 @@ jobs:
- name: Configure AWS Credentials
uses: aws-actions/configure-aws-credentials@v1
with:
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
aws-access-key-id: ${{ vars.AWS_DOCS_ACCESS_KEY_ID }}
aws-secret-access-key: ${{ secrets.AWS_DOCS_SECRET_ACCESS_KEY }}
aws-region: us-east-1
- name: Upload to AWS S3

View File

@@ -6,13 +6,13 @@ on:
jobs:
check-errno:
runs-on: ubuntu-latest
runs-on: ubuntu-20.04
container:
image: zephyrprojectrtos/ci:v0.18.4
steps:
- name: checkout
uses: actions/checkout@v2
uses: actions/checkout@v3
- name: Run errno.py
run: |

View File

@@ -13,19 +13,14 @@ on:
# same commit
- 'v*'
concurrency:
group: ${{ github.workflow }}-${{ github.event_name }}-${{ github.head_ref || github.ref }}
cancel-in-progress: true
jobs:
footprint-tracking-cancel:
runs-on: ubuntu-latest
if: github.repository == 'zephyrproject-rtos/zephyr'
steps:
- name: Cancel Previous Runs
uses: styfle/cancel-workflow-action@0.6.0
with:
access_token: ${{ github.token }}
footprint-tracking:
runs-on: ubuntu-latest
runs-on: ubuntu-20.04
if: github.repository == 'zephyrproject-rtos/zephyr'
needs: footprint-tracking-cancel
container:
image: zephyrprojectrtos/ci:v0.18.4
options: '--entrypoint /bin/bash'
@@ -44,7 +39,7 @@ jobs:
sudo pip3 install -U setuptools wheel pip gitpython
- name: checkout
uses: actions/checkout@v2
uses: actions/checkout@v3
with:
ref: ${{ github.event.pull_request.head.sha }}
fetch-depth: 0
@@ -52,13 +47,14 @@ jobs:
- name: west setup
run: |
west init -l . || true
west update
west config --global update.narrow true
west update 2>&1 1> west.update.log || west update 2>&1 1> west.update2.log
- name: Configure AWS Credentials
uses: aws-actions/configure-aws-credentials@v1
with:
aws-access-key-id: ${{ secrets.FOOTPRINT_AWS_KEY_ID }}
aws-secret-access-key: ${{ secrets.FOOTPRINT_AWS_ACCESS_KEY }}
aws-access-key-id: ${{ vars.AWS_TESTING_ACCESS_KEY_ID }}
aws-secret-access-key: ${{ secrets.AWS_TESTING_SECRET_ACCESS_KEY }}
aws-region: us-east-1
- name: Record Footprint

View File

@@ -2,19 +2,14 @@ name: Footprint Delta
on: pull_request
concurrency:
group: ${{ github.workflow }}-${{ github.event_name }}-${{ github.head_ref || github.ref }}
cancel-in-progress: true
jobs:
footprint-cancel:
runs-on: ubuntu-latest
if: github.repository == 'zephyrproject-rtos/zephyr'
steps:
- name: Cancel Previous Runs
uses: styfle/cancel-workflow-action@0.6.0
with:
access_token: ${{ github.token }}
footprint-delta:
runs-on: ubuntu-latest
runs-on: ubuntu-20.04
if: github.repository == 'zephyrproject-rtos/zephyr'
needs: footprint-cancel
container:
image: zephyrprojectrtos/ci:v0.18.4
options: '--entrypoint /bin/bash'
@@ -25,16 +20,12 @@ jobs:
CLANG_ROOT_DIR: /usr/lib/llvm-12
ZEPHYR_TOOLCHAIN_VARIANT: zephyr
steps:
- name: Cancel Previous Runs
uses: styfle/cancel-workflow-action@0.6.0
with:
access_token: ${{ github.token }}
- name: Update PATH for west
run: |
echo "$HOME/.local/bin" >> $GITHUB_PATH
- name: checkout
uses: actions/checkout@v2
uses: actions/checkout@v3
with:
ref: ${{ github.event.pull_request.head.sha }}
fetch-depth: 0
@@ -42,7 +33,8 @@ jobs:
- name: west setup
run: |
west init -l . || true
west update
west config --global update.narrow true
west update 2>&1 1> west.update.log || west update 2>&1 1> west.update.log
- name: Detect Changes in Footprint
env:

View File

@@ -14,13 +14,13 @@ env:
jobs:
track-issues:
name: "Collect Issue Stats"
runs-on: ubuntu-latest
runs-on: ubuntu-20.04
if: github.repository == 'zephyrproject-rtos/zephyr'
steps:
- name: Download configuration file
run: |
wget -q https://raw.githubusercontent.com/$GITHUB_REPOSITORY/master/.github/workflows/issues-report-config.json
wget -q https://raw.githubusercontent.com/$GITHUB_REPOSITORY/main/.github/workflows/issues-report-config.json
- name: install-packages
run: |
@@ -34,7 +34,7 @@ jobs:
token: ${{ secrets.GITHUB_TOKEN }}
- name: upload-stats
uses: actions/upload-artifact@master
uses: actions/upload-artifact@v3
continue-on-error: True
with:
name: ${{ env.OUTPUT_FILE_NAME }}
@@ -43,8 +43,8 @@ jobs:
- name: Configure AWS Credentials
uses: aws-actions/configure-aws-credentials@v1
with:
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID_TESTING }}
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY_TESTING }}
aws-access-key-id: ${{ vars.AWS_TESTING_ACCESS_KEY_ID }}
aws-secret-access-key: ${{ secrets.AWS_TESTING_SECRET_ACCESS_KEY }}
aws-region: us-east-1
- name: Post Results

View File

@@ -7,6 +7,4 @@ jobs:
name: Pull Request Labeler
runs-on: ubuntu-latest
steps:
- uses: actions/labeler@v2.1.1
with:
repo-token: '${{ secrets.GITHUB_TOKEN }}'
- uses: actions/labeler@v4

View File

@@ -4,7 +4,7 @@ on: [pull_request]
jobs:
scancode_job:
runs-on: ubuntu-latest
runs-on: ubuntu-20.04
name: Scan code for licenses
steps:
- name: Checkout the code
@@ -15,7 +15,7 @@ jobs:
with:
directory-to-scan: 'scan/'
- name: Artifact Upload
uses: actions/upload-artifact@v1
uses: actions/upload-artifact@v3
with:
name: scancode
path: ./artifacts

View File

@@ -6,15 +6,16 @@ on:
jobs:
contribs:
runs-on: ubuntu-latest
runs-on: ubuntu-22.04
name: Manifest
steps:
- name: Checkout the code
uses: actions/checkout@v2
uses: actions/checkout@v3
with:
path: zephyrproject/zephyr
ref: ${{ github.event.pull_request.head.sha }}
fetch-depth: 0
persist-credentials: false
- name: Manifest
uses: zephyrproject-rtos/action-manifest@2f1ad2908599d4fe747f886f9d733dd7eebae4ef

View File

@@ -7,15 +7,16 @@ on:
jobs:
release:
runs-on: ubuntu-latest
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Get the version
id: get_version
run: echo ::set-output name=VERSION::${GITHUB_REF#refs/tags/}
run: |
echo "VERSION=${GITHUB_REF#refs/tags/}" >> $GITHUB_OUTPUT
- name: REUSE Compliance Check
uses: fsfe/reuse-action@v1
@@ -23,7 +24,7 @@ jobs:
args: spdx -o zephyr-${{ steps.get_version.outputs.VERSION }}.spdx
- name: upload-results
uses: actions/upload-artifact@master
uses: actions/upload-artifact@v3
continue-on-error: True
with:
name: zephyr-${{ steps.get_version.outputs.VERSION }}.spdx

View File

@@ -6,7 +6,7 @@ on:
jobs:
stale:
name: Find Stale issues and PRs
runs-on: ubuntu-latest
runs-on: ubuntu-20.04
if: github.repository == 'zephyrproject-rtos/zephyr'
steps:
- uses: actions/stale@v3

251
.github/workflows/twister.yaml vendored Normal file
View File

@@ -0,0 +1,251 @@
name: Run tests with twister
on:
push:
branches:
- v2.7-branch
pull_request_target:
branches:
- v2.7-branch
schedule:
# Run at 00:00 on Saturday
- cron: '20 0 * * 6'
concurrency:
group: ${{ github.workflow }}-${{ github.event_name }}-${{ github.head_ref || github.ref }}
cancel-in-progress: true
jobs:
twister-build-prep:
runs-on: zephyr-runner-linux-x64-4xlarge
container:
image: zephyrprojectrtos/ci:v0.18.4
options: '--entrypoint /bin/bash'
volumes:
- /repo-cache/zephyrproject:/github/cache/zephyrproject
outputs:
subset: ${{ steps.output-services.outputs.subset }}
size: ${{ steps.output-services.outputs.size }}
env:
MATRIX_SIZE: 10
PUSH_MATRIX_SIZE: 15
DAILY_MATRIX_SIZE: 80
ZEPHYR_SDK_INSTALL_DIR: /opt/toolchains/zephyr-sdk-0.13.1
CLANG_ROOT_DIR: /usr/lib/llvm-12
TESTS_PER_BUILDER: 700
COMMIT_RANGE: ${{ github.event.pull_request.base.sha }}..${{ github.event.pull_request.head.sha }}
BASE_REF: ${{ github.base_ref }}
steps:
- name: Clone cached Zephyr repository
if: github.event_name == 'pull_request_target'
continue-on-error: true
run: |
git clone --shared /github/cache/zephyrproject/zephyr .
git remote set-url origin ${GITHUB_SERVER_URL}/${GITHUB_REPOSITORY}
- name: Checkout
if: github.event_name == 'pull_request_target'
uses: actions/checkout@v3
with:
ref: ${{ github.event.pull_request.head.sha }}
fetch-depth: 0
persist-credentials: false
- name: Environment Setup
if: github.event_name == 'pull_request_target'
run: |
pip3 install GitPython
git config --global user.email "bot@zephyrproject.org"
git config --global user.name "Zephyr Bot"
git rebase origin/${BASE_REF}
git log --pretty=oneline | head -n 10
west init -l . || true
# no need for west update here
- name: Generate Test Plan with Twister
if: github.event_name == 'pull_request_target'
id: test-plan
run: |
export ZEPHYR_BASE=${PWD}
export ZEPHYR_TOOLCHAIN_VARIANT=zephyr
# temporary until we have all PRs rebased on top of this commit.
git log -n 500 --oneline | grep -q "run twister using github action" || (
echo "Your branch is not up to date, you need to rebase on top of latest HEAD of main branch"
exit 1
)
python3 ./scripts/ci/test_plan.py -c origin/${BASE_REF}.. --pull-request -t $TESTS_PER_BUILDER
if [ -s .testplan ]; then
cat .testplan >> $GITHUB_ENV
else
echo "TWISTER_NODES=${MATRIX_SIZE}" >> $GITHUB_ENV
fi
rm -f testplan.csv .testplan
- name: Determine matrix size
id: output-services
run: |
if [ "${{github.event_name}}" = "pull_request_target" ]; then
if [ -n "${TWISTER_NODES}" ]; then
subset="[$(seq -s',' 1 ${TWISTER_NODES})]"
else
subset="[$(seq -s',' 1 ${MATRIX_SIZE})]"
fi
size=${TWISTER_NODES}
elif [ "${{github.event_name}}" = "push" ]; then
subset="[$(seq -s',' 1 ${PUSH_MATRIX_SIZE})]"
size=${MATRIX_SIZE}
elif [ "${{github.event_name}}" = "schedule" && "${{github.repository}}" = "zephyrproject-rtos/zephyr" ]; then
subset="[$(seq -s',' 1 ${DAILY_MATRIX_SIZE})]"
size=${DAILY_MATRIX_SIZE}
else
size=0
fi
echo "subset=${subset}" >> $GITHUB_OUTPUT
echo "size=${size}" >> $GITHUB_OUTPUT
twister-build:
runs-on: zephyr-runner-linux-x64-4xlarge
needs: twister-build-prep
if: needs.twister-build-prep.outputs.size != 0
container:
image: zephyrprojectrtos/ci:v0.18.4
options: '--entrypoint /bin/bash'
volumes:
- /repo-cache/zephyrproject:/github/cache/zephyrproject
strategy:
fail-fast: false
matrix:
subset: ${{fromJSON(needs.twister-build-prep.outputs.subset)}}
env:
ZEPHYR_SDK_INSTALL_DIR: /opt/toolchains/zephyr-sdk-0.13.1
CLANG_ROOT_DIR: /usr/lib/llvm-12
TWISTER_COMMON: ' --inline-logs -v -N -M --retry-failed 3 '
DAILY_OPTIONS: ' -M --build-only --all '
PR_OPTIONS: ' --clobber-output --integration '
PUSH_OPTIONS: ' --clobber-output -M '
COMMIT_RANGE: ${{ github.event.pull_request.base.sha }}..${{ github.event.pull_request.head.sha }}
BASE_REF: ${{ github.base_ref }}
steps:
- name: Clone cached Zephyr repository
continue-on-error: true
run: |
git clone --shared /github/cache/zephyrproject/zephyr .
git remote set-url origin ${GITHUB_SERVER_URL}/${GITHUB_REPOSITORY}
- name: Checkout
uses: actions/checkout@v3
with:
ref: ${{ github.event.pull_request.head.sha }}
fetch-depth: 0
persist-credentials: false
- name: Environment Setup
run: |
pip3 install GitPython
if [ "${{github.event_name}}" = "pull_request_target" ]; then
git config --global user.email "bot@zephyrproject.org"
git config --global user.name "Zephyr Builder"
git rebase origin/${BASE_REF}
git log --pretty=oneline | head -n 10
fi
echo "$HOME/.local/bin" >> $GITHUB_PATH
west init -l . || true
west config --global update.narrow true
west update --path-cache /github/cache/zephyrproject 2>&1 1> west.update.log || west update --path-cache /github/cache/zephyrproject 2>&1 1> west.update.log || ( rm -rf ../modules && west update --path-cache /github/cache/zephyrproject)
west forall -c 'git reset --hard HEAD'
- name: Check Environment
run: |
cmake --version
${CLANG_ROOT_DIR}/bin/clang --version
gcc --version
ls -la
echo "github.ref: ${{ github.ref }}"
echo "github.base_ref: ${{ github.base_ref }}"
echo "github.ref_name: ${{ github.ref_name }}"
- name: Prepare ccache timestamp/data
id: ccache_cache_timestamp
shell: cmake -P {0}
run: |
string(TIMESTAMP current_date "%Y-%m-%d-%H;%M;%S" UTC)
string(REPLACE "/" "_" repo ${{github.repository}})
string(REPLACE "-" "_" repo2 ${repo})
file(APPEND $ENV{GITHUB_OUTPUT} "repo=${repo2}\n")
- name: use cache
id: cache-ccache
uses: nashif/action-s3-cache@master
with:
key: ${{ steps.ccache_cache_timestamp.outputs.repo }}-${{ github.ref_name }}-${{github.event_name}}-${{ matrix.subset }}-ccache
path: /github/home/.ccache
aws-s3-bucket: ccache.zephyrproject.org
aws-access-key-id: ${{ vars.AWS_CCACHE_ACCESS_KEY_ID }}
aws-secret-access-key: ${{ secrets.AWS_CCACHE_SECRET_ACCESS_KEY }}
aws-region: us-east-2
- name: ccache stats initial
run: |
test -d github/home/.ccache && rm -rf /github/home/.ccache && mv github/home/.ccache /github/home/.ccache
ccache -M 10G -s
- if: github.event_name == 'push'
name: Run Tests with Twister (Push)
run: |
export ZEPHYR_BASE=${PWD}
export ZEPHYR_TOOLCHAIN_VARIANT=zephyr
./scripts/twister --subset ${{matrix.subset}}/${{ strategy.job-total }} ${TWISTER_COMMON} ${PUSH_OPTIONS}
- if: github.event_name == 'pull_request_target'
name: Run Tests with Twister (Pull Request)
run: |
rm -f testplan.csv
export ZEPHYR_BASE=${PWD}
export ZEPHYR_TOOLCHAIN_VARIANT=zephyr
python3 ./scripts/ci/test_plan.py -c origin/${BASE_REF}.. --pull-request
./scripts/twister --subset ${{matrix.subset}}/${{ strategy.job-total }} --load-tests testplan.csv ${TWISTER_COMMON} ${PR_OPTIONS}
- if: github.event_name == 'schedule'
name: Run Tests with Twister (Daily)
run: |
export ZEPHYR_BASE=${PWD}
export ZEPHYR_TOOLCHAIN_VARIANT=zephyr
./scripts/twister --subset ${{matrix.subset}}/${{ strategy.job-total }} ${TWISTER_COMMON} ${DAILY_OPTIONS}
- name: ccache stats post
run: |
ccache -s
- name: Upload Unit Test Results
if: always()
uses: actions/upload-artifact@v3
with:
name: Unit Test Results (Subset ${{ matrix.subset }})
if-no-files-found: ignore
path: |
twister-out/twister.xml
testplan.csv
twister-test-results:
name: "Publish Unit Tests Results"
needs: twister-build
runs-on: ubuntu-20.04
# the build-and-test job might be skipped, we don't need to run this job then
if: success() || failure()
steps:
- name: Download Artifacts
uses: actions/download-artifact@v2
with:
path: artifacts
- name: Publish Unit Test Results
uses: EnricoMi/publish-unit-test-result-action@v1
with:
check_name: Unit Test Results
github_token: ${{ secrets.GITHUB_TOKEN }}
files: "**/twister.xml"
comment_mode: off

View File

@@ -5,12 +5,16 @@ name: Twister TestSuite
on:
push:
branches:
- v2.7-branch
paths:
- 'scripts/pylib/twister/**'
- 'scripts/twister'
- 'scripts/tests/twister/**'
- '.github/workflows/twister_tests.yml'
pull_request:
branches:
- v2.7-branch
paths:
- 'scripts/pylib/twister/**'
- 'scripts/twister'
@@ -24,17 +28,17 @@ jobs:
strategy:
matrix:
python-version: [3.6, 3.7, 3.8]
os: [ubuntu-latest]
os: [ubuntu-20.04]
steps:
- name: checkout
uses: actions/checkout@v2
uses: actions/checkout@v3
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v1
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
- name: cache-pip-linux
if: startsWith(runner.os, 'Linux')
uses: actions/cache@v1
uses: actions/cache@v3
with:
path: ~/.cache/pip
key: ${{ runner.os }}-pip-${{ matrix.python-version }}

View File

@@ -5,11 +5,15 @@ name: Zephyr West Command Tests
on:
push:
branches:
- v2.7-branch
paths:
- 'scripts/west-commands.yml'
- 'scripts/west_commands/**'
- '.github/workflows/west_cmds.yml'
pull_request:
branches:
- v2.7-branch
paths:
- 'scripts/west-commands.yml'
- 'scripts/west_commands/**'
@@ -22,20 +26,22 @@ jobs:
strategy:
matrix:
python-version: [3.6, 3.7, 3.8]
os: [ubuntu-latest, macos-latest, windows-latest]
os: [ubuntu-20.04, macos-11, windows-2022]
exclude:
- os: macos-latest
- os: macos-11
python-version: 3.6
- os: windows-2022
python-version: 3.6
steps:
- name: checkout
uses: actions/checkout@v2
uses: actions/checkout@v3
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v1
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
- name: cache-pip-linux
if: startsWith(runner.os, 'Linux')
uses: actions/cache@v1
uses: actions/cache@v3
with:
path: ~/.cache/pip
key: ${{ runner.os }}-pip-${{ matrix.python-version }}
@@ -43,7 +49,7 @@ jobs:
${{ runner.os }}-pip-${{ matrix.python-version }}
- name: cache-pip-mac
if: startsWith(runner.os, 'macOS')
uses: actions/cache@v1
uses: actions/cache@v3
with:
path: ~/Library/Caches/pip
# Trailing '-' was just to get a different cache name
@@ -52,7 +58,7 @@ jobs:
${{ runner.os }}-pip-${{ matrix.python-version }}-
- name: cache-pip-win
if: startsWith(runner.os, 'Windows')
uses: actions/cache@v1
uses: actions/cache@v3
with:
path: ~\AppData\Local\pip\Cache
key: ${{ runner.os }}-pip-${{ matrix.python-version }}

View File

@@ -168,21 +168,29 @@ if(CONFIG_CPLUSPLUS)
# Kconfig choice ensures only one of these CONFIG_STD_CPP* is set.
if(CONFIG_STD_CPP98)
set(STD_CPP_DIALECT_FLAGS $<TARGET_PROPERTY:compiler-cpp,dialect_cpp98>)
list(APPEND CMAKE_CXX_COMPILE_FEATURES ${compile_features_cpp98})
elseif(CONFIG_STD_CPP11)
set(STD_CPP_DIALECT_FLAGS $<TARGET_PROPERTY:compiler-cpp,dialect_cpp11>) # Default in kconfig
list(APPEND CMAKE_CXX_COMPILE_FEATURES ${compile_features_cpp11})
elseif(CONFIG_STD_CPP14)
set(STD_CPP_DIALECT_FLAGS $<TARGET_PROPERTY:compiler-cpp,dialect_cpp14>)
list(APPEND CMAKE_CXX_COMPILE_FEATURES ${compile_features_cpp14})
elseif(CONFIG_STD_CPP17)
set(STD_CPP_DIALECT_FLAGS $<TARGET_PROPERTY:compiler-cpp,dialect_cpp17>)
list(APPEND CMAKE_CXX_COMPILE_FEATURES ${compile_features_cpp17})
elseif(CONFIG_STD_CPP2A)
set(STD_CPP_DIALECT_FLAGS $<TARGET_PROPERTY:compiler-cpp,dialect_cpp2a>)
list(APPEND CMAKE_CXX_COMPILE_FEATURES ${compile_features_cpp20})
elseif(CONFIG_STD_CPP20)
set(STD_CPP_DIALECT_FLAGS $<TARGET_PROPERTY:compiler-cpp,dialect_cpp20>)
list(APPEND CMAKE_CXX_COMPILE_FEATURES ${compile_features_cpp20})
elseif(CONFIG_STD_CPP2B)
set(STD_CPP_DIALECT_FLAGS $<TARGET_PROPERTY:compiler-cpp,dialect_cpp2b>)
list(APPEND CMAKE_CXX_COMPILE_FEATURES ${compile_features_cpp20})
else()
assert(0 "Unreachable code. Expected C++ standard to have been chosen. See Kconfig.zephyr.")
endif()
set(CMAKE_CXX_COMPILE_FEATURES ${CMAKE_CXX_COMPILE_FEATURES} PARENT_SCOPE)
zephyr_compile_options($<$<COMPILE_LANGUAGE:CXX>:${STD_CPP_DIALECT_FLAGS}>)
endif()
@@ -619,7 +627,7 @@ if(CONFIG_64BIT)
endif()
if(CONFIG_TIMEOUT_64BIT)
set(SYSCALL_SPLIT_TIMEOUT_ARG --split-type k_timeout_t)
set(SYSCALL_SPLIT_TIMEOUT_ARG --split-type k_timeout_t --split-type k_ticks_t)
endif()
add_custom_command(OUTPUT include/generated/syscall_dispatch.c ${syscall_list_h}
@@ -979,6 +987,7 @@ set_ifndef(CSTD c99)
zephyr_compile_options(
$<$<COMPILE_LANGUAGE:C>:$<TARGET_PROPERTY:compiler,cstd>${CSTD}>
)
set(CMAKE_C_COMPILE_FEATURES ${compile_features_${CSTD}} PARENT_SCOPE)
# @Intent: Configure linker scripts, i.e. generate linker scripts with variables substituted
toolchain_ld_configure_files()
@@ -1035,7 +1044,7 @@ if(CONFIG_USERSPACE)
OUTPUT ${APP_SMEM_UNALIGNED_LD} ${APP_SMEM_PINNED_UNALIGNED_LD}
COMMAND ${PYTHON_EXECUTABLE}
${ZEPHYR_BASE}/scripts/gen_app_partitions.py
-d ${OBJ_FILE_DIR}
-f ${CMAKE_BINARY_DIR}/compile_commands.json
-o ${APP_SMEM_UNALIGNED_LD}
$<$<BOOL:${APP_SMEM_PINNED_UNALIGNED_LD}>:--pinoutput=${APP_SMEM_PINNED_UNALIGNED_LD}>
${APP_SMEM_PINNED_PARTITION_LIST_ARG}
@@ -1376,6 +1385,17 @@ if(CONFIG_OUTPUT_PRINT_MEMORY_USAGE)
endif()
endif()
if(NOT CONFIG_EXCEPTIONS)
set(eh_frame_section ".eh_frame")
else()
set(eh_frame_section "")
endif()
set(remove_sections_argument_list "")
foreach(section .comment COMMON ${eh_frame_section})
list(APPEND remove_sections_argument_list
$<TARGET_PROPERTY:bintools,elfconvert_flag_section_remove>${section})
endforeach()
if(CONFIG_BUILD_OUTPUT_HEX OR BOARD_FLASH_RUNNER STREQUAL openocd)
get_property(elfconvert_formats TARGET bintools PROPERTY elfconvert_formats)
if(ihex IN_LIST elfconvert_formats)
@@ -1385,9 +1405,7 @@ if(CONFIG_BUILD_OUTPUT_HEX OR BOARD_FLASH_RUNNER STREQUAL openocd)
$<TARGET_PROPERTY:bintools,elfconvert_flag>
${GAP_FILL}
$<TARGET_PROPERTY:bintools,elfconvert_flag_outtarget>ihex
$<TARGET_PROPERTY:bintools,elfconvert_flag_section_remove>.comment
$<TARGET_PROPERTY:bintools,elfconvert_flag_section_remove>COMMON
$<TARGET_PROPERTY:bintools,elfconvert_flag_section_remove>.eh_frame
${remove_sections_argument_list}
$<TARGET_PROPERTY:bintools,elfconvert_flag_infile>${KERNEL_ELF_NAME}
$<TARGET_PROPERTY:bintools,elfconvert_flag_outfile>${KERNEL_HEX_NAME}
$<TARGET_PROPERTY:bintools,elfconvert_flag_final>
@@ -1409,9 +1427,7 @@ if(CONFIG_BUILD_OUTPUT_BIN)
$<TARGET_PROPERTY:bintools,elfconvert_flag>
${GAP_FILL}
$<TARGET_PROPERTY:bintools,elfconvert_flag_outtarget>binary
$<TARGET_PROPERTY:bintools,elfconvert_flag_section_remove>.comment
$<TARGET_PROPERTY:bintools,elfconvert_flag_section_remove>COMMON
$<TARGET_PROPERTY:bintools,elfconvert_flag_section_remove>.eh_frame
${remove_sections_argument_list}
$<TARGET_PROPERTY:bintools,elfconvert_flag_infile>${KERNEL_ELF_NAME}
$<TARGET_PROPERTY:bintools,elfconvert_flag_outfile>${KERNEL_BIN_NAME}
$<TARGET_PROPERTY:bintools,elfconvert_flag_final>

View File

@@ -8,9 +8,10 @@
<a href="https://bestpractices.coreinfrastructure.org/projects/74"><img
src="https://bestpractices.coreinfrastructure.org/projects/74/badge"></a>
<a href="https://buildkite.com/zephyr/zephyr">
<a
href="https://github.com/zephyrproject-rtos/zephyr/actions/workflows/twister.yaml?query=branch%3Amain">
<img
src="https://badge.buildkite.com/f5bd0dc88306cee17c9b38e78d11bb74a6291e3f40e7d13f31.svg?branch=main"></a>
src="https://github.com/zephyrproject-rtos/zephyr/actions/workflows/twister.yaml/badge.svg?event=push"></a>
The Zephyr Project is a scalable real-time operating system (RTOS) supporting
@@ -62,8 +63,7 @@ Here's a quick summary of resources to help you find your way around:
`Zephyr Development mailing list`_. The other `Zephyr mailing list
subgroups`_ have their own archives and sign-up pages.
* **Nightly CI Build Status**: https://lists.zephyrproject.org/g/builds
The builds@lists.zephyrproject.org mailing list archives the CI
(buildkite) nightly build results.
The builds@lists.zephyrproject.org mailing list archives the CI nightly build results.
* **Chat**: Real-time chat happens in Zephyr's Discord Server. Use
this `Discord Invite`_ to register.
* **Contributing**: see the `Contribution Guide`_

View File

@@ -1,5 +1,5 @@
VERSION_MAJOR = 2
VERSION_MINOR = 7
PATCHLEVEL = 0
PATCHLEVEL = 5
VERSION_TWEAK = 0
EXTRAVERSION =

View File

@@ -136,6 +136,7 @@ config NUM_IRQS
config RGF_NUM_BANKS
int "Number of General Purpose Register Banks"
depends on ARC_FIRQ
depends on NUM_IRQ_PRIO_LEVELS > 1
range 1 2
default 2
help
@@ -145,10 +146,15 @@ config RGF_NUM_BANKS
If fast interrupts are supported but there is only 1
register bank, the fast interrupt handler must save
and restore general purpose registers.
NOTE: it's required to have more than one interrupt priority level
to use second register bank - otherwise all interrupts will use
same register bank. Such configuration isn't supported in software
and it is not beneficial from the performance point of view.
config ARC_FIRQ
bool "FIRQ enable"
depends on ISA_ARCV2
depends on NUM_IRQ_PRIO_LEVELS > 1
default y
help
Fast interrupts are supported (FIRQ). If FIRQ enabled, for interrupts
@@ -156,6 +162,10 @@ config ARC_FIRQ
other regs will be saved according to the number of register bank;
If FIRQ is disabled, the handle of interrupts with highest priority
will be same with other interrupts.
NOTE: we don't allow the configuration with FIRQ enabled and only one
interrupt priority level (so all interrupts are FIRQ). Such
configuration isn't supported in software and it is not beneficial
from the performance point of view.
config ARC_FIRQ_STACK
bool "Enable separate firq stack"

View File

@@ -56,7 +56,7 @@ void arch_start_cpu(int cpu_num, k_thread_stack_t *stack, int sz,
* arc_cpu_wake_flag will protect arc_cpu_sp that
* only one slave cpu can read it per time
*/
arc_cpu_sp = Z_THREAD_STACK_BUFFER(stack) + sz;
arc_cpu_sp = Z_KERNEL_STACK_BUFFER(stack) + sz;
arc_cpu_wake_flag = cpu_num;

View File

@@ -849,7 +849,7 @@ static inline z_arch_esf_t *get_esf(uint32_t msp, uint32_t psp, uint32_t exc_ret
bool *nested_exc)
{
bool alternative_state_exc = false;
z_arch_esf_t *ptr_esf;
z_arch_esf_t *ptr_esf = NULL;
*nested_exc = false;

View File

@@ -40,7 +40,7 @@ static inline uint64_t z_arm_dwt_freq_get(void)
/* SysTick and DWT both run at CPU frequency,
* reflected in the system timer HW cycles/sec.
*/
return CONFIG_SYS_CLOCK_HW_CYCLES_PER_SEC;
return sys_clock_hw_cycles_per_sec();
#else
static uint64_t dwt_frequency;
uint32_t cyc_start, cyc_end;

View File

@@ -26,7 +26,7 @@
extern "C" {
#endif
extern K_KERNEL_STACK_ARRAY_DEFINE(z_interrupt_stacks, CONFIG_MP_NUM_CPUS,
K_KERNEL_STACK_ARRAY_EXTERN(z_interrupt_stacks, CONFIG_MP_NUM_CPUS,
CONFIG_ISR_STACK_SIZE);
/**

View File

@@ -101,9 +101,28 @@ spurious_continue:
* x0: 1st thread in the ready queue
* x1: _current thread
*/
#ifdef CONFIG_SMP
/*
* 2 possibilities here:
* - x0 != NULL (implies x0 != x1): we need to context switch and set
* the switch_handle in the context switch code
* - x0 == NULL: no context switch
*/
cmp x0, #0x0
bne switch
/*
* No context switch. Restore x0 from x1 (they are the same thread).
* See also comments to z_arch_get_next_switch_handle()
*/
mov x0, x1
b exit
switch:
#else
cmp x0, x1
beq exit
#endif
/* Switch thread */
bl z_arm64_context_switch

View File

@@ -129,7 +129,11 @@ void z_arm64_el2_init(void)
zero_cntvoff_el2(); /* Set 64-bit virtual timer offset to 0 */
zero_cnthctl_el2();
#ifdef CONFIG_CPU_AARCH64_CORTEX_R
zero_cnthps_ctl_el2();
#else
zero_cnthp_ctl_el2();
#endif
/*
* Enable this if/when we use the hypervisor timer.
* write_cnthp_cval_el2(~(uint64_t)0);

View File

@@ -124,9 +124,28 @@ void arch_new_thread(struct k_thread *thread, k_thread_stack_t *stack,
void *z_arch_get_next_switch_handle(struct k_thread **old_thread)
{
/*
* When returning from this function we will have the current thread
* onto the stack to be popped in x1 and the next thread in x0 returned
* from z_get_next_switch_handle() (see isr_wrapper.S)
*/
*old_thread = _current;
#ifdef CONFIG_SMP
/*
* XXX: see thread in #41840 and #40795
*
* The scheduler API requires a complete switch handle here, but arm64
* optimizes things such that the callee-save registers are still
* unsaved here (they get written out in z_arm64_context_switch()
* below). So pass a NULL instead, which the scheduler will store into
* the thread switch_handle field. The resulting thread won't be
* switched into until we write that ourselves.
*/
return z_get_next_switch_handle(NULL);
#else
return z_get_next_switch_handle(*old_thread);
#endif
}
#ifdef CONFIG_USERSPACE

View File

@@ -6,6 +6,7 @@ zephyr_library()
zephyr_library_sources(cpuhalt.c)
zephyr_library_sources(prep_c.c)
zephyr_library_sources(fatal.c)
zephyr_library_sources(cpuid.c)
zephyr_library_sources(spec_ctrl.c)
zephyr_library_sources_ifdef(CONFIG_X86_MEMMAP memmap.c)

51
arch/x86/core/cpuid.c Normal file
View File

@@ -0,0 +1,51 @@
/*
* Copyright (c) 2022 Intel Corporation
*
* SPDX-License-Identifier: Apache-2.0
*/
#include <cpuid.h> /* Header provided by the toolchain. */
#include <kernel_structs.h>
#include <arch/x86/cpuid.h>
#include <kernel.h>
uint32_t z_x86_cpuid_extended_features(void)
{
uint32_t eax, ebx, ecx = 0U, edx;
if (__get_cpuid(CPUID_EXTENDED_FEATURES_LVL,
&eax, &ebx, &ecx, &edx) == 0) {
return 0;
}
return edx;
}
#define INITIAL_APIC_ID_SHIFT (24)
#define INITIAL_APIC_ID_MASK (0xFF)
uint8_t z_x86_cpuid_get_current_physical_apic_id(void)
{
uint32_t eax, ebx, ecx, edx;
if (IS_ENABLED(CONFIG_X2APIC)) {
/* leaf 0x1F should be used first prior to using 0x0B */
if (__get_cpuid(CPUID_EXTENDED_TOPOLOGY_ENUMERATION_V2,
&eax, &ebx, &ecx, &edx) == 0) {
if (__get_cpuid(CPUID_EXTENDED_TOPOLOGY_ENUMERATION,
&eax, &ebx, &ecx, &edx) == 0) {
return 0;
}
}
} else {
if (__get_cpuid(CPUID_BASIC_INFO_1,
&eax, &ebx, &ecx, &edx) == 0) {
return 0;
}
edx = (ebx >> INITIAL_APIC_ID_SHIFT);
}
return (uint8_t)(edx & INITIAL_APIC_ID_MASK);
}

View File

@@ -114,4 +114,18 @@ void arch_new_thread(struct k_thread *thread, k_thread_stack_t *stack,
thread->arch.excNestCount = 0;
#endif /* CONFIG_LAZY_FPU_SHARING */
thread->arch.flags = 0;
/*
* When "eager FPU sharing" mode is enabled, FPU registers must be
* initialised at the time of thread creation because the floating-point
* context is always active and no further FPU initialisation is performed
* later.
*/
#if defined(CONFIG_EAGER_FPU_SHARING)
thread->arch.preempFloatReg.floatRegsUnion.fpRegs.fcw = 0x037f;
thread->arch.preempFloatReg.floatRegsUnion.fpRegs.ftw = 0xffff;
#if defined(CONFIG_X86_SSE)
thread->arch.preempFloatReg.floatRegsUnion.fpRegsEx.mxcsr = 0x1f80;
#endif /* CONFIG_X86_SSE */
#endif /* CONFIG_EAGER_FPU_SHARING */
}

View File

@@ -16,6 +16,8 @@
#include <kernel_arch_func.h>
#include <device.h>
#include <drivers/pcie/msi.h>
#include <drivers/interrupt_controller/sysapic.h>
#include <arch/x86/cpuid.h>
#endif
/* PCI Express Extended Configuration Mechanism (MMIO) */
@@ -179,12 +181,15 @@ static bool get_vtd(void)
/* these functions are explained in include/drivers/pcie/msi.h */
#define MSI_MAP_DESTINATION_ID_SHIFT 12
#define MSI_RH BIT(3)
uint32_t pcie_msi_map(unsigned int irq,
msi_vector_t *vector)
{
uint32_t map;
ARG_UNUSED(irq);
#if defined(CONFIG_INTEL_VTD_ICTL)
#if !defined(CONFIG_PCIE_MSI_X)
if (vector != NULL) {
@@ -197,7 +202,15 @@ uint32_t pcie_msi_map(unsigned int irq,
#endif
#endif
{
map = 0xFEE00000U; /* standard delivery to BSP local APIC */
uint32_t dest_id;
dest_id = z_x86_cpuid_get_current_physical_apic_id() <<
MSI_MAP_DESTINATION_ID_SHIFT;
/* Directing to current physical CPU (may not be BSP)
* Destination ID - RH 1 - DM 0
*/
map = 0xFEE00000U | dest_id | MSI_RH;
}
return map;

View File

@@ -4,13 +4,12 @@
* SPDX-License-Identifier: Apache-2.0
*/
#include <cpuid.h> /* Header provided by the toolchain. */
#include <init.h>
#include <kernel_structs.h>
#include <kernel_arch_data.h>
#include <kernel_arch_func.h>
#include <arch/x86/msr.h>
#include <arch/x86/cpuid.h>
#include <kernel.h>
/*
@@ -18,31 +17,13 @@
* https://software.intel.com/security-software-guidance/api-app/sites/default/files/336996-Speculative-Execution-Side-Channel-Mitigations.pdf
*/
#define CPUID_EXTENDED_FEATURES_LVL 7
/* Bits to check in CPUID extended features */
#define CPUID_SPEC_CTRL_SSBD BIT(31)
#define CPUID_SPEC_CTRL_IBRS BIT(26)
#if defined(CONFIG_DISABLE_SSBD) || defined(CONFIG_ENABLE_EXTENDED_IBRS)
static uint32_t cpuid_extended_features(void)
{
uint32_t eax, ebx, ecx = 0U, edx;
if (__get_cpuid(CPUID_EXTENDED_FEATURES_LVL,
&eax, &ebx, &ecx, &edx) == 0) {
return 0;
}
return edx;
}
static int spec_ctrl_init(const struct device *dev)
{
ARG_UNUSED(dev);
uint32_t enable_bits = 0U;
uint32_t cpuid7 = cpuid_extended_features();
uint32_t cpuid7 = z_x86_cpuid_extended_features();
#ifdef CONFIG_DISABLE_SSBD
if ((cpuid7 & CPUID_SPEC_CTRL_SSBD) != 0U) {

View File

@@ -12,6 +12,7 @@ endif()
string(REPLACE "nsim" "mdb" MDB_ARGS "${BOARD}.args")
if((CONFIG_SOC_NSIM_HS_SMP OR CONFIG_SOC_NSIM_HS6X_SMP))
board_runner_args(mdb-nsim "--cores=${CONFIG_MP_NUM_CPUS}" "--nsim_args=${MDB_ARGS}")
board_runner_args(mdb-hw "--cores=${CONFIG_MP_NUM_CPUS}")
else()
board_runner_args(mdb-nsim "--nsim_args=${MDB_ARGS}")
endif()

View File

@@ -27,6 +27,7 @@ endif # BOARD_BL5340_DVK_CPUAPP
config BUILD_WITH_TFM
default y if BOARD_BL5340_DVK_CPUAPP_NS
depends on ZEPHYR_TRUSTED_FIRMWARE_M_MODULE
if BUILD_WITH_TFM

Binary file not shown.

After

Width:  |  Height:  |  Size: 59 KiB

View File

@@ -43,8 +43,8 @@ This development kit has the following features:
* :abbr:`USB (Universal Serial Bus)`
* :abbr:`WDT (Watchdog Timer)`
.. figure:: img/bl5340_dvk_front.jpg
:width: 800px
.. figure:: img/bl5340_dvk_top.png
:width: 340px
:align: center
:alt: BL5340 DVK

View File

@@ -1,6 +1,6 @@
# BL654 USB adapter board configuration
# Copyright (c) 2021 Laird Connectivity
# Copyright (c) 2021-2022 Laird Connectivity
# SPDX-License-Identifier: Apache-2.0
if BOARD_BL654_USB
@@ -13,16 +13,21 @@ config BOARD
# Nordic nRF5 bootloader exists outside of the partitions specified in the
# DTS file, so we manually override FLASH_LOAD_OFFSET to link the application
# correctly, after Nordic MBR.
# correctly, after Nordic MBR, and limit the maximum size to not protude into
# the bootloader at the end of flash.
# When building MCUBoot, MCUBoot itself will select USE_DT_CODE_PARTITION
# which will make it link into the correct partition specified in DTS file,
# so no override is necessary.
# so no override or limit is necessary.
config FLASH_LOAD_OFFSET
default 0x1000
depends on !USE_DT_CODE_PARTITION
config FLASH_LOAD_SIZE
default 0xdf000
depends on !USE_DT_CODE_PARTITION
if USB_DEVICE_STACK
config USB_UART_CONSOLE

View File

@@ -1,4 +1,4 @@
# BT6X0 board configuration
# BT610 board configuration
# Copyright (c) 2021 Laird Connectivity
# SPDX-License-Identifier: Apache-2.0
@@ -7,4 +7,4 @@ config BOARD_ENABLE_DCDC
bool "Enable DCDC mode"
select SOC_DCDC_NRF52X
default y
depends on BOARD_BT6X0
depends on BOARD_BT610

View File

@@ -1,8 +1,8 @@
# BT6X0 board configuration
# BT610 board configuration
# Copyright (c) 2021 Laird Connectivity
# SPDX-License-Identifier: Apache-2.0
config BOARD_BT6X0
bool "BT6X0"
config BOARD_BT610
bool "BT610"
depends on SOC_NRF52840_QIAA

View File

@@ -3,10 +3,10 @@
# Copyright (c) 2021 Laird Connectivity
# SPDX-License-Identifier: Apache-2.0
if BOARD_BT6X0
if BOARD_BT610
config BOARD
default "bt6x0"
default "bt610"
config IEEE802154_NRF5
default y
@@ -21,4 +21,4 @@ DT_COMPAT_TI_TCA9538 := ti,tca9538
config I2C
default $(dt_compat_on_bus,$(DT_COMPAT_TI_TCA9538),i2c)
endif # BOARD_BT6X0
endif # BOARD_BT610

View File

@@ -8,8 +8,8 @@
#include <nordic/nrf52840_qiaa.dtsi>
/ {
model = "Laird BT6x0 Sensor";
compatible = "lairdconnect,bt6x0";
model = "Laird BT610 Sensor";
compatible = "lairdconnect,bt610";
chosen {
zephyr,console = &uart0;

View File

@@ -1,5 +1,5 @@
identifier: bt6x0
name: BT6X0
identifier: bt610
name: BT610
type: mcu
arch: arm
ram: 256

View File

@@ -2,7 +2,7 @@
CONFIG_SOC_SERIES_NRF52X=y
CONFIG_SOC_NRF52840_QIAA=y
CONFIG_BOARD_BT6X0=y
CONFIG_BOARD_BT610=y
# Enable MPU
CONFIG_ARM_MPU=y

View File

@@ -1,12 +1,12 @@
.. _bt6x0:
.. _bt610:
Laird Connectivity Sentrius BT6x0 Sensor
Laird Connectivity Sentrius BT610 Sensor
########################################
Overview
********
The Sentrius™ BT6x0 Sensor is a battery powered, Bluetooth v5 Long Range
The Sentrius™ BT610 Sensor is a battery powered, Bluetooth v5 Long Range
integrated sensor platform that uses a Nordic Semiconductor nRF52840 ARM
Cortex-M4F CPU.
@@ -28,19 +28,19 @@ The sensor has the following features:
* :abbr:`UART (Universal Asynchronous Receiver-Transmitter)`
* :abbr:`WDT (Watchdog Timer)`
.. figure:: img/bt6x0_front.jpg
.. figure:: img/bt610_front.jpg
:width: 500px
:align: center
:alt: Sentrius BT6x0 Sensor, front view
:alt: Sentrius BT610 Sensor, front view
Sentrius BT6x0 Sensor, front view
Sentrius BT610 Sensor, front view
.. figure:: img/bt6x0_back.jpg
.. figure:: img/bt610_back.jpg
:width: 500px
:align: center
:alt: Sentrius BT6x0 Sensor, rear view
:alt: Sentrius BT610 Sensor, rear view
Sentrius BT6x0 Sensor, rear view
Sentrius BT610 Sensor, rear view
More information about the board can be found at the
`Sentrius BT610 website`_.
@@ -51,7 +51,7 @@ Hardware
Supported Features
==================
The BT6x0 Sensor supports the following
The BT610 Sensor supports the following
hardware features:
+-----------+------------+----------------------+
@@ -89,12 +89,12 @@ hardware features:
| WDT | on-chip | watchdog |
+-----------+------------+----------------------+
.. figure:: img/bt6x0_board.jpg
.. figure:: img/bt610_board.jpg
:width: 500px
:align: center
:alt: Sentrius BT6x0 Sensor, board layout
:alt: Sentrius BT610 Sensor, board layout
Sentrius BT6x0 Sensor, board layout
Sentrius BT610 Sensor, board layout
Connections and IOs
===================
@@ -102,7 +102,7 @@ Connections and IOs
LED
---
Two LEDs are visible through the BT6x0 housing lid. Note that the LEDs can be
Two LEDs are visible through the BT610 housing lid. Note that the LEDs can be
driven either directly, or via PWM. PWM should be used when current consumption
is required to be minimised.
@@ -115,7 +115,7 @@ is required to be minimised.
Push button
------------
The BT6x0 incorporates three mechanical push buttons. Note these are only
The BT610 incorporates three mechanical push buttons. Note these are only
accessible with the housing cover removed.
Two of the buttons are available for use via the board DTS file, as follows.
@@ -129,7 +129,7 @@ microcontroller.
Magnetoresistive sensor
-----------------------
The BT6x0 incorporates a Honeywell SM351LT magnetoresistive sensor. Refer to
The BT610 incorporates a Honeywell SM351LT magnetoresistive sensor. Refer to
the `Honeywell SM351LT datasheet`_ for further details.
* MAG_1 = SW2 = P1.15 (SM3531LT_0)
@@ -157,7 +157,7 @@ This can deliver up to 50mA peak and 20mA continuous current.
Sensor connectivity
-------------------
The BT6x0 incorporates three terminal blocks J5, J6 & J7 that allow
The BT610 incorporates three terminal blocks J5, J6 & J7 that allow
connectivity to its sensor inputs, as follows.
Terminal Block J5
@@ -485,12 +485,12 @@ Required pins are as follows.
Programming and Debugging
*************************
Applications for the ``bt6x0`` board configuration can be
Applications for the ``bt610`` board configuration can be
built and flashed in the usual way (see :ref:`build_an_application`
and :ref:`application_run` for more details); however, the standard
debugging targets are not currently available.
The BT6x0 features a 10 way header, J3, for connection of a
The BT610 features a 10 way header, J3, for connection of a
programmer/debugger, with pinout as follows.
+-----------+------------+----------------------+
@@ -537,7 +537,7 @@ pinout as follows.
+-----------+------------+----------------------+-----------+
Note that pin 3 requires a solder bridge to be closed to enable powering of the
BT6x0 board via the UART connector.
BT610 board via the UART connector.
Flashing
========
@@ -552,7 +552,7 @@ Here is an example for the :ref:`hello_world` application.
First, run your favorite terminal program to listen for output.
NOTE: On the BT6x0, the UART lines are at TTL levels and must be passed through
NOTE: On the BT610, the UART lines are at TTL levels and must be passed through
an appropriate line driver circuit for translation to RS232 levels. Refer to
the `MAX3232 datasheet`_ for a suitable driver IC.
@@ -560,14 +560,14 @@ the `MAX3232 datasheet`_ for a suitable driver IC.
$ minicom -D <tty_device> -b 115200
Replace :code:`<tty_device>` with the port where the BT6x0 can be found. For
Replace :code:`<tty_device>` with the port where the BT610 can be found. For
example, under Linux, :code:`/dev/ttyUSB0`.
Then build and flash the application in the usual way.
.. zephyr-app-commands::
:zephyr-app: samples/hello_world
:board: bt6x0
:board: bt610
:goals: build flash
Note that an external debugger is required to perform application flashing.
@@ -575,14 +575,14 @@ Note that an external debugger is required to perform application flashing.
Debugging
=========
The ``bt6x0`` board does not have an on-board J-Link debug IC
The ``bt610`` board does not have an on-board J-Link debug IC
as some nRF5x development boards, however, instructions from the
:ref:`nordic_segger` page also apply to this board, with the additional step
of connecting an external debugger.
Testing Bluetooth on the BT6x0
Testing Bluetooth on the BT610
***********************************
Many of the Bluetooth examples will work on the BT6x0.
Many of the Bluetooth examples will work on the BT610.
Try them out:
* :ref:`ble_peripheral`
@@ -590,7 +590,7 @@ Try them out:
* :ref:`bluetooth-ibeacon-sample`
Testing the LEDs and buttons on the BT6x0
Testing the LEDs and buttons on the BT610
*****************************************
There are 2 samples that allow you to test that the buttons (switches) and LEDs
@@ -601,7 +601,7 @@ on the board are working properly with Zephyr:
You can build and flash the examples to make sure Zephyr is running correctly
on your board. The button, LED and sensor device definitions can be found in
:zephyr_file:`boards/arm/bt6x0/bt6x0.dts`.
:zephyr_file:`boards/arm/bt610/bt610.dts`.
References

View File

Before

Width:  |  Height:  |  Size: 76 KiB

After

Width:  |  Height:  |  Size: 76 KiB

View File

Before

Width:  |  Height:  |  Size: 78 KiB

After

Width:  |  Height:  |  Size: 78 KiB

View File

Before

Width:  |  Height:  |  Size: 48 KiB

After

Width:  |  Height:  |  Size: 48 KiB

View File

@@ -20,6 +20,7 @@ config BOARD
# force building with TF-M as the Secure Execution Environment.
config BUILD_WITH_TFM
default y if TRUSTED_EXECUTION_NONSECURE
depends on ZEPHYR_TRUSTED_FIRMWARE_M_MODULE
if GPIO

View File

@@ -4,7 +4,10 @@ type: mcu
arch: arm
ram: 4096
flash: 4096
simulation: qemu
# TFM is not supported by default in the Zephyr LTS release.
# Excluding this board's simulator to avoid CI failures.
#
#simulation: qemu
toolchain:
- gnuarmemb
- zephyr

View File

@@ -13,6 +13,7 @@ config BOARD
config BUILD_WITH_TFM
default y if BOARD_NRF5340DK_NRF5340_CPUAPP_NS
depends on ZEPHYR_TRUSTED_FIRMWARE_M_MODULE
if BUILD_WITH_TFM

View File

@@ -13,6 +13,7 @@ config BOARD
config BUILD_WITH_TFM
default y if BOARD_NRF9160DK_NRF9160_NS
depends on ZEPHYR_TRUSTED_FIRMWARE_M_MODULE
if BUILD_WITH_TFM

View File

@@ -216,7 +216,7 @@ Run a serial host program to connect with your NUCLEO-H745ZI-Q board.
$ minicom -b 115200 -D /dev/ttyACM0
or use scrreen:
or use screen:
.. code-block:: console
@@ -235,15 +235,20 @@ You should see the following message on the console:
$ Hello World! nucleo_h745zi_q_m7
Blinky example can also be used:
.. note::
Sometimes, flashing is not working. It is necessary to erase the flash
(with STM32CubeProgrammer for example) to make it work again.
Similarly, you can build and flash samples on the M4 target. For this, please
take care of the resource sharing (UART port used for console for instance).
Here is an example for the :ref:`blinky-sample` application on M4 core.
.. zephyr-app-commands::
:zephyr-app: samples/basic/blinky
:board: nucleo_h745zi_q_m7
:board: nucleo_h745zi_q_m4
:goals: build flash
Same way M4 core can be flashed.
.. note::
Flashing both M4 and M7 and pushing RESTART button on the board leads
@@ -261,6 +266,10 @@ You can debug an application in the usual way. Here is an example for the
:maybe-skip-config:
:goals: debug
Debugging with west is currently not available on Cortex M4 side.
In order to debug a Zephyr application on Cortex M4 side, you can use
`STM32CubeIDE`_.
.. _Nucleo H745ZI-Q website:
https://www.st.com/en/evaluation-tools/nucleo-h745zi-q.html

View File

@@ -6,6 +6,9 @@ CONFIG_SOC_STM32H745XX=y
# Board config should be specified since there are 2 possible targets
CONFIG_BOARD_NUCLEO_H745ZI_Q_M7=y
# Enable the internal SMPS regulator
CONFIG_POWER_SUPPLY_DIRECT_SMPS=y
# Enable MPU
CONFIG_ARM_MPU=y

View File

@@ -255,19 +255,17 @@ flashed in the usual way (see :ref:`build_an_application` and
Flashing
========
Nucleo L552ZE Q board includes an ST-LINK/V3E embedded debug tool
interface. This interface is not yet supported by the openocd version.
Instead, support can be enabled on pyocd by adding "pack" support with
the following pyocd command:
Nucleo L552ZE Q board includes an ST-LINK/V2-1 embedded debug tool
interface. Support can be enabled on pyocd by adding "pack" support with the
following pyocd command:
.. code-block:: console
$ pyocd pack --update
$ pyocd pack --install stm32l552ze
Nucleo L552ZE Q board includes an ST-LINK/V2-1 embedded debug tool
interface. This interface is supported by the openocd version
included in the Zephyr SDK since v0.9.2.
Alternatively, this interface is supported by the openocd version
included in the Zephyr SDK since v0.13.1.
Flashing an application to Nucleo L552ZE Q
------------------------------------------

View File

@@ -0,0 +1,19 @@
source [find interface/stlink.cfg]
transport select hla_swd
source [find target/stm32l5x.cfg]
# use hardware reset
reset_config srst_only srst_nogate
$_TARGETNAME configure -event gdb-attach {
echo "Debugger attaching: halting execution"
reset halt
gdb_breakpoint_override hard
}
$_TARGETNAME configure -event gdb-detach {
echo "Debugger detaching: resuming execution"
resume
}

View File

@@ -1,5 +1,7 @@
# SPDX-License-Identifier: Apache-2.0
board_runner_args(pyocd "--target=stm32wb55rgvx")
board_runner_args(stm32cubeprogrammer "--port=swd" "--reset=hw")
include(${ZEPHYR_BASE}/boards/common/openocd.board.cmake)
include(${ZEPHYR_BASE}/boards/common/pyocd.board.cmake)
include(${ZEPHYR_BASE}/boards/common/stm32cubeprogrammer.board.cmake)

View File

@@ -186,8 +186,9 @@ To operate bluetooth on Nucleo WB55RG, Cortex-M0 core should be flashed with
a valid STM32WB Coprocessor binaries (either 'Full stack' or 'HCI Layer').
These binaries are delivered in STM32WB Cube packages, under
Projects/STM32WB_Copro_Wireless_Binaries/STM32WB5x/
To date, interoperability and backward compatibility has been tested and is
guaranteed up to version 1.5 of STM32Cube package releases.
For compatibility information with the various versions of these binaries,
please check `modules/hal/stm32/lib/stm32wb/hci/README <https://github.com/zephyrproject-rtos/hal_stm32/blob/main/lib/stm32wb/hci/README>`__
in the hal_stm32 repo.
Connections and IOs
===================

View File

@@ -3,6 +3,9 @@
CONFIG_SOC_SERIES_STM32H7X=y
CONFIG_SOC_STM32H735XX=y
# Enable the internal SMPS regulator
CONFIG_POWER_SUPPLY_DIRECT_SMPS=y
# Enable MPU
CONFIG_ARM_MPU=y

View File

@@ -220,24 +220,6 @@ the USB port to prepare it for flashing. Then build and flash your application.
Here is an example for the :ref:`hello_world` application.
.. zephyr-app-commands::
:zephyr-app: samples/hello_world
:board: stm32h747i_disco_m7
:goals: build
Use the following commands to flash either m7 or m4 target:
.. code-block:: console
$ ./STM32_Programmer_CLI -c port=SWD mode=UR -w <path_to_m7_binary> 0x8000000
$ ./STM32_Programmer_CLI -c port=SWD mode=UR -w <path_to_m4_binary> 0x8100000
Alternatively it is possible to flash with OpenOcd but with some restrictions:
Sometimes, flashing is not working. It is necessary to erase the flash
(with STM32CubeProgrammer for example) to make it work again.
Debugging with OpenOCD is currently working for this board only with Cortex M7,
not Cortex M4.
.. zephyr-app-commands::
:zephyr-app: samples/hello_world
:board: stm32h747i_disco_m7
@@ -255,6 +237,20 @@ You should see the following message on the console:
Hello World! stm32h747i_disco_m7
.. note::
Sometimes, flashing is not working. It is necessary to erase the flash
(with STM32CubeProgrammer for example) to make it work again.
Similarly, you can build and flash samples on the M4 target. For this, please
take care of the resource sharing (UART port used for console for instance).
Here is an example for the :ref:`blinky-sample` application on M4 core.
.. zephyr-app-commands::
:zephyr-app: samples/basic/blinky
:board: stm32h747i_disco_m4
:goals: build flash
Debugging
=========
@@ -266,6 +262,9 @@ You can debug an application in the usual way. Here is an example for the
:board: stm32h747i_disco_m7
:goals: debug
Debugging with west is currently not available on Cortex M4 side.
In order to debug a Zephyr application on Cortex M4 side, you can use
`STM32CubeIDE`_.
.. _STM32H747I-DISCO website:
http://www.st.com/en/evaluation-tools/stm32h747i-disco.html
@@ -284,3 +283,6 @@ You can debug an application in the usual way. Here is an example for the
.. _DISCO_H747I modifications for Ethernet:
https://os.mbed.com/teams/ST/wiki/DISCO_H747I-modifications-for-Ethernet
.. _STM32CubeIDE:
https://www.st.com/en/development-tools/stm32cubeide.html

View File

@@ -9,6 +9,9 @@ CONFIG_BOARD_STM32H747I_DISCO_M7=y
# enable pinmux
CONFIG_PINMUX=y
# Enable the internal SMPS regulator
CONFIG_POWER_SUPPLY_DIRECT_SMPS=y
# enable GPIO
CONFIG_GPIO=y

View File

@@ -252,18 +252,16 @@ Flashing
========
STM32L562E-DK Discovery board includes an ST-LINK/V3E embedded debug tool
interface. This interface is not yet supported by the openocd version.
Instead, support can be enabled on pyocd by adding "pack" support with
the following pyocd command:
interface. Support can be enabled on pyocd by adding "pack" support with the
following pyocd command:
.. code-block:: console
$ pyocd pack --update
$ pyocd pack --install stm32l562qe
STM32L562E-DK Discovery board includes an ST-LINK/V2-1 embedded debug tool
interface. This interface is supported by the openocd version
included in the Zephyr SDK since v0.9.2.
Alternatively, this interface is supported by the openocd version
included in the Zephyr SDK since v0.13.1.
Flashing an application to STM32L562E-DK Discovery
--------------------------------------------------

View File

@@ -0,0 +1,19 @@
source [find interface/stlink.cfg]
transport select hla_swd
source [find target/stm32l5x.cfg]
# use hardware reset
reset_config srst_only srst_nogate
$_TARGETNAME configure -event gdb-attach {
echo "Debugger attaching: halting execution"
reset halt
gdb_breakpoint_override hard
}
$_TARGETNAME configure -event gdb-detach {
echo "Debugger detaching: resuming execution"
resume
}

View File

@@ -40,7 +40,7 @@ The Waveshare Open103Z configuration supports the following hardware features:
+-----------+------------+--------------------------------------+
| I2C | on-chip | i2c |
+-----------+------------+--------------------------------------+
| CAN | on-chip | can |
| CAN | on-chip | can (disabled by default) |
+-----------+------------+--------------------------------------+
| USB | on-chip | usb |
+-----------+------------+--------------------------------------+

View File

@@ -16,4 +16,3 @@ supported:
- watchdog
- adc
- usb_device
- can

View File

@@ -3,6 +3,7 @@
set(EMU_PLATFORM armfvp)
set(ARMFVP_BIN_NAME FVP_BaseR_AEMv8R)
set(ARMFVP_MIN_VERSION 11.16.16)
set(ARMFVP_FLAGS
-C cluster0.has_aarch64=1

View File

@@ -27,6 +27,8 @@ To Run the Fixed Virtual Platform simulation tool you must download "Armv8-R AEM
FVP" from Arm developer [1]_ (This might require the user to register) and
install it on your host PC.
The current minimum required version of "Armv8-R AEM FVP" is 11.16.16.
Hardware
********

View File

@@ -33,3 +33,5 @@ CONFIG_PM_CPU_OPS_PSCI=n
CONFIG_SOC_FVP_AEMV8R_EL2_INIT=y
CONFIG_MP_NUM_CPUS=4
CONFIG_MAX_THREAD_BYTES=3

View File

@@ -9,6 +9,7 @@
# set(<old_board_name>_DEPRECATED <new_board_name>)
set(bl5340_dvk_cpuappns_DEPRECATED bl5340_dvk_cpuapp_ns)
set(bt6x0_DEPRECATED bt610)
set(mps2_an521_nonsecure_DEPRECATED mps2_an521_ns)
set(musca_b1_nonsecure_DEPRECATED musca_b1_ns)
set(musca_s1_nonsecure_DEPRECATED musca_s1_ns)

View File

@@ -24,6 +24,7 @@ if(CONFIG_BOOTLOADER_ESP_IDF)
-DCMAKE_CXX_COMPILER=${CMAKE_CXX_COMPILER}
-DCMAKE_ASM_COMPILER=${CMAKE_ASM_COMPILER}
-DCMAKE_SYSTEM_NAME=${CMAKE_SYSTEM_NAME}
-DPYTHON=${PYTHON_EXECUTABLE}
BUILD_COMMAND
${CMAKE_COMMAND} --build .
INSTALL_COMMAND "" # This particular build system has no install command
@@ -35,14 +36,14 @@ if(CONFIG_BOOTLOADER_ESP_IDF)
BINARY_DIR ${espidf_build_dir}
CONFIGURE_COMMAND ""
BUILD_COMMAND
python ${ESP_IDF_PATH}/components/partition_table/gen_esp32part.py -q
${PYTHON_EXECUTABLE} ${ESP_IDF_PATH}/components/partition_table/gen_esp32part.py -q
--offset 0x1000 --flash-size 4MB ${ESP_IDF_PATH}/components/partition_table/partitions_singleapp.csv ${espidf_build_dir}/partitions_singleapp.bin
INSTALL_COMMAND ""
)
if(CONFIG_BUILD_OUTPUT_BIN)
set_property(GLOBAL APPEND PROPERTY extra_post_build_commands
COMMAND python ${ESP_IDF_PATH}/components/esptool_py/esptool/esptool.py
COMMAND ${PYTHON_EXECUTABLE} ${ESP_IDF_PATH}/components/esptool_py/esptool/esptool.py
ARGS --chip esp32c3 elf2image --flash_mode dio --flash_freq 40m
-o ${CMAKE_BINARY_DIR}/zephyr/${CONFIG_KERNEL_BIN_NAME}.bin
${CMAKE_BINARY_DIR}/zephyr/${CONFIG_KERNEL_BIN_NAME}.elf)

View File

@@ -23,6 +23,7 @@ if(CONFIG_BOOTLOADER_ESP_IDF)
-DCMAKE_CXX_COMPILER=${CMAKE_CXX_COMPILER}
-DCMAKE_ASM_COMPILER=${CMAKE_ASM_COMPILER}
-DCMAKE_SYSTEM_NAME=${CMAKE_SYSTEM_NAME}
-DPYTHON=${PYTHON_EXECUTABLE}
BUILD_COMMAND
${CMAKE_COMMAND} --build .
INSTALL_COMMAND "" # This particular build system has no install command
@@ -34,14 +35,14 @@ if(CONFIG_BOOTLOADER_ESP_IDF)
BINARY_DIR ${espidf_build_dir}
CONFIGURE_COMMAND ""
BUILD_COMMAND
python ${ESP_IDF_PATH}/components/partition_table/gen_esp32part.py -q
${PYTHON_EXECUTABLE} ${ESP_IDF_PATH}/components/partition_table/gen_esp32part.py -q
--offset 0x1000 --flash-size 4MB ${ESP_IDF_PATH}/components/partition_table/partitions_singleapp.csv ${espidf_build_dir}/partitions_singleapp.bin
INSTALL_COMMAND ""
)
if(CONFIG_BUILD_OUTPUT_BIN)
set_property(GLOBAL APPEND PROPERTY extra_post_build_commands
COMMAND python ${ESP_IDF_PATH}/components/esptool_py/esptool/esptool.py
COMMAND ${PYTHON_EXECUTABLE} ${ESP_IDF_PATH}/components/esptool_py/esptool/esptool.py
ARGS --chip esp32 elf2image --flash_mode dio --flash_freq 40m
-o ${CMAKE_BINARY_DIR}/zephyr/${CONFIG_KERNEL_BIN_NAME}.bin
${CMAKE_BINARY_DIR}/zephyr/${CONFIG_KERNEL_BIN_NAME}.elf)

View File

@@ -23,6 +23,7 @@ if(CONFIG_BOOTLOADER_ESP_IDF)
-DCMAKE_CXX_COMPILER=${CMAKE_CXX_COMPILER}
-DCMAKE_ASM_COMPILER=${CMAKE_ASM_COMPILER}
-DCMAKE_SYSTEM_NAME=${CMAKE_SYSTEM_NAME}
-DPYTHON=${PYTHON_EXECUTABLE}
BUILD_COMMAND
${CMAKE_COMMAND} --build .
INSTALL_COMMAND "" # This particular build system has no install command
@@ -34,14 +35,14 @@ if(CONFIG_BOOTLOADER_ESP_IDF)
BINARY_DIR ${espidf_build_dir}
CONFIGURE_COMMAND ""
BUILD_COMMAND
python ${ESP_IDF_PATH}/components/partition_table/gen_esp32part.py -q
${PYTHON_EXECUTABLE} ${ESP_IDF_PATH}/components/partition_table/gen_esp32part.py -q
--offset 0x1000 --flash-size 4MB ${ESP_IDF_PATH}/components/partition_table/partitions_singleapp.csv ${espidf_build_dir}/partitions_singleapp.bin
INSTALL_COMMAND ""
)
if(CONFIG_BUILD_OUTPUT_BIN)
set_property(GLOBAL APPEND PROPERTY extra_post_build_commands
COMMAND python ${ESP_IDF_PATH}/components/esptool_py/esptool/esptool.py
COMMAND ${PYTHON_EXECUTABLE} ${ESP_IDF_PATH}/components/esptool_py/esptool/esptool.py
ARGS --chip esp32s2 elf2image --flash_mode dio --flash_freq 40m
-o ${CMAKE_BINARY_DIR}/zephyr/${CONFIG_KERNEL_BIN_NAME}.bin
${CMAKE_BINARY_DIR}/zephyr/${CONFIG_KERNEL_BIN_NAME}.elf)

View File

@@ -546,6 +546,14 @@ set(SOC_SERIES ${CONFIG_SOC_SERIES})
set(SOC_TOOLCHAIN_NAME ${CONFIG_SOC_TOOLCHAIN_NAME})
set(SOC_FAMILY ${CONFIG_SOC_FAMILY})
# For the gen_app_partitions.py to work correctly, we must ensure that
# all targets exports their compile commands to fetch object files.
# We enable it unconditionally, as this is also useful for several IDEs
set(CMAKE_EXPORT_COMPILE_COMMANDS TRUE CACHE BOOL
"Export CMake compile commands. Used by gen_app_partitions.py script"
FORCE
)
if("${SOC_SERIES}" STREQUAL "")
set(SOC_PATH ${SOC_NAME})
else()

View File

@@ -0,0 +1,26 @@
set(c23id c2x gnu2x)
set(c17id c17 c18 gnu17 gnu18 "iso9899:2017" "iso9899:2018")
set(c11id c11 gnu11 "iso9899:2011")
set(c99id c99 gnu99 "iso9899:1999")
set(c90id c89 c90 gnu89 gnu90 "iso9899:1990" "iso9899:199409")
set(compile_features_list)
# For each id value above a compile_features_${idval} with a list of supported
# `c_std_XX` values are created for easy lookup.
# For example, the settings
# - `compile_feature_c99` will contain `c_std_90;c_std_99`
# - `compile_feature_iso9899:2011` will contain `c_std_90;c_std_99;c_std_11`
# that can then be used to set CMAKE_C_COMPILE_FEATURES accordingly.
foreach(standard 90 99 11 17 23)
list(APPEND compile_features_list c_std_${standard})
foreach(id ${c${standard}id})
set(compile_features_${id} ${compile_features_list})
endforeach()
endforeach()
set(compile_features_cpp98 cxx_std_98)
set(compile_features_cpp11 cxx_std_11 ${compile_features_cpp98})
set(compile_features_cpp14 cxx_std_14 ${compile_features_cpp11})
set(compile_features_cpp17 cxx_std_17 ${compile_features_cpp14})
set(compile_features_cpp20 cxx_std_20 ${compile_features_cpp17})

View File

@@ -10,6 +10,20 @@ find_program(
NAMES ${ARMFVP_BIN_NAME}
)
if ((NOT "${ARMFVP}" STREQUAL "ARMFVP-NOTFOUND") AND (DEFINED ARMFVP_MIN_VERSION))
execute_process(
COMMAND ${ARMFVP} --version
OUTPUT_VARIABLE out
OUTPUT_STRIP_TRAILING_WHITESPACE
)
string(REPLACE "\n" "" out ${out})
string(REGEX MATCH "[0-9]+\.[0-9]+\.[0-9]+" armfvp_version ${out})
if(${armfvp_version} VERSION_LESS ${ARMFVP_MIN_VERSION})
message(WARNING "Found FVP version is \"${armfvp_version}\", "
"the minimum required by the current board is \"${ARMFVP_MIN_VERSION}\".")
endif()
endif()
if(CONFIG_ARMV8_A_NS)
foreach(filetype BL1 FIP)
if ((NOT DEFINED ARMFVP_${filetype}_FILE) AND (EXISTS "$ENV{ARMFVP_${filetype}_FILE}"))

View File

@@ -518,7 +518,7 @@ function(zephyr_library_cc_option)
string(MAKE_C_IDENTIFIER check${option} check)
zephyr_check_compiler_flag(C ${option} ${check})
if(${check})
if(${${check}})
zephyr_library_compile_options(${option})
endif()
endforeach()
@@ -1003,9 +1003,9 @@ endfunction()
function(zephyr_check_compiler_flag lang option check)
# Check if the option is covered by any hardcoded check before doing
# an automated test.
zephyr_check_compiler_flag_hardcoded(${lang} "${option}" check exists)
zephyr_check_compiler_flag_hardcoded(${lang} "${option}" _${check} exists)
if(exists)
set(check ${check} PARENT_SCOPE)
set(${check} ${_${check}} PARENT_SCOPE)
return()
endif()
@@ -1110,11 +1110,11 @@ function(zephyr_check_compiler_flag_hardcoded lang option check exists)
# because they would produce a warning instead of an error during
# the test. Exclude them by toolchain-specific blocklist.
if((${lang} STREQUAL CXX) AND ("${option}" IN_LIST CXX_EXCLUDED_OPTIONS))
set(check 0 PARENT_SCOPE)
set(exists 1 PARENT_SCOPE)
set(${check} 0 PARENT_SCOPE)
set(${exists} 1 PARENT_SCOPE)
else()
# There does not exist a hardcoded check for this option.
set(exists 0 PARENT_SCOPE)
set(${exists} 0 PARENT_SCOPE)
endif()
endfunction(zephyr_check_compiler_flag_hardcoded)
@@ -1862,7 +1862,7 @@ function(check_set_linker_property)
zephyr_check_compiler_flag(C "" ${check})
set(CMAKE_REQUIRED_FLAGS ${SAVED_CMAKE_REQUIRED_FLAGS})
if(${check})
if(${${check}})
set_property(TARGET ${LINKER_PROPERTY_TARGET} ${APPEND} PROPERTY ${property} ${option})
endif()
endfunction()

View File

@@ -1,6 +1,8 @@
# SPDX-License-Identifier: Apache-2.0
include(${ZEPHYR_BASE}/cmake/toolchain/zephyr/host-tools.cmake)
if(ZEPHYR_SDK_HOST_TOOLS)
include(${ZEPHYR_BASE}/cmake/toolchain/zephyr/host-tools.cmake)
endif()
# dtc is an optional dependency
find_program(

View File

@@ -90,6 +90,8 @@ endforeach()
# A list of common environment settings used when invoking Kconfig during CMake
# configure time or menuconfig and related build target.
string(REPLACE ";" "\\\;" SHIELD_AS_LIST_ESCAPED "${SHIELD_AS_LIST}")
# cmake commands are escaped differently
string(REPLACE ";" "\\;" SHIELD_AS_LIST_ESCAPED_COMMAND "${SHIELD_AS_LIST}")
set(COMMON_KCONFIG_ENV_SETTINGS
PYTHON_EXECUTABLE=${PYTHON_EXECUTABLE}
@@ -161,12 +163,23 @@ endforeach()
unset(EXTRA_KCONFIG_OPTIONS)
get_cmake_property(cache_variable_names CACHE_VARIABLES)
foreach (name ${cache_variable_names})
if("${name}" MATCHES "^CONFIG_")
if("${name}" MATCHES "^CLI_CONFIG_")
# Variable was set by user in earlier invocation, let's append to extra
# config unless a new value has been given.
string(REGEX REPLACE "^CLI_" "" org_name ${name})
if(NOT DEFINED ${org_name})
set(EXTRA_KCONFIG_OPTIONS
"${EXTRA_KCONFIG_OPTIONS}\n${org_name}=${${name}}"
)
endif()
elseif("${name}" MATCHES "^CONFIG_")
# When a cache variable starts with 'CONFIG_', it is assumed to be
# a Kconfig symbol assignment from the CMake command line.
set(EXTRA_KCONFIG_OPTIONS
"${EXTRA_KCONFIG_OPTIONS}\n${name}=${${name}}"
)
set(CLI_${name} "${${name}}")
list(APPEND cli_config_list ${name})
endif()
endforeach()
@@ -250,7 +263,7 @@ endif()
execute_process(
COMMAND ${CMAKE_COMMAND} -E env
${COMMON_KCONFIG_ENV_SETTINGS}
SHIELD_AS_LIST=${SHIELD_AS_LIST_ESCAPED}
SHIELD_AS_LIST=${SHIELD_AS_LIST_ESCAPED_COMMAND}
${PYTHON_EXECUTABLE}
${ZEPHYR_BASE}/scripts/kconfig/kconfig.py
--zephyr-base=${ZEPHYR_BASE}
@@ -294,21 +307,20 @@ add_custom_target(config-twister DEPENDS ${DOTCONFIG})
# Remove the CLI Kconfig symbols from the namespace and
# CMakeCache.txt. If the symbols end up in DOTCONFIG they will be
# re-introduced to the namespace through 'import_kconfig'.
foreach (name ${cache_variable_names})
if("${name}" MATCHES "^CONFIG_")
unset(${name})
unset(${name} CACHE)
endif()
foreach (name ${cli_config_list})
unset(${name})
unset(${name} CACHE)
endforeach()
# Parse the lines prefixed with CONFIG_ in the .config file from Kconfig
import_kconfig(CONFIG_ ${DOTCONFIG})
# Re-introduce the CLI Kconfig symbols that survived
foreach (name ${cache_variable_names})
if("${name}" MATCHES "^CONFIG_")
if(DEFINED ${name})
set(${name} ${${name}} CACHE STRING "")
endif()
# Cache the CLI Kconfig symbols that survived through Kconfig, prefixed with CLI_.
# Remove those who might have changed compared to earlier runs, if they no longer appears.
foreach (name ${cli_config_list})
if(DEFINED ${name})
set(CLI_${name} ${CLI_${name}} CACHE INTERNAL "")
else()
unset(CLI_${name} CACHE)
endif()
endforeach()

View File

@@ -24,6 +24,11 @@ set(TOOLCHAIN_SIGNATURE ${CMAKE_C_COMPILER_MD5_SUM})
string(MD5 COMPILER_SIGNATURE ${CMAKE_C_COMPILER}_${CMAKE_C_COMPILER_ID}_${CMAKE_C_COMPILER_VERSION})
set(TOOLCHAIN_SIGNATURE ${TOOLCHAIN_SIGNATURE}_${COMPILER_SIGNATURE})
# Load the compile features file which will provide compile features lists for
# various C / CXX language dialects that can then be exported based on current
# Zephyr Kconfig settings or the CSTD global property.
include(${CMAKE_CURRENT_LIST_DIR}/compiler/compiler_features.cmake)
# Loading of templates are strictly not needed as they does not set any
# properties.
# They purely provides an overview as well as a starting point for supporting

View File

@@ -1,8 +0,0 @@
# Zephyr 0.11 SDK Toolchain
# Copyright (c) 2020 Linaro Limited.
# SPDX-License-Identifier: Apache-2.0
config TOOLCHAIN_ZEPHYR_0_11
def_bool y
select HAS_NEWLIB_LIBC_NANO if (ARC || ARM || RISCV)

View File

@@ -1,34 +0,0 @@
# SPDX-License-Identifier: Apache-2.0
set(TOOLCHAIN_HOME ${ZEPHYR_SDK_INSTALL_DIR})
set(COMPILER gcc)
set(LINKER ld)
set(BINTOOLS gnu)
# Find some toolchain that is distributed with this particular SDK
file(GLOB toolchain_paths
LIST_DIRECTORIES true
${TOOLCHAIN_HOME}/xtensa/*/*-zephyr-elf
${TOOLCHAIN_HOME}/*-zephyr-elf
${TOOLCHAIN_HOME}/*-zephyr-eabi
)
if(toolchain_paths)
list(GET toolchain_paths 0 some_toolchain_path)
get_filename_component(one_toolchain_root "${some_toolchain_path}" DIRECTORY)
get_filename_component(one_toolchain "${some_toolchain_path}" NAME)
set(CROSS_COMPILE_TARGET ${one_toolchain})
set(SYSROOT_TARGET ${one_toolchain})
endif()
if(NOT CROSS_COMPILE_TARGET)
message(FATAL_ERROR "Unable to find 'x86_64-zephyr-elf' or any other architecture in ${TOOLCHAIN_HOME}")
endif()
set(CROSS_COMPILE ${one_toolchain_root}/${CROSS_COMPILE_TARGET}/bin/${CROSS_COMPILE_TARGET}-)
set(SYSROOT_DIR ${one_toolchain_root}/${SYSROOT_TARGET}/${SYSROOT_TARGET})
set(TOOLCHAIN_HAS_NEWLIB ON CACHE BOOL "True if toolchain supports newlib")

View File

@@ -1,12 +0,0 @@
# SPDX-License-Identifier: Apache-2.0
set(HOST_TOOLS_HOME ${ZEPHYR_SDK_INSTALL_DIR}/sysroots/${TOOLCHAIN_ARCH}-pokysdk-linux)
# Path used for searching by the find_*() functions, with appropriate
# suffixes added. Ensures that the SDK's host tools will be found when
# we call, e.g. find_program(QEMU qemu-system-x86)
list(APPEND CMAKE_PREFIX_PATH ${HOST_TOOLS_HOME}/usr)
# TODO: Use find_* somehow for these as well?
set_ifndef(QEMU_BIOS ${HOST_TOOLS_HOME}/usr/share/qemu)
set_ifndef(OPENOCD_DEFAULT_PATH ${HOST_TOOLS_HOME}/usr/share/openocd/scripts)

View File

@@ -1,53 +0,0 @@
# SPDX-License-Identifier: Apache-2.0
set(CROSS_COMPILE_TARGET_arm arm-zephyr-eabi)
set(CROSS_COMPILE_TARGET_arm64 aarch64-zephyr-elf)
set(CROSS_COMPILE_TARGET_nios2 nios2-zephyr-elf)
set(CROSS_COMPILE_TARGET_riscv riscv64-zephyr-elf)
set(CROSS_COMPILE_TARGET_mips mipsel-zephyr-elf)
set(CROSS_COMPILE_TARGET_xtensa xtensa-zephyr-elf)
set(CROSS_COMPILE_TARGET_arc arc-zephyr-elf)
set(CROSS_COMPILE_TARGET_x86 x86_64-zephyr-elf)
set(CROSS_COMPILE_TARGET_sparc sparc-zephyr-elf)
set(CROSS_COMPILE_TARGET ${CROSS_COMPILE_TARGET_${ARCH}})
set(SYSROOT_TARGET ${CROSS_COMPILE_TARGET})
if("${ARCH}" STREQUAL "xtensa")
# Xtensa GCC needs a different toolchain per SOC
if("${SOC_SERIES}" STREQUAL "cavs_v15")
set(SR_XT_TC_SOC intel_apl_adsp)
elseif("${SOC_SERIES}" STREQUAL "cavs_v18")
set(SR_XT_TC_SOC intel_s1000)
elseif("${SOC_SERIES}" STREQUAL "cavs_v20")
set(SR_XT_TC_SOC intel_s1000)
elseif("${SOC_SERIES}" STREQUAL "cavs_v25")
set(SR_XT_TC_SOC intel_s1000)
elseif("${SOC_SERIES}" STREQUAL "baytrail_adsp")
set(SR_XT_TC_SOC intel_byt_adsp)
elseif("${SOC_SERIES}" STREQUAL "broadwell_adsp")
set(SR_XT_TC_SOC intel_bdw_adsp)
elseif("${SOC_SERIES}" STREQUAL "imx8")
set(SR_XT_TC_SOC nxp_imx_adsp)
elseif("${SOC_SERIES}" STREQUAL "imx8m")
set(SR_XT_TC_SOC nxp_imx8m_adsp)
else()
message(FATAL_ERROR "Not compiler set for SOC_SERIES ${SOC_SERIES}")
endif()
set(SYSROOT_DIR ${TOOLCHAIN_HOME}/xtensa/${SR_XT_TC_SOC}/${SYSROOT_TARGET})
set(CROSS_COMPILE ${TOOLCHAIN_HOME}/xtensa/${SR_XT_TC_SOC}/${CROSS_COMPILE_TARGET}/bin/${CROSS_COMPILE_TARGET}-)
else()
# Non-Xtensa SDK toolchains follow a simpler convention
set(SYSROOT_DIR ${TOOLCHAIN_HOME}/${SYSROOT_TARGET}/${SYSROOT_TARGET})
set(CROSS_COMPILE ${TOOLCHAIN_HOME}/${CROSS_COMPILE_TARGET}/bin/${CROSS_COMPILE_TARGET}-)
endif()
if("${ARCH}" STREQUAL "x86")
if(CONFIG_X86_64)
list(APPEND TOOLCHAIN_C_FLAGS -m64)
list(APPEND TOOLCHAIN_LD_FLAGS -m64)
else()
list(APPEND TOOLCHAIN_C_FLAGS -m32)
list(APPEND TOOLCHAIN_LD_FLAGS -m32)
endif()
endif()

View File

@@ -1,13 +1,7 @@
# SPDX-License-Identifier: Apache-2.0
if(${SDK_VERSION} VERSION_LESS_EQUAL 0.11.2)
# For backward compatibility with 0.11.1 and 0.11.2
# we need to source files from Zephyr repo
include(${CMAKE_CURRENT_LIST_DIR}/${SDK_MAJOR_MINOR}/generic.cmake)
include(${ZEPHYR_SDK_INSTALL_DIR}/cmake/zephyr/generic.cmake)
set(TOOLCHAIN_KCONFIG_DIR ${CMAKE_CURRENT_LIST_DIR}/${SDK_MAJOR_MINOR})
else()
include(${ZEPHYR_SDK_INSTALL_DIR}/cmake/zephyr/generic.cmake)
set(TOOLCHAIN_KCONFIG_DIR ${ZEPHYR_SDK_INSTALL_DIR}/cmake/zephyr)
set(TOOLCHAIN_KCONFIG_DIR ${ZEPHYR_SDK_INSTALL_DIR}/cmake/zephyr)
endif()
message(STATUS "Found toolchain: zephyr ${SDK_VERSION} (${ZEPHYR_SDK_INSTALL_DIR})")

View File

@@ -1,55 +1,5 @@
# SPDX-License-Identifier: Apache-2.0
# This is the minimum required version for Zephyr to work (Old style)
set(REQUIRED_SDK_VER 0.11.1)
cmake_host_system_information(RESULT TOOLCHAIN_ARCH QUERY OS_PLATFORM)
include(${ZEPHYR_SDK_INSTALL_DIR}/cmake/zephyr/host-tools.cmake)
if(NOT DEFINED ZEPHYR_SDK_INSTALL_DIR)
# Until https://github.com/zephyrproject-rtos/zephyr/issues/4912 is
# resolved we use ZEPHYR_SDK_INSTALL_DIR to determine whether the user
# wants to use the Zephyr SDK or not.
return()
endif()
# Cache the Zephyr SDK install dir.
set(ZEPHYR_SDK_INSTALL_DIR ${ZEPHYR_SDK_INSTALL_DIR} CACHE PATH "Zephyr SDK install directory")
if(NOT DEFINED SDK_VERSION)
if(ZEPHYR_TOOLCHAIN_VARIANT AND ZEPHYR_SDK_INSTALL_DIR)
# Manual detection for Zephyr SDK 0.11.1 and 0.11.2 for backward compatibility.
set(sdk_version_path ${ZEPHYR_SDK_INSTALL_DIR}/sdk_version)
if(NOT (EXISTS ${sdk_version_path}))
message(FATAL_ERROR
"The file '${ZEPHYR_SDK_INSTALL_DIR}/sdk_version' was not found. \
Is ZEPHYR_SDK_INSTALL_DIR=${ZEPHYR_SDK_INSTALL_DIR} misconfigured?")
endif()
# Read version as published by the SDK
file(READ ${sdk_version_path} SDK_VERSION_PRE1)
# Remove any pre-release data, for example 0.10.0-beta4 -> 0.10.0
string(REGEX REPLACE "-.*" "" SDK_VERSION_PRE2 ${SDK_VERSION_PRE1})
# Strip any trailing spaces/newlines from the version string
string(STRIP ${SDK_VERSION_PRE2} SDK_VERSION)
string(REGEX MATCH "([0-9]*).([0-9]*)" SDK_MAJOR_MINOR ${SDK_VERSION})
string(REGEX MATCH "([0-9]+)\.([0-9]+)\.([0-9]+)" SDK_MAJOR_MINOR_MICRO ${SDK_VERSION})
#at least 0.0.0
if(NOT SDK_MAJOR_MINOR_MICRO)
message(FATAL_ERROR "sdk version: ${SDK_MAJOR_MINOR_MICRO} improper format.
Expected format: x.y.z
Check whether the Zephyr SDK was installed correctly.
")
endif()
endif()
endif()
message(STATUS "Using toolchain: zephyr ${SDK_VERSION} (${ZEPHYR_SDK_INSTALL_DIR})")
if(${SDK_VERSION} VERSION_LESS_EQUAL 0.11.2)
# For backward compatibility with 0.11.1 and 0.11.2
# we need to source files from Zephyr repo
include(${CMAKE_CURRENT_LIST_DIR}/${SDK_MAJOR_MINOR}/host-tools.cmake)
else()
include(${ZEPHYR_SDK_INSTALL_DIR}/cmake/zephyr/host-tools.cmake)
endif()
message(STATUS "Found host-tools: zephyr ${SDK_VERSION} (${ZEPHYR_SDK_INSTALL_DIR})")

View File

@@ -1,18 +1,3 @@
# SPDX-License-Identifier: Apache-2.0
if(${SDK_VERSION} VERSION_LESS_EQUAL 0.11.2)
# For backward compatibility with 0.11.1 and 0.11.2
# we need to source files from Zephyr repo
include(${CMAKE_CURRENT_LIST_DIR}/${SDK_MAJOR_MINOR}/target.cmake)
elseif(("${ARCH}" STREQUAL "sparc") AND (${SDK_VERSION} VERSION_LESS 0.12))
# SDK 0.11.3, 0.11.4 does not have SPARC target support.
include(${CMAKE_CURRENT_LIST_DIR}/${SDK_MAJOR_MINOR}/target.cmake)
else()
include(${ZEPHYR_SDK_INSTALL_DIR}/cmake/zephyr/target.cmake)
# Workaround, FIXME: Waiting for new SDK.
if("${ARCH}" STREQUAL "xtensa")
set(SYSROOT_DIR ${TOOLCHAIN_HOME}/xtensa/${SOC_TOOLCHAIN_NAME}/${SYSROOT_TARGET})
set(CROSS_COMPILE ${TOOLCHAIN_HOME}/xtensa/${SOC_TOOLCHAIN_NAME}/${CROSS_COMPILE_TARGET}/bin/${CROSS_COMPILE_TARGET}-)
endif()
endif()
include(${ZEPHYR_SDK_INSTALL_DIR}/cmake/zephyr/target.cmake)

View File

@@ -90,10 +90,6 @@ if(NOT DEFINED ZEPHYR_TOOLCHAIN_VARIANT)
if (NOT Zephyr-sdk_CONSIDERED_VERSIONS)
set(error_msg "ZEPHYR_TOOLCHAIN_VARIANT not specified and no Zephyr SDK is installed.\n")
string(APPEND error_msg "Please set ZEPHYR_TOOLCHAIN_VARIANT to the toolchain to use or install the Zephyr SDK.")
if(NOT ZEPHYR_TOOLCHAIN_VARIANT AND NOT ZEPHYR_SDK_INSTALL_DIR)
set(error_note "Note: If you are using Zephyr SDK 0.11.1 or 0.11.2, remember to set ZEPHYR_SDK_INSTALL_DIR and ZEPHYR_TOOLCHAIN_VARIANT")
endif()
else()
# Note: When CMake mimimun version becomes >= 3.17, change this loop into:
# foreach(version config IN ZIP_LISTS Zephyr-sdk_CONSIDERED_VERSIONS Zephyr-sdk_CONSIDERED_CONFIGS)
@@ -116,11 +112,17 @@ if(NOT DEFINED ZEPHYR_TOOLCHAIN_VARIANT)
message(FATAL_ERROR "${error_msg}
The Zephyr SDK can be downloaded from:
https://github.com/zephyrproject-rtos/sdk-ng/releases/download/v${TOOLCHAIN_ZEPHYR_MINIMUM_REQUIRED_VERSION}/zephyr-sdk-${TOOLCHAIN_ZEPHYR_MINIMUM_REQUIRED_VERSION}-setup.run
${error_note}
")
endif()
if(DEFINED ZEPHYR_SDK_INSTALL_DIR)
# Cache the Zephyr SDK install dir.
set(ZEPHYR_SDK_INSTALL_DIR ${ZEPHYR_SDK_INSTALL_DIR} CACHE PATH "Zephyr SDK install directory")
# Use the Zephyr SDK host-tools.
set(ZEPHYR_SDK_HOST_TOOLS TRUE)
endif()
if(CMAKE_SCRIPT_MODE_FILE)
if("${FORMAT}" STREQUAL "json")
set(json "{\"ZEPHYR_TOOLCHAIN_VARIANT\" : \"${ZEPHYR_TOOLCHAIN_VARIANT}\", ")

View File

@@ -31,6 +31,9 @@ Configuration options
- ``doxyrunner_doxyfile``: Path to Doxyfile.
- ``doxyrunner_outdir``: Doxygen build output directory (inserted to
``OUTPUT_DIRECTORY``)
- ``doxyrunner_outdir_var``: Variable representing the Doxygen build output
directory, as used by ``OUTPUT_DIRECTORY``. This can be useful if other
Doxygen variables reference to the output directory.
- ``doxyrunner_fmt``: Flag to indicate if Doxyfile should be formatted.
- ``doxyrunner_fmt_vars``: Format variables dictionary (name: value).
- ``doxyrunner_fmt_pattern``: Format pattern.
@@ -132,6 +135,7 @@ def process_doxyfile(
fmt: bool = False,
fmt_pattern: Optional[str] = None,
fmt_vars: Optional[Dict[str, str]] = None,
outdir_var: Optional[str] = None,
) -> str:
"""Process Doxyfile.
@@ -146,6 +150,7 @@ def process_doxyfile(
fmt: If Doxyfile should be formatted.
fmt_pattern: Format pattern.
fmt_vars: Format variables.
outdir_var: Variable representing output directory.
Returns:
Processed Doxyfile content.
@@ -179,6 +184,10 @@ def process_doxyfile(
if not fmt_pattern or not fmt_vars:
raise ValueError("Invalid formatting pattern or variables")
if outdir_var:
fmt_vars = fmt_vars.copy()
fmt_vars[outdir_var] = outdir.as_posix()
for var, value in fmt_vars.items():
content = content.replace(fmt_pattern.format(var), value)
@@ -349,6 +358,7 @@ def doxygen_build(app: Sphinx) -> None:
app.config.doxyrunner_fmt,
app.config.doxyrunner_fmt_pattern,
app.config.doxyrunner_fmt_vars,
app.config.doxyrunner_outdir_var,
)
logger.info("Checking if Doxygen needs to be run...")
@@ -374,6 +384,7 @@ def setup(app: Sphinx) -> Dict[str, Any]:
app.add_config_value("doxyrunner_doxygen", "doxygen", "env")
app.add_config_value("doxyrunner_doxyfile", None, "env")
app.add_config_value("doxyrunner_outdir", None, "env")
app.add_config_value("doxyrunner_outdir_var", None, "env")
app.add_config_value("doxyrunner_fmt", False, "env")
app.add_config_value("doxyrunner_fmt_vars", {}, "env")
app.add_config_value("doxyrunner_fmt_pattern", "@{}@", "env")

View File

@@ -124,64 +124,27 @@ hr,
border-color: var(--admonition-attention-title-background-color) !important;
color: var(--admonition-attention-color) !important;
}
.rst-content dl:not(.docutils).class dt,
.rst-content dl:not(.docutils).function dt,
.rst-content dl:not(.docutils).method dt,
.rst-content dl:not(.docutils).attribute dt {
width: 100% !important;
}
.rst-content dl:not(.docutils).class > dt,
.rst-content dl:not(.docutils).function > dt,
.rst-content dl:not(.docutils).method > dt,
.rst-content dl:not(.docutils).attribute > dt {
font-size: 100% !important;
font-weight: normal !important;
margin-bottom: 16px !important;
padding: 6px 8px !important;
}
.rst-content dl:not(.docutils) tt.descclassname,
.rst-content dl:not(.docutils) code.descclassname {
color: var(--highlight-type2-color) !important;
font-weight: normal !important;
}
.rst-content dl:not(.docutils) tt.descname,
.rst-content dl:not(.docutils) code.descname {
color: var(--highlight-function-color) !important;
font-weight: normal !important;
}
.rst-content dl:not(.docutils) .sig-paren,
.rst-content dl:not(.docutils) .optional {
color: var(--highlight-operator-color) !important;
font-weight: normal !important;
padding: 0 2px !important;
}
.rst-content dl:not(.docutils) .optional {
font-style: italic !important;
}
.rst-content dl:not(.docutils) .sig-param,
.rst-content dl:not(.docutils).class dt > em,
.rst-content dl:not(.docutils).function dt > em,
.rst-content dl:not(.docutils).method dt > em {
color: var(--code-literal-color) !important;
.rst-content dt.sig .k {
color: var(--highlight-keyword2-color) !important;
font-style: normal !important;
padding: 0 4px !important;
}
.rst-content dl:not(.docutils) .sig-param,
.rst-content dl:not(.docutils).class dt > code,
.rst-content dl:not(.docutils).function dt > code,
.rst-content dl:not(.docutils).method dt > code {
padding: 0 4px !important;
}
.rst-content dl:not(.docutils) .sig-param,
.rst-content dl:not(.docutils).class dt > .optional ~ em,
.rst-content dl:not(.docutils).function dt > .optional ~ em,
.rst-content dl:not(.docutils).method dt > .optional ~ em {
color: var(--highlight-number-color) !important;
font-style: italic !important;
}
.rst-content dl:not(.docutils).class dt > em.property {
.rst-content dt.sig .kt {
color: var(--highlight-keyword-color) !important;
font-style: normal !important;
}
.rst-content dt.sig .sig-name .n {
color: var(--highlight-function-color) !important;
}
.rst-content dt.sig .k,
.rst-content dt.sig .kt,
.rst-content dt.sig .n {
font-weight: normal !important;
}
.rst-content dl:not(.docutils) dt a.headerlink {
color: var(--link-color) !important;
}
@@ -878,16 +841,8 @@ kbd, .kbd {
/* Breathe tweaks */
.rst-content dl.group>dt, .rst-content dl.group>dd>p {
display:none !important;
}
.rst-content dl.group {
margin: 0 0 1rem 0;
}
.rst-content dl.group>dd {
margin-left: 0 !important;
.rst-content .section > dl > dd {
margin-left: 0;
}
.rst-content p.breathe-sectiondef-title {
@@ -895,24 +850,12 @@ kbd, .kbd {
color: var(--link-color);
}
.rst-content div.breathe-sectiondef {
padding-left: 0 !important;
}
.rst-content dl:not(.docutils) dl:not(.rst-other-versions) dt {
background: var(--admonition-note-background-color) !important;
border-top: none !important;
border-left: none !important;
}
.rst-content dl:not(.docutils).c.var .pre {
padding-right: 4px;
}
.rst-content dl:not(.docutils).c.struct .property {
padding-right: 4px !important;
}
/* Misc tweaks */
.rst-columns {

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