1 /*
2  * Copyright (c) 2013-2015 Wind River Systems, Inc.
3  * Copyright (c) 2016-2020 Intel Corporation.
4  *
5  * SPDX-License-Identifier: Apache-2.0
6  */
7 
8 /**
9  * @file
10  * @brief Measure time
11  *
12  */
13 #include <zephyr/kernel.h>
14 #include <ksched.h>
15 #include <zephyr/sys/libc-hooks.h>
16 #include "footprint.h"
17 
18 #ifdef CONFIG_USERSPACE
19 K_APPMEM_PARTITION_DEFINE(footprint_mem_partition);
20 struct k_mem_domain footprint_mem_domain;
21 #endif
22 
23 K_THREAD_STACK_DEFINE(my_stack_area, STACK_SIZE);
24 K_THREAD_STACK_DEFINE(my_stack_area_0, STACK_SIZE);
25 
26 struct k_thread my_thread;
27 struct k_thread my_thread_0;
28 
29 extern void run_heap_malloc_free(void);
30 extern void run_libc(void);
31 extern void run_mutex(void);
32 extern void run_pm_device(void);
33 extern void run_semaphore(void);
34 extern void run_thread_system(void);
35 extern void run_timer(void);
36 extern void run_userspace(void);
37 extern void run_workq(void);
38 
main(void)39 int main(void)
40 {
41 	printk("Hello from %s!\n", CONFIG_BOARD);
42 
43 #ifdef CONFIG_USERSPACE
44 	int ret;
45 	struct k_mem_partition *mem_parts[] = {
46 #if Z_LIBC_PARTITION_EXISTS
47 		&z_libc_partition,
48 #endif
49 		&footprint_mem_partition
50 	};
51 
52 	ret = k_mem_domain_init(&footprint_mem_domain,
53 				ARRAY_SIZE(mem_parts), mem_parts);
54 	__ASSERT_NO_MSG(ret == 0);
55 	ARG_UNUSED(ret);
56 #endif /* CONFIG_USERSPACE */
57 
58 	run_thread_system();
59 
60 	run_heap_malloc_free();
61 
62 	run_semaphore();
63 
64 	run_mutex();
65 
66 	run_timer();
67 
68 	run_libc();
69 
70 	run_workq();
71 
72 #ifdef CONFIG_PM_DEVICE
73 	run_pm_device();
74 #endif
75 
76 #ifdef CONFIG_USERSPACE
77 	run_userspace();
78 #endif
79 
80 	printk("PROJECT EXECUTION SUCCESSFUL\n");
81 	return 0;
82 }
83