1 /* 2 * Copyright (c) 2020 Nordic Semiconductor ASA 3 * 4 * SPDX-License-Identifier: Apache-2.0 5 */ 6 7 #if defined(CONFIG_APP_FORMATTER_PRINTK) 8 #include <zephyr/sys/printk.h> 9 #define PRINT_S "printk" 10 #define PRINT(...) printk(__VA_ARGS__) 11 #elif defined(CONFIG_APP_FORMATTER_PRINTF) 12 #include <stdio.h> 13 #ifdef CONFIG_NEWLIB_LIBC 14 #define PRINT_S "printf/newlib" 15 #else /* NEWLIB_LIBC */ 16 #define PRINT_S "printf" 17 #endif /* NEWLIB_LIBC */ 18 #define PRINT(...) printf(__VA_ARGS__) 19 #elif defined(CONFIG_APP_FORMATTER_PRINTFCB) 20 #include <zephyr/sys/cbprintf.h> 21 #ifdef CONFIG_NEWLIB_LIBC 22 #define PRINT_S "printfcb/newlib" 23 #else /* NEWLIB_LIBC */ 24 #define PRINT_S "printfcb" 25 #endif /* NEWLIB_LIBC */ 26 #define PRINT(...) printfcb(__VA_ARGS__) 27 #elif defined(CONFIG_APP_FORMATTER_FPRINTF) 28 #include <stdio.h> 29 #define PRINT_S "fprintf" 30 #define PRINT(...) fprintf(stdout, __VA_ARGS__) 31 #elif defined(CONFIG_APP_FORMATTER_FPRINTFCB) 32 #include <zephyr/sys/cbprintf.h> 33 #define PRINT_S "fprintfcb" 34 #define PRINT(...) fprintfcb(stdout, __VA_ARGS__) 35 #else 36 #error Unsupported configuration 37 #endif 38 main(void)39int main(void) 40 { 41 PRINT("Hello with %s on %s\nComplete\n", PRINT_S, CONFIG_BOARD); 42 return 0; 43 } 44