forked from ps2/subg_rfspy
-
Notifications
You must be signed in to change notification settings - Fork 5
/
common.mk
executable file
·50 lines (34 loc) · 1.49 KB
/
common.mk
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
RADIO_LOCALE := US
ifeq ($(RADIO_LOCALE),US)
RADIO_LOCALE_DEF := -DUS_RADIO_LOCALE
endif
TARGET_DEVICE ?= CC1110
CODE_LOC := 0x000
CODE_LOC_NAME := STDLOC
TARGET_BUILD := ${SERIAL_TYPE}_${BOARD_TYPE}_${RADIO_LOCALE}_${CODE_LOC_NAME}
CC=sdcc
LDFLAGS=--xram-loc 0xf000 --xram-size 0x1000 --code-loc ${CODE_LOC}
CFLAGS=-I. -I${SERIAL_TYPE} --verbose ${RADIO_LOCALE_DEF} -D${BOARD_TYPE} ${BOARD_PARAMS} ${SERIAL_PARAMS}
default: output output/${TARGET_BUILD} output/${TARGET_BUILD}/${TARGET_BUILD}.hex
common_modules = radio.rel main.rel timer.rel \
commands.rel delay.rel hardware.rel
clean:
rm -rf output/${TARGET_BUILD}
%.rel: %.c
$(CC) $(CFLAGS) -o output/${TARGET_BUILD}/$@ -c $<
# The serial implementation used depends on the TARGET_BUILD parameter, so is built
# separately from the other .rel files
serial.rel: ${SERIAL_TYPE}/serial.c
# ${REL}
$(CC) $(CFLAGS) -o output/${TARGET_BUILD}/$@ -c $< $(REL)
output/${TARGET_BUILD}/${TARGET_BUILD}.hex: $(common_modules) $(REL) serial.rel
cd output/${TARGET_BUILD} && $(CC) $(LDFLAGS) $(CFLAGS) $(common_modules) $(REL) serial.rel -o ${TARGET_BUILD}.hex
install: output/${TARGET_BUILD} output/${TARGET_BUILD}/${TARGET_BUILD}.hex
sudo cc-tool -n ${TARGET_DEVICE} --log install.log -ew output/${TARGET_BUILD}/${TARGET_BUILD}.hex
test: main.c output
gcc -g -o output/${TARGET_BUILD}/test -DNON_NATIVE_TEST main.c
output:
mkdir output
output/${TARGET_BUILD}: output
mkdir -p output/${TARGET_BUILD}/
output/${TARGET_BUILD}/%.rel : %.c Makefile