1 /*
2 * Copyright (c) 2023 Intel Corporation.
3 *
4 * SPDX-License-Identifier: Apache-2.0
5 */
6
7 /*
8 * This very simple hello world C code can be used as a test case for building
9 * probably the simplest loadable extension. It requires a single symbol be
10 * linked, section relocation support, and the ability to export and call out to
11 * a function.
12 */
13
14 #include <zephyr/llext/symbol.h>
15 #include <zephyr/sys/printk.h>
16
hello_world(void)17 void hello_world(void)
18 {
19 #if defined(CONFIG_HELLO_WORLD_MODE)
20 /* HELLO_WORLD_MODE=y: CONFIG_* is defined */
21 printk("Hello, world, from the main binary!\n");
22 #else
23 /* HELLO_WORLD_MODE=m: CONFIG_*_MODULE is defined instead */
24 printk("Hello, world, from an llext!\n");
25 #endif
26 }
27 EXPORT_SYMBOL(hello_world);
28