summaryrefslogtreecommitdiff
path: root/fw/fe310/phone/Makefile
blob: 9cdac9e86a6742ed435aba4c26eaf010dac8a2c6 (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
include ../common.mk
DEPS = main.o mem.o wifi.o cell.o phone.o modem.o timer.o test.o flash.o

lib_eos = eve eos eos-soc eos-dev eos-net eos-ext eos-bsp
lib_ecp =

CFLAGS += -I$(bsp_dir)/include -I$(bsp_dir)/drivers -I$(ext_dir)/crypto -I$(ext_dir)/fsfat -I$(ecp_dir)/src -I$(ecp_dir)/src/platform/fe310 -I..
LDFLAGS = app/*.o $(CFLAGS) -L.. -L$(ecp_dir)/build-fe310 -Wl,--gc-sections -nostartfiles -nostdlib -Wl,--start-group -lc -lm -lgcc $(addprefix -l,$(lib_eos)) $(addprefix -l,$(lib_ecp)) -Wl,--end-group -T../bsp/default.lds
TARGET = phone


all: $(TARGET)

app_:
	(cd app && $(MAKE)) || exit;

%.o: %.c
	$(CC) $(CFLAGS) -c $<

$(TARGET): app_ $(DEPS)
	$(CC) $(DEPS) $(LDFLAGS) -o $@

upload: $(TARGET)
	$(OBJCOPY) $(TARGET) -O binary $(TARGET).bin
	../../../util/upload $(PORT) $(TARGET).bin

upload_ftdi: $(TARGET)
	../bsp/upload --elf ./$(TARGET) --openocd $(RISCV_OPENOCD_HOME)/bin/openocd --gdb $(RISCV_HOME)/bin/riscv64-unknown-elf-gdb --openocd-config ../bsp/openocd_jlink.cfg

upload_jlink: $(TARGET)
	$(OBJCOPY) $(TARGET) -O binary $(TARGET).bin
	../bsp/upload --bin ./$(TARGET).bin --addr 0x20000000 --jlink JLinkExe

clean:
	(cd app && $(MAKE) clean) || exit;
	rm -f *.o *.a $(TARGET) $(TARGET).bin