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
|
@ -94,9 +94,12 @@ config USE_CODE_PARTITION
|
|||
help
|
||||
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
|
||||
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
|
||||
depends on HAS_FLASH_LOAD_OFFSET
|
||||
help
|
||||
|
@ -109,7 +112,7 @@ config FLASH_LOAD_OFFSET
|
|||
|
||||
config FLASH_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
|
||||
depends on HAS_FLASH_LOAD_OFFSET
|
||||
help
|
||||
|
|
14
arch/Kconfig
14
arch/Kconfig
|
@ -95,9 +95,12 @@ config 64BIT
|
|||
|
||||
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
|
||||
int "SRAM Size in kB"
|
||||
default $(dt_int_val,DT_SRAM_SIZE)
|
||||
default $(dt_chosen_reg_size,$(DT_CHOSEN_Z_SRAM),0,K)
|
||||
help
|
||||
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
|
||||
|
@ -105,15 +108,18 @@ config SRAM_SIZE
|
|||
|
||||
config 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
|
||||
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
|
||||
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
|
||||
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
|
||||
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
|
||||
|
@ -121,7 +127,7 @@ config FLASH_SIZE
|
|||
|
||||
config 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
|
||||
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
|
||||
|
|
|
@ -47,20 +47,23 @@ endif # SPI
|
|||
# Apply this configuration below by setting the Kconfig symbols used by
|
||||
# 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
|
||||
|
||||
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
|
||||
|
||||
if BOARD_NRF9160_PCA10090NS
|
||||
|
||||
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
|
||||
default $(dt_hex_val,DT_CODE_PARTITION_SIZE)
|
||||
default $(dt_chosen_reg_size,$(DT_CHOSEN_Z_CODE_PARTITION))
|
||||
|
||||
endif # BOARD_NRF9160_PCA10090NS
|
||||
|
||||
|
|
|
@ -68,9 +68,12 @@ config BT_NO_DRIVER
|
|||
|
||||
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
|
||||
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"
|
||||
depends on BT_UART
|
||||
help
|
||||
|
|
|
@ -8,9 +8,13 @@
|
|||
#
|
||||
|
||||
# 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
|
||||
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"
|
||||
depends on (UART_CONSOLE || CONSOLE_SUBSYS)
|
||||
help
|
||||
|
@ -193,9 +197,12 @@ config UART_PIPE
|
|||
data (as contrary to console UART driver) and all aspects of received
|
||||
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
|
||||
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"
|
||||
depends on UART_PIPE
|
||||
help
|
||||
|
@ -214,9 +221,12 @@ config 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
|
||||
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"
|
||||
help
|
||||
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,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_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)
|
||||
|
||||
|
||||
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):
|
||||
# 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
|
||||
default 12000000
|
||||
|
||||
# Workaround for not being able to have commas in macro arguments
|
||||
DT_CHOSEN_Z_FLASH := zephyr,flash
|
||||
|
||||
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
|
||||
default $(dt_hex_val,DT_FLASH_BASE_ADDRESS)
|
||||
default $(dt_chosen_reg_addr,$(DT_CHOSEN_Z_FLASH))
|
||||
|
||||
endif
|
||||
|
|
|
@ -178,8 +178,11 @@ if FLASH
|
|||
config SOC_FLASH_RV32M1
|
||||
default y
|
||||
|
||||
# Workaround for not being able to have commas in macro arguments
|
||||
DT_CHOSEN_Z_FLASH := zephyr,flash
|
||||
|
||||
config FLASH_BASE_ADDRESS
|
||||
default $(dt_hex_val,DT_FLASH_BASE_ADDRESS)
|
||||
default $(dt_chosen_reg_addr,$(DT_CHOSEN_Z_FLASH))
|
||||
|
||||
endif # FLASH
|
||||
|
||||
|
|
|
@ -128,9 +128,12 @@ config BT_HCI_ACL_FLOW_CONTROL
|
|||
not run out of incoming ACL buffers.
|
||||
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
|
||||
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"
|
||||
depends on BT_HCI_RAW
|
||||
help
|
||||
|
|
|
@ -126,10 +126,13 @@ endchoice
|
|||
|
||||
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
|
||||
string "Device Name of Bluetooth monitor logging UART"
|
||||
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"
|
||||
help
|
||||
This option specifies the name of UART device to be used
|
||||
|
|
|
@ -30,9 +30,12 @@ config SHELL_PROMPT_UART
|
|||
help
|
||||
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
|
||||
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"
|
||||
help
|
||||
This option specifies the name of UART device to be used for the
|
||||
|
|
Loading…
Reference in a new issue