-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathMakefile
More file actions
62 lines (43 loc) · 1.82 KB
/
Makefile
File metadata and controls
62 lines (43 loc) · 1.82 KB
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
TARGET=bldc_backemf
SWDIR=/home/knielsen/devel/study/stellaris-arm/SW-EK-LM4F120XL-9453
GCCDIR=/home/knielsen/devel/study/stellaris-arm/install
BINDIR=/usr/bin
CC=$(BINDIR)/arm-none-eabi-gcc
LD=$(BINDIR)/arm-none-eabi-ld
OBJCOPY=$(BINDIR)/arm-none-eabi-objcopy
LM4FLASH=/home/knielsen/devel/study/stellaris-arm/lm4tools/lm4flash/lm4flash
STARTUP=startup_gcc
LINKSCRIPT=$(TARGET).ld
FP_LDFLAGS= -L$(GCCDIR)/arm-none-eabi/lib/thumb/cortex-m4/float-abi-hard/fpuv4-sp-d16 -lm -L$(GCCDIR)/lib/gcc/arm-none-eabi/4.6.2/thumb/cortex-m4/float-abi-hard/fpuv4-sp-d16 -lgcc -lc
ARCH_CFLAGS=-mthumb -mcpu=cortex-m4 -mfpu=fpv4-sp-d16 -mfloat-abi=hard -ffunction-sections -fdata-sections -DTARGET_IS_BLIZZARD_RA1
INC=-I/home/knielsen/devel/study/stellaris-arm/SW-EK-LM4F120XL-9453 -DPART_LM4F131H5QR
CFLAGS=-g -O3 -std=c99 -Wall -pedantic -Dgcc $(ARCH_CFLAGS) $(INC)
LDFLAGS=--entry ResetISR --gc-sections
OBJS = $(TARGET).o dbg.o led.o nrf.o ps2.o usb.o usb_serial_structs.o
LIBS = $(SWDIR)/usblib/gcc-cm4f/libusb-cm4f.a $(SWDIR)/driverlib/gcc-cm4f/libdriver-cm4f.a
all: $(TARGET).bin
$(TARGET).bin: $(TARGET).elf
$(TARGET).elf: $(OBJS) $(STARTUP).o $(LINKSCRIPT)
$(LD) $(LDFLAGS) -T $(LINKSCRIPT) -o $@ $(STARTUP).o $(OBJS) $(LIBS) $(FP_LDFLAGS)
$(TARGET).o: $(TARGET).c dbg.h
$(STARTUP).o: $(STARTUP).c
bldc_backemf.o: bldc_backemf.h dbg.h ps2.h nrf.h usb.h
dbg.o: dbg.c dbg.h
led.o: bldc_backemf.h
usb.o: bldc_backemf.h usb.h
nrf.o: bldc_backemf.h nrf.h dbg.h
ps2.o: bldc_backemf.h ps2.h dbg.h
usb_serial_structs.o: usb_serial_structs.h
%.o: %.c
$(CC) $(CFLAGS) -c $< -o $@
%.bin: %.elf
$(OBJCOPY) -O binary $< $@
flash: $(TARGET).bin
$(LM4FLASH) $(TARGET).bin
clean:
rm -f $(OBJS) $(TARGET).elf $(TARGET).bin $(STARTUP).o
tty:
stty -F/dev/stellaris raw -echo -hup cs8 -parenb -cstopb 500000
cat:
cat /dev/stellaris
.PHONY: all clean flash tty cat