Skip to content

Commit 5e03a97

Browse files
lyakhkv2019i
authored andcommitted
fast-get: limit scope
fast-get is only needed when DRAM is used, i.e. when CONFIG_COLD_STORE_EXECUTE_DRAM is selected. It's also unneeded in modules when CONFIG_LLEXT_TYPE_ELF_SHAREDLIB is used, i.e. in gcc builds, because also in those builds no .cold and .coldrodata sections are created. Signed-off-by: Guennadi Liakhovetski <guennadi.liakhovetski@linux.intel.com>
1 parent 759c926 commit 5e03a97

2 files changed

Lines changed: 21 additions & 0 deletions

File tree

src/include/sof/lib/fast-get.h

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,26 @@
1212

1313
struct k_heap;
1414

15+
/*
16+
* When built for SOF, fast_get() and fast_put() are only needed when DRAM
17+
* storage and execution is enabled (CONFIG_COLD_STORE_EXECUTE_DRAM=y), but not
18+
* when building LLEXT extensions (!defined(LL_EXTENSION_BUILD)), using Zephyr
19+
* SDK (CONFIG_LLEXT_TYPE_ELF_RELOCATABLE=n while
20+
* CONFIG_LLEXT_TYPE_ELF_SHAREDLIB=y).
21+
* For unit-testing full versions of fast_get() and fast_put() are checked by
22+
* test/ztest/unit/fast-get/ and test/cmocka/src/lib/fast-get/
23+
*/
24+
#if (CONFIG_COLD_STORE_EXECUTE_DRAM && \
25+
(CONFIG_LLEXT_TYPE_ELF_RELOCATABLE || !defined(LL_EXTENSION_BUILD))) || \
26+
!CONFIG_SOF_FULL_ZEPHYR_APPLICATION
1527
const void *fast_get(struct k_heap *heap, const void * const dram_ptr, size_t size);
1628
void fast_put(struct k_heap *heap, const void *sram_ptr);
29+
#else
30+
static inline const void *fast_get(struct k_heap *heap, const void * const dram_ptr, size_t size)
31+
{
32+
return dram_ptr;
33+
}
34+
static inline void fast_put(struct k_heap *heap, const void *sram_ptr) {}
35+
#endif
1736

1837
#endif /* __SOF_LIB_FAST_GET_H__ */

zephyr/CMakeLists.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -518,7 +518,9 @@ zephyr_library_sources(
518518
# SOF module interface functions
519519
add_subdirectory(../src/module module_unused_install/)
520520

521+
if(CONFIG_COLD_STORE_EXECUTE_DRAM)
521522
zephyr_library_sources_ifdef(CONFIG_FAST_GET lib/fast-get.c)
523+
endif()
522524

523525
# Optional SOF sources - depends on Kconfig - WIP
524526

0 commit comments

Comments
 (0)