Merge pull request #3690 from OlegHahm/shell_uart0_newlib_distinction
shell: uart0 newlib distinction (workaround)
This commit is contained in:
commit
ed3a33982c
13
Makefile.dep
13
Makefile.dep
@ -185,6 +185,15 @@ ifneq (,$(filter gnrc_pktbuf_%, $(USEMODULE)))
|
||||
USEMODULE += gnrc_pktbuf # make MODULE_GNRC_PKTBUF macro available for all implementations
|
||||
endif
|
||||
|
||||
ifneq (,$(filter newlib,$(USEMODULE)))
|
||||
USEMODULE += uart_stdio
|
||||
else
|
||||
ifneq (,$(filter shell,$(USEMODULE)))
|
||||
USEMODULE += uart0
|
||||
endif
|
||||
endif
|
||||
|
||||
|
||||
ifneq (,$(filter uart0,$(USEMODULE)))
|
||||
USEMODULE += posix
|
||||
endif
|
||||
@ -239,10 +248,6 @@ ifneq (,$(filter cpp11-compat,$(USEMODULE)))
|
||||
FEATURES_REQUIRED += cpp
|
||||
endif
|
||||
|
||||
ifneq (,$(filter newlib,$(USEMODULE)))
|
||||
USEMODULE += uart_stdio
|
||||
endif
|
||||
|
||||
ifneq (,$(filter gnrc_netdev_eth,$(USEMODULE)))
|
||||
USEMODULE += gnrc_pktbuf
|
||||
endif
|
||||
|
||||
@ -26,10 +26,14 @@
|
||||
#include <string.h>
|
||||
|
||||
#include "thread.h"
|
||||
#ifdef MODULE_NEWLIB
|
||||
# include "uart_stdio.h"
|
||||
#else
|
||||
# include "posix_io.h"
|
||||
# include "board_uart0.h"
|
||||
#endif
|
||||
#include "shell.h"
|
||||
#include "shell_commands.h"
|
||||
#include "board_uart0.h"
|
||||
|
||||
#if FEATURE_PERIPH_RTC
|
||||
#include "periph/rtc.h"
|
||||
@ -42,7 +46,6 @@
|
||||
int main(void)
|
||||
{
|
||||
shell_t shell;
|
||||
(void) posix_open(uart0_handler_pid, 0);
|
||||
|
||||
#ifdef MODULE_LTC4150
|
||||
ltc4150_start();
|
||||
@ -54,7 +57,12 @@ int main(void)
|
||||
|
||||
(void) puts("Welcome to RIOT!");
|
||||
|
||||
#ifndef MODULE_NEWLIB
|
||||
(void) posix_open(uart0_handler_pid, 0);
|
||||
shell_init(&shell, NULL, UART0_BUFSIZE, uart0_readc, uart0_putc);
|
||||
#else
|
||||
shell_init(&shell, NULL, UART0_BUFSIZE, getchar, putchar);
|
||||
#endif
|
||||
|
||||
shell_run(&shell);
|
||||
return 0;
|
||||
|
||||
@ -20,9 +20,14 @@
|
||||
|
||||
#include <stdio.h>
|
||||
|
||||
#include "kernel.h"
|
||||
#include "shell.h"
|
||||
#include "board_uart0.h"
|
||||
#ifdef MODULE_NEWLIB
|
||||
# include "uart_stdio.h"
|
||||
#else
|
||||
# include "posix_io.h"
|
||||
# include "board_uart0.h"
|
||||
#endif
|
||||
|
||||
extern int udp_cmd(int argc, char **argv);
|
||||
|
||||
@ -39,8 +44,12 @@ int main(void)
|
||||
|
||||
/* start shell */
|
||||
puts("All up, running the shell now");
|
||||
posix_open(uart0_handler_pid, 0);
|
||||
shell_init(&shell, shell_commands, UART0_BUFSIZE, uart0_readc, uart0_putc);
|
||||
#ifndef MODULE_NEWLIB
|
||||
(void) posix_open(uart0_handler_pid, 0);
|
||||
shell_init(&shell, NULL, UART0_BUFSIZE, uart0_readc, uart0_putc);
|
||||
#else
|
||||
shell_init(&shell, NULL, UART0_BUFSIZE, getchar, putchar);
|
||||
#endif
|
||||
shell_run(&shell);
|
||||
|
||||
/* should be never reached */
|
||||
|
||||
@ -22,8 +22,12 @@
|
||||
|
||||
#include "shell.h"
|
||||
#include "shell_commands.h"
|
||||
#ifdef MODULE_NEWLIB
|
||||
# include "uart_stdio.h"
|
||||
#else
|
||||
# include "posix_io.h"
|
||||
# include "board_uart0.h"
|
||||
#endif
|
||||
#include "net/gnrc/pktdump.h"
|
||||
#include "net/gnrc.h"
|
||||
|
||||
@ -50,8 +54,12 @@ int main(void)
|
||||
|
||||
/* start the shell */
|
||||
puts("Initialization successful - starting the shell now");
|
||||
#ifndef MODULE_NEWLIB
|
||||
(void) posix_open(uart0_handler_pid, 0);
|
||||
shell_init(&shell, NULL, SHELL_BUFSIZE, uart0_readc, uart0_putc);
|
||||
#else
|
||||
shell_init(&shell, NULL, SHELL_BUFSIZE, getchar, putchar);
|
||||
#endif
|
||||
shell_run(&shell);
|
||||
|
||||
return 0;
|
||||
|
||||
@ -21,8 +21,12 @@
|
||||
|
||||
#include "shell.h"
|
||||
#include "shell_commands.h"
|
||||
#ifdef MODULE_NEWLIB
|
||||
# include "uart_stdio.h"
|
||||
#else
|
||||
# include "posix_io.h"
|
||||
# include "board_uart0.h"
|
||||
#endif
|
||||
#include "net/gnrc.h"
|
||||
#include "net/gnrc/pktdump.h"
|
||||
|
||||
@ -46,8 +50,12 @@ int main(void)
|
||||
|
||||
/* start the shell */
|
||||
puts("Initialization successful - starting the shell now");
|
||||
#ifndef MODULE_NEWLIB
|
||||
(void) posix_open(uart0_handler_pid, 0);
|
||||
shell_init(&shell, NULL, SHELL_BUFSIZE, uart0_readc, uart0_putc);
|
||||
#else
|
||||
shell_init(&shell, NULL, SHELL_BUFSIZE, getchar, putchar);
|
||||
#endif
|
||||
shell_run(&shell);
|
||||
|
||||
return 0;
|
||||
|
||||
@ -21,8 +21,12 @@
|
||||
#include <stdio.h>
|
||||
|
||||
#include "shell.h"
|
||||
#ifdef MODULE_NEWLIB
|
||||
# include "uart_stdio.h"
|
||||
#else
|
||||
# include "posix_io.h"
|
||||
# include "board_uart0.h"
|
||||
#endif
|
||||
#include "nrfmin.h"
|
||||
#include "net/gnrc.h"
|
||||
#include "net/gnrc/nomac.h"
|
||||
@ -51,9 +55,13 @@ int main(void)
|
||||
gnrc_netreg_register(GNRC_NETTYPE_UNDEF, &netobj);
|
||||
|
||||
/* initialize and run the shell */
|
||||
#ifndef MODULE_NEWLIB
|
||||
board_uart0_init();
|
||||
posix_open(uart0_handler_pid, 0);
|
||||
(void) posix_open(uart0_handler_pid, 0);
|
||||
shell_init(&shell, NULL, SHELL_BUFSIZE, uart0_readc, uart0_putc);
|
||||
#else
|
||||
shell_init(&shell, NULL, SHELL_BUFSIZE, getchar, putchar);
|
||||
#endif
|
||||
shell_run(&shell);
|
||||
|
||||
return 0;
|
||||
|
||||
@ -35,8 +35,12 @@
|
||||
#include <string.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
#ifdef MODULE_NEWLIB
|
||||
# include "uart_stdio.h"
|
||||
#else
|
||||
# include "posix_io.h"
|
||||
# include "board_uart0.h"
|
||||
#endif
|
||||
#include "shell.h"
|
||||
#include "pcd8544.h"
|
||||
|
||||
@ -170,8 +174,12 @@ int main(void)
|
||||
|
||||
/* run shell */
|
||||
puts("All OK, running shell now");
|
||||
#ifndef MODULE_NEWLIB
|
||||
(void) posix_open(uart0_handler_pid, 0);
|
||||
shell_init(&shell, shell_commands, SHELL_BUFSIZE, uart0_readc, uart0_putc);
|
||||
shell_init(&shell, NULL, SHELL_BUFSIZE, uart0_readc, uart0_putc);
|
||||
#else
|
||||
shell_init(&shell, NULL, SHELL_BUFSIZE, getchar, putchar);
|
||||
#endif
|
||||
shell_run(&shell);
|
||||
|
||||
return 0;
|
||||
|
||||
@ -22,8 +22,12 @@
|
||||
#include <stdlib.h>
|
||||
|
||||
#include "shell.h"
|
||||
#ifdef MODULE_NEWLIB
|
||||
# include "uart_stdio.h"
|
||||
#else
|
||||
# include "posix_io.h"
|
||||
# include "board_uart0.h"
|
||||
#endif
|
||||
#include "periph/gpio.h"
|
||||
#include "hwtimer.h"
|
||||
|
||||
@ -247,8 +251,12 @@ int main(void)
|
||||
" behavior for not existing ports/pins is not defined!");
|
||||
|
||||
/* start the shell */
|
||||
#ifndef MODULE_NEWLIB
|
||||
(void) posix_open(uart0_handler_pid, 0);
|
||||
shell_init(&shell, shell_commands, SHELL_BUFSIZE, uart0_readc, uart0_putc);
|
||||
shell_init(&shell, NULL, SHELL_BUFSIZE, uart0_readc, uart0_putc);
|
||||
#else
|
||||
shell_init(&shell, NULL, SHELL_BUFSIZE, getchar, putchar);
|
||||
#endif
|
||||
shell_run(&shell);
|
||||
|
||||
return 0;
|
||||
|
||||
@ -21,11 +21,16 @@
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
#include "kernel.h"
|
||||
#include "periph_conf.h"
|
||||
#include "periph/i2c.h"
|
||||
#include "shell.h"
|
||||
#ifdef MODULE_NEWLIB
|
||||
# include "uart_stdio.h"
|
||||
#else
|
||||
# include "posix_io.h"
|
||||
# include "board_uart0.h"
|
||||
#endif
|
||||
|
||||
#define BUFSIZE (128U)
|
||||
|
||||
@ -310,12 +315,16 @@ int main(void)
|
||||
|
||||
puts("Test for the low-level I2C driver");
|
||||
|
||||
#ifndef MODULE_NEWLIB
|
||||
/* prepare I/O for shell */
|
||||
board_uart0_init();
|
||||
posix_open(uart0_handler_pid, 0);
|
||||
(void) posix_open(uart0_handler_pid, 0);
|
||||
shell_init(&shell, NULL, UART0_BUFSIZE, uart0_readc, uart0_putc);
|
||||
#else
|
||||
shell_init(&shell, NULL, UART0_BUFSIZE, getchar, putchar);
|
||||
#endif
|
||||
|
||||
/* define own shell commands */
|
||||
shell_init(&shell, shell_commands, UART0_BUFSIZE, uart0_readc, uart0_putc);
|
||||
shell_run(&shell);
|
||||
|
||||
return 0;
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user