aboutsummaryrefslogtreecommitdiff
path: root/src/jtag/drivers/Makefile.rlink
blob: 538228dac87286808b848edb0b8b7526d6351af3 (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
# SPDX-License-Identifier: GPL-2.0-or-later

#
# Copyright (C) 2008 Lou Deluxe
# lou.openocd012@fixit.nospammail.net
#

TOP = ../../..
INTERFACE_NAME = rlink

PERL = perl
M4 = m4

TARGETDIR = ${TOP}/src/target
TOOLSDIR = ${TOP}/tools

MAKE_SPEED_TABLE = ${TOOLSDIR}/rlink_make_speed_table/rlink_make_speed_table
ST7_DTC_AS = ${TOOLSDIR}/st7_dtc_as/st7_dtc_as

OPENOCD = ${TOP}/src/openocd
OPENOCD_CONFIG = -s ${TARGETDIR}
OPENOCD_CONFIG += -f interface/rlink.cfg
OPENOCD_CONFIG += -f board/stm32f10x_128k_eval.cfg

PATCHFILE = /tmp/openocd_${INTERFACE_NAME}.diff.gz

# relative to ${TOP}
SVNADDFILES =
SVNADDFILES += src/target/interface/rlink.cfg
SVNADDFILES += src/jtag/${INTERFACE_NAME}.c
SVNADDFILES += src/jtag/${INTERFACE_NAME}

PRESCALERS = 64 11 8 2

DTCFILES =
DTCFILES += $(addsuffix _init.dtc, ${PRESCALERS})
DTCFILES += $(addsuffix _call.dtc, ${PRESCALERS})

default: rlink_speed_table.c clean

%_init.fsm: rlink_init.m4
	${M4} -P -DSHIFTER_PRESCALER=`echo "$@" | sed -e's/_.*//'` $< > $@

%_call.fsm: rlink_call.m4
	${M4} -P -DSHIFTER_PRESCALER=`echo "$@" | sed -e's/_.*//'` $< > $@

%.dtc: %.fsm
	${ST7_DTC_AS} -b -o $@ -i $< > /dev/null

rlink_speed_table.c: ${DTCFILES}
	${MAKE_SPEED_TABLE} ${PRESCALERS} > $@ || rm $@

clean:
	-rm *.dtc *.fsm

distclean: clean

test: default
	(cd ${TOP} && (rm src/jtag/${INTERFACE_NAME}.o; ${MAKE}))
	${OPENOCD} -d0 ${OPENOCD_CONFIG} -c init -c 'poll off'