zephyr/modules/segger/CMakeLists.txt
Carl Eriksson Skogh f30dec4295 cmake: segger: linker_script: handle section rtt_buff_data
The segger cmake linker script is out of date compared to
segger_rtt.ld. This is causing linker failures with IAR
when segger is enabled (on nrf hardware for example).

Signed-off-by: Carl Eriksson Skogh <carl.erikssonskogh@gmail.com>
2025-02-21 18:03:29 +00:00

34 lines
1.3 KiB
CMake

if(CONFIG_USE_SEGGER_RTT)
zephyr_library()
zephyr_library_compile_definitions(SEGGER_RTT_ALIGNMENT=CONFIG_SEGGER_RTT_CB_ALIGNMENT)
set(SEGGER_DIR ${ZEPHYR_CURRENT_MODULE_DIR})
zephyr_include_directories_ifdef(CONFIG_USE_SEGGER_RTT
${SEGGER_DIR}/SEGGER
${SEGGER_DIR}/Config
)
zephyr_library_sources(
${SEGGER_DIR}/SEGGER/SEGGER_RTT.c
SEGGER_RTT_zephyr.c
)
zephyr_library_sources_ifdef(CONFIG_SEGGER_SYSTEMVIEW ${SEGGER_DIR}/SEGGER/SEGGER_SYSVIEW.c)
# Using sort key AAA to ensure that we are placed at start of RAM
zephyr_linker_sources_ifdef(CONFIG_SEGGER_RTT_SECTION_CUSTOM RAM_SECTIONS SORT_KEY aaa segger_rtt.ld)
zephyr_linker_section_ifdef(CONFIG_SEGGER_RTT_SECTION_CUSTOM NAME "rtt_buff_data" GROUP RAM_REGION ALIGN 4 NOINPUT)
zephyr_linker_section_configure(SECTION "rtt_buff_data" INPUT "${CONFIG_SEGGER_RTT_SECTION_CUSTOM_NAME}" SYMBOLS )
endif()
if(CONFIG_SEGGER_DEBUGMON)
if(!CONFIG_USE_SEGGER_RTT)
zephyr_library()
endif()
set(SEGGER_DIR ${ZEPHYR_CURRENT_MODULE_DIR})
zephyr_include_directories_ifdef(CONFIG_SEGGER_DEBUGMON
${SEGGER_DIR}/SEGGER/DebugMon/include
)
zephyr_library_sources(
${SEGGER_DIR}/SEGGER/DebugMon/JLINK_MONITOR.c
${SEGGER_DIR}/SEGGER/DebugMon/JLINK_MONITOR_ISR_SES.s
)
endif()