cmake: set big-endian flags to TOOLCHAIN_*_FLAGS

Set -big-endian to both compiler and linker flags if
CONFIG_BIG_ENDIAN is set.

Signed-off-by: Tavish Naruka <t-naruka@ispace-inc.com>
This commit is contained in:
Tavish Naruka 2024-05-31 17:42:41 +09:00 committed by Anas Nashif
commit b1af1928f8
2 changed files with 8 additions and 2 deletions

View file

@ -186,8 +186,9 @@ config BIG_ENDIAN
Little-endian architecture is the default and should leave this option
unselected. This option is selected by arch/$ARCH/Kconfig,
soc/**/Kconfig, or boards/**/Kconfig and the user should generally avoid
modifying it. The option is used to select linker script OUTPUT_FORMAT
and command line option for gen_isr_tables.py.
modifying it. The option is used to select linker script OUTPUT_FORMAT,
the toolchain flags (TOOLCHAIN_C_FLAGS, TOOLCHAIN_LD_FLAGS), and command
line option for gen_isr_tables.py.
config LITTLE_ENDIAN
# Hidden Kconfig option representing the default little-endian architecture

View file

@ -10,6 +10,11 @@ endif()
list(APPEND ARM_C_FLAGS -mabi=aapcs)
if(CONFIG_BIG_ENDIAN)
list(APPEND TOOLCHAIN_C_FLAGS -mbig-endian)
list(APPEND TOOLCHAIN_LD_FLAGS -mbig-endian)
endif()
if(CONFIG_FPU)
list(APPEND ARM_C_FLAGS -mfpu=${GCC_M_FPU})