diff --git a/CMakeLists.txt b/CMakeLists.txt index 9ca8a20cdaa9f2..31c37241e6ce90 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -772,6 +772,7 @@ if(CONFIG_GEN_ISR_TABLES) --output-source isr_tables.c --kernel $ --intlist isrList.bin + $<$:--big-endian> $<$:--debug> ${GEN_ISR_TABLE_EXTRA_ARG} DEPENDS zephyr_prebuilt diff --git a/arch/Kconfig b/arch/Kconfig index 818c9333f69fa9..f9e48275f167ff 100644 --- a/arch/Kconfig +++ b/arch/Kconfig @@ -61,6 +61,17 @@ module = MPU module-str = mpu source "subsys/logging/Kconfig.template.log_config" +config BIG_ENDIAN + bool + help + This option tells the build system that the target system is + 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. + config HW_STACK_PROTECTION bool "Hardware Stack Protection" depends on ARCH_HAS_STACK_PROTECTION diff --git a/include/linker/linker-tool-gcc.h b/include/linker/linker-tool-gcc.h index 2a845e8e1c7224..72b67df65e7c6c 100644 --- a/include/linker/linker-tool-gcc.h +++ b/include/linker/linker-tool-gcc.h @@ -16,7 +16,12 @@ #define ZEPHYR_INCLUDE_LINKER_LINKER_TOOL_GCC_H_ #if defined(CONFIG_ARM) - OUTPUT_FORMAT("elf32-littlearm", "elf32-bigarm", "elf32-littlearm") +#if defined(CONFIG_BIG_ENDIAN) +#define OUTPUT_FORMAT_ "elf32-bigarm" +#else +#define OUTPUT_FORMAT_ "elf32-littlearm" +#endif + OUTPUT_FORMAT(OUTPUT_FORMAT_) #elif defined(CONFIG_ARC) OUTPUT_FORMAT("elf32-littlearc", "elf32-bigarc", "elf32-littlearc") #elif defined(CONFIG_X86)