source: soft/giet_vm/Makefile @ 268

Last change on this file since 268 was 259, checked in by devigne, 11 years ago

giet_fat32/fat32.c :
Added _fat_write function. At the moment it does not support the creation of a
new file (the writing must exist in the disk image) and does not support the
allocation of additional cluster from the original file.

create_dmg :
Bug fix for support Linux (The tree files were not consistent with the
pathnames in boot.c).

giet_libs/stdlib.c and stdlib.h :
Added stdlib file. At the moment they only contain the atoi function.

giet_libs/stdio.h :
Bug fix in SYSCALL DEFINE. SYSCALL_FAT_READ, WRITE, CLOSE, LSEEK had the same
value.

Makefile :
Added compilation line for stdlib.o

File size: 13.0 KB
Line 
1export # export all variable to sub-Makefile
2CC = mipsel-unknown-elf-gcc
3AS = mipsel-unknown-elf-as
4LD = mipsel-unknown-elf-ld
5DU = mipsel-unknown-elf-objdump
6
7### FAT parameters definition for Disk image
8### sector_size          = 512
9### partition_begin_lba  = 300
10### sector_per_cluster   = 8
11### partition sectors    = 524832
12
13MAP_XML      = mappings/4c_1p_iob_four.xml
14
15### Objects to be linked for kernel.elf
16KERNEL_OBJS  = build/common/utils.o        \
17               build/common/vmem.o          \
18               build/fat32/fat32.o        \
19               build/drivers/dma_driver.o \
20               build/drivers/fbf_driver.o \
21               build/drivers/xcu_driver.o \
22               build/drivers/icu_driver.o \
23               build/drivers/ioc_driver.o \
24               build/drivers/iob_driver.o \
25               build/drivers/mmc_driver.o \
26               build/drivers/mwr_driver.o \
27               build/drivers/nic_driver.o \
28               build/drivers/tim_driver.o \
29               build/drivers/tty_driver.o \
30               build/kernel/giet.o        \
31               build/kernel/switch.o      \
32               build/kernel/ctx_handler.o \
33               build/kernel/exc_handler.o \
34               build/kernel/sys_handler.o \
35               build/kernel/irq_handler.o \
36               build/kernel/kernel_init.o
37
38### Objects to be linked for boot.elf
39BOOT_OBJS    = build/common/utils.o        \
40               build/common/vmem.o          \
41               build/fat32/fat32.o        \
42               build/drivers/tty_driver.o \
43               build/drivers/xcu_driver.o \
44               build/drivers/dma_driver.o \
45               build/drivers/mwr_driver.o \
46               build/drivers/ioc_driver.o \
47               build/drivers/nic_driver.o \
48               build/drivers/mmc_driver.o \
49               build/kernel/ctx_handler.o \
50               build/kernel/switch.o      \
51               build/boot/boot.o
52
53### Objects to be linked for display.elf
54DISPLAY_OBJS = build/display/main.o \
55               build/libs/stdio.o
56
57### Objects to be linked for router.elf
58ROUTER_OBJS  = build/router/main.o        \
59               build/libs/mwmr_channel.o  \
60               build/libs/stdio.o
61
62### Objects to be linked for hello.elf
63HELLO_OBJS   = build/hello/main.o   \
64               build/libs/stdio.o         
65
66### Objects to be linked for pgcd.elf
67PGCD_OBJS    = build/pgcd/main.o          \
68               build/libs/stdio.o
69
70### Objects to be linked for game.elf
71GAMEOFLIFE_OBJS = build/gameoflife/main.o \
72                  build/libs/stdio.o      \
73                  build/libs/barrier.o
74
75### Objects to be linked for dhrystone.elf
76DHRYSTONE_OBJS = build/dhrystone/dhry_1.o \
77                 build/dhrystone/dhry_2.o \
78                 build/libs/stdio.o       \
79                 build/libs/string.o      \
80                 build/libs/spin_lock.o   \
81                 build/libs/malloc.o
82
83### Objects to be linked for sort.elf
84SORT_OBJS   = build/sort/main.o        \
85              build/libs/stdio.o       \
86              build/libs/spin_lock.o   \
87              build/libs/barrier.o
88
89
90CFLAGS = -Wall -ffreestanding -mno-gpopt -mips32
91
92GIET_INCLUDE = -Igiet_boot    \
93               -Igiet_kernel  \
94               -Igiet_xml     \
95               -Igiet_fat32   \
96               -Igiet_drivers \
97               -Igiet_common  \
98               -Igiet_libs    \
99               -I.
100
101USER_INCLUDE = -Igiet_libs    \
102               -Igiet_xml     \
103               -I.
104
105all: map.bin                         \
106     build/boot/boot.elf             \
107     build/kernel/kernel.elf         \
108     build/display/display.elf       \
109     build/router/router.elf         \
110     build/hello/hello.elf           \
111     build/pgcd/pgcd.elf             \
112     build/dhrystone/dhrystone.elf   \
113     build/gameoflife/gameoflife.elf \
114     build/sort/sort.elf             \
115     hdd/virt_hdd.dmg
116
117### Disk image generation
118### This requires the generic LINUX/MacOS sript "create_dmg" script
119### written by C.Fuguet. (should be installed in GIET-VM root directory).
120hdd/virt_hdd.dmg: map.bin                   \
121         build/boot/boot.elf            \
122         build/kernel/kernel.elf        \
123         build/display/display.elf      \
124         build/hello/hello.elf          \
125         build/pgcd/pgcd.elf            \
126         build/router/router.elf        \
127         build/dhrystone/dhrystone.elf  \
128         build/gameoflife/gameoflife.elf
129### remove all content of virtual disk virt_hdd
130        rm -rf hdd/virt_hdd/*
131### copy content to virtual disk from build, misc and map.bin
132### the boot.elf file is not copied on the virtual disk
133        cp -r build hdd/virt_hdd
134        rm -rf hdd/virt_hdd/build/boot
135        cp -r hdd/misc hdd/virt_hdd
136        cp map.bin  hdd/virt_hdd
137### create temporary partition image (partition_image.dmg)
138        ./create_dmg create hdd/virt_hdd partition_image
139### copy standard MBR into virtual disk image (mbr.dmg)
140        cp hdd/mbr.dmg $@ 
141### copy boot.elf into virtual disk image (sector 2)
142        dd if=build/boot/boot.elf of=$@ seek=2
143### copy partition image into virtual disk image (sector 300)
144        dd if=partition_image.dmg of=$@ seek=300 
145### remove partition image
146        rm partition_image.dmg
147
148### mapping compilation
149map.bin: $(MAP_XML)
150        $(MAKE) -C giet_xml
151        giet_xml/xml2bin $< .
152
153### drivers compilation
154build/drivers/dma_driver.o: giet_drivers/dma_driver.c  \
155                            giet_drivers/dma_driver.h  \
156                            giet_config.h              \
157                            $(MAP_XML)
158        $(CC) $(GIET_INCLUDE) $(CFLAGS)  -c -o $@ $<
159
160build/drivers/fbf_driver.o: giet_drivers/fbf_driver.c  \
161                            giet_drivers/fbf_driver.h  \
162                            giet_config.h              \
163                            $(MAP_XML)
164        $(CC) $(GIET_INCLUDE) $(CFLAGS)  -c -o $@ $<
165
166build/drivers/xcu_driver.o: giet_drivers/xcu_driver.c  \
167                            giet_drivers/xcu_driver.h  \
168                            giet_config.h              \
169                            $(MAP_XML)
170        $(CC) $(GIET_INCLUDE) $(CFLAGS)  -c -o $@ $<
171
172build/drivers/icu_driver.o: giet_drivers/icu_driver.c  \
173                            giet_drivers/icu_driver.h  \
174                            giet_config.h              \
175                            $(MAP_XML)
176        $(CC) $(GIET_INCLUDE) $(CFLAGS)  -c -o $@ $<
177
178build/drivers/ioc_driver.o: giet_drivers/ioc_driver.c  \
179                            giet_drivers/ioc_driver.h  \
180                            giet_config.h              \
181                            $(MAP_XML)
182        $(CC) $(GIET_INCLUDE) $(CFLAGS)  -c -o $@ $<
183
184build/drivers/iob_driver.o: giet_drivers/iob_driver.c  \
185                            giet_drivers/iob_driver.h  \
186                            giet_config.h              \
187                            $(MAP_XML)
188        $(CC) $(GIET_INCLUDE) $(CFLAGS)  -c -o $@ $<
189
190build/drivers/mmc_driver.o: giet_drivers/mmc_driver.c  \
191                            giet_drivers/mmc_driver.h  \
192                            giet_config.h              \
193                            $(MAP_XML)
194        $(CC) $(GIET_INCLUDE) $(CFLAGS)  -c -o $@ $<
195
196build/drivers/mwr_driver.o: giet_drivers/mwr_driver.c  \
197                            giet_drivers/mwr_driver.h  \
198                            giet_config.h              \
199                            $(MAP_XML)
200        $(CC) $(GIET_INCLUDE) $(CFLAGS)  -c -o $@ $<
201
202build/drivers/nic_driver.o: giet_drivers/nic_driver.c  \
203                            giet_drivers/nic_driver.h  \
204                            giet_config.h              \
205                            $(MAP_XML)
206        $(CC) $(GIET_INCLUDE) $(CFLAGS)  -c -o $@ $<
207
208build/drivers/tim_driver.o: giet_drivers/tim_driver.c  \
209                            giet_drivers/tim_driver.h  \
210                            giet_config.h              \
211                            $(MAP_XML)
212        $(CC) $(GIET_INCLUDE) $(CFLAGS)  -c -o $@ $<
213
214build/drivers/tty_driver.o: giet_drivers/tty_driver.c  \
215                            giet_drivers/tty_driver.h  \
216                            giet_config.h              \
217                            $(MAP_XML)
218        $(CC) $(GIET_INCLUDE) $(CFLAGS)  -c -o $@ $<
219
220### fat32 compilation
221build/fat32/fat32.o: giet_fat32/fat32.c \
222                     giet_fat32/fat32.h \
223                     giet_config.h      \
224                     $(MAP_XML)
225        $(CC) $(GIET_INCLUDE) $(CFLAGS)  -c -o $@ $<
226
227### utils compilation
228build/common/utils.o: giet_common/utils.c \
229                      giet_common/utils.h \
230                      giet_config.h       \
231                      $(MAP_XML)
232        $(CC) $(GIET_INCLUDE) $(CFLAGS)  -c -o $@ $<
233
234### vmem compilation
235build/common/vmem.o: giet_common/vmem.c \
236                     giet_common/vmem.h \
237                     giet_config.h    \
238                     $(MAP_XML)
239        $(CC) $(GIET_INCLUDE) $(CFLAGS)  -c -o $@ $<
240
241### boot compilation
242build/boot/boot.elf: $(BOOT_OBJS) 
243        $(LD) -o $@ -T giet_boot/boot.ld $(BOOT_OBJS) 
244        $(DU) -D $@ > $@.txt
245
246build/boot/boot.o: giet_boot/boot.c          \
247                   giet_common/utils.h       \
248                   giet_fat32/fat32.h        \
249                   giet_common/vmem.h          \
250                   giet_drivers/tty_driver.h \
251                   giet_drivers/ioc_driver.h \
252                   giet_config.h             \
253                   $(MAP_XML)
254        $(CC) $(GIET_INCLUDE) $(CFLAGS)  -c -o $@ $<
255
256### kernel compilation
257build/kernel/kernel.elf: $(KERNEL_OBJS) giet_kernel/kernel.ld
258        $(LD) -o $@ -T giet_kernel/kernel.ld $(KERNEL_OBJS)
259        $(DU) -D $@ > $@.txt
260
261build/kernel/%.o: giet_kernel/%.c giet_config.h $(MAP_XML)
262        $(CC) $(GIET_INCLUDE) $(CFLAGS)  -c -o $@ $<
263
264build/kernel/%.o: giet_kernel/%.s giet_config.h $(MAP_XML)
265        $(CC) $(GIET_INCLUDE) $(CFLAGS)  -c -o $@ $<
266
267
268
269
270### libs compilation
271build/libs/stdio.o: giet_libs/stdio.c \
272                    giet_libs/stdio.h \
273                    giet_config.h 
274        $(CC) $(CFLAGS) $(USER_INCLUDE) -c -o $@ $<
275
276build/libs/mwmr_channel.o: giet_libs/mwmr_channel.c \
277                           giet_libs/mwmr_channel.h \
278                           giet_config.h
279        $(CC) $(CFLAGS) $(USER_INCLUDE) -c -o $@ $<
280
281build/libs/malloc.o: giet_libs/malloc.c         \
282                     giet_libs/malloc.h         \
283                     giet_libs/malloc_private.h \
284                     giet_config.h
285        $(CC) $(CFLAGS) $(USER_INCLUDE) -c -o $@ $<
286
287build/libs/barrier.o: giet_libs/barrier.c \
288                      giet_libs/barrier.h \
289                      giet_config.h
290        $(CC) $(CFLAGS) $(USER_INCLUDE) -c -o $@ $<
291
292build/libs/stdlib.o: giet_libs/stdlib.c \
293                     giet_libs/stdlib.h \
294                     giet_config.h
295        $(CC) $(CFLAGS) $(USER_INCLUDE) -c -o $@ $<
296
297build/libs/string.o: giet_libs/string.c \
298                     giet_libs/string.h \
299                     giet_config.h
300        $(CC) $(CFLAGS) $(USER_INCLUDE) -c -o $@ $<
301
302build/libs/spin_lock.o: giet_libs/spin_lock.c \
303                        giet_libs/spin_lock.h \
304                        giet_config.h
305        $(CC) $(CFLAGS) $(USER_INCLUDE) -c -o $@ $<
306
307
308
309
310### display compilation
311build/display/display.elf: $(DISPLAY_OBJS) display/display.ld
312        $(LD) -o $@ -T display/display.ld $(DISPLAY_OBJS)
313        $(DU) -D $@ > $@.txt
314
315build/display/main.o: display/main_cma.c
316        $(CC) $(USER_INCLUDE) $(CFLAGS)  -c -o $@ $<
317
318### router compilation
319build/router/router.elf: $(ROUTER_OBJS) router/router.ld
320        $(LD) -o $@ -T router/router.ld $(ROUTER_OBJS)
321        $(DU) -D $@ > $@.txt
322
323build/router/main.o: router/main.c
324        $(CC) $(USER_INCLUDE) $(CFLAGS)  -c -o $@ $<
325
326### hello compilation
327build/hello/hello.elf: $(HELLO_OBJS) hello/hello.ld
328        $(LD) -o $@ -T hello/hello.ld $(HELLO_OBJS)
329        $(DU) -D $@ > $@.txt
330
331build/hello/main.o: hello/main.c
332        $(CC) $(USER_INCLUDE) $(CFLAGS) -c -o $@ $<
333
334### pgcd compilation
335build/pgcd/pgcd.elf: $(PGCD_OBJS) pgcd/pgcd.ld
336        $(LD) -o $@ -T pgcd/pgcd.ld $(PGCD_OBJS)
337        $(DU) -D $@ > $@.txt
338
339build/pgcd/main.o: pgcd/main.c
340        $(CC) $(USER_INCLUDE) $(CFLAGS) -c -o $@ $<
341
342### gameoflife compilation
343build/gameoflife/gameoflife.elf: $(GAMEOFLIFE_OBJS) gameoflife/gameoflife.ld
344        $(LD) -o $@ -T gameoflife/gameoflife.ld $(GAMEOFLIFE_OBJS)
345        $(DU) -D $@ > $@.txt
346
347build/gameoflife/main.o: gameoflife/main.c
348        $(CC) $(USER_INCLUDE) $(CFLAGS) -O3 -c -o $@ $<
349
350### dhrystone compilation
351build/dhrystone/dhrystone.elf: $(DHRYSTONE_OBJS) dhrystone/dhrystone.ld
352        $(LD) -o $@ -T dhrystone/dhrystone.ld $(DHRYSTONE_OBJS)
353        $(DU) -D $@ > $@.txt
354
355build/dhrystone/dhry_1.o: dhrystone/dhry_1.c
356        $(CC) $(USER_INCLUDE) $(CFLAGS)  -c -o $@ $<
357
358build/dhrystone/dhry_2.o: dhrystone/dhry_2.c
359        $(CC) $(USER_INCLUDE) $(CFLAGS)  -c -o $@ $<
360
361### sort compilation
362build/sort/sort.elf: $(SORT_OBJS) sort/sort.ld
363        $(LD) -o $@ -T sort/sort.ld $(SORT_OBJS)
364        $(DU) -D $@ > $@.txt
365
366build/sort/main.o: sort/main.c
367        $(CC) $(USER_INCLUDE) $(CFLAGS) -c -o $@ $<
368
369### clean
370clean:
371        rm -f *.o *.elf *.bin *.txt core  giet_vsegs.ld hard_config.h map.bin*~
372        $(MAKE) -s clean -C giet_xml
373        rm -rf build/boot/*
374        rm -rf build/fat32/*
375        rm -rf build/common/*
376        rm -rf build/drivers/*
377        rm -rf build/kernel/*
378        rm -rf build/reset/*
379        rm -rf build/libs/*
380        rm -rf build/pgcd/*
381        rm -rf build/hello/*
382        rm -rf build/display/*
383        rm -rf build/router/*
384        rm -rf build/gameoflife/*
385        rm -rf build/dhrystone/*
386        rm -rf build/sort/*
387        rm -rf build/map.bin
388        rm -rf hdd/virt_hdd.dmg
Note: See TracBrowser for help on using the repository browser.