Skip to content

Commit

Permalink
smart-amp-test: add support for the Cadence toolchain
Browse files Browse the repository at this point in the history
The Cadence Xtensa cross-toolchain cannot build shared libraries,
when using it we build relocatable ELF objects instead. Update
smart-amp-test to support both formats.

Signed-off-by: Guennadi Liakhovetski <guennadi.liakhovetski@linux.intel.com>
  • Loading branch information
lyakh authored and lgirdwood committed Apr 16, 2024
1 parent 30b9470 commit c5230a9
Showing 1 changed file with 12 additions and 3 deletions.
15 changes: 12 additions & 3 deletions src/samples/audio/smart_amp_llext/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,16 @@ target_compile_options(${MODULE} PRIVATE
-save-temps -O2
)

if("${ZEPHYR_TOOLCHAIN_VARIANT}" STREQUAL "zephyr")
set(MODULE_LINKER_PARAMS -nostdlib -nodefaultlibs)
set(EXTRA_LINKED_PARAMS -shared)
set(COPY_CMD ${CMAKE_STRIP} -R .xt.* -o ${MODULE}_out.so ${MODULE}_llext.so)
else()
set(MODULE_LINKER_PARAMS -nostdlib -nodefaultlibs -r)
set(EXTRA_LINKED_PARAMS)
set(COPY_CMD ${CMAKE_OBJCOPY} -R .xt.* ${MODULE}_llext.so ${MODULE}_out.so)
endif()

target_link_options(${MODULE} PRIVATE
${MODULE_LINKER_PARAMS}
)
Expand All @@ -62,9 +71,9 @@ add_custom_command(OUTPUT lib${MODULE}_out.so
DEPENDS ${MODULE}
COMMAND ${SOF_BASE}scripts/llext_link_helper.py
-f lib${MODULE}.so -t "0xa06ca000" ${CMAKE_C_COMPILER} --
${MODULE_LINKER_PARAMS} -shared -fPIC
-o lib${MODULE}_llext.so $<TARGET_OBJECTS:${MODULE}>
COMMAND ${CMAKE_STRIP} -R .xt.* -o lib${MODULE}_out.so lib${MODULE}_llext.so
${MODULE_LINKER_PARAMS} ${EXTRA_LINKED_PARAMS} -fPIC
-o ${MODULE}_llext.so $<TARGET_OBJECTS:${MODULE}>
COMMAND ${COPY_CMD}
COMMAND_EXPAND_LISTS
)

Expand Down

0 comments on commit c5230a9

Please sign in to comment.