1
0
mirror of https://github.com/RIOT-OS/RIOT.git synced 2024-12-29 04:50:03 +01:00

Merge pull request #468 from LudwigOrtmann/native_includes

make native includes RIOT posix compatible
This commit is contained in:
Oleg Hahm 2013-12-23 14:25:52 -08:00
commit 894dfe5912
8 changed files with 62 additions and 41 deletions

View File

@ -11,6 +11,8 @@ DEP = $(SRC:%.c=$(BINDIR)%.d)
INCLUDES += -I$(RIOTBOARD)/native/include/
EXCLUDES := -I$(RIOTBASE)/sys/posix/%
$(BINDIR)native_drivers.a: $(OBJ)
@$(AR) rcs $(BINDIR)${ARCH} $(OBJ)
@ -19,7 +21,7 @@ $(BINDIR)native_drivers.a: $(OBJ)
# compile and generate dependency info
$(BINDIR)%.o: %.c
$(CC) $(CFLAGS) $(INCLUDES) $(BOARDINCLUDE) $(PROJECTINCLUDE) $(CPUINCLUDE) -c $*.c -o $(BINDIR)$*.o
$(CC) $(CFLAGS) $(filter-out $(EXCLUDES),$(INCLUDES)) $(BOARDINCLUDE) $(PROJECTINCLUDE) $(CPUINCLUDE) -c $*.c -o $(BINDIR)$*.o
@$(CC) $(CFLAGS) $(INCLUDES) $(BOARDINCLUDE) $(PROJECTINCLUDE) $(CPUINCLUDE) -MM $*.c > $(BINDIR)$*.d
@printf "$(BINDIR)" | cat - $(BINDIR)$*.d > /tmp/riot_out && mv /tmp/riot_out $(BINDIR)$*.d

View File

@ -15,5 +15,5 @@ ifeq ($(CPU),mc1322x)
export INCLUDES += -I$(RIOTBASE)/cpu/arm_common/include
endif
ifeq ($(CPU),native)
export INCLUDES += -I$(RIOTBASE)/cpu/native/include
export INCLUDES += -I$(RIOTCPU)/native/include
endif

View File

@ -1,6 +1,9 @@
MODULE = cpu
INCLUDES += -I../include -I$(RIOTBASE)/core/include
EXCLUDES := -I$(RIOTBASE)/sys/posix/%
DIRS =
ifneq (,$(findstring rtc,$(USEMODULE)))
DIRS += rtc
@ -14,6 +17,12 @@ all: $(BINDIR)$(MODULE).a
include $(RIOTBASE)/Makefile.base
$(BINDIR)%.o: %.c
$(CC) $(CFLAGS) $(filter-out $(EXCLUDES),$(INCLUDES)) $(BOARDINCLUDE) $(PROJECTINCLUDE) $(CPUINCLUDE) -c $*.c -o $(BINDIR)$*.o
@$(CC) $(CFLAGS) $(INCLUDES) $(BOARDINCLUDE) $(PROJECTINCLUDE) $(CPUINCLUDE) -MM $*.c > $(BINDIR)$*.d
@printf "$(BINDIR)" | cat - $(BINDIR)$*.d > /tmp/riot_out && mv /tmp/riot_out $(BINDIR)$*.d
clean::
@for i in $(DIRS) ; do "$(MAKE)" -C $$i clean ; done ;

View File

@ -15,7 +15,6 @@
*/
#ifndef CPUCONF_H_
#define CPUCONF_H_
#include <signal.h>
/* TODO: tighten stack sizes */
#ifdef __MACH__ /* OSX */

View File

@ -22,50 +22,14 @@
#ifndef _CPU_H
#define _CPU_H
#include <sys/param.h>
/* enable signal handler register access on different platforms
* check here for more:
* http://sourceforge.net/p/predef/wiki/OperatingSystems/
*/
#ifdef BSD // BSD = (FreeBSD, Darwin, ...)
#ifndef _XOPEN_SOURCE
#define _XOPEN_SOURCE
#include <ucontext.h>
#undef _XOPEN_SOURCE
#else
#include <ucontext.h>
#endif
#elif defined(__linux__)
#ifndef _GNU_SOURCE
#define GNU_SOURCE
#include <ucontext.h>
#undef GNU_SOURCE
#else
#include <ucontext.h>
#endif
#endif // BSD/Linux
#include "kernel_internal.h"
#include "sched.h"
#include "cpu-conf.h"
/* TODO: choose better value? */
#define F_CPU 1000000
/* TODO: remove once these have been removed from RIOT: */
void dINT(void);
void eINT(void);
/**
* register interrupt handler handler for interrupt sig
*/
int register_interrupt(int sig, void (*handler)(void));
/**
* unregister interrupt handler for interrupt sig
*/
int unregister_interrupt(int sig);
/** @} */
#endif //_CPU_H

View File

@ -12,7 +12,7 @@
#ifndef _NATIVE_INTERNAL_H
#define _NATIVE_INTERNAL_H
//#include <signal.h>
#include <signal.h>
/**
* internal functions
@ -56,5 +56,44 @@ extern const char *_progname;
extern fd_set _native_rfds;
#endif
/**
* register interrupt handler handler for interrupt sig
*/
int register_interrupt(int sig, void (*handler)(void));
/**
* unregister interrupt handler for interrupt sig
*/
int unregister_interrupt(int sig);
//#include <sys/param.h>
/* enable signal handler register access on different platforms
* check here for more:
* http://sourceforge.net/p/predef/wiki/OperatingSystems/
*/
#ifdef BSD // BSD = (FreeBSD, Darwin, ...)
#ifndef _XOPEN_SOURCE
#define _XOPEN_SOURCE
#include <ucontext.h>
#undef _XOPEN_SOURCE
#else
#include <ucontext.h>
#endif
#elif defined(__linux__)
#ifndef _GNU_SOURCE
#define GNU_SOURCE
#include <ucontext.h>
#undef GNU_SOURCE
#else
#include <ucontext.h>
#endif
#endif // BSD/Linux
#include "kernel_internal.h"
#include "sched.h"
/** @} */
#endif /* _NATIVE_INTERNAL_H */

View File

@ -1,6 +1,13 @@
INCLUDES += -I$(RIOTBASE)/core/include -I$(RIOTBASE)/sys/include
EXCLUDES := -I$(RIOTBASE)/sys/posix/%
MODULE = nativenet
include $(MAKEBASE)/Makefile.base
$(BINDIR)%.o: %.c
$(CC) $(CFLAGS) $(filter-out $(EXCLUDES),$(INCLUDES)) $(BOARDINCLUDE) $(PROJECTINCLUDE) $(CPUINCLUDE) -c $*.c -o $(BINDIR)$*.o
@$(CC) $(CFLAGS) $(INCLUDES) $(BOARDINCLUDE) $(PROJECTINCLUDE) $(CPUINCLUDE) -MM $*.c > $(BINDIR)$*.d
@printf "$(BINDIR)" | cat - $(BINDIR)$*.d > /tmp/riot_out && mv /tmp/riot_out $(BINDIR)$*.d

View File

@ -27,6 +27,7 @@
#define ENABLE_DEBUG (0)
#include "debug.h"
#include "transceiver.h"
#include "msg.h"
#include "tap.h"
#include "nativenet.h"