Skip to content

Commit

Permalink
cmake: set big-endian flags to TOOLCHAIN_*_FLAGS
Browse files Browse the repository at this point in the history
Set -big-endian to both compiler and linker flags if
CONFIG_BIG_ENDIAN is set.

Signed-off-by: Tavish Naruka <[email protected]>
  • Loading branch information
Tavish Naruka authored and nashif committed Sep 19, 2024
1 parent b5ee4c0 commit b1af192
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
5 changes: 3 additions & 2 deletions arch/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
5 changes: 5 additions & 0 deletions cmake/compiler/gcc/target_arm.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -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})

Expand Down

0 comments on commit b1af192

Please sign in to comment.