2015-11-12 16:29:41 +01: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 15:03:00 +02:00
### If no board is specified the default option is the RE-Mote revision B
2015-11-12 16:29:41 +01:00
i f e q ( $( BOARD ) , )
2016-09-01 15:03:00 +02: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 16:29:41 +01:00
e n d i f
PYTHON = python
BSL_FLAGS += -e -w -v
### 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
CONTIKI_TARGET_SOURCEFILES += leds.c leds-arch.c cc1200-zoul-arch.c
2016-01-17 23:04:34 +01:00
CONTIKI_TARGET_SOURCEFILES += adc-zoul.c button-sensor.c zoul-sensors.c
2015-11-12 16:29:41 +01: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
MODULES += core/net core/net/mac \
core/net/mac/contikimac \
2015-10-21 10:18:04 +02:00
core/net/llsec core/net/llsec/noncoresec dev/cc1200
2015-11-12 16:29:41 +01:00
BSL = $( CONTIKI) /tools/cc2538-bsl/cc2538-bsl.py
2016-09-01 15:03:00 +02:00
### Use the specific Zoul subplatform to query for connected devices
2015-11-12 16:29:41 +01: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 16:10:23 +02: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 16:29:41 +01:00
e l s e
### If we are not running under Mac, we assume Linux
USBDEVPREFIX =
2016-06-14 16:10:23 +02: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 16:29:41 +01:00
perl -ne 'print $$1 . " " if(m-(/dev/\w+)-);' )
e n d i f
2016-06-14 16:10:23 +02: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 16:29:41 +01:00
i f e q ( $( wildcard $ ( BSL ) ) , )
2016-06-14 16:10:23 +02:00
%.upload :
2015-11-12 16:29:41 +01:00
@echo "ERROR: Could not find the cc2538-bsl script. Did you run 'git submodule update --init' ?"
e l s e
2016-06-14 16:10:23 +02:00
### Upload to every MOTE
%.upload : $( foreach MOTE ,$ ( MOTES ) ,%.$ ( MOTE ) )
@# Dummy recipe to prevent "No rule to make *.upload errors"
2015-11-12 16:29:41 +01:00
e n d i f
2016-06-14 16:10:23 +02: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` ; \
$( PYTHON) $( BSL) $( BSL_FLAGS) -a $$ $$ { BSL_ADDRESS} -p $( MOTE) $$ <
e n d e f
### Create an upload rule for every MOTE connected
$( foreach MOTE ,$ ( MOTES ) ,$ ( eval $ ( UPLOAD_RULE ) ) )
2015-11-12 16:29:41 +01: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) )