Skip to content

Commit de42aea

Browse files
ulfalizergalak
authored andcommitted
kconfig/cmake: Check that one of the CONFIG_<arch> symbols is set
All SoCs must now 'select' one of the CONFIG_<arch> symbols. Add an ARCH_IS_SET helper symbol that's selected by the arch symbols and checked in CMake, printing a warning otherwise. Might save people some time until they're used to the new scheme. Signed-off-by: Ulf Magnusson <[email protected]>
1 parent c5839f8 commit de42aea

File tree

2 files changed

+20
-0
lines changed

2 files changed

+20
-0
lines changed

CMakeLists.txt

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -142,6 +142,13 @@ else()
142142
assert(0 "Unreachable code. Expected optimization level to have been chosen. See Kconfig.zephyr")
143143
endif()
144144

145+
if(NOT CONFIG_ARCH_IS_SET)
146+
message(WARNING "\
147+
None of the CONFIG_<arch> (e.g. CONFIG_X86) symbols are set. \
148+
Select one of them from the SOC_SERIES_* symbol or, lacking that, from the \
149+
SOC_* symbol.")
150+
endif()
151+
145152
# Apply the final optimization flag(s)
146153
zephyr_compile_options(${OPTIMIZATION_FLAG})
147154

arch/Kconfig

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,38 +18,44 @@ source "$(ARCH_DIR)/$(ARCH)/Kconfig"
1818

1919
config ARC
2020
bool
21+
select ARCH_IS_SET
2122
select HAS_DTS
2223
help
2324
ARC architecture
2425

2526
config ARM
2627
bool
28+
select ARCH_IS_SET
2729
select HAS_DTS
2830
help
2931
ARM architecture
3032

3133
config X86
3234
bool
35+
select ARCH_IS_SET
3336
select ATOMIC_OPERATIONS_BUILTIN
3437
select HAS_DTS
3538
help
3639
x86 architecture
3740

3841
config NIOS2
3942
bool
43+
select ARCH_IS_SET
4044
select ATOMIC_OPERATIONS_C
4145
select HAS_DTS
4246
help
4347
Nios II Gen 2 architecture
4448

4549
config RISCV
4650
bool
51+
select ARCH_IS_SET
4752
select HAS_DTS
4853
help
4954
RISCV architecture
5055

5156
config XTENSA
5257
bool
58+
select ARCH_IS_SET
5359
select HAS_DTS
5460
select USE_SWITCH
5561
select USE_SWITCH_SUPPORTED
@@ -59,6 +65,7 @@ config XTENSA
5965

6066
config ARCH_POSIX
6167
bool
68+
select ARCH_IS_SET
6269
select ATOMIC_OPERATIONS_BUILTIN
6370
select ARCH_HAS_CUSTOM_SWAP_TO_MAIN
6471
select ARCH_HAS_CUSTOM_BUSY_WAIT
@@ -68,6 +75,12 @@ config ARCH_POSIX
6875
help
6976
POSIX (native) architecture
7077

78+
config ARCH_IS_SET
79+
bool
80+
help
81+
Helper symbol to detect SoCs forgetting to select one of the arch
82+
symbols above. See the top-level CMakeLists.txt.
83+
7184
menu "General Architecture Options"
7285

7386
module = ARCH

0 commit comments

Comments
 (0)