2010-06-09 16:43:22 +02:00
|
|
|
# -*- makefile -*-
|
|
|
|
|
|
|
|
# Adapted from Makefile.msp430
|
|
|
|
# Adapted from Makefile.at91sam7
|
|
|
|
|
|
|
|
### Define the CPU directory
|
|
|
|
CONTIKI_CPU=$(CONTIKI)/cpu/mc1322x
|
|
|
|
|
|
|
|
### Define the source files we have in the AT91SAM7S port
|
|
|
|
|
|
|
|
CONTIKI_CPU_DIRS = . lib src board dev ../arm/common/dbg-io
|
|
|
|
|
|
|
|
MC1322X = debug-uart.c rtimer-arch.c watchdog.c contiki-crm.c contiki-maca.c contiki-misc.c leds-arch.c leds.c contiki-uart.c slip-uart1.c
|
|
|
|
|
|
|
|
DBG_IO = dbg-printf.c dbg-snprintf.c dbg-sprintf.c strformat.c
|
|
|
|
|
|
|
|
CPU_LIBS = $(notdir $(wildcard $(CONTIKI_CPU)/lib/*.c))
|
|
|
|
CPU_SRCS = $(notdir $(wildcard $(CONTIKI_CPU)/src/*.c)) $(notdir $(wildcard $(CONTIKI_CPU)/src/*.S))
|
|
|
|
|
|
|
|
CONTIKI_TARGET_SOURCEFILES += $(MC1322X) $(DBG_IO) $(CPU_LIBS) $(CPU_SRCS) $(SYSAPPS) $(ELFLOADER) \
|
|
|
|
$(TARGETLIBS) $(UIPDRIVERS) $(USB)
|
|
|
|
|
|
|
|
CONTIKI_SOURCEFILES += $(CONTIKI_TARGET_SOURCEFILES)
|
|
|
|
|
|
|
|
THREADS =
|
|
|
|
|
2010-11-17 21:04:31 +01:00
|
|
|
CROSS_COMPILE ?= arm-none-eabi-
|
2010-11-09 14:13:45 +01:00
|
|
|
CROSS ?= $(CROSS_COMPILE)
|
2010-06-09 16:43:22 +02:00
|
|
|
|
|
|
|
### Compiler definitions
|
|
|
|
CC = $(CROSS)gcc
|
|
|
|
LD = $(CROSS)gcc
|
|
|
|
AS = $(CROSS)as
|
|
|
|
AR = $(CROSS)ar
|
|
|
|
NM = $(CROSS)nm
|
|
|
|
OBJCOPY = $(CROSS)objcopy
|
|
|
|
STRIP = $(CROSS)strip
|
|
|
|
|
|
|
|
PROJECT_OBJECTFILES += ${addprefix $(OBJECTDIR)/,$(CONTIKI_TARGET_MAIN:.c=.o)}
|
|
|
|
|
|
|
|
TEXT_BASE = 0x00400000
|
|
|
|
export TEXT_BASE
|
|
|
|
LINKERSCRIPT = $(CONTIKI_CPU)/mc1322x.lds
|
|
|
|
|
|
|
|
STARTUP=$(OBJECTDIR)/start.o
|
|
|
|
|
|
|
|
ARCH_FLAGS= -mcpu=arm7tdmi-s -mthumb-interwork -march=armv4t -mtune=arm7tdmi-s -DCONFIG_ARM -D__ARM__ #-Wcast-align
|
|
|
|
THUMB_FLAGS= -mthumb -mcallee-super-interworking
|
2011-01-13 13:03:29 +01:00
|
|
|
ARM_FLAGS= -marm
|
2010-06-09 16:43:22 +02:00
|
|
|
|
|
|
|
CFLAGSNO = -I. -I$(CONTIKI)/core -I$(CONTIKI_CPU) -I$(CONTIKI_CPU)/loader \
|
|
|
|
-I$(CONTIKI_CPU)/dbg-io \
|
|
|
|
-I$(CONTIKI)/platform/$(TARGET) \
|
|
|
|
-I$(CONTIKI_CPU)/lib/include \
|
|
|
|
-I$(CONTIKI_CPU)/src \
|
|
|
|
-I$(CONTIKI_CPU)/board \
|
|
|
|
${addprefix -I,$(APPDIRS)} \
|
|
|
|
-DWITH_ASCII -DMCK=$(MCK) \
|
|
|
|
-Werror $(ARCH_FLAGS) -g
|
|
|
|
|
|
|
|
CFLAGS += $(CFLAGSNO) -Os -DRUN_AS_SYSTEM -DROM_RUN -fno-strict-aliasing -fno-common -ffixed-r8 -msoft-float -DTEXT_BASE=$(TEXT_BASE) -fno-builtin-printf -fno-builtin-sprintf
|
2010-11-07 15:57:53 +01:00
|
|
|
LDFLAGS += -T $(LINKERSCRIPT) -nostartfiles -static -u_start -Wl,-Map=contiki-$(TARGET).map,-export-dynamic
|
2010-06-09 16:43:22 +02:00
|
|
|
AFLAGS := $(AFLAGS_DEBUG) -D__ASSEMBLY__ $(CPPFLAGS) -gstabs
|
|
|
|
|
|
|
|
CDEPFLAGS = $(CFLAGS) -D __MAKING_DEPS__
|
|
|
|
|
|
|
|
### Setup directory search path for source files
|
|
|
|
|
|
|
|
CUSTOM_RULE_C_TO_OBJECTDIR_O=yes
|
|
|
|
CUSTOM_RULE_C_TO_O=yes
|
|
|
|
|
|
|
|
CFLAGS += -I$(OBJECTDIR) -I$(CONTIKI_CPU)/board -DBOARD=$(TARGET)
|
|
|
|
|
|
|
|
$(OBJECTDIR)/board.h: $(OBJECTDIR)
|
2011-03-04 22:53:39 +01:00
|
|
|
ifneq (,$(findstring cygdrive,$(shell pwd)))
|
|
|
|
${info Cygwin detected.}
|
|
|
|
ln -f $(CONTIKI_CPU)/board/$(TARGET).h $(OBJECTDIR)/board.h
|
|
|
|
else
|
2010-06-09 16:43:22 +02:00
|
|
|
ln -sf ../$(CONTIKI_CPU)/board/$(TARGET).h $(OBJECTDIR)/board.h
|
2011-03-04 22:53:39 +01:00
|
|
|
endif
|
2010-06-09 16:43:22 +02:00
|
|
|
|
|
|
|
|
|
|
|
$(OBJECTDIR)/isr.o: $(CONTIKI_CPU)/src/isr.c
|
|
|
|
$(CC) $(CFLAGS) $(ARM_FLAGS) $< -c -o $@
|
|
|
|
|
|
|
|
%.o: %.c
|
|
|
|
$(CC) $(CFLAGS) $(THUMB_FLAGS) $< -c
|
|
|
|
|
|
|
|
$(OBJECTDIR)/%.o: %.c
|
|
|
|
$(CC) $(CFLAGS) $(THUMB_FLAGS) -c $< -o $@
|
|
|
|
|
|
|
|
CUSTOM_RULE_S_TO_OBJECTDIR_O = yes
|
|
|
|
%.o: %.S
|
|
|
|
$(CC) $(CFLAGS) $(AFLAGS) $(ARM_FLAGS) $< -c
|
|
|
|
|
|
|
|
$(OBJECTDIR)/%.o: %.S
|
|
|
|
$(CC) $(CFLAGS) $(AFLAGS) $(ARM_FLAGS) $< -c -o $@
|
|
|
|
|
|
|
|
CUSTOM_RULE_C_TO_CO=yes
|
|
|
|
|
|
|
|
%.co: %.c
|
|
|
|
$(CC) $(CFLAGS) -DAUTOSTART_ENABLE $(THUMB_FLAGS) $< -c -o $@
|
|
|
|
|
|
|
|
.PRECIOUS: %.bin %_$(TARGET).bin
|
|
|
|
|
|
|
|
%.ihex: %.$(TARGET)
|
|
|
|
$(OBJCOPY) $^ -O ihex $@
|
|
|
|
|
|
|
|
%_$(TARGET).bin: %.elf
|
|
|
|
$(OBJCOPY) -O binary $< $@
|
|
|
|
|
|
|
|
symbols.c:
|
|
|
|
@${CONTIKI}/tools/make-empty-symbols
|
|
|
|
|
|
|
|
%.$(TARGET): %_$(TARGET).bin
|
|
|
|
@
|
|
|
|
|
|
|
|
%.elf: $(OBJECTDIR)/board.h %.co $(PROJECT_OBJECTFILES) contiki-$(TARGET).a $(STARTUP) $(OBJECTDIR)/symbols.o
|
|
|
|
$(CC) $(LDFLAGS) $(CFLAGS) -nostartfiles -o $@ $(filter-out %.a,$^) $(filter %.a,$^) $(filter %.a,$^)
|
|
|
|
|
|
|
|
|