Devices using the MCUX FlexSPI flash driver erase their flash too
slowly, causing the usb stack to freeze, and USB DFU utilities to
report a timeout. Enable IMG_ERASE_PROGRESSIVELY for SOCs using the
MCUX FlexSPI driver to prevent this error.
Fixes#45359
Signed-off-by: Daniel DeGrasse <daniel.degrasse@nxp.com>
In order to bring consistency in-tree, migrate all subsystems code to
the new prefix <zephyr/...>. Note that the conversion has been scripted,
refer to zephyrproject-rtos#45388 for more details.
Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
Move include paths and add new target_include_directories to support
backwards compatibility:
* /include -> /include/zephyr
example: <irq.h> -> <zephyr/irq.h>
Issue #41543
Signed-off-by: Yuval Peress <peress@google.com>
Until now the whole USB device stack code is located
in the top subsys/usb directory. Move it to own directory
in preparation for upcoming extension and rework of USB support.
Signed-off-by: Johann Fischer <johann.fischer@nordicsemi.no>
This commit adds the USB_DFU_PERMANENT_DOWNLOAD and USB_DFU_REBOOT and
symbols.When the permanent download symbol is enabled, slot 1 will be
marked as confirmed. With the reboot symbol enabled, the devices
automatically reboots after the download is completed.
The functionality is split into two symbols to allow the automatic
reboot without confirming the image. This enables image confirmation via
another channel. For example via the shell’s Mcuboot commands.
This functionality allows downloading an image to the device without the
user having to interact with the device. It is useful in cases where
ease of use is more important then safety. For example when using USB
download for daily development. This is especially applicable for
devices with a closed case.
The changes were tested on an nrf52840dk. The following line can be used
to build the USB DFU example with the symbols enabled.
west build -b nrf52840dk_nrf52840 zephyr/samples/subsys/usb/dfu \
-d build-dfu -- -DCONFIG_BOOTLOADER_MCUBOOT=y \
-DOVERLAY_CONFIG=overlay-reboot-permanent.conf \
-DCONFIG_MCUBOOT_SIGNATURE_KEY_FILE\
=\"bootloader/mcuboot/root-rsa-2048.pem\"
Fixes#41921
Signed-off-by: Martijn Stommels <martijn@martijnpc.nl>
According to Kconfig guidelines, boolean prompts must not start with
"Enable...". The following command has been used to automate the changes
in this patch:
sed -i "s/bool \"[Ee]nables\? \(\w\)/bool \"\U\1/g" **/Kconfig*
Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
Firmware uploading to the host may not always be desired,
disable it by default.
Enable it for existing USB DFU sample to keep
the usual behavior, add note about new option to README.rst.
Signed-off-by: Johann Fischer <johann.fischer@nordicsemi.no>
Rename confusing UPLOAD_FLASH_AREA_ID to DOWNLOAD_FLASH_AREA_ID
as it is area where firmware image is downloaded.
Signed-off-by: Johann Fischer <johann.fischer@nordicsemi.no>
It is possible that the actual data stage length of
the control transfer is zero, in that case we do not
need an additional ZLP packet.
This fixes a problem with USB DFU, where after an upload
the device is no longer responsive if upload size is
multiple of control endpoint MPS.
Signed-off-by: Johann Fischer <johann.fischer@nordicsemi.no>
Possibility to initialize USB device support is useful when
only CDC ACM class is enabled and CDC ACM UART is used as
backend for console, shell, or logging.
Signed-off-by: Johann Fischer <johann.fischer@nordicsemi.no>
This patch fixes an issue where mcux usb devices may stop
functioning after a reset event, because they do not
provide a USB_DC_DISCONNECTED event and USB_DC_RESET
events were not handled by the forward status callback.
Signed-off-by: Jacob Caughfield <mlsvrts@protonmail.com>
The new macro USBD_STRING_DESCR_USER_DEFINE works like
USBD_STRING_DESCR_DEFINE with the exception of being
ordered strictly after it. The new macro is needed to
ensures that user defined string descriptors can be added
without disturbing the order of string descriptors
defined by the usb subsystem.
Signed-off-by: Alexander Mihajlovic <a@abxy.se>
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>
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>
Stop using redundant DEV_DATA/DEV_CFG macros and use dev->data and
dev->config instead.
Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
For functions returning nothing, there is no need to document
with @return, as Doxgen complains about "documented empty
return type of ...".
Signed-off-by: Daniel Leung <daniel.leung@intel.com>
Rework suspended to be a shared atomic variable between
bluetooth_status_cb() and hci_tx_thread().
If the bus is suspended, initiate remote-wakeup and
wait until the bus is operational.
Signed-off-by: Johann Fischer <johann.fischer@nordicsemi.no>
Replace deprecated macro USBD_CFG_DATA_DEFINE by
USBD_DEFINE_CFG_DATA which places usb_cfg_data structures
in specific iterable section.
Replace __usb_data_start, __usb_data_end usage patterns
size_t size = (__usb_data_end - __usb_data_start);
for (size_t i = 0; i < size; i++) {...}
by
STRUCT_SECTION_FOREACH(usb_cfg_data, ...) {...}
Signed-off-by: Johann Fischer <johann.fischer@nordicsemi.no>
Update the macro prototype to explicitly require the length of the
desired user data. Update all in-tree usage of this macro.
Signed-off-by: Jordan Yates <jordan.yates@data61.csiro.au>
In the current USB device support, the sizes of bulk endpoint
are mostly configure through Kconfig and do not care if a device
is high-speed capable. The information if a USB device controller
supports high-speed comes from devicetree. Add a Kconfig option to
map this information and configure bulk endpoint sizes
accordingly.
Signed-off-by: Johann Fischer <johann.fischer@nordicsemi.no>
Use same init level and priority as serial drivers.
Align priority to the changes in
commit ad1450510a ("drivers: serial: Refactor drivers
to use shared init priority Kconfig")
Signed-off-by: Johann Fischer <johann.fischer@nordicsemi.no>
The print specifier for `atomic_t` should be updated
to `%ld`, `%lu`, or `%lx` to account for the type
change of `atomic_t` to `long`.
Signed-off-by: Christopher Friedt <chrisfriedt@gmail.com>
Add a macro to retrieve the iso data load length (the
length stored in the iso header) with a bit mask that
ensures that we only take the first 14 bits.
This is to remove any RFU bits that may have been set.
Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
There were a few cases where bt_hci_iso_data_hdr was used
instead of the proper struct bt_hci_iso_hdr.
Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
Kconfig USB_DEVICE_REMOTE_WAKEUP option depends only on
USB device controller capability, but is not controlled
by the USB device controller drivers configuration.
Move USB_DEVICE_REMOTE_WAKEUP option to drivers and
make it promptless.
Signed-off-by: Johann Fischer <johann.fischer@nordicsemi.no>
USB_SCD_ATTRIBUTES is a configuration dependent macro
that does not map any part of the spec and does not
belong to usb_ch9 header.
Signed-off-by: Johann Fischer <johann.fischer@nordicsemi.no>
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>
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>
When we build tests/kernel/common/kernel.common.misra on
bl654_usb we get the following error:
subsys/usb/usb_descriptor.c:313:2: error: ISO C90 forbids array
'hwid' whose size cannot be evaluated [-Werror=vla]
Fix by removing use of usblen variable in array.
Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
cdc_acm_irq_tx_ready was not checking if its interrupt was enabled.
This causes spurious tx irq handler calls.
Signed-off-by: Eric Johnson <eric@liveathos.com>
Prefix ringbuffers with cdc_acm because it is not possible
to use static specifier with RING_BUF_*_DECLARE_* macros
to avoid conflicts.
Fixes: #36608
Signed-off-by: Johann Fischer <johann.fischer@nordicsemi.no>
Before commit 4f2682bd79
("usb: cdc_acm: avoid spurious interrupt on configured or resume
events") spurious rx-interrupt provided start to read shell tx ring
buffer by CDC ACM UART. Now shell log backend not transmit data,
until CDC ACM UART received data from host.
This PR added invoking interrupt callback if tx interrupt is enable,
when CDC ACM class go to configured state, and flag tx_ready go to true.
Signed-off-by: Grixa Yrev <GrixaYrev@yandex.ru>
Add hidden Kconfig option to Kconfig.cdc and allow
to configure CDC ACM UART device from devicetree.
Signed-off-by: Johann Fischer <johann.fischer@nordicsemi.no>
After the modules are adapted for the revised
USB device stack configuration, and it seems that
it was only necessary for MCUboot, we can finally
remove Kconfig option CONFIG_USB.
Signed-off-by: Johann Fischer <johann.fischer@nordicsemi.no>
Change cdc_acm_poll_out to do the best to mimic behavior
of a hardware UART controller without flow control.
With this patch, if the USB subsystem is not ready,
no data is transfered to the buffer, that is, new character
is dropped. If the USB subsystem is ready and the buffer is full,
the first character from the tx_ringbuf is removed to
make room for the new character.
Signed-off-by: Johann Fischer <johann.fischer@nordicsemi.no>
With the last changes in USB device stack it was unfortunately
not considered that an interface can have no endpoints.
This caused the USB DFU class to stop working in DFU mode.
Signed-off-by: Johann Fischer <johann.fischer@nordicsemi.no>
Cleanup standard device request handler.
Pass pointer to setup packet as argument where
it is reasonable.
Signed-off-by: Johann Fischer <johann.fischer@nordicsemi.no>
Cleanup standard device request handler.
Pass pointer to setup packet as argument where
it is reasonable.
Signed-off-by: Johann Fischer <johann.fischer@nordicsemi.no>