Merge pull request #11668 from aabadie/pr/sys/stdio_ethos
sys/stdio_ethos: replace USE_ETHOS_FOR_STDIO by stdio_ethos pseudomodule
This commit is contained in:
commit
110e718ea8
@ -401,6 +401,12 @@ ifneq (,$(filter shell,$(USEMODULE)))
|
|||||||
USEMODULE += stdin
|
USEMODULE += stdin
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
ifneq (,$(filter stdio_ethos,$(USEMODULE)))
|
||||||
|
USEMODULE += ethos
|
||||||
|
USEMODULE += stdin
|
||||||
|
USEMODULE += stdio_uart
|
||||||
|
endif
|
||||||
|
|
||||||
ifneq (,$(filter stdin,$(USEMODULE)))
|
ifneq (,$(filter stdin,$(USEMODULE)))
|
||||||
ifneq (,$(filter stdio_uart,$(USEMODULE)))
|
ifneq (,$(filter stdio_uart,$(USEMODULE)))
|
||||||
USEMODULE += stdio_uart_rx
|
USEMODULE += stdio_uart_rx
|
||||||
|
|||||||
6
dist/tools/ethos/README.md
vendored
6
dist/tools/ethos/README.md
vendored
@ -8,8 +8,8 @@ To use, add
|
|||||||
|
|
||||||
#
|
#
|
||||||
GNRC_NETIF_NUMOF := 2
|
GNRC_NETIF_NUMOF := 2
|
||||||
USEMODULE += ethos gnrc_netdev
|
USEMODULE += stdio_ethos gnrc_netdev
|
||||||
CFLAGS += '-DETHOS_UART=UART_DEV(0)' -DETHOS_BAUDRATE=115200 -DUSE_ETHOS_FOR_STDIO
|
CFLAGS += '-DETHOS_UART=UART_DEV(0)' -DETHOS_BAUDRATE=115200
|
||||||
|
|
||||||
to app Makefile, "make clean all flash", then run this tool so follows:
|
to app Makefile, "make clean all flash", then run this tool as follows:
|
||||||
# sudo ./ethos <tap-device> <serial>
|
# sudo ./ethos <tap-device> <serial>
|
||||||
|
|||||||
@ -34,6 +34,10 @@
|
|||||||
#include "net/ethernet.h"
|
#include "net/ethernet.h"
|
||||||
|
|
||||||
#ifdef USE_ETHOS_FOR_STDIO
|
#ifdef USE_ETHOS_FOR_STDIO
|
||||||
|
#error USE_ETHOS_FOR_STDIO is deprecated, use USEMODULE+=stdio_ethos instead
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef MODULE_STDIO_ETHOS
|
||||||
#include "stdio_uart.h"
|
#include "stdio_uart.h"
|
||||||
#include "isrpipe.h"
|
#include "isrpipe.h"
|
||||||
extern isrpipe_t stdio_uart_isrpipe;
|
extern isrpipe_t stdio_uart_isrpipe;
|
||||||
@ -104,7 +108,7 @@ static void _handle_char(ethos_t *dev, char c)
|
|||||||
_reset_state(dev);
|
_reset_state(dev);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
#ifdef USE_ETHOS_FOR_STDIO
|
#ifdef MODULE_STDIO_ETHOS
|
||||||
case ETHOS_FRAME_TYPE_TEXT:
|
case ETHOS_FRAME_TYPE_TEXT:
|
||||||
dev->framesize++;
|
dev->framesize++;
|
||||||
isrpipe_write_one(&stdio_uart_isrpipe, c);
|
isrpipe_write_one(&stdio_uart_isrpipe, c);
|
||||||
|
|||||||
@ -34,7 +34,7 @@ extern "C" {
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* if using ethos + stdio, use STDIO_UART values unless overridden */
|
/* if using ethos + stdio, use STDIO_UART values unless overridden */
|
||||||
#ifdef USE_ETHOS_FOR_STDIO
|
#ifdef MODULE_STDIO_ETHOS
|
||||||
#include "stdio_uart.h"
|
#include "stdio_uart.h"
|
||||||
#ifndef ETHOS_UART
|
#ifndef ETHOS_UART
|
||||||
#define ETHOS_UART STDIO_UART_DEV
|
#define ETHOS_UART STDIO_UART_DEV
|
||||||
|
|||||||
@ -28,11 +28,11 @@ BOARD_BLACKLIST += mips-malta pic32-wifire pic32-clicker ruuvitag thingy52
|
|||||||
# UART, but not on native, as native has a tap interface towards the host.
|
# UART, but not on native, as native has a tap interface towards the host.
|
||||||
ifeq (,$(filter native,$(BOARD)))
|
ifeq (,$(filter native,$(BOARD)))
|
||||||
GNRC_NETIF_NUMOF := 2
|
GNRC_NETIF_NUMOF := 2
|
||||||
USEMODULE += ethos
|
USEMODULE += stdio_ethos
|
||||||
|
|
||||||
# ethos baudrate can be configured from make command
|
# ethos baudrate can be configured from make command
|
||||||
ETHOS_BAUDRATE ?= 115200
|
ETHOS_BAUDRATE ?= 115200
|
||||||
CFLAGS += -DETHOS_BAUDRATE=$(ETHOS_BAUDRATE) -DUSE_ETHOS_FOR_STDIO
|
CFLAGS += -DETHOS_BAUDRATE=$(ETHOS_BAUDRATE)
|
||||||
else
|
else
|
||||||
GNRC_NETIF_NUMOF := 2
|
GNRC_NETIF_NUMOF := 2
|
||||||
TERMFLAGS += -z [::1]:17754
|
TERMFLAGS += -z [::1]:17754
|
||||||
|
|||||||
@ -95,8 +95,8 @@ has the following:
|
|||||||
```make
|
```make
|
||||||
ifeq (,$(filter native,$(BOARD)))
|
ifeq (,$(filter native,$(BOARD)))
|
||||||
GNRC_NETIF_NUMOF := 2
|
GNRC_NETIF_NUMOF := 2
|
||||||
USEMODULE += ethos
|
USEMODULE += stdio_ethos
|
||||||
CFLAGS += '-DETHOS_UART=UART_DEV(0)' -DETHOS_BAUDRATE=115200 -DUSE_ETHOS_FOR_STDIO
|
CFLAGS += '-DETHOS_UART=UART_DEV(0)' -DETHOS_BAUDRATE=115200
|
||||||
FEATURES_REQUIRED += periph_uart
|
FEATURES_REQUIRED += periph_uart
|
||||||
endif
|
endif
|
||||||
# include UHCP client
|
# include UHCP client
|
||||||
|
|||||||
@ -74,6 +74,7 @@ PSEUDOMODULES += sock_ip
|
|||||||
PSEUDOMODULES += sock_tcp
|
PSEUDOMODULES += sock_tcp
|
||||||
PSEUDOMODULES += sock_udp
|
PSEUDOMODULES += sock_udp
|
||||||
PSEUDOMODULES += stdin
|
PSEUDOMODULES += stdin
|
||||||
|
PSEUDOMODULES += stdio_ethos
|
||||||
PSEUDOMODULES += stdio_uart_rx
|
PSEUDOMODULES += stdio_uart_rx
|
||||||
|
|
||||||
# print ascii representation in function od_hex_dump()
|
# print ascii representation in function od_hex_dump()
|
||||||
|
|||||||
@ -35,7 +35,7 @@
|
|||||||
#include "periph/uart.h"
|
#include "periph/uart.h"
|
||||||
#include "isrpipe.h"
|
#include "isrpipe.h"
|
||||||
|
|
||||||
#ifdef USE_ETHOS_FOR_STDIO
|
#ifdef MODULE_STDIO_ETHOS
|
||||||
#include "ethos.h"
|
#include "ethos.h"
|
||||||
extern ethos_t ethos;
|
extern ethos_t ethos;
|
||||||
#endif
|
#endif
|
||||||
@ -61,18 +61,16 @@ void stdio_init(void)
|
|||||||
cb = (uart_rx_cb_t) isrpipe_write_one;
|
cb = (uart_rx_cb_t) isrpipe_write_one;
|
||||||
arg = &stdio_uart_isrpipe;
|
arg = &stdio_uart_isrpipe;
|
||||||
#else
|
#else
|
||||||
#ifdef USE_ETHOS_FOR_STDIO
|
|
||||||
#error "ethos needs stdio_uart_rx"
|
|
||||||
#endif
|
|
||||||
cb = NULL;
|
cb = NULL;
|
||||||
arg = NULL;
|
arg = NULL;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifndef USE_ETHOS_FOR_STDIO
|
#ifdef MODULE_STDIO_ETHOS
|
||||||
uart_init(STDIO_UART_DEV, STDIO_UART_BAUDRATE, cb, arg);
|
|
||||||
#else
|
|
||||||
uart_init(ETHOS_UART, ETHOS_BAUDRATE, cb, arg);
|
uart_init(ETHOS_UART, ETHOS_BAUDRATE, cb, arg);
|
||||||
|
#else
|
||||||
|
uart_init(STDIO_UART_DEV, STDIO_UART_BAUDRATE, cb, arg);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if MODULE_VFS
|
#if MODULE_VFS
|
||||||
vfs_bind_stdio();
|
vfs_bind_stdio();
|
||||||
#endif
|
#endif
|
||||||
@ -91,10 +89,10 @@ ssize_t stdio_read(void* buffer, size_t count)
|
|||||||
|
|
||||||
ssize_t stdio_write(const void* buffer, size_t len)
|
ssize_t stdio_write(const void* buffer, size_t len)
|
||||||
{
|
{
|
||||||
#ifndef USE_ETHOS_FOR_STDIO
|
#ifdef MODULE_STDIO_ETHOS
|
||||||
uart_write(STDIO_UART_DEV, (const uint8_t *)buffer, len);
|
|
||||||
#else
|
|
||||||
ethos_send_frame(ðos, (const uint8_t *)buffer, len, ETHOS_FRAME_TYPE_TEXT);
|
ethos_send_frame(ðos, (const uint8_t *)buffer, len, ETHOS_FRAME_TYPE_TEXT);
|
||||||
|
#else
|
||||||
|
uart_write(STDIO_UART_DEV, (const uint8_t *)buffer, len);
|
||||||
#endif
|
#endif
|
||||||
return len;
|
return len;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -21,10 +21,10 @@ ifeq (native,$(BOARD))
|
|||||||
|
|
||||||
TERMFLAGS ?= $(TAP)
|
TERMFLAGS ?= $(TAP)
|
||||||
else
|
else
|
||||||
USEMODULE += ethos
|
USEMODULE += stdio_ethos
|
||||||
|
|
||||||
ETHOS_BAUDRATE ?= 115200
|
ETHOS_BAUDRATE ?= 115200
|
||||||
CFLAGS += -DETHOS_BAUDRATE=$(ETHOS_BAUDRATE) -DUSE_ETHOS_FOR_STDIO
|
CFLAGS += -DETHOS_BAUDRATE=$(ETHOS_BAUDRATE)
|
||||||
TERMDEPS += ethos
|
TERMDEPS += ethos
|
||||||
TERMPROG ?= sudo $(RIOTTOOLS)/ethos/ethos
|
TERMPROG ?= sudo $(RIOTTOOLS)/ethos/ethos
|
||||||
TERMFLAGS ?= $(TAP) $(PORT) $(ETHOS_BAUDRATE)
|
TERMFLAGS ?= $(TAP) $(PORT) $(ETHOS_BAUDRATE)
|
||||||
|
|||||||
@ -24,10 +24,10 @@ ifeq (native,$(BOARD))
|
|||||||
|
|
||||||
TERMFLAGS ?= $(TAP)
|
TERMFLAGS ?= $(TAP)
|
||||||
else
|
else
|
||||||
USEMODULE += ethos
|
USEMODULE += stdio_ethos
|
||||||
|
|
||||||
ETHOS_BAUDRATE ?= 115200
|
ETHOS_BAUDRATE ?= 115200
|
||||||
CFLAGS += -DETHOS_BAUDRATE=$(ETHOS_BAUDRATE) -DUSE_ETHOS_FOR_STDIO
|
CFLAGS += -DETHOS_BAUDRATE=$(ETHOS_BAUDRATE)
|
||||||
TERMDEPS += ethos
|
TERMDEPS += ethos
|
||||||
TERMPROG ?= sudo $(RIOTTOOLS)/ethos/ethos
|
TERMPROG ?= sudo $(RIOTTOOLS)/ethos/ethos
|
||||||
TERMFLAGS ?= $(TAP) $(PORT) $(ETHOS_BAUDRATE)
|
TERMFLAGS ?= $(TAP) $(PORT) $(ETHOS_BAUDRATE)
|
||||||
|
|||||||
@ -25,10 +25,10 @@ ifeq (native,$(BOARD))
|
|||||||
|
|
||||||
TERMFLAGS ?= $(TAP)
|
TERMFLAGS ?= $(TAP)
|
||||||
else
|
else
|
||||||
USEMODULE += ethos
|
USEMODULE += stdio_ethos
|
||||||
|
|
||||||
ETHOS_BAUDRATE ?= 115200
|
ETHOS_BAUDRATE ?= 115200
|
||||||
CFLAGS += -DETHOS_BAUDRATE=$(ETHOS_BAUDRATE) -DUSE_ETHOS_FOR_STDIO
|
CFLAGS += -DETHOS_BAUDRATE=$(ETHOS_BAUDRATE)
|
||||||
TERMDEPS += ethos
|
TERMDEPS += ethos
|
||||||
TERMPROG ?= sudo $(RIOTTOOLS)/ethos/ethos
|
TERMPROG ?= sudo $(RIOTTOOLS)/ethos/ethos
|
||||||
TERMFLAGS ?= $(TAP) $(PORT) $(ETHOS_BAUDRATE)
|
TERMFLAGS ?= $(TAP) $(PORT) $(ETHOS_BAUDRATE)
|
||||||
|
|||||||
@ -39,11 +39,11 @@ LOW_MEMORY_BOARDS := nucleo-f334r8
|
|||||||
GNRC_NETIF_NUMOF := 2
|
GNRC_NETIF_NUMOF := 2
|
||||||
|
|
||||||
# uncomment these to use ethos
|
# uncomment these to use ethos
|
||||||
#USEMODULE += ethos gnrc_uhcpc
|
#USEMODULE += stdio_ethos gnrc_uhcpc
|
||||||
#
|
#
|
||||||
## ethos baudrate can be configured from make command
|
## ethos baudrate can be configured from make command
|
||||||
#ETHOS_BAUDRATE ?= 115200
|
#ETHOS_BAUDRATE ?= 115200
|
||||||
#CFLAGS += -DETHOS_BAUDRATE=$(ETHOS_BAUDRATE) -DUSE_ETHOS_FOR_STDIO
|
#CFLAGS += -DETHOS_BAUDRATE=$(ETHOS_BAUDRATE)
|
||||||
|
|
||||||
ifneq (,$(filter $(BOARD),$(LOW_MEMORY_BOARDS)))
|
ifneq (,$(filter $(BOARD),$(LOW_MEMORY_BOARDS)))
|
||||||
$(info Using low-memory configuration for microcoap_server.)
|
$(info Using low-memory configuration for microcoap_server.)
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user