CMakeLists.txt 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  1. # Xtensa Component Architecture
  2. #
  3. # The ESP-IDF Xtesna component contains two major features:
  4. # - The Xtensa HAL
  5. # - The Xtensa RTOS porting layer
  6. #
  7. # The Xtensa HAL provides various macros/functions regarding the Xtensa processor's configuration and extensions (see
  8. # "sys_sw_rm.pdf 3.1"). The Xtensa HAL...
  9. # - is packaged as a library ("libxt_hal.a") in the ESP-IDF Xtensa component
  10. # - expects `#include <xtensa/...h>` as the include path to the Xtensa HAL's headers
  11. #
  12. # The Xtensa RTOS Porting Layer is a set of helper functions and interrupt vectors that act as a basis of an RTOS port.
  13. # The porting layer sources files are OS agnostic, thus are common across multiple Xtensa RTOS ports (e.g., FreeRTOS,
  14. # ThreadX). The Xtensa RTOS Porting Layer...
  15. # - interfaces with an RTOS port via the "xtensa_rtos.h" header provided by the RTOS port
  16. # - expected `#include <...h>` as the incldue path to the porting layer's headers
  17. idf_build_get_property(target IDF_TARGET)
  18. idf_build_get_property(arch IDF_TARGET_ARCH)
  19. if(NOT "${arch}" STREQUAL "xtensa")
  20. return()
  21. endif()
  22. set(include_dirs
  23. "${target}/include" # - Add include path for target specific Xtensa HAL headers (`#include <xtensa/...h>`)
  24. "include" # - Add include path for...
  25. # - common Xtensa HAL headers (`#include <xtensa/...h>`)
  26. # - Xtensa RTOS porting layer headers (`#include <...h>`)
  27. "deprecated_include") # - For deprecated include paths (see IDF-7230)
  28. set(srcs
  29. "eri.c"
  30. "xt_trax.c")
  31. # Minor optimization. The following sources are excluded from the bootloader as they are not required by the bootloader.
  32. #
  33. # - ROM provides a copy of basic exception vectors (e.g., _UserExceptionVector and _WindowOverflow8)
  34. # - The bootloader doesn't register any interrupts, thus...
  35. # - the "xtensa_api.h" isn't used
  36. # - the "xtensa_context.h" functions aren't used as there are no interrupts to trigger a context switch
  37. if(NOT BOOTLOADER_BUILD)
  38. list(APPEND srcs
  39. "xtensa_context.S"
  40. "xtensa_intr_asm.S"
  41. "xtensa_intr.c"
  42. "xtensa_vectors.S")
  43. if(CONFIG_ESP32_IRAM_AS_8BIT_ACCESSIBLE_MEMORY)
  44. list(APPEND srcs "xtensa_loadstore_handler.S")
  45. endif()
  46. if(NOT CONFIG_FREERTOS_PORT)
  47. # No RTOS provided. Use default bare metal stubs (to pass G0 build test)
  48. list(APPEND srcs
  49. "baremetal/xtensa_rtos_bm.S")
  50. list(APPEND include_dirs
  51. "baremetal") # For "...h"
  52. endif()
  53. endif()
  54. idf_component_register(SRCS ${srcs}
  55. INCLUDE_DIRS ${include_dirs}
  56. LDFRAGMENTS linker.lf)
  57. target_link_libraries(${COMPONENT_LIB} PUBLIC "${CMAKE_CURRENT_SOURCE_DIR}/${target}/libxt_hal.a")