2009-09-08 20:07:35 +00:00
|
|
|
### Compiler definitions
|
|
|
|
CC = sdcc
|
|
|
|
LD = sdcc
|
|
|
|
AS = sdcc
|
2013-08-06 16:09:32 +00:00
|
|
|
AR = sdar
|
2009-09-08 20:07:35 +00:00
|
|
|
OBJCOPY = objcopy
|
|
|
|
STRIP = strip
|
2012-03-05 16:28:06 +00:00
|
|
|
PACKIHX = packihx
|
|
|
|
BANK_ALLOC = $(CONTIKI)/cpu/cc2430/bank-alloc.py
|
|
|
|
SEGMENT_RULES = $(OBJECTDIR)/segment.rules
|
|
|
|
|
|
|
|
CFLAGS += --model-$(MEMORY_MODEL) --stack-auto -DSDCC_CC2430 --std-c99
|
2012-09-07 13:30:33 +00:00
|
|
|
CFLAGS += --fomit-frame-pointer
|
2012-03-05 16:28:06 +00:00
|
|
|
|
2013-08-09 14:36:30 +00:00
|
|
|
### Disable warning 110 (EVELYN the modified dog) and 126 (unreachable code)
|
|
|
|
CFLAGS += --disable-warning 110 --disable-warning 126
|
|
|
|
|
2012-03-05 16:28:06 +00:00
|
|
|
LDFLAGS += --model-$(MEMORY_MODEL) --stack-auto -DSDCC_CC2430 --out-fmt-ihx
|
|
|
|
LDFLAGS += --xram-loc 0xE000 --xram-size 0x1F00
|
|
|
|
LDFLAGS += --code-loc $(START_ADDR) --code-size $(CODE_SIZE)
|
2009-09-08 20:07:35 +00:00
|
|
|
|
|
|
|
ASFLAGS += -plosgff
|
2012-03-05 16:28:06 +00:00
|
|
|
|
2013-08-06 16:09:32 +00:00
|
|
|
AROPTS = -rc
|
2010-01-21 15:33:19 +00:00
|
|
|
|
2012-03-05 16:28:06 +00:00
|
|
|
### Our object files are .rel, so we can't use the default finalize dependency
|
|
|
|
### generation. Override here.
|
|
|
|
define FINALIZE_SDCC_DEPENDENCY
|
|
|
|
cp $(@:.rel=.d) $(@:.rel=.$$$$); \
|
|
|
|
sed -e 's/#.*//' -e 's/^[^:]*: *//' -e 's/ *\\$$//' \
|
|
|
|
-e '/^$$/ d' -e 's/$$/ :/' < $(@:.rel=.$$$$) >> $(@:.rel=.d); \
|
|
|
|
rm -f $(@:.rel=.$$$$)
|
|
|
|
endef
|
|
|
|
|
|
|
|
### Banking Guesswork:
|
|
|
|
### Examples outside examples/sensinode do not specify banking.
|
|
|
|
### We automatically turn it on if its unspecified and if we are building with
|
2014-11-12 09:18:29 +00:00
|
|
|
### CONTIKI_WITH_IPV6
|
2012-03-05 16:28:06 +00:00
|
|
|
ifndef HAVE_BANKING
|
2014-11-12 09:18:29 +00:00
|
|
|
ifeq ($(CONTIKI_WITH_IPV6),1)
|
2012-03-05 16:28:06 +00:00
|
|
|
HAVE_BANKING=1
|
|
|
|
else
|
|
|
|
HAVE_BANKING=0
|
|
|
|
endif
|
|
|
|
endif
|
|
|
|
|
|
|
|
### Does the project want us to offset the firmware?
|
|
|
|
### define start address and max code size accordingly, turn Disco on
|
|
|
|
ifeq ($(OFFSET_FIRMWARE),1)
|
|
|
|
START_ADDR = 0x01000
|
|
|
|
HOME_START = 00001000
|
|
|
|
ifeq ($(HAVE_BANKING),1)
|
|
|
|
CODE_SIZE = 0x1F000
|
|
|
|
else
|
|
|
|
CODE_SIZE = 0x0F000
|
|
|
|
endif
|
2010-01-21 15:33:19 +00:00
|
|
|
else
|
2012-03-05 16:28:06 +00:00
|
|
|
START_ADDR = 0x00000
|
|
|
|
HOME_START = 00000000
|
|
|
|
ifeq ($(HAVE_BANKING),1)
|
|
|
|
CODE_SIZE = 0x20000
|
|
|
|
else
|
|
|
|
CODE_SIZE = 0x10000
|
|
|
|
endif
|
|
|
|
endif
|
|
|
|
|
|
|
|
### Are we building with BANKing supoprt?
|
|
|
|
ifeq ($(HAVE_BANKING),1)
|
|
|
|
## Yes
|
|
|
|
MEMORY_MODEL=huge
|
|
|
|
LDFLAGS += -Wl-bBANK1=0x018000
|
|
|
|
LD_POST_FLAGS += -Wl-bBANK2=0x028000
|
|
|
|
LD_POST_FLAGS += -Wl-bBANK3=0x038000
|
|
|
|
LDFLAGS += -Wl-r
|
|
|
|
CFLAGS += -DHAVE_SDCC_BANKING
|
|
|
|
#use this in $(call c_seg,$<) to get segment for a source file.
|
|
|
|
c_seg = --codeseg $(shell python $(BANK_ALLOC) $1 $(SEGMENT_RULES) $2)
|
|
|
|
else
|
|
|
|
## No banking
|
|
|
|
MEMORY_MODEL=large
|
|
|
|
c_seg =
|
2010-01-21 15:33:19 +00:00
|
|
|
endif
|
2009-09-08 20:07:35 +00:00
|
|
|
|
|
|
|
### CPU-dependent cleanup files
|
2012-04-30 09:05:14 +00:00
|
|
|
CLEAN += *.lnk *.lk *.sym *.lib *.ihx *.rel *.mem *.rst *.asm *.hex
|
2012-03-05 16:28:06 +00:00
|
|
|
CLEAN += *.omf *.cdb *.banks
|
|
|
|
CLEAN += symbols.c symbols.h
|
2009-09-08 20:07:35 +00:00
|
|
|
|
|
|
|
### CPU-dependent directories
|
|
|
|
CONTIKI_CPU_DIRS = . dev
|
|
|
|
|
|
|
|
### CPU-dependent source files
|
2012-03-05 16:28:06 +00:00
|
|
|
CONTIKI_SOURCEFILES += bus.c clock.c uart0.c uart1.c cc2430_rf.c dma.c
|
|
|
|
CONTIKI_SOURCEFILES += uart_intr.c cc2430_rf_intr.c dma_intr.c
|
2012-09-07 14:23:08 +00:00
|
|
|
CONTIKI_SOURCEFILES += watchdog-cc2430.c rtimer-arch.c stack.c
|
2009-09-08 20:07:35 +00:00
|
|
|
CONTIKI_ASMFILES +=
|
|
|
|
|
2012-03-05 16:28:06 +00:00
|
|
|
CONTIKI_ASMOBJECTFILES = $(addprefix $(OBJECTDIR)/,$(CONTIKI_ASMFILES:.S=.rel))
|
2009-09-08 20:07:35 +00:00
|
|
|
|
2012-03-05 16:28:06 +00:00
|
|
|
CONTIKI_CASMOBJECTFILES = $(addprefix $(OBJECTDIR)/, \
|
|
|
|
$(CONTIKI_CASMFILES:.cS=.rel))
|
2009-09-08 20:07:35 +00:00
|
|
|
|
|
|
|
CONTIKI_PLATFORM_DIRS = $(PLATFORM_APPDIRS) \
|
2012-03-05 16:28:06 +00:00
|
|
|
$(addprefix $(CONTIKI)/platform/$(TARGET)/, $(CONTIKI_TARGET_DIRS))
|
2009-09-08 20:07:35 +00:00
|
|
|
|
2012-03-05 16:28:06 +00:00
|
|
|
CONTIKI_CPU_DIRS_LIST = $(addprefix $(CONTIKI_CPU)/, \
|
|
|
|
$(CONTIKI_CPU_DIRS))
|
2010-01-21 15:33:19 +00:00
|
|
|
|
2012-03-05 16:28:06 +00:00
|
|
|
oname = $(patsubst %.c,%.rel,$(patsubst %.S,%.rel,$(1)))
|
2009-09-08 20:07:35 +00:00
|
|
|
|
2012-03-05 16:28:06 +00:00
|
|
|
CONTIKI_OBJECTFILES = $(addprefix $(OBJECTDIR)/, \
|
|
|
|
$(call oname, $(CONTIKI_SOURCEFILES)))
|
2010-01-21 15:33:19 +00:00
|
|
|
|
2012-03-05 16:28:06 +00:00
|
|
|
PROJECT_OBJECTFILES = $(addprefix $(OBJECTDIR)/, \
|
|
|
|
$(call oname, $(PROJECT_SOURCEFILES)))
|
2010-01-21 15:33:19 +00:00
|
|
|
|