-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
36 lines (27 loc) · 833 Bytes
/
Copy pathMakefile
File metadata and controls
36 lines (27 loc) · 833 Bytes
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
TARGET = usb-bios-key
SKETCH = $(TARGET).c
INCLUDE = src
FREQ_SYS = 16000000
XRAM_LOC = 0x0100
XRAM_SIZE = 0x0300
CODE_SIZE = 0x3800
CC = sdcc
OBJCOPY = objcopy
WCHISP = wchisp
# Compiler Flags
CFLAGS = -mmcs51 --model-small --no-xinit-opt
CFLAGS += --xram-size $(XRAM_SIZE) --xram-loc $(XRAM_LOC) --code-size $(CODE_SIZE)
CFLAGS += -I$(INCLUDE) -DF_CPU=$(FREQ_SYS)
CFILES = $(SKETCH) $(wildcard $(INCLUDE)/*.c)
RFILES = $(CFILES:.c=.rel)
%.rel : %.c
@$(CC) -c $(CFLAGS) $<
$(TARGET).ihx: $(RFILES)
@$(CC) $(notdir $(RFILES)) $(CFLAGS) -o $(TARGET).ihx
$(TARGET).bin: $(TARGET).ihx
@$(OBJCOPY) -I ihex -O binary $(TARGET).ihx $(TARGET).bin
bin: $(TARGET).bin
flash: $(TARGET).bin
@$(WCHISP) flash $(TARGET).bin
clean:
@rm -f *.ihx *.lk *.map *.mem *.lst *.rel *.rst *.sym *.asm *.bin