1 /*
2  * Copyright (c) 2024 Schneider Electric.
3  *
4  * SPDX-License-Identifier: Apache-2.0
5  */
6 
7 /*
8  * This test is designed to test MOV.W and MOV.T instructions on ARM architectures.
9  * (except Cortex-M0, M0+ and M1, that don't support them)
10  */
11 
12 #include <stdint.h>
13 #include <zephyr/llext/symbol.h>
14 #include <zephyr/sys/printk.h>
15 #include <zephyr/ztest_assert.h>
16 
17 static int test_var;
18 
test_func(void)19 static __used void test_func(void)
20 {
21 	printk("%s\n", __func__);
22 	test_var = 1;
23 }
24 
test_entry(void)25 void test_entry(void)
26 {
27 	test_var = 0;
28 
29 	printk("test movwmovt\n");
30 	__asm volatile ("movw r0, #:lower16:test_func");
31 	__asm volatile ("movt r0, #:upper16:test_func");
32 	__asm volatile ("blx r0");
33 	zassert_equal(test_var, 1, "mov.w and mov.t test failed");
34 }
35 LL_EXTENSION_SYMBOL(test_entry);
36