2015-11-12 15:29:41 +00:00
### Zoul Makefile
i f n d e f C O N T I K I
$( error CONTIKI not defined! You must specify where CONTIKI resides!)
e n d i f
2016-09-01 13:03:00 +00:00
### If no board is specified the default option is the RE-Mote revision B
2015-11-12 15:29:41 +00:00
i f e q ( $( BOARD ) , )
2016-09-01 13:03:00 +00:00
BOARD = remote-revb
e n d i f
### As previously the RE-Mote revision A was plainly defined as remote, keep for
### backward compatibility
i f e q ( $( BOARD ) , r e m o t e )
override BOARD = remote-reva
2015-11-12 15:29:41 +00:00
e n d i f
PYTHON = python
BSL_FLAGS += -e -w -v
2016-12-20 17:18:28 +00:00
BSL_SPEED ?= 460800
2016-11-17 17:14:33 +00:00
# Works in Linux and probably on OSX too (RTCC example)
CFLAGS += -DDATE= "\"`date +" %02u %02d %02m %02y %02H %02M %02S"`\""
2015-11-12 15:29:41 +00:00
### Configure the build for the board and pull in board-specific sources
CONTIKI_TARGET_DIRS += . dev
CONTIKI_TARGET_DIRS += . $( BOARD)
PLATFORM_ROOT_DIR = $( CONTIKI) /platform/$( TARGET)
### Include the board dir if one exists
- i n c l u d e $( PLATFORM_ROOT_DIR ) / $( BOARD ) / M a k e f i l e . $( BOARD )
### Include
CONTIKI_TARGET_SOURCEFILES += contiki-main.c
2016-09-02 12:58:17 +00:00
CONTIKI_TARGET_SOURCEFILES += leds.c cc1200-zoul-arch.c
2016-01-17 22:04:34 +00:00
CONTIKI_TARGET_SOURCEFILES += adc-zoul.c button-sensor.c zoul-sensors.c
2015-11-12 15:29:41 +00:00
CONTIKI_TARGET_SOURCEFILES += $( BOARD_SOURCEFILES)
CONTIKI_SOURCEFILES += $( CONTIKI_TARGET_SOURCEFILES)
CLEAN += *.zoul
### Unless the example dictates otherwise, build with code size optimisations
i f n d e f S M A L L
SMALL = 1
e n d i f
### Define the CPU directory
CONTIKI_CPU = $( CONTIKI) /cpu/cc2538
i n c l u d e $( CONTIKI_CPU ) / M a k e f i l e . c c 2 5 3 8
2016-12-19 18:39:14 +00:00
MODULES += core/net core/net/mac core/net/ip \
2015-11-12 15:29:41 +00:00
core/net/mac/contikimac \
2015-10-21 08:18:04 +00:00
core/net/llsec core/net/llsec/noncoresec dev/cc1200
2015-11-12 15:29:41 +00:00
2016-12-19 18:39:14 +00:00
i f e q ( $( WITH_IP 64) , 1 )
MODULES += core/net/ip64
e n d i f
2015-11-12 15:29:41 +00:00
BSL = $( CONTIKI) /tools/cc2538-bsl/cc2538-bsl.py
2016-09-01 13:03:00 +00:00
### Use the specific Zoul subplatform to query for connected devices
2015-11-12 15:29:41 +00:00
i f d e f M O T E L I S T _ Z O L E R T I A
MOTELIST_FLAGS += -b $( MOTELIST_ZOLERTIA)
e n d i f
### Detect if a mote is connected over serial port
i f e q ( $( HOST_OS ) , D a r w i n )
USBDEVPREFIX =
2016-06-14 14:10:23 +00:00
MOTELIST := $( CONTIKI) /tools/zolertia/motelist-zolertia-macos
MOTES := $( shell $( MOTELIST) -c 2>& - | cut -f 2 -d ,)
SERIALDUMP := $( CONTIKI) /tools/sky/serialdump-macos
2015-11-12 15:29:41 +00:00
e l s e
### If we are not running under Mac, we assume Linux
USBDEVPREFIX =
2016-06-14 14:10:23 +00:00
SERIALDUMP := $( CONTIKI) /tools/sky/serialdump-linux
MOTELIST := $( CONTIKI) /tools/zolertia/motelist-zolertia
MOTES := $( shell $( MOTELIST) -b $( MOTELIST_ZOLERTIA) -c 2>& - | cut -f 2 -d , | \
2015-11-12 15:29:41 +00:00
perl -ne 'print $$1 . " " if(m-(/dev/\w+)-);' )
e n d i f
2016-06-14 14:10:23 +00:00
### If PORT is defined, override to keep backward compatibility
i f d e f P O R T
MOTES := $( PORT)
e n d i f
### Check the BSL script exists
2015-11-12 15:29:41 +00:00
i f e q ( $( wildcard $ ( BSL ) ) , )
2016-06-14 14:10:23 +00:00
%.upload :
2015-11-12 15:29:41 +00:00
@echo "ERROR: Could not find the cc2538-bsl script. Did you run 'git submodule update --init' ?"
e l s e
2016-06-14 14:10:23 +00:00
### Upload to every MOTE
%.upload : $( foreach MOTE ,$ ( MOTES ) ,%.$ ( MOTE ) )
@# Dummy recipe to prevent "No rule to make *.upload errors"
2015-11-12 15:29:41 +00:00
e n d i f
2016-06-14 14:10:23 +00:00
### Variable that expands into a pattern rule to upload to a given MOTE.
### Requires $(MOTE) to be defined
### $$$$ Double escapes $s that need to be passed to the shell - once for when make parses UPLOAD_RULE, and once for when the expanded rule is parsed by make.
d e f i n e U P L O A D _ R U L E
%.$(MOTE) : %.bin %.elf
@echo " Flashing $( MOTE) "
@BSL_ADDRESS= ` $( OBJDUMP) -h $$ *.elf | grep -B1 LOAD | \
grep -Ev 'LOAD|\-\-' | awk '{print "0x" $$$$5}' | \
sort -g | head -1` ; \
2016-12-20 17:18:28 +00:00
$( PYTHON) $( BSL) $( BSL_FLAGS) -b $( BSL_SPEED) -a $$ $$ { BSL_ADDRESS} -p $( MOTE) $$ <
2016-06-14 14:10:23 +00:00
e n d e f
### Create an upload rule for every MOTE connected
$( foreach MOTE ,$ ( MOTES ) ,$ ( eval $ ( UPLOAD_RULE ) ) )
2015-11-12 15:29:41 +00:00
motelist :
$( MOTELIST)
zoul-motelist :
$( MOTELIST) $( MOTELIST_FLAGS)
zoul-motes :
@echo $( MOTES)
serialview :
$( SERIALDUMP) -b115200 $( USBDEVPREFIX) $( firstword $( MOTES) ) | $( CONTIKI) /tools/timestamp
login :
$( SERIALDUMP) -b115200 $( USBDEVPREFIX) $( firstword $( MOTES) )