Skip to content

Commit

Permalink
boards: mimxrt1060_evk: made Kconfig more sensitive
Browse files Browse the repository at this point in the history
Remove all the static default configuration in board extensions
or snippets and introduce the more sensitive `Kconfig.defconfig`
pattern for the NXP MIMXRT1060-EVK board extension.

Signed-off-by: Stephan Linz <[email protected]>
  • Loading branch information
rexut committed May 13, 2024
1 parent 97e2a1c commit e1a4580
Show file tree
Hide file tree
Showing 12 changed files with 185 additions and 167 deletions.
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"
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
136 changes: 83 additions & 53 deletions boards/extensions/mimxrt1060_evk/doc/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -23,46 +23,98 @@ List of extensions

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

* - .. rubric:: NXP MIMXRT1060-EVK
- .. rubric:: NXP MIMXRT1060-EVKB
- .. rubric:: NXP MIMXRT1060-EVK Hyper Flash
* - .. rubric:: NXP MIMXRT1060-EVK and MIMXRT1060-EVKB

* - .. literalinclude:: ../mimxrt1060_evk.conf
:caption: mimxrt1060_evk.conf
:language: cfg
:encoding: ISO-8859-1
:start-at: CONFIG_USB_SELF_POWERED
:end-at: CONFIG_USB_MAX_POWER
- .. literalinclude:: ../mimxrt1060_evkb.conf
:caption: mimxrt1060_evkb.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
- .. literalinclude:: ../mimxrt1060_evk_hyperflash.conf
:caption: mimxrt1060_evk_hyperflash.conf
:language: cfg
:emphasize-lines: 1-2,5-7
: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 MIMXRT1060-EVK and MIMXRT1060-EVKB

* - .. 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 MIMXRT1060-EVK and MIMXRT1060-EVKB

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

- FlexPWM not routed to the green user LED ``LED1`` on the EVK **B**
revision, thus why board DTS disables :devicetree:`&flexpwm2_pwm3`
but neither related :devicetree:`&pwmleds` node nor alias:

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

* - .. rubric:: NXP MIMXRT1060-EVKB

* - .. literalinclude:: ../mimxrt1060_evkb.overlay
:caption: mimxrt1060_evkb.overlay
:language: DTS
:encoding: ISO-8859-1
:emphasize-lines: 3,6
:prepend: / {
:start-at: aliases {
:end-at: /delete-node/ pwmleds;
:append: };

- add a :dtcompatible:`zephyr,flash-disk` node linked to the
: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
:width: 75%
:width: 50%
:widths: 100

* - .. rubric:: NXP MIMXRT1010-EVK(B/Hyper Flash)
* - .. rubric:: NXP MIMXRT1060-EVK and MIMXRT1060-EVKB

* - .. literalinclude:: ../mimxrt1060_evk.dtsi
:caption: mimxrt1060_evk.dtsi
Expand All @@ -74,33 +126,11 @@ List of extensions
:end-at: };
:append: };

.. list-table::
:align: left
:width: 75%
:widths: 33, 33, 33

* - .. rubric:: NXP MIMXRT1060-EVK
- .. rubric:: NXP MIMXRT1060-EVKB
- .. rubric:: NXP MIMXRT1060-EVK Hyper Flash

* - .. literalinclude:: ../mimxrt1060_evk.conf
:caption: mimxrt1060_evk.conf
:language: cfg
:encoding: ISO-8859-1
:emphasize-lines: 1
:start-at: CONFIG_MASS_STORAGE_DISK_NAME=
:end-at: CONFIG_MASS_STORAGE_DISK_NAME=
- .. literalinclude:: ../mimxrt1060_evkb.conf
:caption: mimxrt1060_evkb.conf
:language: cfg
:encoding: ISO-8859-1
:emphasize-lines: 1
:start-at: CONFIG_MASS_STORAGE_DISK_NAME=
:end-at: CONFIG_MASS_STORAGE_DISK_NAME=
- .. literalinclude:: ../mimxrt1060_evk_hyperflash.conf
:caption: mimxrt1060_evk_hyperflash.conf
:language: cfg
.. literalinclude:: ../Kconfig.defconfig
:caption: Kconfig.defconfig
:language: Kconfig
:encoding: ISO-8859-1
:emphasize-lines: 1
:start-at: CONFIG_MASS_STORAGE_DISK_NAME=
:end-at: CONFIG_MASS_STORAGE_DISK_NAME=
:prepend: #
: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/mimxrt1060_evk/mimxrt1060_evk.conf

This file was deleted.

8 changes: 8 additions & 0 deletions boards/extensions/mimxrt1060_evk/mimxrt1060_evk.dtsi
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,14 @@
*/

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

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

msc_disk0 {
compatible = "zephyr,flash-disk";
partition = <&storage_partition>;
Expand Down
27 changes: 0 additions & 27 deletions boards/extensions/mimxrt1060_evk/mimxrt1060_evk_hyperflash.conf

This file was deleted.

This file was deleted.

27 changes: 0 additions & 27 deletions boards/extensions/mimxrt1060_evk/mimxrt1060_evkb.conf

This file was deleted.

13 changes: 12 additions & 1 deletion boards/extensions/mimxrt1060_evk/mimxrt1060_evkb.overlay
Original file line number Diff line number Diff line change
@@ -1,6 +1,17 @@
/*
* Copyright (c) 2023 TiaC Systems
* Copyright (c) 2023-2024 TiaC Systems
* SPDX-License-Identifier: Apache-2.0
*/

#include "mimxrt1060_evk.dtsi"

/* FLEXPWM not routed to LED on this EVK revision, thus why board DTS
* disables &flexpwm2_pwm3 but neither related &pwmleds node nor alias. */

/ {
aliases {
/delete-property/ pwm-led0;
};

/delete-node/ pwmleds;
};
18 changes: 0 additions & 18 deletions samples/helloshell/boards/mimxrt1060_evkb.overlay

This file was deleted.

Loading

0 comments on commit e1a4580

Please sign in to comment.