1 /*
2  * Copyright (c) 2023 Yonatan Schachter
3  *
4  * SPDX-License-Identifier: Apache-2.0
5  */
6 
7 #include <zephyr/kernel.h>
8 #include <zephyr/bindesc.h>
9 
10 BINDESC_STR_DEFINE(my_string, 1, "Hello world!");
11 BINDESC_UINT_DEFINE(my_int, 2, 5);
12 BINDESC_BYTES_DEFINE(my_bytes, 3, ({1, 2, 3, 4}));
13 
main(void)14 int main(void)
15 {
16 	size_t i;
17 
18 	/* Builtin descriptors */
19 	printk("Zephyr version: %s\n", BINDESC_GET_STR(kernel_version_string));
20 	printk("App version: %s\n", BINDESC_GET_STR(app_version_string));
21 	printk("Build time: %s\n", BINDESC_GET_STR(build_date_time_string));
22 	printk("Compiler: %s %s\n", BINDESC_GET_STR(c_compiler_name),
23 		BINDESC_GET_STR(c_compiler_version));
24 
25 	/* Custom descriptors */
26 	printk("my_string: %s\n", BINDESC_GET_STR(my_string));
27 	printk("my_int: %d\n", BINDESC_GET_UINT(my_int));
28 	printk("my_bytes: ");
29 	for (i = 0; i < BINDESC_GET_SIZE(my_bytes); i++) {
30 		printk("%02x ", BINDESC_GET_BYTES(my_bytes)[i]);
31 	}
32 	printk("\n");
33 
34 	return 0;
35 }
36