2017-09-21 19:31:09 +00:00
|
|
|
|
2018-04-05 19:32:05 +00:00
|
|
|
ALARM_APP = 1
|
2018-05-24 20:21:16 +00:00
|
|
|
CALIBRATE_APP = 1
|
2018-03-29 22:55:20 +00:00
|
|
|
RPN_APP = 1
|
|
|
|
HEX_APP = 1
|
|
|
|
STOPWATCH_APP = 1
|
|
|
|
PHRASE_APP = 0
|
2018-08-03 16:48:32 +00:00
|
|
|
SHABBAT_APP = 0
|
2018-03-29 22:55:20 +00:00
|
|
|
RNG_APP = 1
|
|
|
|
TUNER_APP = 1
|
|
|
|
MORSE_APP = 1
|
|
|
|
BEACON_APP = 1
|
2018-04-05 15:00:34 +00:00
|
|
|
OOK_APP = 1
|
2018-04-20 20:33:26 +00:00
|
|
|
COUNTER_APP = 1
|
2018-03-29 22:55:20 +00:00
|
|
|
|
2018-01-31 04:34:27 +00:00
|
|
|
#set default flashing serial port, dont override if passed in as an argument
|
|
|
|
PORT = /dev/ttyUSB0
|
2018-07-29 19:40:05 +00:00
|
|
|
#Mandatory applets.
|
|
|
|
APPS_OBJ += apps/clock.o apps/settime.o apps/submenu.o
|
2018-03-29 22:55:20 +00:00
|
|
|
|
|
|
|
#add optional apps
|
|
|
|
ifeq ($(ALARM_APP),1)
|
|
|
|
APPS_OBJ += apps/alarm.o
|
|
|
|
APPS_DEFINES += ALARM_APP
|
|
|
|
endif
|
2018-08-03 16:48:32 +00:00
|
|
|
ifeq ($(SHABBAT_APP),1)
|
|
|
|
APPS_OBJ += apps/shabbat.o
|
|
|
|
APPS_DEFINES += SHABBAT_APP
|
|
|
|
endif
|
2018-03-29 22:55:20 +00:00
|
|
|
ifeq ($(RPN_APP),1)
|
|
|
|
APPS_OBJ += apps/rpn.o
|
|
|
|
APPS_DEFINES += RPN_APP
|
|
|
|
endif
|
|
|
|
ifeq ($(HEX_APP),1)
|
|
|
|
APPS_OBJ += apps/hex.o
|
|
|
|
APPS_DEFINES += HEX_APP
|
|
|
|
endif
|
2018-05-24 20:21:16 +00:00
|
|
|
ifeq ($(CALIBRATE_APP),1)
|
|
|
|
APPS_OBJ += apps/calibrate.o
|
|
|
|
APPS_DEFINES += CALIBRATE_APP
|
|
|
|
endif
|
2018-03-29 22:55:20 +00:00
|
|
|
ifeq ($(STOPWATCH_APP),1)
|
|
|
|
APPS_OBJ += apps/stopwatch.o
|
2018-04-05 19:32:05 +00:00
|
|
|
APPS_DEFINES += STOPWATCH_APP
|
2018-03-29 22:55:20 +00:00
|
|
|
endif
|
|
|
|
ifeq ($(PHRASE_APP),1)
|
|
|
|
APPS_OBJ += apps/phrase.o
|
|
|
|
APPS_DEFINES += PHRASE_APP
|
|
|
|
endif
|
|
|
|
ifeq ($(RNG_APP),1)
|
|
|
|
APPS_OBJ += apps/rngapp.o
|
|
|
|
APPS_DEFINES += RNG_APP
|
|
|
|
endif
|
|
|
|
ifeq ($(TUNER_APP),1)
|
|
|
|
APPS_OBJ += apps/tuner.o
|
|
|
|
APPS_DEFINES += TUNER_APP
|
|
|
|
endif
|
|
|
|
ifeq ($(MORSE_APP),1)
|
|
|
|
APPS_OBJ += apps/morse.o
|
|
|
|
APPS_DEFINES += MORSE_APP
|
|
|
|
endif
|
|
|
|
ifeq ($(BEACON_APP),1)
|
|
|
|
APPS_OBJ += apps/beacon.o
|
|
|
|
APPS_DEFINES += BEACON_APP
|
|
|
|
endif
|
2018-04-05 15:00:34 +00:00
|
|
|
ifeq ($(OOK_APP),1)
|
|
|
|
APPS_OBJ += apps/ook.o
|
|
|
|
APPS_DEFINES += OOK_APP
|
|
|
|
endif
|
2018-04-20 20:33:26 +00:00
|
|
|
ifeq ($(COUNTER_APP),1)
|
|
|
|
APPS_OBJ += apps/counter.o
|
|
|
|
APPS_DEFINES += COUNTER_APP
|
|
|
|
endif
|
2018-03-29 22:55:20 +00:00
|
|
|
|
2018-01-31 04:34:27 +00:00
|
|
|
|
2017-09-23 15:20:55 +00:00
|
|
|
#Standard Debian gcc-msp430 and msp430mcu packages.
|
2018-04-05 14:31:54 +00:00
|
|
|
CC = msp430-gcc -mmcu=cc430f6137 -Wall -I. -Os $(addprefix -D, $(APPS_DEFINES))
|
2017-09-21 19:31:09 +00:00
|
|
|
|
2018-01-31 04:34:27 +00:00
|
|
|
BSL = ../bin/cc430-bsl.py -r 38400 -p $(PORT)
|
2017-09-23 16:36:20 +00:00
|
|
|
|
2018-07-23 23:07:59 +00:00
|
|
|
modules=rtcasm.o main.o lcd.o lcdtext.o rtc.o keypad.o bcd.o apps.o applist.o adc.o ref.o \
|
2018-02-08 01:38:41 +00:00
|
|
|
sidebutton.o power.o uart.o monitor.o ucs.o buzz.o \
|
2018-04-21 18:04:00 +00:00
|
|
|
radio.o packet.o dmesg.o codeplug.o rng.o descriptor.o \
|
2018-05-19 22:09:14 +00:00
|
|
|
optim.o libs/assembler.o libs/morse.o
|
2017-12-08 23:40:33 +00:00
|
|
|
|
2018-03-29 22:55:20 +00:00
|
|
|
apps= $(APPS_OBJ)
|
2017-09-23 15:20:55 +00:00
|
|
|
|
2017-09-23 16:21:58 +00:00
|
|
|
all: goodwatch.hex
|
2017-09-23 15:20:55 +00:00
|
|
|
|
2018-05-17 14:36:35 +00:00
|
|
|
*.c: githash.h
|
2017-10-02 23:22:29 +00:00
|
|
|
|
2018-05-17 14:36:35 +00:00
|
|
|
githash.h:
|
|
|
|
echo "#define GITHASH" 0x`git rev-parse HEAD | head -c7` > githash.h
|
2018-08-29 14:25:26 +00:00
|
|
|
goodwatch.elf: $(modules) $(apps) *.h
|
|
|
|
$(CC) -T msp430.x -o goodwatch.elf $(modules) $(apps)
|
|
|
|
../bin/printsizes.py goodwatch.elf || echo "Please install python-pyelftools."
|
2017-10-06 22:11:50 +00:00
|
|
|
|
2018-08-29 14:25:26 +00:00
|
|
|
goodwatch.hex: goodwatch.elf
|
|
|
|
msp430-objcopy -O ihex goodwatch.elf goodwatch.hex
|
2017-09-21 19:31:09 +00:00
|
|
|
|
|
|
|
clean:
|
2018-08-29 14:25:26 +00:00
|
|
|
rm -rf *~ */*~ *.hex *.elf *.o */*.o goodwatch githash.h html latex goodwatch.elf energytrace.png energytrace.txt
|
2017-09-21 19:31:09 +00:00
|
|
|
erase:
|
2017-09-23 16:36:20 +00:00
|
|
|
$(BSL) -e
|
2018-08-29 14:25:26 +00:00
|
|
|
sbwflash: goodwatch.hex
|
|
|
|
mspdebug tilib "prog goodwatch.elf"
|
2017-09-24 15:48:52 +00:00
|
|
|
flash: goodwatch.hex
|
2017-09-24 22:52:30 +00:00
|
|
|
$(BSL) -etf goodwatch.hex
|
2017-11-18 19:56:46 +00:00
|
|
|
dmesg:
|
2017-12-04 19:14:09 +00:00
|
|
|
$(BSL) -P goodwatch.hex -uD
|
2018-09-05 16:35:51 +00:00
|
|
|
sbwdmesg:
|
|
|
|
mspdebug tilib "save_raw 0x2400 2048 dmesg.bin"
|
|
|
|
strings dmesg.bin
|
2017-09-23 16:36:20 +00:00
|
|
|
|
2017-11-19 04:05:18 +00:00
|
|
|
#Same as dmesg, but it gives the target some time to boot first.
|
|
|
|
run:
|
|
|
|
sleep 5
|
2018-01-31 04:34:27 +00:00
|
|
|
../bin/cc430-bsl.py -p $(PORT) -P goodwatch.hex -uD
|
2017-11-30 20:48:22 +00:00
|
|
|
|
|
|
|
codeplug.hex: codeplug.txt
|
|
|
|
../bin/goodwatch-txt2cp.py -i codeplug.txt -o codeplug.hex
|
2017-11-30 22:50:42 +00:00
|
|
|
flashcp: codeplug.hex
|
2017-12-03 03:49:33 +00:00
|
|
|
$(BSL) -Ef codeplug.hex
|
2018-09-03 23:06:33 +00:00
|
|
|
sbwflashcp: codeplug.hex
|
|
|
|
mspdebug tilib "load codeplug.hex"
|
|
|
|
|
2017-11-30 22:50:42 +00:00
|
|
|
dump:
|
|
|
|
$(BSL) -ed
|
|
|
|
|
|
|
|
|
2018-08-29 14:25:26 +00:00
|
|
|
|
|
|
|
energytrace.txt: goodwatch.hex sbwflash
|
2018-08-30 17:54:40 +00:00
|
|
|
energytrace 60 > energytrace.txt #This will take a minute.
|
2018-08-29 14:25:26 +00:00
|
|
|
gnuplot energytrace.gnuplot
|
2018-08-29 16:12:09 +00:00
|
|
|
gnuplot energytrace-txt.gnuplot
|
|
|
|
../bin/batterylife.py <energytrace.txt
|
|
|
|
|