Project

General

Profile

2) Linux » History » Version 7

krufter_multiclet, 07/10/2013 12:39 PM

1 1 krufter_multiclet
h1. 2) Linux
2 1 krufter_multiclet
3 5 krufter_multiclet
1) Пример создания makefile:
4 1 krufter_multiclet
5 1 krufter_multiclet
<pre>
6 1 krufter_multiclet
PATH_TO_MULTICLET_INC = /usr/local/include/Multiclet/MCp0411100101/
7 1 krufter_multiclet
PATH_TO_MULTICLET_LIB = /usr/local/lib/Multiclet/MCp0411100101/
8 1 krufter_multiclet
9 1 krufter_multiclet
image = image.bin
10 1 krufter_multiclet
objects = sin_cos_example.o
11 1 krufter_multiclet
12 1 krufter_multiclet
load: $(image)
13 1 krufter_multiclet
	mc-ploader $(image)
14 1 krufter_multiclet
15 1 krufter_multiclet
$(image): $(objects)
16 1 krufter_multiclet
	mc-lcc -target=mcp -Wl-L$(PATH_TO_MULTICLET_LIB) -Wl-lmath -Wl-M -o $(image) $(PATH_TO_MULTICLET_LIB)/crt0.o $(objects)
17 1 krufter_multiclet
	rm *.o
18 1 krufter_multiclet
19 1 krufter_multiclet
sin_cos_example.o: sin_cos_example.c
20 1 krufter_multiclet
	mc-lcc -target=mcp -c -Wp-I$(PATH_TO_MULTICLET_INC) -Wa--arch=MCp0411100101 -o sin_cos_example.o sin_cos_example.c
21 1 krufter_multiclet
22 1 krufter_multiclet
23 1 krufter_multiclet
clean:
24 1 krufter_multiclet
	rm -rf *.o $(image)
25 1 krufter_multiclet
</pre>
26 2 krufter_multiclet
27 2 krufter_multiclet
28 2 krufter_multiclet
Дополнительные библиотеки подключаются аналогично математической:
29 2 krufter_multiclet
30 2 krufter_multiclet
<pre>
31 2 krufter_multiclet
-Wl-lmath -Wl-luart -Wl-li2cmaster -Wl-li2cslave -Wl-lwdt -Wl-lpwm -Wl-lspi -Wl-leth
32 2 krufter_multiclet
</pre>
33 3 krufter_multiclet
34 3 krufter_multiclet
Только компиляция:
35 3 krufter_multiclet
36 3 krufter_multiclet
<pre>
37 3 krufter_multiclet
make image.bin
38 3 krufter_multiclet
</pre>
39 4 krufter_multiclet
40 4 krufter_multiclet
41 5 krufter_multiclet
2) [[Полный цикл сборки]]