mirror of
https://github.com/apache/nuttx.git
synced 2026-10-12 08:40:20 +00:00
arch/arm64: Allow non MMU builds.
MMU initialization is redundant for bootloaders(BL2) that load TF‑A(BL31). TF-A will ignore and overwrite any MMU configuration performed by BL2. Additionally the MMU comes with a large memory footprint (~50 KB) which could be precious for such setups. When the MMU is disabled all the memory is treated as device memory and all alignment faults generate exceptions (as opposed to normal memory when MMU is enabled). For that reason we need to add -fno-builtin when compiling with CONFIG_ARCH_USE_MMU != y to prevent alignment faults. - Guard MMU initialization with CONFIG_ARCH_USE_MMU - If CONFIG_ARCH_USE_MMU is not set add -fno-builtin which prevents alignment errors. - Deliberately didn't try to replace CONFIG_ARCH_HAVE_MMU with CONFIG_ARCH_USE_MMU occurrences, because this will break a lot of build targets that assume MMU without guarding the MMU initialization. Signed-off-by: Theodore Karatapanis <tkaratapanis@census-labs.com>
This commit is contained in:
parent
d278c6cb15
commit
5d63c3e460
3 changed files with 13 additions and 0 deletions
|
|
@ -100,6 +100,13 @@ ifeq ($(CONFIG_MM_KASAN_DISABLE_WRITES_CHECK),y)
|
|||
ARCHOPTIMIZATION += --param asan-instrument-writes=0
|
||||
endif
|
||||
|
||||
# If we don't use MMU, all memory is treated as device memory and can't handle
|
||||
# alignment faults. Some compiler builtins like memset() can introduce
|
||||
# alignment faults. We need to disable them in that case.
|
||||
ifneq ($(CONFIG_ARCH_USE_MMU),y)
|
||||
ARCHOPTIMIZATION += -fno-builtin
|
||||
endif
|
||||
|
||||
# Instrumentation options
|
||||
|
||||
ifeq ($(CONFIG_ARCH_INSTRUMENT_ALL),y)
|
||||
|
|
|
|||
|
|
@ -195,6 +195,10 @@ if(CONFIG_DEBUG_SYMBOLS)
|
|||
add_compile_options(${CONFIG_DEBUG_SYMBOLS_LEVEL})
|
||||
endif()
|
||||
|
||||
if(NOT CONFIG_ARCH_USE_MMU)
|
||||
add_compile_options(-fno-builtin)
|
||||
endif()
|
||||
|
||||
if(CONFIG_ARCH_TOOLCHAIN_GNU AND NOT CONFIG_ARCH_TOOLCHAIN_CLANG)
|
||||
if(NOT GCCVER)
|
||||
execute_process(COMMAND ${CMAKE_C_COMPILER} --version
|
||||
|
|
|
|||
|
|
@ -142,9 +142,11 @@ void arm64_chip_boot(void)
|
|||
#endif
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_ARCH_USE_MMU
|
||||
/* MAP IO and DRAM, enable MMU. */
|
||||
|
||||
arm64_mmu_init(true);
|
||||
#endif
|
||||
|
||||
/* Do UART early initialization & pin muxing */
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue