soc/xtensa/intel_adsp: Add support for L1-cache-aware linkage

Xtensa CPUs have incoherent L1 caches, which is deeply inconvenient
for SMP systems.  But as a treatment for this, the ADSP memory map
contains the RAM twice, in separate 512MB regions that can be managed
separately by the Xtensa TLB/cacheattr mechanism.  The low mapping is
set to bypass the cache where the high mapping is cached.

Set up linkage to use both as appropriate, then reassemble the final
sections to a contiguous region.  Read-only areas (.text, .rodata) are
cached.  Data sections are uncached by default, except for a special
".cache" section that may be used by higher level code to flag static
areas (e.g. stacks) which don't store multiprocessor-shared content.

Signed-off-by: Andy Ross <andrew.j.ross@intel.com>
This commit is contained in:
Andy Ross 2020-05-13 15:26:08 +00:00 committed by Anas Nashif
commit 15e2117a0b
2 changed files with 61 additions and 15 deletions

View file

@ -14,12 +14,17 @@ if(EXISTS ${CMAKE_CURRENT_LIST_DIR}/bootloader/CMakeLists.txt)
add_subdirectory(${CMAKE_CURRENT_LIST_DIR}/bootloader ${build_dir})
endif()
set(ELF_FIX ${SOC_DIR}/${ARCH}/${SOC_FAMILY}/common/fix_elf_addrs.py)
add_custom_target(
process_elf ALL
DEPENDS base_module
DEPENDS ${ZEPHYR_FINAL_EXECUTABLE}
COMMAND ${CMAKE_OBJCOPY} --dump-section .data=mod-apl.bin $<TARGET_FILE:base_module>
COMMAND ${CMAKE_OBJCOPY} --add-section .module=mod-apl.bin --set-section-flags .module=load,readonly ${CMAKE_BINARY_DIR}/zephyr/${KERNEL_ELF_NAME} ${CMAKE_BINARY_DIR}/zephyr/${KERNEL_ELF_NAME}.mod
# Adjust final section addresses so they all appear in the cached region.
COMMAND ${ELF_FIX} ${CMAKE_OBJCOPY} ${CMAKE_BINARY_DIR}/zephyr/zephyr.elf.mod
)
add_custom_target(