aboutsummaryrefslogtreecommitdiffstats
path: root/firmware/fx3/b200/bootloader/makefile
blob: e8b7d5916cda05e72167e248cae4610ad57b1b06 (plain)
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
# 
# Copyright 2019 Ettus Research, a National Instruments Brand
# 
# SPDX-License-Identifier: GPL-3.0-or-later
# 

IMGOUT = usrp_b200_bl.img

all:$(IMGOUT)

ELF2IMG_SRC=$(FX3FWROOT)/util/elf2img/elf2img.c
ELF2IMG=elf2img

CYFXBUILD = gcc

include $(FX3FWROOT)/fw_build/boot_fw/fx3_build_config.mak

MODULE = cyfx_boot_app

ifeq ($(CYFXBUILD), arm)
	APP_ASM_SOURCE = 
else
	APP_ASM_SOURCE = cyfx_gcc_startup.S
endif

APP_SOURCE = main.c usb_boot.c usb_descriptors.c ../common/common_descriptors.c ../common/common_helpers.c

INCFLAGS = -I../common

APP_OBJECT=$(APP_SOURCE:%.c=./%.o)

APP_ASM_OBJECT=$(APP_ASM_SOURCE:%.S=./%.o)

EXES = $(MODULE).$(EXEEXT)

$(APP_ASM_OBJECT) : %.o : %.S 
	$(ASSEMBLE)


$(APP_OBJECT) : %.o : %.c
	$(COMPILE) $(INCFLAGS)

$(MODULE).$(EXEEXT): $(APP_OBJECT) $(APP_ASM_OBJECT) 
	$(LINK)

$(ELF2IMG):
	gcc -o $(ELF2IMG) $(ELF2IMG_SRC)

cyfx_gcc_startup.S:
	cp $(FX3FWROOT)/firmware/boot_fw/src/cyfx_gcc_startup.S .


clean:
	rm -f ./$(MODULE).$(EXEEXT)
	rm -f ./$(MODULE).map
	rm -f ./$(IMGOUT)
	rm -f ./cyfx_gcc_startup.S
	rm -f ./*.o
	rm -f ../common/*.o
	rm -f ./$(ELF2IMG)
ifeq ($(CYFXBUILD), gcc)
	rm -f ./gcceclipse_files/*.o
endif

compile: $(APP_OBJECT) $(APP_ASM_OBJECT) $(EXES)

$(IMGOUT): compile $(EXES) $(ELF2IMG)
	./$(ELF2IMG) -i $(EXES) -o $(IMGOUT) -i2cconf 0x1A

#[]#