Source

watches / Makefile.rules

# Allerta Inc Pulse Build System
# Copyright 2011

SHELL		= /bin/sh

# Original one; won't accept programs
#MAC		= 00:50:c2:79:ee:55

# Silver, solid black
#MAC		= 00:50:c2:79:ef:08

# Black, clear back
MAC		= 00:50:c2:79:ed:e5

# Silver, clear back
#MAC		= 00:50:c2:79:ef:14  ### 5791

# Having trouble flashing?
#MAC = 00:50:c2:79:ee:fb  ### 5766, silver clear back

PULSE_DIR	= ../..
LIBDIR		= $(PULSE_DIR)/lib
OBJDIR		= $(PULSE_DIR)/lib/obj
TOOLSDIR	= $(PULSE_DIR)/tools
INCDIR		= ./include

PULSE_INCDIR	= $(PULSE_DIR)/include
PULSE_LIBS	= $(wildcard $(LIBDIR)/*.a)
PULSE_OBJS	= $(wildcard $(OBJDIR)/*.o)

CC		= $(HOME)/sat/bin/arm-none-eabi-gcc
OBJCOPY		= $(HOME)/sat/bin/arm-none-eabi-objcopy
CS		= $(TOOLSDIR)/fw_checksummer/checksummer.py
PYTHON		= python


OBJCOPY_FLAGS = -O ihex

CFLAGS += \
	-I$(INCDIR) \
	-I$(PULSE_INCDIR) \
	-std=gnu99 \
	-g \
	-Os \
	-Wall \
	-Wno-format \
	-fno-builtin \
	-mcpu=arm7tdmi-s \
	-march=armv4t \
	-mthumb \
	-mthumb-interwork \
	-ffunction-sections \
	-fdata-sections \
	-DNDEBUG \
	-Wno-unused-parameter \

all: pulse_app.bin
install: pulse_app.bin


RESOURCES := resources/inpulse_resources.bin
include/app_resources.h: resources/fonts.txt
	$(PYTHON) $(TOOLSDIR)/resource_packer/resource_packer.py
	echo > include/spi_resources.h \
		"#define SPIFLASH_OFFSET `stat -f "%z" $(RESOURCES)`" 


pulse_app: $(SRCS) include/app_resources.h $(RESOURCES)
	$(CC) \
		-o $@ \
		$(SRCS) \
		$(CFLAGS) \
		-T$(OBJDIR)/firmware.ld \
		-Wl,--cref \
		-Wl,--gc-sections \
		-Wl,-Map=pulse_app.map \
		-Wl,-\( \
			$(PULSE_LIBS) \
			$(PULSE_OBJS) \
			-lgcc \
		-Wl,-\) \

%.hex: %
	$(OBJCOPY) $(OBJCOPY_FLAGS) $< $@

%.bin: %.hex
	$(PYTHON) $(CS) $< $@

.PHONY: clean

clean:
	$(RM) \
		*.o \
		*.bin \
		*.hex \
		pulse_app* \
		include/app_resources.h \
		include/spi_resources.h \
		resources/inpulse_resources.bin \

server:
	cd $(PULSE_DIR); \
	java -d32 -jar ./tools/L2CAPServer/L2CAPServer.jar

install: pulse_app.bin
	touch TEMP.zip
	$(PYTHON) $(PULSE_DIR)/compileandload.py \
		-d $(MAC) \
		-l $< \

install-resources: $(RESOURCES)
	$(PYTHON) $(PULSE_DIR)/compileandload.py \
		-d $(MAC) \
		-r \
		-f $< \
	
	
install-both: resources/inpulse_resources.bin pulse_app.bin
	$(PYTHON) $(PULSE_DIR)/compileandload.py \
		-d $(MAC) \
		-r \
		-l pulse_app.bin \
		-f resources/inpulse_resources.bin \

settime:
	$(PYTHON) ../../tools/send_test_msg.py $(MAC)


FORCE: