diff --git a/Kconfig.zephyr b/Kconfig.zephyr index bf34d67f86..7d105817fc 100644 --- a/Kconfig.zephyr +++ b/Kconfig.zephyr @@ -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 diff --git a/arch/Kconfig b/arch/Kconfig index 213f473c03..650fa038a2 100644 --- a/arch/Kconfig +++ b/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 diff --git a/boards/arm/nrf9160_pca10090/Kconfig.defconfig b/boards/arm/nrf9160_pca10090/Kconfig.defconfig index 6b05c62e05..d8fea918e3 100644 --- a/boards/arm/nrf9160_pca10090/Kconfig.defconfig +++ b/boards/arm/nrf9160_pca10090/Kconfig.defconfig @@ -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 diff --git a/drivers/bluetooth/hci/Kconfig b/drivers/bluetooth/hci/Kconfig index d4ec05ce02..f152c64c75 100644 --- a/drivers/bluetooth/hci/Kconfig +++ b/drivers/bluetooth/hci/Kconfig @@ -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 diff --git a/drivers/console/Kconfig b/drivers/console/Kconfig index aaabf90d02..8a70034ec4 100644 --- a/drivers/console/Kconfig +++ b/drivers/console/Kconfig @@ -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 diff --git a/scripts/dts/gen_defines.py b/scripts/dts/gen_defines.py index 0571c686ef..3350495223 100755 --- a/scripts/dts/gen_defines.py +++ b/scripts/dts/gen_defines.py @@ -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 "