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

* updated and integrated makefiles

* added some auto dependencies
This commit is contained in:
Oleg Hahm 2013-02-08 17:37:02 +01:00
parent 8de9df24b5
commit 5df0bd0cc4
50 changed files with 269 additions and 55 deletions

2
board

@ -1 +1 @@
Subproject commit 182151f46326e9eb6c0c48bd2ac6438c66302a13
Subproject commit 402bc0e1b920b54e1a87329d0b496fedfeafd811

View File

@ -1,5 +1,5 @@
MODULE =core
INCLUDES = -Iinclude/ -I../sys/include -I../sys/lib -I../sys/drivers/include -I../cpu/$(CPU)/include/ -I../..
INCLUDES = -Iinclude/ -I../sys/include -I../sys/lib -I../sys/drivers/include -I../cpu/$(CPU)/include/ -I../.. -I../drivers/include/
include $(RIOTBASE)/makefile.base

View File

@ -0,0 +1,6 @@
INCLUDES = -I$(RIOTBASE)/drivers/include -I$(RIOTBASE)/sys/include -I../../net -I../include -I../../lib -I../../../.. -I../../../cpu/ -I../../../core/include -I../../
MODULE =gpioint
include $(MAKEBASE)/makefile.base

View File

@ -1,7 +1,16 @@
MODULE =cpu
INCLUDES = -Iinclude -Idrivers/include -I../arm_common/include -I../../sys/lib -I../../drivers/include -I../../core/include -I../../sys/include -I../../hal/include -I../../..
INCLUDES = -I../include -Idrivers/include -I../arm_common/include -I../../sys/lib -I../../drivers/include -I../../core/include -I../../sys/include -I../../hal/include -I../../..
DIRS =
ifneq (,$(findstring gpioint,$(USEMODULE)))
DIRS += gpioint
endif
ifneq (,$(findstring mci,$(USEMODULE)))
DIRS += mci
endif
ifneq (,$(findstring rtc,$(USEMODULE)))
DIRS += rtc
endif
all: $(BINDIR)$(MODULE).a
@for i in $(DIRS) ; do $(MAKE) -C $$i ; done ;

View File

@ -18,7 +18,7 @@
#include "hwtimer.h"
#include "diskio.h"
#define ENABLE_DEBUG
//#define ENABLE_DEBUG
#include "debug.h"
extern unsigned long hwtimer_now(void);

6
cpu/lpc2387/mci/makefile Normal file
View File

@ -0,0 +1,6 @@
INCLUDES = -I$(RIOTBASE)/drivers/include -I$(RIOTBASE)/sys/include -I../../net -I../include -I../../lib -I../../../.. -I../../../cpu/ -I../../../core/include -I../../
MODULE =mci
include $(MAKEBASE)/makefile.base

6
cpu/lpc2387/rtc/makefile Normal file
View File

@ -0,0 +1,6 @@
INCLUDES = -I$(RIOTBASE)/drivers/include -I$(RIOTBASE)/core/include
MODULE =rtc
include $(MAKEBASE)/makefile.base

50
dist/makefile vendored
View File

@ -9,7 +9,7 @@
#### Mandatory vars!
# this has to be the absolute path of the feuerware-base dir
# this has to be the absolute path of the RIOT-base dir
export RIOTBASE =$(CURDIR)/../RIOT
export RIOTBOARD =$(CURDIR)/../RIOT/board
@ -26,9 +26,17 @@ export AS = $(PREFIX)as
export LINK = $(PREFIX)gcc
export SIZE = $(PREFIX)size
export OBJCOPY = $(PREFIX)objcopy
FLASH = lpc2k_pgm
TERM = pyterm.py
LINKFLAGS = -gdwarf-2 -mcpu=arm7tdmi-s -static -lgcc -nostartfiles -T$(RIOTBASE)/cpu/$(CPU)/linkerscript.x
## Modules to include. No autodependencies!
PROJBINDIR = bin
ifeq ($(strip $(PORT)),)
PORT = /dev/ttyUSB0
endif
## Modules to include.
#USEMODULE += nanopan5375_proprietary
#USEMODULE += sys
@ -57,9 +65,6 @@ LINKFLAGS = -gdwarf-2 -mcpu=arm7tdmi-s -static -lgcc -nostartfiles -T$(RIOTBASE)
#USEMODULE += net_kernel
#USEMODULE += net_mm
# mandatory include!
include $(RIOTBASE)/makefile.modules
#### Project Config
# name of your project
@ -68,6 +73,9 @@ PROJECT = hello-world
# for easy switching of boards
export BOARD = msba2
# mandatory include!
include $(RIOTBASE)/makefile.modules
# if you want to publish the board into the sources as an uppercase #define
BB = $(shell echo $(BOARD)|tr 'a-z' 'A-Z')
CFLAGS += -DBOARD_$(BB)
@ -75,31 +83,37 @@ export CFLAGS
# your binaries to link
BASELIBS += $(RIOTBOARD)/$(BOARD)/bin/$(BOARD)_base.a
BASELIBS += bin/project.a
BASELIBS += $(PROJBINDIR)/project.a
INCLUDES = -I$(RIOTBOARD)/$(BOARD)/include -I$(RIOTBASE)/core/include -I$(RIOTBASE)/cpu/$(CPU)/include -I$(RIOTBASE)/cpu/arm_common/include -I$(RIOTBASE)/sys/lib
INCLUDES = -I$(RIOTBOARD)/$(BOARD)/include -I$(RIOTBASE)/core/include -I$(RIOTBASE)/cpu/$(CPU)/include -I$(RIOTBASE)/cpu/arm_common/include -I$(RIOTBASE)/sys/lib -I$(RIOTBASE)/sys/include/ -I$(RIOTBASE)/drivers/include/
export INCLUDES
## make script for your project. Build feuerware-base here!
all: bin/$(PROJECT).a
## make script for your project. Build RIOT-base here!
all: $(PROJBINDIR)/$(PROJECT).a
@echo "Building project $(PROJECT) for $(BOARD) w/ MCU $(CPU)."
$(MAKE) -C $(RIOTBOARD)
$(MAKE) -C $(RIOTBASE)
$(LINK) $(LINKFLAGS) $(UNDEF) -o bin/$(PROJECT).elf -Wl,--start-group $(BASELIBS) -lm -Wl,--end-group -Wl,-Map=bin/$(PROJECT).map
$(SIZE) bin/$(PROJECT).elf
$(OBJCOPY) -O ihex bin/$(PROJECT).elf bin/$(PROJECT).hex
$(LINK) $(LINKFLAGS) $(UNDEF) -o $(PROJBINDIR)/$(PROJECT).elf -Wl,--start-group $(BASELIBS) -lm -Wl,--end-group -Wl,-Map=$(PROJBINDIR)/$(PROJECT).map
$(SIZE) $(PROJBINDIR)/$(PROJECT).elf
$(OBJCOPY) -O ihex $(PROJBINDIR)/$(PROJECT).elf $(PROJBINDIR)/$(PROJECT).hex
## your make rules
## Only basic example - modify it for larger projects!!
bin/$(PROJECT).a: bin/$(PROJECT).o
$(AR) -rc bin/project.a bin/$(PROJECT).o
$(PROJBINDIR)/$(PROJECT).a: $(PROJBINDIR)/$(PROJECT).o
$(AR) -rc $(PROJBINDIR)/project.a $(PROJBINDIR)/$(PROJECT).o
bin/$(PROJECT).o: main.c
$(CC) $(CFLAGS) $(BOARDINCLUDE) $(INCLUDES) -c main.c -o bin/$(PROJECT).o
$(PROJBINDIR)/$(PROJECT).o: main.c
$(CC) $(CFLAGS) $(BOARDINCLUDE) $(INCLUDES) -c main.c -o $(PROJBINDIR)/$(PROJECT).o
clean:
$(MAKE) -C $(RIOTBOARD) clean
$(MAKE) -C $(RIOTBASE) clean
rm -f bin/*
rm -f $(PROJBINDIR)/*
flash: all
$(FLASH) $(PORT) $(PROJBINDIR)/$(PROJECT).hex
term:
$(TERM) $(PORT)

View File

@ -1,6 +1,6 @@
INCLUDES = -I../../include -I../../net -I../include -I../../lib -I../../../.. -I../../../cpu/ -I../../../core/include -I../../
INCLUDES = -I$(RIOTBASE)/sys/include -I../../net -I../include -I../../lib -I../../../.. -I../../../cpu/ -I../../../core/include -I../../
MODULE =cc110x
MODULE =cc110x_ng
include $(MAKEBASE)/makefile.base

View File

@ -1,5 +1,16 @@
INCLUDES = -I../../include -I../../net -I../include -I../../lib -I../../../.. -I../../../cpu/ -I../../../core/include -I../../ -Iinclude/
INCLUDES = -I$(RIOTBASE)/sys/include -I../../net -I../include -I../../lib -I../../../.. -I../../../cpu/ -I$(RIOTBASE)/core/include -I../../ -Iinclude/
MODULE =cc110x_ng
include $(MAKEBASE)/makefile.base
DIRS =
ifneq (,$(findstring msba2,$(BOARD)))
DIRS += spi
endif
all: $(BINDIR)$(MODULE).a
@for i in $(DIRS) ; do $(MAKE) -C $$i ; done ;
include $(RIOTBASE)/makefile.base
clean::
@for i in $(DIRS) ; do $(MAKE) -C $$i clean ; done ;

View File

@ -0,0 +1,6 @@
INCLUDES = -I$(RIOTBASE)/sys/include -I../../net -I../include -I../../lib -I../../../.. -I../../../cpu/ -I$(RIOTBASE)/core/include -I../../ -Iinclude/
MODULE =cc110x_spi
include $(MAKEBASE)/makefile.base

View File

@ -58,15 +58,15 @@ static double mAh_to_Joule(double mAh) {
return (SUPPLY_VOLTAGE * mAh * 3600);
}
uint32_t ltc4150_get_last_int_duration_us() {
uint32_t ltc4150_get_last_int_duration_us(void) {
return HWTIMER_TICKS_TO_US(last_int_duration);
}
double ltc4150_get_current_mA() {
double ltc4150_get_current_mA(void) {
return 1000000000/(ltc4150_get_last_int_duration_us()*(_GFH * _R_SENSE));
}
double __attribute__((__no_instrument_function__)) ltc4150_get_total_mAh() {
double __attribute__((__no_instrument_function__)) ltc4150_get_total_mAh(void) {
return coulomb_to_mA(int_to_coulomb(int_count));
}
@ -74,23 +74,23 @@ double ltc4150_get_total_Joule(void) {
return mAh_to_Joule(ltc4150_get_total_mAh());
}
double ltc4150_get_avg_mA() {
double ltc4150_get_avg_mA(void) {
return (int_to_coulomb(int_count)*1000000000)/HWTIMER_TICKS_TO_US(last_int_time - start_time);
}
int ltc4150_get_interval() {
int ltc4150_get_interval(void) {
return HWTIMER_TICKS_TO_US(last_int_time - start_time);
}
unsigned long __attribute__((__no_instrument_function__)) ltc4150_get_intcount() {
unsigned long __attribute__((__no_instrument_function__)) ltc4150_get_intcount(void) {
return int_count;
}
void ltc4150_init() {
void ltc4150_init(void) {
ltc4150_arch_init();
}
void ltc4150_start() {
void ltc4150_start(void) {
ltc4150_disable_int();
int_count = 0;
uint32_t now = hwtimer_now();
@ -100,11 +100,11 @@ void ltc4150_start() {
ltc4150_enable_int();
}
void ltc4150_stop() {
void ltc4150_stop(void) {
ltc4150_disable_int();
}
void __attribute__((__no_instrument_function__)) ltc4150_interrupt()
void __attribute__((__no_instrument_function__)) ltc4150_interrupt(void)
{
uint32_t now = hwtimer_now();
if (now >= last_int_time) {

View File

@ -1,4 +1,4 @@
INCLUDES = -I../../include -I../../lib -I../../../cpu/$(CPU)/include -I../../../cpu/ -I../../../hal/include -I../../../core/include -I../../config -I../include
INCLUDES = -I$(RIOTBASE)/core/include -I../include/
MODULE =ltc4150
include $(MAKEBASE)/makefile.base

View File

@ -1,4 +1,4 @@
INCLUDES = -I../../include -I../../lib -I../../../cpu/$(CPU)/include -I../../../cpu/ -I../../../hal/include -I../../../core/include -I../../config -I../include
INCLUDES = -I$(RIOTBASE)/core/include -I../include -I$(RIOTBOARD)/$(BOARD)
MODULE =sht11
include $(MAKEBASE)/makefile.base

View File

@ -20,6 +20,11 @@ ifeq ($(CPU),cc430)
INCLUDES += -I$(MAKEBASE)/cpu/msp430-common/include/
INCLUDES += -I$(MAKEBASE)/cpu/cc430/include/
endif
ifeq ($(BOARD),msba2)
INCLUDES += -I$(RIOTBOARD)/msba2/include/
INCLUDES += -I$(RIOTBOARD)/msba2-common/include/
INCLUDES += -I$(RIOTBOARD)/msba2-common/drivers/include/
endif
$(BINDIR)$(MODULE).a: $(OBJ) $(ASMOBJ)
$(AR) -rc $(BINDIR)$(MODULE).a $(OBJ) $(ASMOBJ)

27
makefile.dep Normal file
View File

@ -0,0 +1,27 @@
ifneq (,$(findstring vtimer,$(USEMODULE)))
ifeq (,$(findstring hwtimer,$(USEMODULE)))
USEMODULE += hwtimer
endif
ifeq (,$(findstring timex,$(USEMODULE)))
USEMODULE += timex
endif
endif
ifneq (,$(findstring uart0,$(USEMODULE)))
ifeq (,$(findstring lib,$(USEMODULE)))
USEMODULE += lib
endif
endif
ifneq (,$(findstring cc110x_ng,$(USEMODULE)))
ifneq (,$(findstring msba2,$(BOARD)))
USEMODULE += cc110x_spi
ifeq (,$(findstring gpioint,$(USEMODULE)))
USEMODULE += gpioint
endif
ifeq (,$(findstring hwtimer,$(USEMODULE)))
USEMODULE += hwtimer
endif
endif
endif

View File

@ -20,7 +20,11 @@ USEMODULE += cpu core sys
endif
ED = $(USEMODULE:%=-D MODULE_%)
EXTDEFINES = $(shell echo $(ED)|tr 'a-z' 'A-Z')
export BASELIBS=$(USEMODULE:%= $(BINDIR)%.a)
BL=$(USEMODULE:%= $(BINDIR)%.a)
# exclude hwtimer, because it is part of the kernel but the define is needed for auto_init
export BASELIBS = $(shell echo $(BL)|sed 's/[^ ]*hwtimer.a//')
CFLAGS += $(EXTDEFINES)
include $(RIOTBASE)/makefile.dep
export USEMODULE

5
sys/auto_init/makefile Normal file
View File

@ -0,0 +1,5 @@
INCLUDES = -I../include -I$(RIOTBASE)/core/include/ -I$(RIOTBASE)/drivers/include
MODULE =auto_init
include $(RIOTBASE)/makefile.base

5
sys/config/makefile Normal file
View File

@ -0,0 +1,5 @@
INCLUDES = -I../include -I$(RIOTBASE)/core/include
MODULE =config
include $(RIOTBASE)/makefile.base

View File

@ -1,7 +1,7 @@
#ifndef __PS_H
#define __PS_H
void thread_print_all();
void thread_print_all(void);
void _ps_handler(char*);
#endif /* __PS_H */

View File

@ -1,6 +1,5 @@
INCLUDES = -I../include -I../drivers/include -I../lib -I../../cpu/$(CPU)/include -I../../cpu/ -I../lib/cmdengine -I../net -I../../hal/include -I../../core/include -I../config
MODULE =shell
MODULE =lib
include $(RIOTBASE)/makefile.base

View File

@ -2,6 +2,9 @@
INCLUDES = -Iinclude -I$(RIOTBASE)/drivers/ -I$(RIOTBASE)/drivers/include -Ilib -I../.. -I../cpu/$(CPU)/include -I../cpu/ -Ilib/cmdengine -Inet -I../hal/include -I../core/include -Iconfig
MODULE =sys
ifneq (,$(findstring auto_init,$(USEMODULE)))
DIRS += auto_init
endif
ifneq (,$(findstring config,$(USEMODULE)))
DIRS += config
endif
@ -20,6 +23,9 @@ endif
ifneq (,$(findstring mprint,$(USEMODULE)))
DIRS += mprint
endif
ifneq (,$(findstring ps,$(USEMODULE)))
DIRS += ps
endif
ifneq (,$(findstring sync_read,$(USEMODULE)))
DIRS += sync_read
endif
@ -29,21 +35,33 @@ endif
ifneq (,$(findstring sysmon,$(USEMODULE)))
DIRS += sysmon
endif
ifneq (,$(findstring utimer,$(USEMODULE)))
DIRS += utimer
endif
ifneq (,$(findstring mqueue,$(USEMODULE)))
DIRS += mqueue
endif
ifneq (,$(findstring posix,$(USEMODULE)))
DIRS += posix
endif
ifneq (,$(findstring shell,$(USEMODULE)))
DIRS += shell
endif
ifneq (,$(findstring shell_commands,$(USEMODULE)))
DIRS += shell/commands
endif
ifneq (,$(findstring timex,$(USEMODULE)))
DIRS += timex
endif
ifneq (,$(findstring tracelog,$(USEMODULE)))
DIRS += tracelog
endif
ifneq (,$(findstring transceiver,$(USEMODULE)))
DIRS += transceiver
endif
ifneq (,$(findstring uart0,$(USEMODULE)))
DIRS += uart0
endif
ifneq (,$(findstring vtimer,$(USEMODULE)))
DIRS += vtimer
endif
all: $(BINDIR)$(MODULE).a
@for i in $(DIRS) ; do $(MAKE) -C $$i ; done ;

5
sys/posix/makefile Normal file
View File

@ -0,0 +1,5 @@
INCLUDES = -I../include -I$(RIOTBASE)/core/include
MODULE =posix
include $(RIOTBASE)/makefile.base

5
sys/ps/makefile Normal file
View File

@ -0,0 +1,5 @@
INCLUDES = -I../include -I$(RIOTBASE)/core/include/ -I$(RIOTBASE)/drivers/include
MODULE =ps
include $(RIOTBASE)/makefile.base

View File

@ -18,8 +18,7 @@ const char *state_names[] = {
/**
* @brief Prints a list of running threads including stack usage to stdout.
*/
void thread_print_all(void)
{
void thread_print_all(void) {
extern unsigned long hwtimer_now(void);
const char queued_name[] = {'_', 'Q'};
int i;
@ -49,8 +48,3 @@ void thread_print_all(void)
}
printf("\t%5s %-21s|%13s%6s %5i\n", "|", "SUM", "|", "|", overall_stacksz);
}
void _ps_handler(char* unnused) {
thread_print_all();
}

View File

@ -0,0 +1,49 @@
#SRC = cc1100.c cc110x_ng.c disk.c id.c ltc4150.c ps.c rtc.c shell.c shell_commands.c sht11.c
SRC = shell_commands.c sc_id.c
INCLUDES = -I../../../core/include -I../../include -I../../../drivers/include/
#cc1100.c cc110x_ng.c disk.c id.c Jamfile ltc4150.c makefile makefile.commands ps.c rtc.c shell.c shell_commands.c sht11.c
ifneq (,$(findstring cc110x_ng,$(USEMODULE)))
INCLUDES += -I$(RIOTBASE)/drivers/cc110x_ng/include/
SRC += sc_cc110x_ng.c
endif
ifneq (,$(findstring cc110x,$(USEMODULE)))
INCLUDES += -I$(RIOTBASE)/drivers/cc110x/
SRC += sc_cc1100.c
endif
ifneq (,$(findstring mci,$(USEMODULE)))
SRC += sc_disk.c
endif
ifneq (,$(findstring ltc4150,$(USEMODULE)))
SRC += sc_ltc4150.c
endif
ifneq (,$(findstring ps,$(USEMODULE)))
SRC += sc_ps.c
endif
ifneq (,$(findstring rtc,$(USEMODULE)))
SRC += sc_rtc.c
endif
ifneq (,$(findstring sht11,$(USEMODULE)))
SRC += sc_sht11.c
endif
OBJ = $(SRC:%.c=$(BINDIR)%.o)
DEP = $(SRC:%.c=$(BINDIR)%.d)
MODULE =shell_commands
$(BINDIR)$(MODULE).a: $(OBJ)
$(AR) rc $(BINDIR)$(MODULE).a $(OBJ)
# pull in dependency info for *existing* .o files
-include $(OBJ:.o=.d)
# compile and generate dependency info
$(BINDIR)%.o: %.c
$(CC) $(CFLAGS) $(PROJECTINCLUDE) $(BOARDINCLUDE) $(INCLUDES) -c $*.c -o $(BINDIR)$*.o
$(CC) $(CFLAGS) $(PROJECTINCLUDE) $(BOARDINCLUDE) $(INCLUDES) -MM $*.c > $(BINDIR)$*.d
@printf "$(BINDIR)"|cat - $(BINDIR)$*.d > /tmp/riot_out && mv /tmp/riot_out $(BINDIR)$*.d
# remove compilation products
clean::
rm -f $(BINDIR)$(MODULE).a $(OBJ) $(DEP) $(ASMOBJ)

View File

@ -0,0 +1,6 @@
#include "ps.h"
void _ps_handler(char* unnused) {
thread_print_all();
}

View File

@ -1,6 +1,23 @@
INCLUDES = -I../include -I../drivers/include -I../lib -I../../cpu/$(CPU)/include -I../../cpu/ -I../lib/cmdengine -I../net -I../../hal/include -I../../core/include -I../config
SRC = shell.c
OBJ = $(SRC:%.c=$(BINDIR)%.o)
DEP = $(SRC:%.c=$(BINDIR)%.d)
INCLUDES = -I../include
MODULE =shell
include $(RIOTBASE)/makefile.base
$(BINDIR)$(MODULE).a: $(OBJ)
$(AR) rc $(BINDIR)$(MODULE).a $(OBJ)
# pull in dependency info for *existing* .o files
-include $(OBJ:.o=.d)
# compile and generate dependency info
$(BINDIR)%.o: %.c
$(CC) $(CFLAGS) $(PROJECTINCLUDE) $(BOARDINCLUDE) $(INCLUDES) -c $*.c -o $(BINDIR)$*.o
$(CC) $(CFLAGS) $(PROJECTINCLUDE) $(BOARDINCLUDE) $(INCLUDES) -MM $*.c > $(BINDIR)$*.d
@printf "$(BINDIR)"|cat - $(BINDIR)$*.d > /tmp/riot_out && mv /tmp/riot_out $(BINDIR)$*.d
# remove compilation products
clean::
rm -f $(BINDIR)$(MODULE).a $(OBJ) $(DEP) $(ASMOBJ)

5
sys/timex/makefile Normal file
View File

@ -0,0 +1,5 @@
INCLUDES = -I../include
MODULE =timex
include $(RIOTBASE)/makefile.base

View File

@ -1,4 +1,4 @@
INCLUDES = -I../include -I../drivers/include -I../drivers/cc110x_ng/include -I../lib -I../../cpu/$(CPU)/include -I../../cpu/ -I../net -I../../hal/include -I../../core/include -I../config
INCLUDES = -I../include -I$(RIOTBAE)/drivers/include -I$(RIOTBASE)/drivers/cc110x_ng/include -I../lib -I../../cpu/$(CPU)/include -I../../cpu/ -I../net -I../../hal/include -I../../core/include -I../config
MODULE =transceiver
include $(MAKEBASE)/makefile.base

7
sys/uart0/makefile Normal file
View File

@ -0,0 +1,7 @@
INCLUDES = -I../include -I../drivers/include -I../lib -I../../cpu/$(CPU)/include -I../../cpu/ -I../lib/cmdengine -I../net -I../../hal/include -I../../core/include -I../config
MODULE =uart0
include $(MAKEBASE)/makefile.base

5
sys/vtimer/makefile Normal file
View File

@ -0,0 +1,5 @@
INCLUDES = -I../include -I$(RIOTBASE)/core/include/ -I$(RIOTBASE)/drivers/include
MODULE =vtimer
include $(RIOTBASE)/makefile.base