Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

zephyr: use zephyr sys_cache instead of CMSIS #3162

Merged
merged 1 commit into from
Feb 20, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions core/shared/platform/zephyr/platform_internal.h
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,12 @@
#include <zephyr/net/net_context.h>
#endif /* end of KERNEL_VERSION_NUMBER < 0x030200 */

#if KERNEL_VERSION_NUMBER >= 0x030300 /* version 3.3.0 */
#if defined(CONFIG_CPU_CORTEX_M7) && defined(CONFIG_ARM_MPU)
#include <zephyr/cache.h>
#endif
#endif /* end of KERNEL_VERSION_NUMBER > 0x030300 */

#ifdef CONFIG_ARM_MPU
#if KERNEL_VERSION_NUMBER < 0x030200 /* version 3.2.0 */
#include <arch/arm/aarch32/cortex_m/cmsis.h>
Expand Down
10 changes: 9 additions & 1 deletion core/shared/platform/zephyr/zephyr_platform.c
Original file line number Diff line number Diff line change
Expand Up @@ -202,10 +202,14 @@ void
os_dcache_flush()
{
#if defined(CONFIG_CPU_CORTEX_M7) && defined(CONFIG_ARM_MPU)
#if KERNEL_VERSION_NUMBER < 0x030300 /* version 3.3.0 */
uint32 key;
key = irq_lock();
SCB_CleanDCache();
irq_unlock(key);
#else
sys_cache_data_flush_all();
wenyongh marked this conversation as resolved.
Show resolved Hide resolved
#endif
#elif defined(CONFIG_SOC_CVF_EM7D) && defined(CONFIG_ARC_MPU) \
&& defined(CONFIG_CACHE_FLUSHING)
__asm__ __volatile__("sync");
Expand All @@ -216,7 +220,11 @@ os_dcache_flush()

void
os_icache_flush(void *start, size_t len)
{}
{
#if KERNEL_VERSION_NUMBER >= 0x030300 /* version 3.3.0 */
sys_cache_instr_flush_range(start, len);
#endif
}

void
set_exec_mem_alloc_func(exec_mem_alloc_func_t alloc_func,
Expand Down
Loading