drivers: native_posix_console: Fix if printk is not selected

We should only try to register a printk backend
if printk is compiled in, otherwise we get a link
error.

Signed-off-by: Alberto Escolar Piedras <alberto.escolar.piedras@nordicsemi.no>
This commit is contained in:
Alberto Escolar Piedras 2023-04-21 17:20:57 +02:00 committed by Carles Cufí
parent 1e1f3ba73c
commit 7a541714f9

View file

@ -39,8 +39,10 @@ static void native_posix_stdout_init(void)
setvbuf(stdout, NULL, _IOLBF, 512);
setvbuf(stderr, NULL, _IOLBF, 512);
#ifdef CONFIG_PRINTK
extern void __printk_hook_install(int (*fn)(int));
__printk_hook_install(putchar);
#endif
}
/**