1 /*
2 * Copyright (c) 2017 Intel Corporation
3 *
4 * SPDX-License-Identifier: Apache-2.0
5 */
6
7 /**
8 * @brief Test to verify XIP
9 *
10 * @defgroup kernel_xip_tests XIP Tests
11 *
12 * @ingroup all_tests
13 *
14 * @details This module tests that XIP performs as expected. If the first
15 * task is even activated that is a good indication that XIP is
16 * working. However, the test does do some some testing on
17 * global variables for completeness sake.
18 *
19 * @{
20 * @}
21 */
22
23 #include <zephyr/ztest.h>
24
25 /* This test relies on these values being one larger than the one before */
26 #define TEST_VAL_1 0x1
27 #define TEST_VAL_2 0x2
28 #define TEST_VAL_3 0x3
29 #define TEST_VAL_4 0x4
30
31 #define XIP_TEST_ARRAY_SZ 4
32
33 extern uint32_t xip_array[XIP_TEST_ARRAY_SZ];
34
35 /*
36 * This array is deliberately defined outside of the scope of the main test
37 * module to avoid optimization issues.
38 */
39 uint32_t xip_array[XIP_TEST_ARRAY_SZ] = {
40 TEST_VAL_1, TEST_VAL_2, TEST_VAL_3, TEST_VAL_4};
41
42 /**
43 * @brief Test XIP
44 *
45 * @ingroup kernel_xip_tests
46 */
ZTEST(xip,test_globals)47 ZTEST(xip, test_globals)
48 {
49 int i;
50
51 /* Array should be filled with monotonically incrementing values */
52 for (i = 0; i < XIP_TEST_ARRAY_SZ; i++) {
53
54 /**TESTPOINT: Check if the array value is correct*/
55 zassert_equal(xip_array[i], (i+1), "Array value is incorrect");
56 }
57 }
58
59 /**test case main entry*/
60 ZTEST_SUITE(xip, NULL, NULL, NULL, NULL, NULL);
61