From cf49dec3035073470db06c8047edc37174181a85 Mon Sep 17 00:00:00 2001 From: Oleg Hahm Date: Wed, 1 Oct 2014 22:29:59 +0200 Subject: [PATCH 1/3] make: fix the order of Makefile.dep for timex The order of modules in Makefile.dep matters. --- Makefile.dep | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/Makefile.dep b/Makefile.dep index a8f7727818..b301fac201 100644 --- a/Makefile.dep +++ b/Makefile.dep @@ -47,17 +47,17 @@ ifneq (,$(filter sixlowpan,$(USEMODULE))) USEMODULE += vtimer endif +ifneq (,$(filter uart0,$(USEMODULE))) + USEMODULE += lib + USEMODULE += posix +endif + ifneq (,$(filter posix,$(USEMODULE))) USEMODULE += uart0 USEMODULE += timex USEMODULE += vtimer endif -ifneq (,$(filter uart0,$(USEMODULE))) - USEMODULE += lib - USEMODULE += posix -endif - ifneq (,$(filter cbor,$(USEMODULE))) USEMODULE += net_help endif From 9cf21545fa97e6273f5ddaa2e761a15521b9e948 Mon Sep 17 00:00:00 2001 From: Oleg Hahm Date: Thu, 2 Oct 2014 02:20:45 +0200 Subject: [PATCH 2/3] make: fix dependencies uart0 depends on POSIX, not the other way around. --- Makefile.dep | 1 - examples/ccn-lite-client/Makefile | 2 +- examples/default/Makefile | 2 +- examples/rpl_udp/Makefile | 1 + tests/shell/Makefile | 2 +- tests/struct_tm_utility/Makefile | 2 +- 6 files changed, 5 insertions(+), 5 deletions(-) diff --git a/Makefile.dep b/Makefile.dep index b301fac201..8f019ce65e 100644 --- a/Makefile.dep +++ b/Makefile.dep @@ -53,7 +53,6 @@ ifneq (,$(filter uart0,$(USEMODULE))) endif ifneq (,$(filter posix,$(USEMODULE))) - USEMODULE += uart0 USEMODULE += timex USEMODULE += vtimer endif diff --git a/examples/ccn-lite-client/Makefile b/examples/ccn-lite-client/Makefile index 8439f360ab..924c1bbf59 100644 --- a/examples/ccn-lite-client/Makefile +++ b/examples/ccn-lite-client/Makefile @@ -33,7 +33,7 @@ BOARD_INSUFFICIENT_RAM := chronos msb-430h telosb wsn430-v1_3b wsn430-v1_4 z1 re USEMODULE += shell USEMODULE += shell_commands -USEMODULE += posix +USEMODULE += uart0 USEMODULE += ps USEMODULE += random USEMODULE += defaulttransceiver diff --git a/examples/default/Makefile b/examples/default/Makefile index 82b5c0e651..33746afc9c 100644 --- a/examples/default/Makefile +++ b/examples/default/Makefile @@ -29,7 +29,7 @@ QUIET ?= 1 # Modules to include: -USEMODULE += posix +USEMODULE += uart0 USEMODULE += shell USEMODULE += shell_commands USEMODULE += ps diff --git a/examples/rpl_udp/Makefile b/examples/rpl_udp/Makefile index a34484c4be..dab8d2cf3f 100644 --- a/examples/rpl_udp/Makefile +++ b/examples/rpl_udp/Makefile @@ -43,6 +43,7 @@ BOARD_BLACKLIST := arduino-mega2560 USEMODULE += shell USEMODULE += shell_commands +USEMODULE += uart0 USEMODULE += ps USEMODULE += vtimer USEMODULE += defaulttransceiver diff --git a/tests/shell/Makefile b/tests/shell/Makefile index 083e92546e..9b2bb6ac7b 100644 --- a/tests/shell/Makefile +++ b/tests/shell/Makefile @@ -4,7 +4,7 @@ include ../Makefile.tests_common USEMODULE += shell USEMODULE += shell_commands USEMODULE += ps -USEMODULE += posix +USEMODULE += uart0 DISABLE_MODULE += auto_init diff --git a/tests/struct_tm_utility/Makefile b/tests/struct_tm_utility/Makefile index 939dc0bd98..452499749a 100644 --- a/tests/struct_tm_utility/Makefile +++ b/tests/struct_tm_utility/Makefile @@ -6,7 +6,7 @@ BOARD_INSUFFICIENT_RAM := stm32f0discovery DISABLE_MODULE += auto_init USEMODULE += shell -USEMODULE += posix +USEMODULE += uart0 USEMODULE += timex # The MSP-430 toolchain lacks sscanf: From a50d44c1951607e76cdab5e6babfeb44bf78a57d Mon Sep 17 00:00:00 2001 From: Oleg Hahm Date: Thu, 2 Oct 2014 10:12:28 +0200 Subject: [PATCH 3/3] posix: configure stdio only to uart0 if enabled --- sys/posix/fd.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/sys/posix/fd.c b/sys/posix/fd.c index fb13402a45..fd557357d1 100644 --- a/sys/posix/fd.c +++ b/sys/posix/fd.c @@ -21,7 +21,9 @@ #include #include "posix_io.h" +#ifdef MODULE_UART0 #include "board_uart0.h" +#endif #include "unistd.h" #include "fd.h" @@ -38,6 +40,7 @@ int fd_init(void) { memset(fd_table, 0, sizeof(fd_t) * FD_MAX); +#ifdef MODULE_UART0 posix_open(uart0_handler_pid, 0); fd_t fd = { .__active = 1, @@ -49,6 +52,7 @@ int fd_init(void) memcpy(&fd_table[STDIN_FILENO], &fd, sizeof(fd_t)); memcpy(&fd_table[STDOUT_FILENO], &fd, sizeof(fd_t)); memcpy(&fd_table[STDERR_FILENO], &fd, sizeof(fd_t)); +#endif return FD_MAX; }