mirror of
https://github.com/bytecodealliance/wasm-micro-runtime.git
synced 2024-11-26 15:32:05 +00:00
zephyr: Use zephyr sys_cache instead of CMSIS (#3162)
When running AOT code in Zephyr on STM32H743VIT6 without CONFIG_CACHE_MANAGEMENT=y, a hard fault occurs, which leads to SCB_CleanDCache(). It’s better to use the functions built into Zephyr.
This commit is contained in:
parent
8b8c59589d
commit
b9db23b983
|
@ -50,6 +50,12 @@
|
||||||
#include <zephyr/net/net_context.h>
|
#include <zephyr/net/net_context.h>
|
||||||
#endif /* end of KERNEL_VERSION_NUMBER < 0x030200 */
|
#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
|
#ifdef CONFIG_ARM_MPU
|
||||||
#if KERNEL_VERSION_NUMBER < 0x030200 /* version 3.2.0 */
|
#if KERNEL_VERSION_NUMBER < 0x030200 /* version 3.2.0 */
|
||||||
#include <arch/arm/aarch32/cortex_m/cmsis.h>
|
#include <arch/arm/aarch32/cortex_m/cmsis.h>
|
||||||
|
|
|
@ -202,10 +202,14 @@ void
|
||||||
os_dcache_flush()
|
os_dcache_flush()
|
||||||
{
|
{
|
||||||
#if defined(CONFIG_CPU_CORTEX_M7) && defined(CONFIG_ARM_MPU)
|
#if defined(CONFIG_CPU_CORTEX_M7) && defined(CONFIG_ARM_MPU)
|
||||||
|
#if KERNEL_VERSION_NUMBER < 0x030300 /* version 3.3.0 */
|
||||||
uint32 key;
|
uint32 key;
|
||||||
key = irq_lock();
|
key = irq_lock();
|
||||||
SCB_CleanDCache();
|
SCB_CleanDCache();
|
||||||
irq_unlock(key);
|
irq_unlock(key);
|
||||||
|
#else
|
||||||
|
sys_cache_data_flush_all();
|
||||||
|
#endif
|
||||||
#elif defined(CONFIG_SOC_CVF_EM7D) && defined(CONFIG_ARC_MPU) \
|
#elif defined(CONFIG_SOC_CVF_EM7D) && defined(CONFIG_ARC_MPU) \
|
||||||
&& defined(CONFIG_CACHE_FLUSHING)
|
&& defined(CONFIG_CACHE_FLUSHING)
|
||||||
__asm__ __volatile__("sync");
|
__asm__ __volatile__("sync");
|
||||||
|
@ -216,7 +220,11 @@ os_dcache_flush()
|
||||||
|
|
||||||
void
|
void
|
||||||
os_icache_flush(void *start, size_t len)
|
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
|
void
|
||||||
set_exec_mem_alloc_func(exec_mem_alloc_func_t alloc_func,
|
set_exec_mem_alloc_func(exec_mem_alloc_func_t alloc_func,
|
||||||
|
|
Loading…
Reference in New Issue
Block a user