summaryrefslogtreecommitdiff
path: root/src/lpc/Makefile-flash.defs
blob: 6bdd204c3949113af7f2eece2c90aeb495a1acfa (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
vpath % $(TOPDIR)/lpc:$(TOPDIR)/product:$(TOPDIR)/drivers:$(TOPDIR)/core:$(TOPDIR)/util:$(TOPDIR)
vpath ao-make-product.5c $(TOPDIR)/util

.SUFFIXES: .elf .ihx

.elf.ihx:
	objcopy -O ihex $*.elf $@

CC=arm-none-eabi-gcc
SAT=/opt/cortex
SAT_CLIB=$(SAT)/lib/pdclib-cortex-m0.a
SAT_CFLAGS=-I$(SAT)/include

ifndef VERSION
include $(TOPDIR)/Version
endif

AO_CFLAGS=-I. -I$(TOPDIR)/lpc -I$(TOPDIR)/core -I$(TOPDIR)/drivers -I$(TOPDIR)/product -I$(TOPDIR)
STM_CFLAGS=-std=gnu99 -mlittle-endian -mcpu=cortex-m0 -mthumb -ffreestanding -nostdlib $(AO_CFLAGS) $(SAT_CFLAGS)

LDFLAGS=-L$(TOPDIR)/lpc -Wl,-Taltos-loader.ld

NICKLE=nickle

V=0
# The user has explicitly enabled quiet compilation.
ifeq ($(V),0)
quiet = @printf "  $1 $2 $@\n"; $($1)
endif
# Otherwise, print the full command line.
quiet ?= $($1)

.c.o:
	$(call quiet,CC) -c $(CFLAGS) -o $@ $<

INC = \
	ao.h \
	ao_arch.h \
	ao_arch_funcs.h \
	ao_flash_pins.h \
	ao_flash_lpc_pins.h \
	ao_flash_task.h \
	ao_pins.h \
	ao_product.h \
	Makefile

#
# Common AltOS sources
#
SRC = \
	ao_interrupt.c \
	ao_romconfig.c \
	ao_boot_chain.c \
	ao_boot_pin.c \
	ao_product.c \
	ao_notask.c \
	ao_timer_lpc.c \
	ao_usb_lpc.c \
	ao_flash_lpc.c \
	ao_flash_task.c \
	ao_flash_loader_lpc.c

OBJ=$(SRC:.c=.o)

PRODUCT=AltosFlash-$(VERSION)
PRODUCT_DEF=-DALTOS_FLASH
IDPRODUCT=0x000a

CFLAGS = $(PRODUCT_DEF) $(STM_CFLAGS) -g -Os

PROGNAME=altos-flash
PROG=$(HARDWARE)-$(PROGNAME)-$(VERSION).elf

$(PROG): Makefile $(OBJ) altos-loader.ld
	$(call quiet,CC) $(LDFLAGS) $(CFLAGS) -o $(PROG) $(OBJ) $(SAT_CLIB) -lgcc

ao_product.h: ao-make-product.5c $(TOPDIR)/Version
	$(call quiet,NICKLE,$<) $< -m altusmetrum.org -i $(IDPRODUCT) -p $(PRODUCT) -v $(VERSION) > $@

$(OBJ): $(INC)

all: $(PROG)

distclean:	clean

clean:
	rm -f *.o $(PROG)
	rm -f ao_product.h

install:

uninstall: