kconfig: Convert device tree chosen properties to new kconfigfunctions
Convert how we get the various chosen properties like "zephyr,console" to use the new kconfig functions like dt_chosen_to_label. Because of how kconfig parses things we define a set of variables of the form DT_CHOSEN_Z_<PROP> since comma's are parsed as field seperators in macros. This conversion allows us to remove code in gen_defines.py for the following chosen properties: zephyr,console zephyr,shell-uart zephyr,bt-uart zephyr,uart-pipe zephyr,bt-mon-uart zephyr,uart-mcumgr zephyr,bt-c2h-uart Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
This commit is contained in:
parent
5735397b9b
commit
8ce0cf0126
11 changed files with 59 additions and 47 deletions
|
@ -94,9 +94,12 @@ config USE_CODE_PARTITION
|
||||||
help
|
help
|
||||||
When selected application will be linked into chosen code-partition.
|
When selected application will be linked into chosen code-partition.
|
||||||
|
|
||||||
|
# Workaround for not being able to have commas in macro arguments
|
||||||
|
DT_CHOSEN_Z_CODE_PARTITION := zephyr,code-partition
|
||||||
|
|
||||||
config FLASH_LOAD_OFFSET
|
config FLASH_LOAD_OFFSET
|
||||||
hex "Kernel load offset"
|
hex "Kernel load offset"
|
||||||
default $(dt_hex_val,DT_CODE_PARTITION_OFFSET) if USE_CODE_PARTITION
|
default $(dt_chosen_reg_addr,$(DT_CHOSEN_Z_CODE_PARTITION)) if USE_CODE_PARTITION
|
||||||
default 0
|
default 0
|
||||||
depends on HAS_FLASH_LOAD_OFFSET
|
depends on HAS_FLASH_LOAD_OFFSET
|
||||||
help
|
help
|
||||||
|
@ -109,7 +112,7 @@ config FLASH_LOAD_OFFSET
|
||||||
|
|
||||||
config FLASH_LOAD_SIZE
|
config FLASH_LOAD_SIZE
|
||||||
hex "Kernel load size"
|
hex "Kernel load size"
|
||||||
default $(dt_hex_val,DT_CODE_PARTITION_SIZE) if USE_CODE_PARTITION
|
default $(dt_chosen_reg_size,$(DT_CHOSEN_Z_CODE_PARTITION)) if USE_CODE_PARTITION
|
||||||
default 0
|
default 0
|
||||||
depends on HAS_FLASH_LOAD_OFFSET
|
depends on HAS_FLASH_LOAD_OFFSET
|
||||||
help
|
help
|
||||||
|
|
14
arch/Kconfig
14
arch/Kconfig
|
@ -95,9 +95,12 @@ config 64BIT
|
||||||
|
|
||||||
if ARC || ARM || NIOS2 || X86 || X86_64
|
if ARC || ARM || NIOS2 || X86 || X86_64
|
||||||
|
|
||||||
|
# Workaround for not being able to have commas in macro arguments
|
||||||
|
DT_CHOSEN_Z_SRAM := zephyr,sram
|
||||||
|
|
||||||
config SRAM_SIZE
|
config SRAM_SIZE
|
||||||
int "SRAM Size in kB"
|
int "SRAM Size in kB"
|
||||||
default $(dt_int_val,DT_SRAM_SIZE)
|
default $(dt_chosen_reg_size,$(DT_CHOSEN_Z_SRAM),0,K)
|
||||||
help
|
help
|
||||||
This option specifies the size of the SRAM in kB. It is normally set by
|
This option specifies the size of the SRAM in kB. It is normally set by
|
||||||
the board's defconfig file and the user should generally avoid modifying
|
the board's defconfig file and the user should generally avoid modifying
|
||||||
|
@ -105,15 +108,18 @@ config SRAM_SIZE
|
||||||
|
|
||||||
config SRAM_BASE_ADDRESS
|
config SRAM_BASE_ADDRESS
|
||||||
hex "SRAM Base Address"
|
hex "SRAM Base Address"
|
||||||
default $(dt_hex_val,DT_SRAM_BASE_ADDRESS)
|
default $(dt_chosen_reg_addr,$(DT_CHOSEN_Z_SRAM))
|
||||||
help
|
help
|
||||||
This option specifies the base address of the SRAM on the board. It is
|
This option specifies the base address of the SRAM on the board. It is
|
||||||
normally set by the board's defconfig file and the user should generally
|
normally set by the board's defconfig file and the user should generally
|
||||||
avoid modifying it via the menu configuration.
|
avoid modifying it via the menu configuration.
|
||||||
|
|
||||||
|
# Workaround for not being able to have commas in macro arguments
|
||||||
|
DT_CHOSEN_Z_FLASH := zephyr,flash
|
||||||
|
|
||||||
config FLASH_SIZE
|
config FLASH_SIZE
|
||||||
int "Flash Size in kB"
|
int "Flash Size in kB"
|
||||||
default $(dt_int_val,DT_FLASH_SIZE) if (XIP && ARM) || !ARM
|
default $(dt_chosen_reg_size,$(DT_CHOSEN_Z_FLASH),0,K) if (XIP && ARM) || !ARM
|
||||||
help
|
help
|
||||||
This option specifies the size of the flash in kB. It is normally set by
|
This option specifies the size of the flash in kB. It is normally set by
|
||||||
the board's defconfig file and the user should generally avoid modifying
|
the board's defconfig file and the user should generally avoid modifying
|
||||||
|
@ -121,7 +127,7 @@ config FLASH_SIZE
|
||||||
|
|
||||||
config FLASH_BASE_ADDRESS
|
config FLASH_BASE_ADDRESS
|
||||||
hex "Flash Base Address"
|
hex "Flash Base Address"
|
||||||
default $(dt_hex_val,DT_FLASH_BASE_ADDRESS) if (XIP && ARM) || !ARM
|
default $(dt_chosen_reg_addr,$(DT_CHOSEN_Z_FLASH)) if (XIP && ARM) || !ARM
|
||||||
help
|
help
|
||||||
This option specifies the base address of the flash on the board. It is
|
This option specifies the base address of the flash on the board. It is
|
||||||
normally set by the board's defconfig file and the user should generally
|
normally set by the board's defconfig file and the user should generally
|
||||||
|
|
|
@ -47,20 +47,23 @@ endif # SPI
|
||||||
# Apply this configuration below by setting the Kconfig symbols used by
|
# Apply this configuration below by setting the Kconfig symbols used by
|
||||||
# the linker according to the information extracted from DT partitions.
|
# the linker according to the information extracted from DT partitions.
|
||||||
|
|
||||||
|
# Workaround for not being able to have commas in macro arguments
|
||||||
|
DT_CHOSEN_Z_CODE_PARTITION := zephyr,code-partition
|
||||||
|
|
||||||
if BOARD_NRF9160_PCA10090 && TRUSTED_EXECUTION_SECURE
|
if BOARD_NRF9160_PCA10090 && TRUSTED_EXECUTION_SECURE
|
||||||
|
|
||||||
config FLASH_LOAD_SIZE
|
config FLASH_LOAD_SIZE
|
||||||
default $(dt_hex_val,DT_CODE_PARTITION_SIZE)
|
default $(dt_chosen_reg_size,$(DT_CHOSEN_Z_CODE_PARTITION))
|
||||||
|
|
||||||
endif # BOARD_NRF9160_PCA10090 && TRUSTED_EXECUTION_SECURE
|
endif # BOARD_NRF9160_PCA10090 && TRUSTED_EXECUTION_SECURE
|
||||||
|
|
||||||
if BOARD_NRF9160_PCA10090NS
|
if BOARD_NRF9160_PCA10090NS
|
||||||
|
|
||||||
config FLASH_LOAD_OFFSET
|
config FLASH_LOAD_OFFSET
|
||||||
default $(dt_hex_val,DT_CODE_PARTITION_OFFSET)
|
default $(dt_chosen_reg_addr,$(DT_CHOSEN_Z_CODE_PARTITION))
|
||||||
|
|
||||||
config FLASH_LOAD_SIZE
|
config FLASH_LOAD_SIZE
|
||||||
default $(dt_hex_val,DT_CODE_PARTITION_SIZE)
|
default $(dt_chosen_reg_size,$(DT_CHOSEN_Z_CODE_PARTITION))
|
||||||
|
|
||||||
endif # BOARD_NRF9160_PCA10090NS
|
endif # BOARD_NRF9160_PCA10090NS
|
||||||
|
|
||||||
|
|
|
@ -68,9 +68,12 @@ config BT_NO_DRIVER
|
||||||
|
|
||||||
endchoice
|
endchoice
|
||||||
|
|
||||||
|
# Workaround for not being able to have commas in macro arguments
|
||||||
|
DT_CHOSEN_Z_BT_UART := zephyr,bt-uart
|
||||||
|
|
||||||
config BT_UART_ON_DEV_NAME
|
config BT_UART_ON_DEV_NAME
|
||||||
string "Device Name of UART Device for Bluetooth"
|
string "Device Name of UART Device for Bluetooth"
|
||||||
default "$(dt_str_val,DT_BT_UART_ON_DEV_NAME)" if HAS_DTS
|
default "$(dt_chosen_label,$(DT_CHOSEN_Z_BT_UART))" if HAS_DTS
|
||||||
default "UART_0"
|
default "UART_0"
|
||||||
depends on BT_UART
|
depends on BT_UART
|
||||||
help
|
help
|
||||||
|
|
|
@ -8,9 +8,13 @@
|
||||||
#
|
#
|
||||||
|
|
||||||
# Setting shared by different subsystems
|
# Setting shared by different subsystems
|
||||||
|
|
||||||
|
# Workaround for not being able to have commas in macro arguments
|
||||||
|
DT_CHOSEN_Z_CONSOLE := zephyr,console
|
||||||
|
|
||||||
config UART_CONSOLE_ON_DEV_NAME
|
config UART_CONSOLE_ON_DEV_NAME
|
||||||
string "Device Name of UART Device for UART Console"
|
string "Device Name of UART Device for UART Console"
|
||||||
default "$(dt_str_val,DT_UART_CONSOLE_ON_DEV_NAME)" if HAS_DTS
|
default "$(dt_chosen_label,$(DT_CHOSEN_Z_CONSOLE))" if HAS_DTS
|
||||||
default "UART_0"
|
default "UART_0"
|
||||||
depends on (UART_CONSOLE || CONSOLE_SUBSYS)
|
depends on (UART_CONSOLE || CONSOLE_SUBSYS)
|
||||||
help
|
help
|
||||||
|
@ -193,9 +197,12 @@ config UART_PIPE
|
||||||
data (as contrary to console UART driver) and all aspects of received
|
data (as contrary to console UART driver) and all aspects of received
|
||||||
protocol data are handled by application provided callback.
|
protocol data are handled by application provided callback.
|
||||||
|
|
||||||
|
# Workaround for not being able to have commas in macro arguments
|
||||||
|
DT_CHOSEN_Z_UART_PIPE := zephyr,uart-pipe
|
||||||
|
|
||||||
config UART_PIPE_ON_DEV_NAME
|
config UART_PIPE_ON_DEV_NAME
|
||||||
string "Device Name of UART Device for pipe UART"
|
string "Device Name of UART Device for pipe UART"
|
||||||
default "$(dt_str_val,DT_UART_PIPE_ON_DEV_NAME)" if HAS_DTS
|
default "$(dt_chosen_label,$(DT_CHOSEN_Z_UART_PIPE))" if HAS_DTS
|
||||||
default "UART_0"
|
default "UART_0"
|
||||||
depends on UART_PIPE
|
depends on UART_PIPE
|
||||||
help
|
help
|
||||||
|
@ -214,9 +221,12 @@ config UART_MCUMGR
|
||||||
|
|
||||||
if UART_MCUMGR
|
if UART_MCUMGR
|
||||||
|
|
||||||
|
# Workaround for not being able to have commas in macro arguments
|
||||||
|
DT_CHOSEN_Z_UART_PIPE := zephyr,uart-mcumgr
|
||||||
|
|
||||||
config UART_MCUMGR_ON_DEV_NAME
|
config UART_MCUMGR_ON_DEV_NAME
|
||||||
string "Device Name of UART Device for mcumgr UART"
|
string "Device Name of UART Device for mcumgr UART"
|
||||||
default "$(dt_str_val,DT_UART_MCUMGR_ON_DEV_NAME)" if HAS_DTS
|
default "$(dt_chosen_label,$(DT_CHOSEN_Z_UART_PIPE))" if HAS_DTS
|
||||||
default "UART_0"
|
default "UART_0"
|
||||||
help
|
help
|
||||||
This option specifies the name of UART device to be used
|
This option specifies the name of UART device to be used
|
||||||
|
|
|
@ -83,18 +83,6 @@ def main():
|
||||||
write_addr_size(edt, "zephyr,ccm", "CCM")
|
write_addr_size(edt, "zephyr,ccm", "CCM")
|
||||||
write_addr_size(edt, "zephyr,dtcm", "DTCM")
|
write_addr_size(edt, "zephyr,dtcm", "DTCM")
|
||||||
|
|
||||||
# NOTE: These defines aren't used by the code and just used by
|
|
||||||
# the kconfig build system, we can remove them in the future
|
|
||||||
# if we provide a function in kconfigfunctions.py to get
|
|
||||||
# the same info
|
|
||||||
write_required_label("UART_CONSOLE_ON_DEV_NAME", edt.chosen_dev("zephyr,console"))
|
|
||||||
write_required_label("UART_SHELL_ON_DEV_NAME", edt.chosen_dev("zephyr,shell-uart"))
|
|
||||||
write_required_label("BT_UART_ON_DEV_NAME", edt.chosen_dev("zephyr,bt-uart"))
|
|
||||||
write_required_label("UART_PIPE_ON_DEV_NAME", edt.chosen_dev("zephyr,uart-pipe"))
|
|
||||||
write_required_label("BT_MONITOR_ON_DEV_NAME", edt.chosen_dev("zephyr,bt-mon-uart"))
|
|
||||||
write_required_label("UART_MCUMGR_ON_DEV_NAME", edt.chosen_dev("zephyr,uart-mcumgr"))
|
|
||||||
write_required_label("BT_C2H_UART_ON_DEV_NAME", edt.chosen_dev("zephyr,bt-c2h-uart"))
|
|
||||||
|
|
||||||
write_flash(edt.chosen_dev("zephyr,flash"))
|
write_flash(edt.chosen_dev("zephyr,flash"))
|
||||||
write_code_partition(edt.chosen_dev("zephyr,code-partition"))
|
write_code_partition(edt.chosen_dev("zephyr,code-partition"))
|
||||||
|
|
||||||
|
@ -418,22 +406,6 @@ def write_flash_partition_prefix(prefix, partition_dev, index):
|
||||||
out_s("{}_DEV".format(prefix), controller.label)
|
out_s("{}_DEV".format(prefix), controller.label)
|
||||||
|
|
||||||
|
|
||||||
def write_required_label(ident, dev):
|
|
||||||
# Helper function. Writes '#define <ident> "<label>"', where <label>
|
|
||||||
# is the value of the 'label' property from 'dev'. Does nothing if
|
|
||||||
# 'dev' is None.
|
|
||||||
#
|
|
||||||
# Errors out if 'dev' exists but has no label.
|
|
||||||
|
|
||||||
if not dev:
|
|
||||||
return
|
|
||||||
|
|
||||||
if dev.label is None:
|
|
||||||
err("missing 'label' property on {!r}".format(dev))
|
|
||||||
|
|
||||||
out_s(ident, dev.label)
|
|
||||||
|
|
||||||
|
|
||||||
def write_irqs(dev):
|
def write_irqs(dev):
|
||||||
# Writes IRQ num and data for the interrupts in dev's 'interrupt' property
|
# Writes IRQ num and data for the interrupts in dev's 'interrupt' property
|
||||||
|
|
||||||
|
|
|
@ -26,10 +26,13 @@ config SYS_CLOCK_HW_CYCLES_PER_SEC
|
||||||
int
|
int
|
||||||
default 12000000
|
default 12000000
|
||||||
|
|
||||||
|
# Workaround for not being able to have commas in macro arguments
|
||||||
|
DT_CHOSEN_Z_FLASH := zephyr,flash
|
||||||
|
|
||||||
config FLASH_SIZE
|
config FLASH_SIZE
|
||||||
default $(dt_int_val,DT_FLASH_SIZE)
|
default $(dt_chosen_reg_size,$(DT_CHOSEN_Z_FLASH),0,K)
|
||||||
|
|
||||||
config FLASH_BASE_ADDRESS
|
config FLASH_BASE_ADDRESS
|
||||||
default $(dt_hex_val,DT_FLASH_BASE_ADDRESS)
|
default $(dt_chosen_reg_addr,$(DT_CHOSEN_Z_FLASH))
|
||||||
|
|
||||||
endif
|
endif
|
||||||
|
|
|
@ -178,8 +178,11 @@ if FLASH
|
||||||
config SOC_FLASH_RV32M1
|
config SOC_FLASH_RV32M1
|
||||||
default y
|
default y
|
||||||
|
|
||||||
|
# Workaround for not being able to have commas in macro arguments
|
||||||
|
DT_CHOSEN_Z_FLASH := zephyr,flash
|
||||||
|
|
||||||
config FLASH_BASE_ADDRESS
|
config FLASH_BASE_ADDRESS
|
||||||
default $(dt_hex_val,DT_FLASH_BASE_ADDRESS)
|
default $(dt_chosen_reg_addr,$(DT_CHOSEN_Z_FLASH))
|
||||||
|
|
||||||
endif # FLASH
|
endif # FLASH
|
||||||
|
|
||||||
|
|
|
@ -128,9 +128,12 @@ config BT_HCI_ACL_FLOW_CONTROL
|
||||||
not run out of incoming ACL buffers.
|
not run out of incoming ACL buffers.
|
||||||
endif # BT_CONN
|
endif # BT_CONN
|
||||||
|
|
||||||
|
# Workaround for not being able to have commas in macro arguments
|
||||||
|
DT_CHOSEN_Z_BT_C2H_UART := zephyr,bt-c2h-uart
|
||||||
|
|
||||||
config BT_CTLR_TO_HOST_UART_DEV_NAME
|
config BT_CTLR_TO_HOST_UART_DEV_NAME
|
||||||
string "Device Name of UART Device to an external Bluetooth Host"
|
string "Device Name of UART Device to an external Bluetooth Host"
|
||||||
default "$(dt_str_val,DT_BT_C2H_UART_ON_DEV_NAME)" if HAS_DTS
|
default "$(dt_chosen_label,$(DT_CHOSEN_Z_BT_C2H_UART))" if HAS_DTS
|
||||||
default "UART_0"
|
default "UART_0"
|
||||||
depends on BT_HCI_RAW
|
depends on BT_HCI_RAW
|
||||||
help
|
help
|
||||||
|
|
|
@ -126,10 +126,13 @@ endchoice
|
||||||
|
|
||||||
if BT_DEBUG
|
if BT_DEBUG
|
||||||
|
|
||||||
|
# Workaround for not being able to have commas in macro arguments
|
||||||
|
DT_CHOSEN_Z_BT_MON_UART := zephyr,bt-mon-uart
|
||||||
|
|
||||||
config BT_MONITOR_ON_DEV_NAME
|
config BT_MONITOR_ON_DEV_NAME
|
||||||
string "Device Name of Bluetooth monitor logging UART"
|
string "Device Name of Bluetooth monitor logging UART"
|
||||||
depends on BT_DEBUG_MONITOR
|
depends on BT_DEBUG_MONITOR
|
||||||
default "$(dt_str_val,DT_BT_MONITOR_ON_DEV_NAME)" if HAS_DTS
|
default "$(dt_chosen_label,$(DT_CHOSEN_Z_BT_MON_UART))" if HAS_DTS
|
||||||
default "UART_0"
|
default "UART_0"
|
||||||
help
|
help
|
||||||
This option specifies the name of UART device to be used
|
This option specifies the name of UART device to be used
|
||||||
|
|
|
@ -30,9 +30,12 @@ config SHELL_PROMPT_UART
|
||||||
help
|
help
|
||||||
Displayed prompt name for UART backend.
|
Displayed prompt name for UART backend.
|
||||||
|
|
||||||
|
# Workaround for not being able to have commas in macro arguments
|
||||||
|
DT_CHOSEN_Z_SHELL_UART := zephyr,shell-uart
|
||||||
|
|
||||||
config UART_SHELL_ON_DEV_NAME
|
config UART_SHELL_ON_DEV_NAME
|
||||||
string "Device Name of UART Device for SHELL_BACKEND_SERIAL"
|
string "Device Name of UART Device for SHELL_BACKEND_SERIAL"
|
||||||
default "$(dt_str_val,DT_UART_SHELL_ON_DEV_NAME)" if HAS_DTS
|
default "$(dt_chosen_label,$(UART_SHELL_ON_DEV_NAME))" if HAS_DTS
|
||||||
default "UART_0"
|
default "UART_0"
|
||||||
help
|
help
|
||||||
This option specifies the name of UART device to be used for the
|
This option specifies the name of UART device to be used for the
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue