Compare commits
14 Commits
backport-1
...
backport-1
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
031155b611 | ||
|
|
c4ec030254 | ||
|
|
2509a8c393 | ||
|
|
59e779d9ed | ||
|
|
fd649f17f0 | ||
|
|
e0a24d3471 | ||
|
|
1ff7fbbaa2 | ||
|
|
ee992eb6a8 | ||
|
|
ef1b2dfd56 | ||
|
|
cde22a3191 | ||
|
|
6173a3cb3e | ||
|
|
cffdb1d8cf | ||
|
|
260d76b698 | ||
|
|
7b0ad6bd9d |
@@ -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)
|
||||
|
||||
@@ -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)), \
|
||||
|
||||
@@ -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
|
||||
***************************
|
||||
|
||||
@@ -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
|
||||
**********************
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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) {
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
27
scripts/utils/west-packages-pip-install.cmd
Normal file
27
scripts/utils/west-packages-pip-install.cmd
Normal 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%
|
||||
@@ -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
|
||||
|
||||
@@ -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) */
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -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
|
||||
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -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;
|
||||
|
||||
|
||||
@@ -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();
|
||||
|
||||
Reference in New Issue
Block a user