-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
68 lines (57 loc) · 1.66 KB
/
Makefile
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
#############################
# TinyBasic make file
#############################
NAME=stm8_term
SDAS=sdasstm8
SDCC=sdcc
SDAR=sdar
OBJCPY=objcpy
CFLAGS=-mstm8 -lstm8 -L$(LIB_PATH) -I../inc
INC=../inc/
INCLUDES=$(BOARD_INC) $(INC)ascii.inc $(INC)gen_macros.inc \
app_macros.inc ps2_codes.inc
BUILD=build/
SRC=hardware_init.asm std_func.asm ps2.asm mcSaite.asm tvout.asm uart.asm font_6x8.asm tv_term.asm
OBJECT=$(BUILD)$(BOARD)/$(NAME).rel
OBJECTS=$(BUILD)$(BOARD)/$(SRC:.asm=.rel)
LIST=$(BUILD)$(BOARD)/$(NAME).lst
FLASH=stm8flash
.PHONY: all
all: clean
#
# "*************************************"
# "compiling $(NAME) for $(BOARD) "
# "*************************************"
$(SDAS) -g -l -o $(BUILD)$(BOARD)/$(NAME).rel $(SRC)
$(SDCC) $(CFLAGS) -Wl-u -o $(BUILD)$(BOARD)/$(NAME).ihx $(OBJECT)
objcopy -Iihex -Obinary $(BUILD)$(BOARD)/$(NAME).ihx $(BUILD)$(BOARD)/$(NAME).bin
#
@ls -l $(BUILD)$(BOARD)/$(NAME).bin
#
.PHONY: clean
clean:
#
# "***************"
# "cleaning files"
# "***************"
rm -f $(BUILD)$(BOARD)/*
flash: $(LIB)
#
# "******************"
# "flashing $(BOARD) "
# "******************"
$(FLASH) -c $(PROGRAMMER) -p $(BOARD) -s flash -w $(BUILD)$(BOARD)/$(NAME).ihx
# read flash memory
read:
$(FLASH) -c $(PROGRAMMER) -p $(BOARD) -s flash -b 16384 -r flash.dat
# erase flash memory from 0x8000-0xffff
erase:
dd if=/dev/zero bs=1 count=32768 of=zero.bin
$(FLASH) -c $(PROGRAMMER) -p$(BOARD) -s flash -b 32768 -w zero.bin
rm -f zero.bin
.PHONY: ee_clear
# erase eeprom
ee_clear:
dd if=/dev/zero bs=1 count=16 of=zero.bin
$(FLASH) -c $(PROGRAMMER) -p$(BOARD) -s eeprom 16 -w zero.bin
rm -f zero.bin