@@ -2,3 +2,4 @@ source Kconfig.host
source backends/Kconfig
source accel/Kconfig
source hw/Kconfig
+source ./target/riscv/Kconfig
@@ -1315,7 +1315,33 @@ foreach target : target_dirs
endif
endforeach
+
config_target_data = configuration_data()
+
+ #Parse RISC-V custom definitions in advance. FIXME: rewrite core detection
+ if config_target['TARGET_BASE_ARCH'] == 'riscv'
+ config_riscv_custom_mak = 'riscv-custom-' + target + '-config-target.mak'
+ config_riscv_custom_mak = configure_file(
+ input: ['default-configs/targets/rv_custom' / target + '.mak', 'Kconfig'],
+ output: config_riscv_custom_mak,
+ depfile: config_riscv_custom_mak + '.d',
+ capture: true,
+ command: [minikconf,
+ get_option('default_devices') ? '--defconfig' : '--allnoconfig',
+ config_riscv_custom_mak, '@DEPFILE@', '@INPUT@',
+ host_kconfig, accel_kconfig])
+
+ rvcustom_parse = keyval.load(config_riscv_custom_mak)
+ foreach k, v : rvcustom_parse
+ if k == 'CONFIG_RISCV_CUSTOM_CSR'
+ config_target_data.set(k, 1)
+ endif
+ if k == 'CONFIG_ANDES_CORE'
+ config_target_data.set(k, 1)
+ endif
+ endforeach
+ endif
+
foreach k, v: config_target
if not k.startswith('TARGET_') and not k.startswith('CONFIG_')
# do nothing
new file mode 100644
@@ -0,0 +1,6 @@
+config RISCV_CUSTOM_CSR
+ bool
+config ANDES_CORE
+ bool
+ select RISCV_CUSTOM_CSR
+ default n
From: Ruinland ChuanTzu Tsai <ruinland@andestech.com> Introduce Kconfig to target/riscv/Kconfig. RISCV_CUSTOM_CSR will be toggled if ANDES_CORE is selected. We need to modify meson.build for handling linux-user in a reasonable way. Otherwise, all Kconfig options goes into *-config-devices.h which won't be accessible for linux-user mode. --- Kconfig | 1 + meson.build | 26 ++++++++++++++++++++++++++ target/riscv/Kconfig | 6 ++++++ 3 files changed, 33 insertions(+) create mode 100644 target/riscv/Kconfig