Compare commits

...

14 Commits

Author SHA1 Message Date
Robert Lubos
031155b611 samples: net: mdns_responder: Verify accept() result in echo server
The mdns_responder sample has a simple TCP echo server running, however
the accept() function errors were ignored, making the server defunct in
case server socket started to report errors (for example when network
went down).

Update the sample to restart the echo server in case of accept() errors
to make the sample more reliable.

Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
(cherry picked from commit 735f16f12f)
2026-01-13 12:36:12 +00:00
Robert Lubos
c4ec030254 net: sockets: Report an unrelying errors from accept()
If the underlying listening TCP context reported an error, it's no
longer usable, therefore accept() call for such a socket should report
an error as well, otherwise it may block indefinitely.

Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
(cherry picked from commit 1a2d9f7b8f)
2026-01-13 12:36:12 +00:00
Robert Lubos
2509a8c393 net: tcp: Make sure TCP context is dereferenced only once on network down
In case network interface goes down, all underlying TCP contexts are
being dereferenced, however they are not released until application
dereferences them as well (i.e. closed the socket). If the application
does not do so however timely, and network interface goes down again,
the TCP context would still be present on the active contexts list and
could've been dereferenced for the second time.

Fix this by checking the context state before dereferencing it on the
stack behalf. Non-listening TCP context are being set to CLOSED state
upon dereferencing.  For the listening contexts, the TCP context has
only one ref from the application side, so use the `accept_cb` pointer
value as an indicator that the accept callback, indicating an error,
has already been called for the context.

Additionally, add a mutex lock when releasing listening context on
network down even, to avoid potential races with yet unprocessed
incoming packets.

Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
(cherry picked from commit 913fae5169)
2026-01-13 12:36:12 +00:00
Joel Schaller
59e779d9ed shell: backend: telnet: No Error ENETDOWN
Set Log Level to Info when the Telnet socket reports ENETDOWN,
instead of logging an error each time the network is down.

Signed-off-by: Joel Schaller <joel.schaller16@gmail.com>
(cherry picked from commit 8f6b216ec0)
2026-01-12 12:50:23 -05:00
Sven Ginka
fd649f17f0 drivers: ethernet: dsa_nxp_imx_netc: fix zephyr random mac
zephyr,random-mac-address defaults to 0 or 1, which is always
available in generated code. so we can use the value itself.

Signed-off-by: Sven Ginka <s.ginka@sensry.de>
(cherry picked from commit c4a4d8aa87)
2026-01-12 12:48:16 -05:00
Missael Maciel
e0a24d3471 drivers: uart: save interrupts in PM Action
Removed usart_intenset attribute from conditional compilation
in mcux_flexcomm_data structure since this parameter needs to
be saved/restored independently if the interrupts are enabled
or not based on the PR feedback

Signed-off-by: Missael Maciel <davidmissael.maciel@nxp.com>
(cherry picked from commit 726e7b64c2)
2026-01-12 14:39:08 +02:00
Missael Maciel
1ff7fbbaa2 drivers: uart: save interrupts in PM Action
The PM action saves the interrupts enabled using a
global variable called usart_intenset. The problem is
when you have multiple uart instances that have different
configurations, when entering/exiting from a power level,
only one configuration is saved and will be applied to all
uart instances when exiting from a power level. We need to
keep this setting individual for each instance. To do this,
usart_intenset was added as a new element to mcux_flexcomm_data
structure. In this way, each uart instance will keep/restore
each own setting.

Signed-off-by: Missael Maciel <davidmissael.maciel@nxp.com>
(cherry picked from commit a84e0b5413)
2026-01-12 14:39:08 +02:00
Pieter De Gendt
ee992eb6a8 scripts: west: packages: Print warning on windows or run new command
On non-Windows systems execute a new program, replacing the west packages
call, when trying to install packages using pip.
For Windows, update the documented way of installing python packages,
or using 'west packages pip --install' print a warning.

Signed-off-by: Pieter De Gendt <pieter.degendt@basalte.be>
(cherry picked from commit 7f97d3dd0a)
2026-01-12 14:35:56 +02:00
Tomasz Chyrowicz
ef1b2dfd56 mcumgr: Prevent FW loader from self-destruction
The FW loader reports and manages exactly two slots:
 - slot 0: this is the slot for the application code to update
 - slot 1: this is the slot, in which the FW loader is placed

The slot 1 is reported, so tools can fetch metadata about the
FW loader installed on the device.
Unfortunately, currently SMP-based FW loader allows to issue slot erase
command for the slot 1, effectively erasing the FW loader code that is
being executed.

This change correctly identifies the slot 1 as an active one, marking it
as used and blocking erase operation on that slot.

Signed-off-by: Tomasz Chyrowicz <tomasz.chyrowicz@nordicsemi.no>
(cherry picked from commit 26128ab73d)
2026-01-12 14:35:44 +02:00
Alberto Escolar Piedras
cde22a3191 drivers: xen: Fix uninitialized variable warning
gcc complains about the posibility of ret and gfn being used
unitialiazed (with the input npages == 0).
Let's fix it by initializing ret to 0.

The warnings being:
```
      zephyr/CMakeFiles/zephyr.dir/drivers/xen/gnttab.c.obj
In file included from include/zephyr/logging/log.h:11,
                 from drivers/xen/gnttab.c:31:
include/zephyr/logging/log_core.h: In function 'gnttab_get_pages':
include/zephyr/logging/log_core.h:221:9: warning: 'gfn' may be used
uninitialized [-Wmaybe-uninitialized]
  221 |         z_log_minimal_printk("%c: " fmt "\n", \
      |         ^~~~~~~~~~~~~~~~~~~~
drivers/xen/gnttab.c:202:19: note: 'gfn' was declared here
  202 |         xen_pfn_t gfn;
      |                   ^~~
include/zephyr/logging/log_core.h:221:9: warning: 'ret' may be used
uninitialized [-Wmaybe-uninitialized]
  221 |         z_log_minimal_printk("%c: " fmt "\n", \
      |         ^~~~~~~~~~~~~~~~~~~~
drivers/xen/gnttab.c:199:13: note: 'ret' was declared here
  199 |         int ret;
      |             ^~~
```

Signed-off-by: Alberto Escolar Piedras <alberto.escolar.piedras@nordicsemi.no>
(cherry picked from commit 139b7c20c2)
2026-01-12 14:35:33 +02:00
Martin Stumpf
6173a3cb3e MCUmgr: OS: fix set datetime millisecond handling
According to the docs the millis were in the format `.SSSSSS`. In
reality though, it only accepted exactly `.SSS`, not `.SS` or `.SSSS`
and specifically also not `.SSSSSS`, contrary to the docs. Further, it did
not fail with an error message but simply produced the wrong value.

With this change it accepts everything from `.` to `.SSSSSS` and
produces the correct result. This is compatible with the previous
behavior, with the documentation and with everything in between.

Signed-off-by: Martin Stumpf <finomnis@gmail.com>
(cherry picked from commit ffb046b797)
2026-01-12 14:35:12 +02:00
Yong Cong Sin
cffdb1d8cf driver: i2c: i2c_dw: clear block mode on init
Depending on the IP's `IC_TX_CMD_BLOCK_DEFAULT` parameter, we
might have to clear the `TX_CMD_BLOCK` bit on init so that
Controller mode works.

Signed-off-by: Yong Cong Sin <ycsin@meta.com>
Signed-off-by: Yong Cong Sin <yongcong.sin@gmail.com>
(cherry picked from commit a028d8fafc)
2025-12-12 16:31:15 +02:00
Furkan Akkiz
260d76b698 manifest: Update hal_adi revision
Update hal_adi revision to get HAL fix commits. One of the fix commits
addresses an issue where the MAX32650 system clock frequency value was
not set correctly, which could lead to improper operation of
time-dependent functions.

Signed-off-by: Furkan Akkiz <hasanfurkan.akkiz@analog.com>
(cherry picked from commit 2385641f12)
2025-12-12 16:31:05 +02:00
Derek Snell
7b0ad6bd9d boards: nxp: mimxrt1180_evk: fix directory for Jlink script
Fixes path to the script file so the script is used with "west debug".

Signed-off-by: Derek Snell <derek.snell@nxp.com>
(cherry picked from commit 6044d455e4)
2025-12-12 16:30:54 +02:00
17 changed files with 287 additions and 129 deletions

View File

@@ -7,14 +7,15 @@
# Note1: Suggest developers use Secure Provisioning Tool(SPT) to download RT1180 image
# SPT can be downloaded on NXP web: https://www.nxp.com/design/design-center/software/development-software/mcuxpresso-software-and-tools-/mcuxpresso-secure-provisioning-tool:MCUXPRESSO-SECURE-PROVISIONING
# Details about the usage of SPT on MIMXRT1180-EVK board can be referred on chapter 7 of getting start with Mcuxpresso SDK for MIMXRT1180-EVK doc in SDK package.
set(JLINKSCRIPTDIR ${CMAKE_CURRENT_LIST_DIR}/jlinkscript)
if(CONFIG_SOC_MIMXRT1189_CM33 OR CONFIG_SECOND_CORE_MCUX)
board_runner_args(linkserver "--device=MIMXRT1189xxxxx:MIMXRT1180-EVK")
board_runner_args(jlink "--device=MIMXRT1189xxx8_M33" "--reset-after-load" "--tool-opt=-jlinkscriptfile jlinkscript/evkmimxrt1180_cm33.jlinkscript")
board_runner_args(jlink "--device=MIMXRT1189xxx8_M33" "--reset-after-load" "--tool-opt=-jlinkscriptfile ${JLINKSCRIPTDIR}/evkmimxrt1180_cm33.jlinkscript")
elseif(CONFIG_SOC_MIMXRT1189_CM7)
# Note: Only support run cm7 image when debugging due to default boot core on board is cm33 core
board_runner_args(linkserver "--device=MIMXRT1189xxxxx:MIMXRT1180-EVK")
board_runner_args(linkserver "--core=cm7")
board_runner_args(jlink "--device=MIMXRT1189xxx8_M7" "--speed=4000" "--no-reset" "--tool-opt=-jlinkscriptfile jlinkscript/evkmimxrt1180_cm7.jlinkscript" "--tool-opt=-ir")
board_runner_args(jlink "--device=MIMXRT1189xxx8_M7" "--speed=4000" "--no-reset" "--tool-opt=-jlinkscriptfile ${JLINKSCRIPTDIR}/evkmimxrt1180_cm7.jlinkscript" "--tool-opt=-ir")
endif()
include(${ZEPHYR_BASE}/boards/common/linkserver.board.cmake)

View File

@@ -83,7 +83,7 @@ of i.MX NETC.
.phy_mode = NETC_PHY_MODE(port), \
}; \
struct dsa_port_config dsa_##n##_##port##_config = { \
.use_random_mac_addr = DT_NODE_HAS_PROP(port, zephyr_random_mac_address), \
.use_random_mac_addr = DT_PROP(port, zephyr_random_mac_address), \
.mac_addr = DT_PROP_OR(port, local_mac_address, {0}), \
.port_idx = DT_REG_ADDR(port), \
.phy_dev = DEVICE_DT_GET_OR_NULL(DT_PHANDLE(port, phy_handle)), \

View File

@@ -136,16 +136,39 @@ Keeping Zephyr updated
To update the Zephyr project source code, you need to get the latest
changes via ``git``. Afterwards, run ``west update`` as mentioned in
the previous paragraph.
Additionally, in the case of updated or added Python dependencies, running
``west packages pip --install`` will make sure these are up-to-date.
Additionally, check for updated or added Python dependencies.
.. code-block:: console
.. tabs::
# replace zephyrproject with the path you gave west init
cd zephyrproject/zephyr
git pull
west update
west packages pip --install
.. group-tab:: Linux/macOS
.. code-block:: console
# replace zephyrproject with the path you gave west init
cd zephyrproject/zephyr
git pull
west update
west packages pip --install
.. group-tab:: Windows
.. tabs::
.. code-tab:: bat
:: replace zephyrproject with the path you gave west init
cd zephyrproject\zephyr
git pull
west update
cmd /c scripts\utils\west-packages-pip-install.cmd
.. code-tab:: powershell
# replace zephyrproject with the path you gave west init
cd zephyrproject\zephyr
git pull
west update
python -m pip install @((west packages pip) -split ' ')
Export Zephyr CMake package
***************************

View File

@@ -266,6 +266,10 @@ chosen. You'll also install Zephyr's additional Python dependencies in a
west packages pip --install
.. note::
This could downgrade or upgrade west itself.
.. group-tab:: macOS
#. Create a new virtual environment:
@@ -317,6 +321,10 @@ chosen. You'll also install Zephyr's additional Python dependencies in a
west packages pip --install
.. note::
This could downgrade or upgrade west itself.
.. group-tab:: Windows
#. Open a ``cmd.exe`` or PowerShell terminal window **as a regular user**
@@ -389,9 +397,19 @@ chosen. You'll also install Zephyr's additional Python dependencies in a
#. Install Python dependencies using ``west packages``.
.. code-block:: bat
.. tabs::
west packages pip --install
.. code-tab:: bat
cmd /c scripts\utils\west-packages-pip-install.cmd
.. code-tab:: powershell
python -m pip install @((west packages pip) -split ' ')
.. note::
This could downgrade or upgrade west itself.
Install the Zephyr SDK
**********************

View File

@@ -451,7 +451,7 @@ static struct dsa_api dsa_netc_api = {
.phy_mode = NETC_PHY_MODE(port), \
}; \
struct dsa_port_config dsa_##n##_##port##_config = { \
.use_random_mac_addr = DT_NODE_HAS_PROP(port, zephyr_random_mac_address), \
.use_random_mac_addr = DT_PROP(port, zephyr_random_mac_address), \
.mac_addr = DT_PROP_OR(port, local_mac_address, {0}), \
.port_idx = DT_REG_ADDR(port), \
.phy_dev = DEVICE_DT_GET_OR_NULL(DT_PHANDLE(port, phy_handle)), \
@@ -482,6 +482,6 @@ static struct dsa_api dsa_netc_api = {
POST_KERNEL, \
CONFIG_ETH_INIT_PRIORITY, \
NULL); \
DSA_SWITCH_INST_INIT(n, &dsa_netc_api, &dsa_netc_data_##n, DSA_NETC_PORT_INST_INIT); \
DSA_SWITCH_INST_INIT(n, &dsa_netc_api, &dsa_netc_data_##n, DSA_NETC_PORT_INST_INIT);
DT_INST_FOREACH_STATUS_OKAY(DSA_NETC_DEVICE);

View File

@@ -1294,6 +1294,11 @@ static int i2c_dw_initialize(const struct device *dev)
uint32_t reg_base = get_regs(dev);
clear_bit_enable_en(reg_base);
/*
* depending on the IP configuration, we may have to disable block mode in
* controller mode
*/
clear_bit_enable_block(reg_base);
/* verify that we have a valid DesignWare register first */
if (read_comp_type(reg_base) != I2C_DW_MAGIC_KEY) {

View File

@@ -108,6 +108,7 @@ struct mcux_flexcomm_data {
bool pm_policy_state_lock;
struct k_work pm_lock_work;
#endif
uint32_t usart_intenset;
};
#ifdef CONFIG_PM_POLICY_DEVICE_CONSTRAINTS
@@ -1205,10 +1206,10 @@ static void mcux_flexcomm_pm_restore_wake(const struct device *dev,
}
#endif /* FC_UART_IS_WAKEUP */
static uint32_t usart_intenset;
static int mcux_flexcomm_pm_action(const struct device *dev, enum pm_device_action action)
{
const struct mcux_flexcomm_config *config = dev->config;
struct mcux_flexcomm_data *data = dev->data;
int ret;
switch (action) {
@@ -1217,14 +1218,14 @@ static int mcux_flexcomm_pm_action(const struct device *dev, enum pm_device_acti
case PM_DEVICE_ACTION_SUSPEND:
break;
case PM_DEVICE_ACTION_TURN_OFF:
usart_intenset = USART_GetEnabledInterrupts(config->base);
data->usart_intenset = USART_GetEnabledInterrupts(config->base);
break;
case PM_DEVICE_ACTION_TURN_ON:
ret = mcux_flexcomm_init_common(dev);
if (ret) {
return ret;
}
USART_EnableInterrupts(config->base, usart_intenset);
USART_EnableInterrupts(config->base, data->usart_intenset);
break;
default:
return -ENOTSUP;

View File

@@ -196,7 +196,7 @@ static void gop_eagain_retry(int cmd, struct gnttab_map_grant_ref *gref)
void *gnttab_get_pages(unsigned int npages)
{
int ret;
int ret = 0;
void *page_addr;
unsigned int removed;
xen_pfn_t gfn;

View File

@@ -26,11 +26,7 @@ static int welcome(int fd)
return send(fd, msg, sizeof(msg), 0);
}
/* This is mainly here to bind to a port to get service advertisement
* to work.. but since we're already here we might as well do something
* useful.
*/
void service(void)
static int echo_service(const struct sockaddr *server_addr)
{
int r;
int server_fd;
@@ -38,11 +34,116 @@ void service(void)
socklen_t len;
void *addrp;
uint16_t *portp;
struct sockaddr client_addr;
struct sockaddr_storage client_addr;
char addrstr[INET6_ADDRSTRLEN];
uint8_t line[64];
static struct sockaddr server_addr;
r = socket(server_addr->sa_family, SOCK_STREAM, 0);
if (r == -1) {
r = -errno;
NET_DBG("socket() failed (%d)", r);
return r;
}
server_fd = r;
NET_DBG("server_fd is %d", server_fd);
r = setsockopt(server_fd, SOL_SOCKET, SO_REUSEADDR, &(int){1}, sizeof(int));
if (r == -1) {
r = -errno;
LOG_ERR("setsockopt() failed (%d)", r);
close(server_fd);
return r;
}
r = bind(server_fd, server_addr, sizeof(*server_addr));
if (r == -1) {
r = -errno;
NET_DBG("bind() failed (%d)", r);
close(server_fd);
return r;
}
if (server_addr->sa_family == AF_INET6) {
addrp = &net_sin6((server_addr))->sin6_addr;
portp = &net_sin6(server_addr)->sin6_port;
} else {
addrp = &net_sin(server_addr)->sin_addr;
portp = &net_sin(server_addr)->sin_port;
}
inet_ntop(server_addr->sa_family, addrp, addrstr, sizeof(addrstr));
NET_DBG("bound to [%s]:%u", addrstr, ntohs(*portp));
r = listen(server_fd, 1);
if (r == -1) {
r = -errno;
NET_DBG("listen() failed (%d)", r);
close(server_fd);
return r;
}
for (;;) {
len = sizeof(client_addr);
r = accept(server_fd, (struct sockaddr *)&client_addr, &len);
if (r == -1) {
NET_DBG("accept() failed (%d)", errno);
break;
}
client_fd = r;
inet_ntop(server_addr->sa_family, addrp, addrstr, sizeof(addrstr));
NET_DBG("accepted connection from [%s]:%u", addrstr, ntohs(*portp));
/* send a banner */
r = welcome(client_fd);
if (r == -1) {
NET_DBG("send() failed (%d)", errno);
close(client_fd);
continue;
}
for (;;) {
/* echo 1 line at a time */
r = recv(client_fd, line, sizeof(line), 0);
if (r == -1) {
NET_DBG("recv() failed (%d)", errno);
close(client_fd);
break;
}
if (r == 0) {
NET_DBG("connection closed by peer");
close(client_fd);
break;
}
len = r;
r = send(client_fd, line, len, 0);
if (r == -1) {
NET_DBG("send() failed (%d)", errno);
close(client_fd);
break;
}
}
}
close(server_fd);
return 0;
}
/* This is mainly here to bind to a port to get service advertisement
* to work.. but since we're already here we might as well do something
* useful.
*/
void service(void)
{
int r = 0;
static struct sockaddr_storage server_addr;
#if DEFAULT_PORT == 0
/* The advanced use case: ephemeral port */
@@ -62,90 +163,21 @@ void service(void)
#endif
if (IS_ENABLED(CONFIG_NET_IPV6)) {
net_sin6(&server_addr)->sin6_family = AF_INET6;
net_sin6(&server_addr)->sin6_addr = in6addr_any;
net_sin6(&server_addr)->sin6_port = sys_cpu_to_be16(DEFAULT_PORT);
net_sin6(net_sad(&server_addr))->sin6_family = AF_INET6;
net_sin6(net_sad(&server_addr))->sin6_addr = in6addr_any;
net_sin6(net_sad(&server_addr))->sin6_port = sys_cpu_to_be16(DEFAULT_PORT);
} else if (IS_ENABLED(CONFIG_NET_IPV4)) {
net_sin(&server_addr)->sin_family = AF_INET;
net_sin(&server_addr)->sin_addr.s_addr = htonl(INADDR_ANY);
net_sin(&server_addr)->sin_port = sys_cpu_to_be16(DEFAULT_PORT);
net_sin(net_sad(&server_addr))->sin_family = AF_INET;
net_sin(net_sad(&server_addr))->sin_addr.s_addr = htonl(INADDR_ANY);
net_sin(net_sad(&server_addr))->sin_port = sys_cpu_to_be16(DEFAULT_PORT);
} else {
__ASSERT(false, "Neither IPv6 nor IPv4 are enabled");
}
r = socket(server_addr.sa_family, SOCK_STREAM, 0);
if (r == -1) {
NET_DBG("socket() failed (%d)", errno);
return;
}
server_fd = r;
NET_DBG("server_fd is %d", server_fd);
r = bind(server_fd, &server_addr, sizeof(server_addr));
if (r == -1) {
NET_DBG("bind() failed (%d)", errno);
close(server_fd);
return;
}
if (server_addr.sa_family == AF_INET6) {
addrp = &net_sin6(&server_addr)->sin6_addr;
portp = &net_sin6(&server_addr)->sin6_port;
} else {
addrp = &net_sin(&server_addr)->sin_addr;
portp = &net_sin(&server_addr)->sin_port;
}
inet_ntop(server_addr.sa_family, addrp, addrstr, sizeof(addrstr));
NET_DBG("bound to [%s]:%u",
addrstr, ntohs(*portp));
r = listen(server_fd, 1);
if (r == -1) {
NET_DBG("listen() failed (%d)", errno);
close(server_fd);
return;
}
for (;;) {
len = sizeof(client_addr);
r = accept(server_fd, (struct sockaddr *)&client_addr, &len);
if (r == -1) {
NET_DBG("accept() failed (%d)", errno);
continue;
}
client_fd = r;
inet_ntop(server_addr.sa_family, addrp, addrstr, sizeof(addrstr));
NET_DBG("accepted connection from [%s]:%u",
addrstr, ntohs(*portp));
/* send a banner */
r = welcome(client_fd);
if (r == -1) {
NET_DBG("send() failed (%d)", errno);
close(client_fd);
return;
}
for (;;) {
/* echo 1 line at a time */
r = recv(client_fd, line, sizeof(line), 0);
if (r == -1) {
NET_DBG("recv() failed (%d)", errno);
close(client_fd);
break;
}
len = r;
r = send(client_fd, line, len, 0);
if (r == -1) {
NET_DBG("send() failed (%d)", errno);
close(client_fd);
break;
}
while (r == 0) {
r = echo_service((struct sockaddr *)&server_addr);
if (r < 0) {
NET_ERR("Fatal echo server error, %d", r);
}
}
}

View File

@@ -0,0 +1,27 @@
:: SPDX-FileCopyrightText: Copyright The Zephyr Project Contributors
:: SPDX-License-Identifier: Apache-2.0
@echo off
rem Collect packages from west and install them with a single pip call.
setlocal enabledelayedexpansion
set "PACKAGES="
for /f "usebackq delims=" %%p in (`west packages pip`) do (
if defined PACKAGES (
set "PACKAGES=!PACKAGES! %%p"
) else (
set "PACKAGES=%%p"
)
)
if not defined PACKAGES (
echo west packages pip returned no packages to install.
exit /b 0
)
echo Installing packages with: python.exe -m pip install %PACKAGES%
python.exe -m pip install %PACKAGES%
set "RESULT=%ERRORLEVEL%"
endlocal & exit /b %RESULT%

View File

@@ -4,13 +4,15 @@
import argparse
import os
import platform
import subprocess
import sys
import textwrap
from itertools import chain
from pathlib import Path
from pathlib import Path, PureWindowsPath
from west.commands import WestCommand
from west.util import quote_sh_list
from zephyr_ext_common import ZEPHYR_BASE
sys.path.append(os.fspath(Path(__file__).parent.parent))
@@ -157,11 +159,38 @@ class Packages(WestCommand):
self.die("Running pip install outside of a virtual environment")
if len(requirements) > 0:
subprocess.check_call(
[sys.executable, "-m", "pip", "install"]
+ list(chain.from_iterable([("-r", r) for r in requirements]))
+ manager_args
cmd = [sys.executable, "-m", "pip", "install"]
cmd += chain.from_iterable([("-r", str(r)) for r in requirements])
cmd += manager_args
self.dbg(quote_sh_list(cmd))
# Use os.execv to execute a new program, replacing the current west process,
# this unloads all python modules first and allows for pip to update packages safely
if platform.system() != 'Windows':
os.execv(cmd[0], cmd)
# Only reachable on Windows systems
# Windows does not really support os.execv:
# https://github.com/python/cpython/issues/63323
# https://github.com/python/cpython/issues/101191
# Warn the users about permission errors as those reported in:
# https://github.com/zephyrproject-rtos/zephyr/issues/100296
cmdscript = (
PureWindowsPath(__file__).parents[1] / "utils" / "west-packages-pip-install.cmd"
)
self.wrn(
"Updating packages on Windows with 'west packages pip --install', that are "
"currently in use by west, results in permission errors. Leaving your "
"environment with conflicting package versions. Recommended is to start with "
"a new environment in that case.\n\n"
"To avoid this using powershell run the following command instead:\n"
f"{sys.executable} -m pip install @((west packages pip) -split ' ')\n\n"
"Using cmd.exe execute the helper script:\n"
f"cmd /c {cmdscript}\n\n"
"Running 'west packages pip --install -- --dry-run' can provide information "
"without actually updating the environment."
)
subprocess.check_call(cmd)
else:
self.inf("Nothing to install")
return

View File

@@ -361,15 +361,13 @@ img_mgmt_state_any_pending(void)
int
img_mgmt_slot_in_use(int slot)
{
#if defined(CONFIG_MCUBOOT_BOOTLOADER_MODE_FIRMWARE_UPDATER)
return 0;
#else
int image = img_mgmt_slot_to_image(slot);
int active_slot = img_mgmt_active_slot(image);
#if !defined(CONFIG_MCUBOOT_BOOTLOADER_MODE_DIRECT_XIP) && \
!defined(CONFIG_MCUBOOT_BOOTLOADER_MODE_RAM_LOAD) && \
!defined(CONFIG_MCUBOOT_BOOTLOADER_MODE_RAM_LOAD_WITH_REVERT)
!defined(CONFIG_MCUBOOT_BOOTLOADER_MODE_RAM_LOAD_WITH_REVERT) && \
!defined(CONFIG_MCUBOOT_BOOTLOADER_MODE_FIRMWARE_UPDATER)
enum img_mgmt_next_boot_type type = NEXT_BOOT_TYPE_NORMAL;
int nbs = img_mgmt_get_next_boot_slot(image, &type);
@@ -391,7 +389,6 @@ img_mgmt_slot_in_use(int slot)
#endif
return (active_slot == slot);
#endif /* !defined(CONFIG_MCUBOOT_BOOTLOADER_MODE_FIRMWARE_UPDATER) */
}
/**

View File

@@ -18,6 +18,7 @@
#include <assert.h>
#include <string.h>
#include <stdio.h>
#include <ctype.h>
#include <zcbor_common.h>
#include <zcbor_encode.h>
@@ -117,8 +118,6 @@ struct datetime_parser {
#define RTC_DATETIME_MINUTE_MAX 59
#define RTC_DATETIME_SECOND_MIN 0
#define RTC_DATETIME_SECOND_MAX 59
#define RTC_DATETIME_MILLISECOND_MIN 0
#define RTC_DATETIME_MILLISECOND_MAX 999
/* Size used for datetime creation buffer */
#ifdef CONFIG_MCUMGR_GRP_OS_DATETIME_MS
@@ -129,7 +128,7 @@ struct datetime_parser {
/* Minimum/maximum size of a datetime string that a client can provide */
#define RTC_DATETIME_MIN_STRING_SIZE 19
#define RTC_DATETIME_MAX_STRING_SIZE 26
#define RTC_DATETIME_MAX_STRING_SIZE 31
#endif
/* Specifies what the "all" ('a') of info parameter shows */
@@ -969,7 +968,7 @@ static int os_mgmt_datetime_write(struct smp_streamer *ctxt)
bool ok = true;
char *pos;
char *new_pos;
char date_string[RTC_DATETIME_MAX_STRING_SIZE];
char date_string[RTC_DATETIME_MAX_STRING_SIZE + 1];
struct rtc_time new_time = {
.tm_wday = -1,
.tm_yday = -1,
@@ -1024,7 +1023,7 @@ static int os_mgmt_datetime_write(struct smp_streamer *ctxt)
if (zcbor_map_decode_bulk(zsd, datetime_decode, ARRAY_SIZE(datetime_decode), &decoded)) {
return MGMT_ERR_EINVAL;
} else if (datetime.len < RTC_DATETIME_MIN_STRING_SIZE ||
datetime.len >= RTC_DATETIME_MAX_STRING_SIZE) {
datetime.len > RTC_DATETIME_MAX_STRING_SIZE) {
return MGMT_ERR_EINVAL;
}
@@ -1060,16 +1059,20 @@ static int os_mgmt_datetime_write(struct smp_streamer *ctxt)
}
#ifdef CONFIG_MCUMGR_GRP_OS_DATETIME_MS
if (*(pos - 1) == '.' && *pos != '\0') {
/* Provided value has a ms value, extract it */
new_time.tm_nsec = strtol(pos, &new_pos, RTC_DATETIME_NUMERIC_BASE);
if (*(pos - 1) == '.') {
uint32_t msec = 0;
uint32_t mul = 100; /* first digit: 10^-1 second = 100 ms */
if (new_time.tm_nsec < RTC_DATETIME_MILLISECOND_MIN ||
new_time.tm_nsec > RTC_DATETIME_MILLISECOND_MAX) {
return MGMT_ERR_EINVAL;
/* Parse up to 3 fractional digits */
while (isdigit((unsigned char)*pos) && mul >= 1) {
msec += (uint32_t)(*pos - '0') * mul;
mul /= 10;
pos++;
}
new_time.tm_nsec *= RTC_DATETIME_MS_TO_NS;
/* "." without digits yields 0 µs */
new_time.tm_nsec = msec * RTC_DATETIME_MS_TO_NS;
}
#endif

View File

@@ -4758,10 +4758,16 @@ static void close_tcp_conn(struct tcp *conn, void *user_data)
return;
}
if (conn->state == TCP_CLOSED) {
return;
}
/* net_tcp_put() will handle decrementing refcount on stack's behalf */
if (net_context_get_state(context) != NET_CONTEXT_LISTENING) {
net_tcp_put(context, true);
} else {
k_mutex_lock(&conn->lock, K_FOREVER);
if (context->conn_handler) {
net_conn_unregister(context->conn_handler);
context->conn_handler = NULL;
@@ -4769,7 +4775,10 @@ static void close_tcp_conn(struct tcp *conn, void *user_data)
if (conn->accept_cb != NULL) {
conn->accept_cb(conn->context, NULL, 0, -ENETDOWN, context->user_data);
conn->accept_cb = NULL;
}
k_mutex_unlock(&conn->lock);
}
}

View File

@@ -488,6 +488,11 @@ int zsock_accept_ctx(struct net_context *parent, struct sockaddr *addr,
return -1;
}
if (sock_is_error(parent)) {
errno = POINTER_TO_INT(parent->user_data);
return -1;
}
if (!sock_is_nonblock(parent)) {
k_timeout_t timeout = K_FOREVER;

View File

@@ -465,6 +465,7 @@ error:
static void telnet_server_cb(struct net_socket_service_event *evt)
{
int sock_error;
int ret;
socklen_t optlen = sizeof(int);
if (sh_telnet == NULL) {
@@ -475,7 +476,14 @@ static void telnet_server_cb(struct net_socket_service_event *evt)
(evt->event.revents & ZSOCK_POLLNVAL)) {
(void)zsock_getsockopt(evt->event.fd, SOL_SOCKET,
SO_ERROR, &sock_error, &optlen);
NET_ERR("Telnet socket %d error (%d)", evt->event.fd, sock_error);
ret = -sock_error;
if (ret == -ENETDOWN) {
LOG_INF("Network is down");
} else {
LOG_ERR("Telnet socket %d error (%d)", evt->event.fd, ret);
}
if (evt->event.fd == sh_telnet->fds[SOCK_ID_CLIENT].fd) {
telnet_end_client_connection();

View File

@@ -144,7 +144,7 @@ manifest:
groups:
- fs
- name: hal_adi
revision: eeb155f7382343438114605963ae64436cc53434
revision: 4a189d5d2d20267084d9066cd0c4548dd730f809
path: modules/hal/adi
groups:
- hal