Skip to content

Commit e81ae47

Browse files
committed
modules: mcuboot: Enable usb.overlay for mcuboot if USB is present
We need to add USB CDC node for mcuboot for devices that have USB. Signed-off-by: Robert Lubos <[email protected]>
1 parent 5252d8c commit e81ae47

File tree

3 files changed

+26
-0
lines changed

3 files changed

+26
-0
lines changed

modules/mcuboot/CMakeLists.txt

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -203,6 +203,16 @@ if(CONFIG_BOOTLOADER_MCUBOOT)
203203
)
204204
endif()
205205

206+
# For devices with USB then a USB CDC node in mcuboot is required.
207+
# As USB CDC is generally needed for this mcuboot use-case it should be
208+
# considered if this solution could be better generalized.
209+
if (CONFIG_MCUBOOT_USB_SUPPORT)
210+
add_overlay_dts(
211+
mcuboot
212+
${ZEPHYR_NRF_MODULE_DIR}/modules/mcuboot/usb.overlay
213+
)
214+
endif()
215+
206216
add_child_image(
207217
NAME mcuboot
208218
SOURCE_DIR ${ZEPHYR_MCUBOOT_MODULE_DIR}/boot/zephyr

modules/mcuboot/Kconfig

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,4 +34,8 @@ config DT_FLASH_WRITE_BLOCK_SIZE
3434
int
3535
default $(dt_node_int_prop_int,$(DT_CHOSEN_ZEPHYR_FLASH),write-block-size)
3636

37+
config MCUBOOT_USB_SUPPORT
38+
bool
39+
default y if "$(dt_nodelabel_enabled,zephyr_udc0)"
40+
3741
endmenu

modules/mcuboot/usb.overlay

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
/*
2+
* Copyright (c) 2021 Nordic Semiconductor ASA
3+
*
4+
* SPDX-License-Identifier: LicenseRef-Nordic-5-Clause
5+
*/
6+
7+
&zephyr_udc0 {
8+
cdc_acm_uart0: cdc_acm_uart0 {
9+
compatible = "zephyr,cdc-acm-uart";
10+
label = "CDC_ACM_0";
11+
};
12+
};

0 commit comments

Comments
 (0)