Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix unsatisfied dependencies by static Kconfig elements #223

Merged
merged 9 commits into from
May 13, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions boards/extensions/Kconfig.mimxrt1010_evk
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# Copyright (c) 2024 TiaC Systems
# SPDX-License-Identifier: Apache-2.0

rsource "mimxrt1010_evk/Kconfig.defconfig"
4 changes: 4 additions & 0 deletions boards/extensions/Kconfig.mimxrt1060_evk
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# Copyright (c) 2024 TiaC Systems
# SPDX-License-Identifier: Apache-2.0

rsource "mimxrt1060_evk/Kconfig.defconfig"
4 changes: 4 additions & 0 deletions boards/extensions/Kconfig.mimxrt1060_evkb
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# Copyright (c) 2024 TiaC Systems
# SPDX-License-Identifier: Apache-2.0

rsource "mimxrt1060_evk/Kconfig.defconfig"
4 changes: 4 additions & 0 deletions boards/extensions/Kconfig.nucleo_f767zi
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# Copyright (c) 2024 TiaC Systems
# SPDX-License-Identifier: Apache-2.0

rsource "nucleo_f767zi/Kconfig.defconfig"
4 changes: 4 additions & 0 deletions boards/extensions/Kconfig.rpi_pico
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# Copyright (c) 2024 TiaC Systems
# SPDX-License-Identifier: Apache-2.0

rsource "rpi_pico/Kconfig.defconfig"
4 changes: 4 additions & 0 deletions boards/extensions/Kconfig.rpi_pico_w
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# Copyright (c) 2024 TiaC Systems
# SPDX-License-Identifier: Apache-2.0

rsource "rpi_pico/Kconfig.defconfig"
4 changes: 4 additions & 0 deletions boards/extensions/Kconfig.seeeduino_xiao
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# Copyright (c) 2024 TiaC Systems
# SPDX-License-Identifier: Apache-2.0

rsource "seeeduino_xiao/Kconfig.defconfig"
73 changes: 73 additions & 0 deletions boards/extensions/mimxrt1010_evk/Kconfig.defconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
# NXP MIMXRT1010-EVK board extended configuration

# Copyright (c) 2024 TiaC Systems
# SPDX-License-Identifier: Apache-2.0

config USB_SELF_POWERED
default y
depends on USB_DEVICE_STACK && BOARD_MIMXRT1010_EVK

config USB_MAX_POWER
default 0 if BOARD_MIMXRT1010_EVK # 0mA (self powered)
depends on USB_DEVICE_STACK && BOARD_MIMXRT1010_EVK

# Workaround for not being able to have commas in macro arguments
DT_CHOSEN_Z_CONSOLE := zephyr,console
DT_COMPAT_Z_CDC_ACM_UART := zephyr,cdc-acm-uart
DT_COMPAT_NXP_USB := nxp,ehci

# Macros to shorten Kconfig expressions
DT_CHOSEN_CONSOLE_NODE := $(dt_chosen_path,$(DT_CHOSEN_Z_CONSOLE))
DT_CHOSEN_CONSOLE_PARENT := $(dt_node_parent,$(DT_CHOSEN_CONSOLE_NODE))

if BOARD_MIMXRT1010_EVK && \
$(dt_chosen_enabled,$(DT_CHOSEN_Z_CONSOLE)) && \
$(dt_compat_on_bus,$(DT_COMPAT_Z_CDC_ACM_UART),usb) && \
$(dt_node_has_compat,$(DT_CHOSEN_CONSOLE_PARENT),$(DT_COMPAT_NXP_USB))

# Logger cannot use itself to log
choice USB_CDC_ACM_LOG_LEVEL_CHOICE
default USB_CDC_ACM_LOG_LEVEL_OFF
depends on LOG
endchoice

# Set USB log level to error only
choice USB_DEVICE_LOG_LEVEL_CHOICE
default USB_DEVICE_LOG_LEVEL_ERR
depends on LOG
endchoice

# Wait 4000ms at startup for logging
config LOG_PROCESS_THREAD_STARTUP_DELAY_MS
default 4000
depends on LOG

# Wait 4000ms at startup for USB enumeration on host side
config BOOT_DELAY
default 4000

endif # zephyr,cdc-acm-uart

#
# WARNINGS and NOTES for the disk name (CONFIG_MASS_STORAGE_DISK_NAME):
#
# 1. In principle, the disk name can be freely selected. If this is changed
# here in Kconfig, then the corresponding property "disk-name" in the
# corresponding Devicetree node with the compatibility "zephyr,flash-disk"
# must also be adapted. This should be improved in the future, as it
# represents double data storage.
#
# 2. If the FAT file system is used, the disk name defined here will also
# be used as the mountpoint. The currently used FATFS implementation
# automatically enters the disk name as mountpoint, which means that
# an application can only reach the correct disk via the exact same
# mountpoint name. Unfortunately, the current example application under
# "zephyr/samples/subsys/usb/mass" is hard-coded at this point and only
# expects the (disk) mountpoint name "NAND" and nothing else. This must
# be changed, as this implicitly represents a special configuration at
# source code level.
#

config MASS_STORAGE_DISK_NAME
default "NAND" if BOARD_MIMXRT1010_EVK
depends on USB_DEVICE_STACK && USB_MASS_STORAGE
73 changes: 59 additions & 14 deletions boards/extensions/mimxrt1010_evk/doc/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -23,23 +23,68 @@ List of extensions

.. list-table::
:align: left
:width: 25%
:width: 50%
:widths: 100

* - .. rubric:: NXP MIMXRT1010-EVK

* - .. literalinclude:: ../Kconfig.defconfig
:caption: Kconfig.defconfig
:language: Kconfig
:encoding: ISO-8859-1
:emphasize-lines: 1-2,5-6
:start-at: config USB_SELF_POWERED
:end-before: Workaround for not being able to have commas in macro arguments

- :brd:`change` log level and startup delay only in case of use the
native USB device port :dtcompatible:`nxp,ehci` with CDC-ACM UART
:dtcompatible:`zephyr,cdc-acm-uart` as Zephyr console:

- :kconfig:option:`CONFIG_USB_CDC_ACM_LOG_LEVEL_CHOICE` :=
:kconfig:option:`CONFIG_USB_CDC_ACM_LOG_LEVEL_OFF`
- :kconfig:option:`CONFIG_USB_DEVICE_LOG_LEVEL_CHOICE` :=
:kconfig:option:`CONFIG_USB_DEVICE_LOG_LEVEL_ERR`
- :kconfig:option:`CONFIG_LOG_PROCESS_THREAD_STARTUP_DELAY_MS`
- :kconfig:option:`CONFIG_BOOT_DELAY`

.. list-table::
:align: left
:width: 50%
:widths: 100

* - .. rubric:: NXP MIMXRT1010-EVK

* - .. literalinclude:: ../mimxrt1010_evk.conf
:caption: mimxrt1010_evk.conf
:language: cfg
* - .. literalinclude:: ../Kconfig.defconfig
:caption: Kconfig.defconfig
:language: Kconfig
:encoding: ISO-8859-1
:start-at: CONFIG_USB_SELF_POWERED
:end-at: CONFIG_USB_MAX_POWER
:emphasize-lines: 3-4,16-17,22-23,28-29,33-34
:start-at: Workaround for not being able to have commas in macro arguments
:end-at: endif # zephyr,cdc-acm-uart

.. rubric:: Devicetree

- set default entries for ``model`` and ``compatible`` of the boards:

.. list-table::
:align: left
:width: 50%
:widths: 100

* - .. rubric:: NXP MIMXRT1010-EVK

* - .. literalinclude:: ../mimxrt1010_evk.overlay
:caption: mimxrt1010_evk.overlay
:language: DTS
:encoding: ISO-8859-1
:prepend: / {
:start-at: model
:end-at: compatible
:append: };

- overwrite the Arduino UNO R3 specific edge connecor binding
:devicetree:`&arduino_header {...};` with additional closed
connections
connections:

.. list-table::
:align: left
Expand Down Expand Up @@ -86,7 +131,7 @@ List of extensions
:devicetree:`partition = <&storage_partition>;` with the hard defined
mass storage disk name :devicetree:`disk-name = "NAND";` – also set
the mass storage disk name hard on Kconfig level by a new board config
file with :kconfig:option:`CONFIG_MASS_STORAGE_DISK_NAME`
file with :kconfig:option:`CONFIG_MASS_STORAGE_DISK_NAME`:

.. list-table::
:align: left
Expand All @@ -105,11 +150,11 @@ List of extensions
:end-at: };
:append: };

.. literalinclude:: ../mimxrt1010_evk.conf
:caption: mimxrt1010_evk.conf
:language: cfg
.. literalinclude:: ../Kconfig.defconfig
:caption: Kconfig.defconfig
:language: Kconfig
:encoding: ISO-8859-1
:emphasize-lines: 21
:prepend: #
:start-at: NOTES for the disk name (CONFIG_MASS_STORAGE_DISK_NAME):
:end-at: CONFIG_MASS_STORAGE_DISK_NAME=
:emphasize-lines: 21-22
:start-at: NOTES for the disk name (CONFIG_MASS_STORAGE_DISK_NAME)
:end-at: depends on USB_DEVICE_STACK && USB_MASS_STORAGE
27 changes: 0 additions & 27 deletions boards/extensions/mimxrt1010_evk/mimxrt1010_evk.conf

This file was deleted.

8 changes: 8 additions & 0 deletions boards/extensions/mimxrt1010_evk/mimxrt1010_evk.overlay
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,14 @@
#include "arduino_r3_connector.dtsi"

/ {
model = "NXP MIMXRT1010-EVK board @ UART Concole";
compatible = "nxp,mimxrt1010", "nxp,mimxrt1010-uartcons";

chosen {
zephyr,console = &lpuart1;
zephyr,shell-uart = &lpuart1;
};

msc_disk0 {
compatible = "zephyr,flash-disk";
partition = <&storage_partition>;
Expand Down
74 changes: 74 additions & 0 deletions boards/extensions/mimxrt1060_evk/Kconfig.defconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
# NXP MIMXRT1060-EVK board extended configuration

# Copyright (c) 2024 TiaC Systems
# SPDX-License-Identifier: Apache-2.0

config USB_SELF_POWERED
default y
depends on USB_DEVICE_STACK && (BOARD_MIMXRT1060_EVK || BOARD_MIMXRT1060_EVKB)

config USB_MAX_POWER
default 0 if BOARD_MIMXRT1060_EVK # 0mA (self powered)
default 0 if BOARD_MIMXRT1060_EVKB # 0mA (self powered)
depends on USB_DEVICE_STACK && (BOARD_MIMXRT1060_EVK || BOARD_MIMXRT1060_EVKB)

# Workaround for not being able to have commas in macro arguments
DT_CHOSEN_Z_CONSOLE := zephyr,console
DT_COMPAT_Z_CDC_ACM_UART := zephyr,cdc-acm-uart
DT_COMPAT_NXP_USB := nxp,ehci

# Macros to shorten Kconfig expressions
DT_CHOSEN_CONSOLE_NODE := $(dt_chosen_path,$(DT_CHOSEN_Z_CONSOLE))
DT_CHOSEN_CONSOLE_PARENT := $(dt_node_parent,$(DT_CHOSEN_CONSOLE_NODE))

if (BOARD_MIMXRT1060_EVK || BOARD_MIMXRT1060_EVKB) && \
$(dt_chosen_enabled,$(DT_CHOSEN_Z_CONSOLE)) && \
$(dt_compat_on_bus,$(DT_COMPAT_Z_CDC_ACM_UART),usb) && \
$(dt_node_has_compat,$(DT_CHOSEN_CONSOLE_PARENT),$(DT_COMPAT_NXP_USB))

# Logger cannot use itself to log
choice USB_CDC_ACM_LOG_LEVEL_CHOICE
default USB_CDC_ACM_LOG_LEVEL_OFF
depends on LOG
endchoice

# Set USB log level to error only
choice USB_DEVICE_LOG_LEVEL_CHOICE
default USB_DEVICE_LOG_LEVEL_ERR
depends on LOG
endchoice

# Wait 4000ms at startup for logging
config LOG_PROCESS_THREAD_STARTUP_DELAY_MS
default 4000
depends on LOG

# Wait 4000ms at startup for USB enumeration on host side
config BOOT_DELAY
default 4000

endif # zephyr,cdc-acm-uart

#
# WARNINGS and NOTES for the disk name (CONFIG_MASS_STORAGE_DISK_NAME):
#
# 1. In principle, the disk name can be freely selected. If this is changed
# here in Kconfig, then the corresponding property "disk-name" in the
# corresponding Devicetree node with the compatibility "zephyr,flash-disk"
# must also be adapted. This should be improved in the future, as it
# represents double data storage.
#
# 2. If the FAT file system is used, the disk name defined here will also
# be used as the mountpoint. The currently used FATFS implementation
# automatically enters the disk name as mountpoint, which means that
# an application can only reach the correct disk via the exact same
# mountpoint name. Unfortunately, the current example application under
# "zephyr/samples/subsys/usb/mass" is hard-coded at this point and only
# expects the (disk) mountpoint name "NAND" and nothing else. This must
# be changed, as this implicitly represents a special configuration at
# source code level.
#

config MASS_STORAGE_DISK_NAME
default "NAND" if (BOARD_MIMXRT1060_EVK || BOARD_MIMXRT1060_EVKB)
depends on USB_DEVICE_STACK && USB_MASS_STORAGE
Loading