aboutsummaryrefslogtreecommitdiff
path: root/projects/hsm/Makefile
blob: 7fd3ad61c36f04f17c899e375eb0099958f7c0b8 (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
PROJ = hsm

# objs in addition to $(PROJ).o
OBJS =	mgmt-cli.o \
	mgmt-firmware.o \
	mgmt-bootloader.o \
	mgmt-fpga.o \
	mgmt-keystore.o \
	mgmt-masterkey.o \
	mgmt-misc.o \
	mgmt-task.o \
	log.o \
	$(TOPLEVEL)/task.o

CFLAGS += -DNUM_RPC_TASK=8

CFLAGS += -I$(LIBHAL_SRC)
CFLAGS += -I$(LIBCLI_SRC)
CFLAGS += -I$(LIBTFM_BLD)
CFLAGS += -Wno-missing-field-initializers

LIBS += $(LIBHAL_BLD)/libhal.a $(LIBTFM_BLD)/libtfm.a
LIBS += $(LIBCLI_BLD)/libcli.a

LDFLAGS += -mcpu=cortex-m4 -mthumb -mlittle-endian -mthumb-interwork
LDFLAGS += -mfloat-abi=hard -mfpu=fpv4-sp-d16
LDFLAGS += -Wl,--gc-sections

ifdef DO_PROFILING
LDFLAGS += --specs=rdimon.specs -lc -lrdimon
endif

ifdef DO_TASK_METRICS
CFLAGS += -DDO_TASK_METRICS
endif

ifdef DO_TIMING
CFLAGS += -DDO_TIMING
CFLAGS += -I../cli-test
CFLAGS += -DCLI_STACK_SIZE=65536
OBJS += ../cli-test/mgmt-timing.o $(TOPLEVEL)/stm-dwt.o
LDFLAGS += -lm
endif

all: $(PROJ:=.elf)

%.elf: %.o $(BOARD_OBJS) $(OBJS) $(LIBS)
	$(CC) $^ -o $@ -T$(LDSCRIPT) -g -Wl,-Map=$*.map $(LDFLAGS)
	$(OBJCOPY) -O binary $*.elf $*.bin
	$(SIZE) $*.elf

clean:
	rm -f *.o
	rm -f *.elf
	rm -f *.bin
	rm -f *.map