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

Shields: Allow shields conditional configuration #20934

Merged
merged 17 commits into from
Jan 2, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
17 commits
Select commit Hold shift + click to select a range
1f8fd14
cmake: make shield list available to Kconfig
erwango Nov 22, 2019
797a037
script/Kconfig: kconfig functions: Add shields_list_contains function
erwango Nov 22, 2019
61fbafe
boards: Kconfig: Enable use of shield conditional Kconfig files
erwango Nov 22, 2019
d03c9c9
boards/shields: x_nucleo_idb05a1: Move to conditional Kconfig
erwango Nov 22, 2019
9594614
boards/shields: Move wnc_m14a2a to conditional Kconfig
erwango Nov 27, 2019
a6c364c
doc/guides: shields: Document possibility to enable several shields
erwango Nov 28, 2019
5d12789
boards/shields: x_nucleo_iks01ax: move to conditional Kconfig
erwango Dec 10, 2019
503d68b
boards/shields: waveshare_epaper: Move to conditional Kconfig
erwango Dec 10, 2019
f77f790
boards/shields: ssd1306: Factorize and move to conditional Kconfig
erwango Dec 10, 2019
cd9dfcb
boards/shields: sparkfun_sara_r4: Move to conditional Kconfig
erwango Dec 10, 2019
9d93f02
boards/shields: link_board_eth: Move to conditional Kconfig
erwango Dec 10, 2019
e86adc4
boards/shields: link_board_can: Move to conditional Kconfig
erwango Dec 10, 2019
62faa39
boards/shields: frdm_kw41z: Move to conditional Kconfig
erwango Dec 10, 2019
a9620f8
boards/shields: fdrm_cr20a: Move to conditional Kconfig
erwango Dec 10, 2019
4191c5c
boards/shields: dfrobot_can_bus_v2_0: Move to Kconfig.shield format
erwango Dec 10, 2019
e594d30
boards/shields: adafruit_2_8_tft_touch_v2: Move to Kconfig.defconfig
erwango Dec 10, 2019
a778c21
doc/guides: shields: Document shield conditional configuration
erwango Dec 10, 2019
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
5 changes: 4 additions & 1 deletion Kconfig.zephyr
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,12 @@ endmenu
# (e.g. the first default) with a satisfied condition.
#
# Board defaults should be parsed before SoC defaults, because boards usually
# overrides SoC values.
# overrides SoC values. Similarly shields defaults should be parsed before
# boards defaults, because shields defaults override boards defaults.
#
# Note: $ARCH and $BOARD_DIR might be glob patterns.
source "boards/shields/*/Kconfig.defconfig"
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Are the enabled shields known pre-Kconfig?

If so we want to limit the sourced files to just those enabled.

Copy link
Member Author

@erwango erwango Nov 22, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Are the enabled shields known pre-Kconfig?

Yes and no.
When running a west build command this is known... But user can modify shields selection using menuconfig.

If so we want to limit the sourced files to just those enabled.

If we do so (need to figure it out how, though), we prevent the ability to select shields in menuconfig.
So we need to chose between this and build performance (which, I guess, is your point).

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

But user can modify shields selection using menuconfig.

Never mind then, thank you for the explanation.


source "$(BOARD_DIR)/Kconfig.defconfig"

source "$(SOC_DIR)/$(ARCH)/*/Kconfig.defconfig"
Expand Down
3 changes: 3 additions & 0 deletions boards/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,9 @@ source "$(BOARD_DIR)/Kconfig.board"

endchoice

# Parse shields references
# Don't do it as a menuconfig, as shield selection is a CMake feature.
rsource "shields/*/Kconfig.shield"
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

FWIW, I prefer source over rsource where rsource isn't needed, because it makes the path easier to grep for.

The globbing kinda breaks grepping already though.


menu "Board Options"
# There might not be any board options, hence the optional source
Expand Down
35 changes: 35 additions & 0 deletions boards/shields/adafruit_2_8_tft_touch_v2/Kconfig.defconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
# Copyright (c) 2019 Linaro Limited
# SPDX-License-Identifier: Apache-2.0

if SHIELD_ADAFRUIT_2_8_TFT_TOUCH_V2

if DISPLAY

config SPI
default y

config ILI9340
default y

if LVGL

config LVGL_DISPLAY_DEV_NAME
default "ILI9340"

config LVGL_HOR_RES
default 320

config LVGL_VER_RES
default 240

config LVGL_VDB_SIZE
default 64

config LVGL_BITS_PER_PIXEL
default 24

endif # LVGL

endif # DISPLAY

endif # SHIELD_ADAFRUIT_2_8_TFT_TOUCH_V2
5 changes: 5 additions & 0 deletions boards/shields/adafruit_2_8_tft_touch_v2/Kconfig.shield
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# Copyright (c) 2019 Linaro Limited
# SPDX-License-Identifier: Apache-2.0

config SHIELD_ADAFRUIT_2_8_TFT_TOUCH_V2
def_bool $(shields_list_contains,adafruit_2_8_tft_touch_v2)

This file was deleted.

18 changes: 18 additions & 0 deletions boards/shields/dfrobot_can_bus_v2_0/Kconfig.defconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# Copyright (c) 2019 Linaro Limited
# SPDX-License-Identifier: Apache-2.0

if SHIELD_DFROBOT_CAN_BUS_V2_0

if CAN

config SPI
default y

config CAN_MCP2515
default y

rsource "boards/*.defconfig"

endif # CAN

endif # SHIELD_DFROBOT_CAN_BUS_V2_0
5 changes: 5 additions & 0 deletions boards/shields/dfrobot_can_bus_v2_0/Kconfig.shield
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# Copyright (c) 2019 Linaro Limited
# SPDX-License-Identifier: Apache-2.0

config SHIELD_DFROBOT_CAN_BUS_V2_0
def_bool $(shields_list_contains,dfrobot_can_bus_v2_0)
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# Copyright (c) 2019 Linaro Limited
# SPDX-License-Identifier: Apache-2.0

if BOARD_NRF52_PCA10040

config CAN_1
default y

endif # BOARD_NRF52_PCA10040
3 changes: 0 additions & 3 deletions boards/shields/dfrobot_can_bus_v2_0/dfrobot_can_bus_v2_0.conf

This file was deleted.

24 changes: 24 additions & 0 deletions boards/shields/frdm_cr20a/Kconfig.defconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
#
# Copyright (c) 2019, NXP
# Copyright (c) 2019 Linaro Limited
# SPDX-License-Identifier: Apache-2.0
#
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Inconsistent header. Make it

# Copyright (c) 2019, NXP
# Copyright (c) 2019 Linaro Limited
# SPDX-License-Identifier: Apache-2.0

...


if SHIELD_FRDM_CR20A

if IEEE802154

config SPI
default y

config IEEE802154_MCR20A
default y

config NET_CONFIG_IEEE802154_DEV_NAME
default "mcr20a"

rsource "boards/*.defconfig"

endif # IEEE802154

endif # SHIELD_FRDM_CR20A
5 changes: 5 additions & 0 deletions boards/shields/frdm_cr20a/Kconfig.shield
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# Copyright (c) 2019 Linaro Limited
# SPDX-License-Identifier: Apache-2.0

config SHIELD_FRDM_CR20A
def_bool $(shields_list_contains,frdm_cr20a)
7 changes: 0 additions & 7 deletions boards/shields/frdm_cr20a/boards/frdm_k64f.conf

This file was deleted.

13 changes: 13 additions & 0 deletions boards/shields/frdm_cr20a/boards/frdm_k64f.defconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
#
# Copyright (c) 2019, NXP
# Copyright (c) 2019 Linaro Limited
#
# SPDX-License-Identifier: Apache-2.0
#
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Make it

# Copyright (c) 2019, NXP
# Copyright (c) 2019 Linaro Limited
# SPDX-License-Identifier: Apache-2.0


if BOARD_FRDM_K64F

config NET_L2_ETHERNET
default n

endif # BOARD_FRDM_K64F
11 changes: 0 additions & 11 deletions boards/shields/frdm_cr20a/frdm_cr20a.conf

This file was deleted.

5 changes: 5 additions & 0 deletions boards/shields/frdm_kw41z/Kconfig.shield
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# Copyright (c) 2019 Linaro Limited
# SPDX-License-Identifier: Apache-2.0

config SHIELD_FRDM_KW41Z
def_bool $(shields_list_contains,frdm_kw41z)
18 changes: 18 additions & 0 deletions boards/shields/link_board_can/Kconfig.defconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# Copyright (c) 2019 Linaro Limited
# SPDX-License-Identifier: Apache-2.0

if SHIELD_LINK_BOARD_CAN

if NETWORKING

config SPI
default y

config CAN_MCP2515
default y

rsource "boards/*.defconfig"

endif # NETWORKING

endif # SHIELD_LINK_BOARD_CAN
5 changes: 5 additions & 0 deletions boards/shields/link_board_can/Kconfig.shield
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# Copyright (c) 2019 Linaro Limited
# SPDX-License-Identifier: Apache-2.0

config SHIELD_LINK_BOARD_CAN
def_bool $(shields_list_contains,link_board_can)
12 changes: 12 additions & 0 deletions boards/shields/link_board_can/boards/reel_board.defconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
# Copyright (c) 2019 Linaro Limited
# SPDX-License-Identifier: Apache-2.0

if BOARD_REEL_BOARD

config SPI_1
default y

config CAN_1
default y

endif # BOARD_REEL_BOARD
4 changes: 0 additions & 4 deletions boards/shields/link_board_can/link_board_can.conf

This file was deleted.

21 changes: 21 additions & 0 deletions boards/shields/link_board_eth/Kconfig.defconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# Copyright (c) 2019 Linaro Limited
# SPDX-License-Identifier: Apache-2.0

if SHIELD_LINK_BOARD_ETH

if NETWORKING

config SPI
default y

config NET_L2_ETHERNET
default y

config ETH_ENC424J600
default y

rsource "boards/*.defconfig"

endif # NETWORKING

endif # SHIELD_LINK_BOARD_ETH
5 changes: 5 additions & 0 deletions boards/shields/link_board_eth/Kconfig.shield
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# Copyright (c) 2019 Linaro Limited
# SPDX-License-Identifier: Apache-2.0

config SHIELD_LINK_BOARD_ETH
def_bool $(shields_list_contains,link_board_eth)
1 change: 0 additions & 1 deletion boards/shields/link_board_eth/boards/reel_board.conf

This file was deleted.

9 changes: 9 additions & 0 deletions boards/shields/link_board_eth/boards/reel_board.defconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# Copyright (c) 2019 Linaro Limited
# SPDX-License-Identifier: Apache-2.0

if BOARD_REEL_BOARD

config ETH_ENC424J600_0_GPIO_SPI_CS
default y

endif # BOARD_REEL_BOARD
4 changes: 0 additions & 4 deletions boards/shields/link_board_eth/link_board_eth.conf

This file was deleted.

39 changes: 39 additions & 0 deletions boards/shields/sparkfun_sara_r4/Kconfig.defconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
# Copyright (c) 2019 Linaro Limited
# SPDX-License-Identifier: Apache-2.0

if SHIELD_SPARKFUN_SARA_R4

if NETWORKING

config MODEM
default y

config MODEM_SHELL
default y

config MODEM_UBLOX_SARA
default y

choice MODEM_UBLOX_SARA_VARIANT
default MODEM_UBLOX_SARA_R4
endchoice

config UART_INTERRUPT_DRIVEN
default y

# extend retry timing to 20 seconds for LTE/LTE-M
config COAP_INIT_ACK_TIMEOUT_MS
default 20000

# Hack: disable IPv6 for now
config NET_IPV6
default n

config NET_CONFIG_NEED_IPV6
default n

rsource "boards/*.defconfig"

endif # NETWORKING

endif # SHIELD_SPARKFUN_SARA_R4
5 changes: 5 additions & 0 deletions boards/shields/sparkfun_sara_r4/Kconfig.shield
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# Copyright (c) 2019 Linaro Limited
# SPDX-License-Identifier: Apache-2.0

config SHIELD_SPARKFUN_SARA_R4
def_bool $(shields_list_contains,sparkfun_sara_r4)

This file was deleted.

1 change: 0 additions & 1 deletion boards/shields/sparkfun_sara_r4/boards/frdm_k64f.conf

This file was deleted.

9 changes: 9 additions & 0 deletions boards/shields/sparkfun_sara_r4/boards/frdm_k64f.defconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# Copyright (c) 2019 Linaro Limited
# SPDX-License-Identifier: Apache-2.0

if BOARD_FRDM_K64F

config UART_MCUX_3
default y

endif # BOARD_FRDM_K64F
2 changes: 0 additions & 2 deletions boards/shields/sparkfun_sara_r4/boards/nrf52840_pca10056.conf

This file was deleted.

12 changes: 12 additions & 0 deletions boards/shields/sparkfun_sara_r4/boards/nrf52840_pca10056.defconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
# Copyright (c) 2019 Linaro Limited
# SPDX-License-Identifier: Apache-2.0

if BOARD_NRF52840_PCA10056

config GPIO_NRF_P1
default y

config UART_1_NRF_UARTE
default y

endif # BOARD_NRF52840_PCA10056
13 changes: 0 additions & 13 deletions boards/shields/sparkfun_sara_r4/sparkfun_sara_r4.conf

This file was deleted.

Loading