Kconfig

From Wiki at Neela Nurseries
Revision as of 23:11, 12 December 2022 by Ted (talk | contribs)
Jump to: navigation, search

Zephyr RTOS building blocks   ::   Device Tree Source   ::   Kconfig   ::   cmake   ::   `west` manifest files



This Neela Nurseries page dedicated to notes on Kconfig configuration system, and language. Agood starting point is at Zephyr's latest documentation as of Zephyr 3.2.99. The following link is itself one of five Zephyr docs pages linked from a parent doc page:


Need to revisit this link to identify its specific topics . . .

Some more useful articles on Kconfig, hosted at Nordic Semi:

Above Kconfig articles linked to from https://developer.nordicsemi.com/nRF_Connect_SDK/doc/latest/zephyr/guides/build/index.html#kconfig.


^ To Invoke Menuconfig From Other Than Project Root

If `zephyr_app` is a project, possibly a "remote" project in a multicore project, and is located two directories below the root of the larger mulitcore, effectively multi-app project, then the following invocation will succeed in opening Kconfig's interactive `menuconfig` interface:

$ west build -b zephyr_app -t menuconfig -- -DBOARD_ROOT=../..


^ Kconfig Interactive Use To Enable IIS2DH

Following messages do not show the interactive, ncurses based Kconfig configuration program. But these do show where Kconfig stores a modified configuration file in a given project:

ted@localhost:~/projects/zephyr-based/z4-sandbox-kionix-work/kionix-driver-demo$ west build -t menuconfig
-- west build: running target menuconfig
[0/1] cd /home/ted/projects/zephyr-based/z4-sandbox-kionix-work/kionix-dri...ed/projects/zephyr-based/z4-sandbox-kionix-work/kionix-driver-demo/Kconfig
Loaded configuration '/home/ted/projects/zephyr-based/z4-sandbox-kionix-work/kionix-driver-demo/build/zephyr/.config'
Configuration saved to '/home/ted/projects/zephyr-based/z4-sandbox-kionix-work/kionix-driver-demo/build/zephyr/.config'

ted@localhost:~/projects/zephyr-based/z4-sandbox-kionix-work/kionix-driver-demo$


^ Kconfig NXP dual core setting

We're getting an error when building multicore app. Error is:


Load components for LPC55S69:
driver_common component is included.
driver_reset component is included.
device_CMSIS component is included.
CMSIS_Include_core_cm component is included.
driver_lpc_gpio component is included.
driver_pint component is included.
driver_inputmux component is included.
driver_inputmux_connections component is included.
driver_flexcomm_usart component is included.
driver_flexcomm component is included.
driver_lpc_iocon component is included.
CMake Error at CMakeLists.txt:150 (message):
  LPC55S69_CPU1_BOOT_ADDRESS out of sync with
  CONFIG_SECOND_CORE_BOOT_ADDRESS_MCUX: 0x30000 != 0x3a000


-- Configuring incomplete, errors occurred!
See also "~/projects-sandbox/workspace-for-nexus/nexus-gateway-firmware/samples/multicore-sample-moved/build/CMakeFiles/CMakeOutput.log".
See also "~/projects-sandbox/workspace-for-nexus/nexus-gateway-firmware/samples/multicore-sample-moved/build/CMakeFiles/CMakeError.log".


Searching for this Kconfig symbol from Zephyr project root:

ted@localhost1:~/projects-sandbox/workspace-out-of-tree/zephyr$ grep -nr SECOND_CORE_BOOT_ADDRESS_MCUX ./*
./boards/arm/lpcxpresso55s69/CMakeLists.txt:25:			-offset ${CONFIG_SECOND_CORE_BOOT_ADDRESS_MCUX}
./soc/arm/nxp_lpc/lpc54xxx/Kconfig.soc:54:config SECOND_CORE_BOOT_ADDRESS_MCUX
./soc/arm/nxp_lpc/lpc54xxx/soc.c:134:#define CORE_M0_BOOT_ADDRESS ((void *)CONFIG_SECOND_CORE_BOOT_ADDRESS_MCUX)
./soc/arm/nxp_lpc/lpc55xxx/Kconfig.soc:135:config SECOND_CORE_BOOT_ADDRESS_MCUX
ted@localhost1:~/projects-sandbox/workspace-out-of-tree/zephyr$

From file `zephyr/soc/arm/nxp_lpc/lpc55xxx/Kconfig.soc`:

118 
119 config SECOND_CORE_MCUX
120         bool "LPC55xxx's second core"
121         depends on HAS_MCUX
122         help
123           Driver for second core startup
124 
125 config SECOND_IMAGE_MCUX
126         depends on SECOND_CORE_MCUX
127         string "Binary image of second core's code"
128         help
129           This points to the image file for the the binary code that will be
130           used by the second core.
131 
132 # Workaround for not being able to have commas in macro arguments
133 DT_CHOSEN_Z_CODE_CPU1_PARTITION := zephyr,code-cpu1-partition
134 
135 config SECOND_CORE_BOOT_ADDRESS_MCUX
136         depends on SECOND_CORE_MCUX
137         hex "Address the second core will boot at"
138         default $(dt_chosen_reg_addr_hex,$(DT_CHOSEN_Z_CODE_CPU1_PARTITION))
139         help
140           This is the address the second core will boot from.
141 
142 endif # SOC_SERIES_LPC55XXX

We need to search further and understand how the Kconfig stanza at line 140 works:

ted@localhost1:~/projects-sandbox/workspace-out-of-tree/zephyr$ grep -nr DT_CHOSEN_Z_CODE_CPU1_PARTITION ./*
./soc/arm/nxp_lpc/lpc55xxx/Kconfig.soc:133:DT_CHOSEN_Z_CODE_CPU1_PARTITION := zephyr,code-cpu1-partition
./soc/arm/nxp_lpc/lpc55xxx/Kconfig.soc:138:	default $(dt_chosen_reg_addr_hex,$(DT_CHOSEN_Z_CODE_CPU1_PARTITION))
Binary file ./soc/arm/nxp_lpc/lpc55xxx/.Kconfig.soc.swp matches

ted@localhost1:~/projects-sandbox/workspace-out-of-tree/zephyr$ grep -nr zephyr,code-cpu1-partition ./*
./boards/arm/lpcxpresso55s69/lpcxpresso55s69_cpu0.dts:39:		zephyr,code-cpu1-partition = &slot1_partition;
./boards/arm/lpcxpresso55s69/CMakeLists.txt:20:	#offset is taken from zephyr,code-cpu1-partition
./soc/arm/nxp_lpc/lpc55xxx/Kconfig.soc:133:DT_CHOSEN_Z_CODE_CPU1_PARTITION := zephyr,code-cpu1-partition
Binary file ./soc/arm/nxp_lpc/lpc55xxx/.Kconfig.soc.swp matches

ted@localhost1:~/projects-sandbox/workspace-out-of-tree/zephyr$ cd ./boards/arm/lpcxpresso55s69

ted@localhost1:~/projects-sandbox/workspace-out-of-tree/zephyr/boards/arm/lpcxpresso55s69$ ls
board.cmake     Kconfig.defconfig               lpcxpresso55s69_cpu1_defconfig  lpcxpresso55s69_ns_defconfig  pinmux.c
CMakeLists.txt  lpcxpresso55s69_cpu0_defconfig  lpcxpresso55s69_cpu1.dts        lpcxpresso55s69_ns.dts        pre_dt_board.cmake
doc             lpcxpresso55s69_cpu0.dts        lpcxpresso55s69_cpu1.yaml       lpcxpresso55s69_ns.yaml
Kconfig.board   lpcxpresso55s69_cpu0.yaml       lpcxpresso55s69.dtsi            lpcxpresso55s69-pinctrl.dtsi

ted@localhost1:~/projects-sandbox/workspace-out-of-tree/zephyr/boards/arm/lpcxpresso55s69$ grep -nr slot1_partition ./*
./lpcxpresso55s69_cpu0.dts:39:		zephyr,code-cpu1-partition = &slot1_partition;
./lpcxpresso55s69_cpu1.dts:23:		zephyr,code-partition = &slot1_partition;
./lpcxpresso55s69.dtsi:129:		slot1_partition: partition@30000 {
./lpcxpresso55s69_ns.dts:31:		zephyr,code-partition = &slot1_partition;

ted@localhost1:~/projects-sandbox/workspace-out-of-tree/zephyr/boards/arm/lpcxpresso55s69$