source: trunk/boot/tsar_mips32/Makefile @ 552

Last change on this file since 552 was 547, checked in by nicolas.van.phan@…, 6 years ago

Implement bootloader SPI SD card driver (VERY SLOW)

Rectify boot_spi_driver frequency

File size: 4.8 KB
Line 
1#############################################################################
2#                  ALMOS-MKH Makefile for BOOTLOADER TSAR                   #
3#############################################################################
4
5-include ../../params-soft.mk
6ifeq ($(ARCH_NAME),)
7$(error Please define in ARCH_NAME parameter in params-soft.mk!)
8endif
9
10-include ../../params-hard.mk
11
12# Rules that don't build target files
13# always out-of-date, need to be regenerated everytime they are called
14.PHONY: compile                         \
15        ../../hard_config.h           \
16                dirs                                \
17                build/boot.elf      \
18
19# Macros to be processed by the C preprocessor.
20MACROS           = -DARCHINFO_PATHNAME="\"arch_info.bin\""              \
21                           -DKERNEL_PATHNAME="\"/bin/kernel/kernel.elf\""
22
23# Objects to be linked for boot.elf generation
24BOOT_OBJS       = build/boot.o            \
25                build/boot_fat32.o      \
26                build/boot_utils.o      \
27                build/boot_spi_utils.o \
28                build/boot_entry.o      \
29                build/boot_tty_driver.o \
30                build/boot_hba_driver.o \
31                build/boot_bdv_driver.o \
32                build/boot_spi_driver.o \
33                build/boot_mmc_driver.o
34
35# List of directories to be searched for included files
36# when compiling for boot.elf generation
37BOOT_INCLUDE = -I.  \
38                -I../../tools/arch_info/        \
39                -I$(HAL_ARCH)/core   \
40                -I../.. \
41                -I$(KERNEL)
42
43# Rule to generate boot.elf, kernel.elf, ksh.elf, sort.elf and update virtual disk.
44compile: dirs                     \
45         build/boot.elf
46
47# Rule to create the build directories.
48dirs:
49        @mkdir -p build
50
51clean:
52        rm -rf build
53
54../../hard_config.h:
55        $(MAKE) -C ../../ hard_config.h
56
57################################################
58# Rules to compile boot drivers used by boot.elf
59build/boot_tty_driver.o:        boot_tty_driver.c \
60                                                                boot_tty_driver.h \
61                                                                boot_utils.h      \
62                                                                boot_config.h     \
63                                                                $(HAL_ARCH)/core/hal_kernel_types.h        \
64                                                                ../../hard_config.h
65        $(CC) $(BOOT_INCLUDE) $(CFLAGS) -c -o $@ $<
66        $(DU) -D $@ > $@.txt
67
68build/boot_bdv_driver.o:        boot_bdv_driver.c \
69                                                                boot_bdv_driver.h \
70                                                                boot_utils.h      \
71                                                                boot_config.h     \
72                                                                $(HAL_ARCH)/core/hal_kernel_types.h        \
73                                                                ../../hard_config.h
74        $(CC) $(BOOT_INCLUDE) $(CFLAGS) -c -o $@ $<
75        $(DU) -D $@ > $@.txt
76
77build/boot_hba_driver.o:        boot_hba_driver.c \
78                                                                boot_hba_driver.h \
79                                                                boot_utils.h      \
80                                                                boot_config.h     \
81                                                                $(HAL_ARCH)/core/hal_kernel_types.h        \
82                                                                ../../hard_config.h
83        $(CC) $(BOOT_INCLUDE) $(CFLAGS) -c -o $@ $<
84        $(DU) -D $@ > $@.txt
85
86build/boot_spi_driver.o:        boot_spi_driver.c \
87                                                                boot_spi_driver.h \
88                                                                boot_utils.h      \
89                                                                $(HAL_ARCH)/core/hal_kernel_types.h        \
90                                                                ../../hard_config.h
91        $(CC) $(BOOT_INCLUDE) $(CFLAGS) -c -o $@ $<
92        $(DU) -D $@ > $@.txt
93
94build/boot_mmc_driver.o:        boot_mmc_driver.c \
95                                                                boot_mmc_driver.h \
96                                                                boot_utils.h      \
97                                                                boot_config.h     \
98                                                                $(HAL_ARCH)/core/hal_kernel_types.h        \
99                                                                ../../hard_config.h
100        $(CC) $(BOOT_INCLUDE) $(CFLAGS) -c -o $@ $<
101        $(DU) -D $@ > $@.txt
102
103##############################
104# Rule to compile boot_spi_utils.o
105build/boot_spi_utils.o: boot_spi_utils.c       \
106                                                                boot_spi_utils.h       \
107                                                                $(HAL_ARCH)/core/hal_kernel_types.h         \
108                                                                ../../hard_config.h
109        $(CC) $(BOOT_INCLUDE) $(CFLAGS) -c -o $@ $<
110        $(DU) -D $@ > $@.txt
111
112##############################
113# Rule to compile boot_fat32.o
114build/boot_fat32.o: boot_fat32.c      \
115                                                                boot_fat32.h      \
116                                                                boot_utils.h      \
117                                                                boot_config.h     \
118                                                                $(HAL_ARCH)/core/hal_kernel_types.h        \
119                                                                ../../hard_config.h                     
120        $(CC) $(BOOT_INCLUDE) $(CFLAGS) -c -o $@ $<
121        $(DU) -D $@ > $@.txt
122
123##############################
124# Rule to compile boot_utils.o
125build/boot_utils.o: boot_utils.c       \
126                                                                boot_utils.h       \
127                                                                boot_tty_driver.h  \
128                                                                $(HAL_ARCH)/core/hal_kernel_types.h         \
129                                                                ../../hard_config.h
130        $(CC) $(BOOT_INCLUDE) $(CFLAGS) -c -o $@ $<
131        $(DU) -D $@ > $@.txt
132
133########################
134# Rule to compile boot.o
135build/boot.o:                           boot.c             \
136                                                                boot_utils.h       \
137                                                                boot_spi_utils.h   \
138                                                                boot_fat32.h       \
139                                                                boot_tty_driver.h  \
140                                                                boot_hba_driver.h  \
141                                                                boot_bdv_driver.h  \
142                                                                boot_mmc_driver.h  \
143                                                                boot_spi_driver.h  \
144                                                                boot_config.h      \
145                                                                $(HAL_ARCH)/core/hal_kernel_types.h         \
146                                                                ../../hard_config.h                             
147        $(CC) $(BOOT_INCLUDE) $(CFLAGS) $(MACROS) -c -o $@ $<
148        $(DU) -D $@ > $@.txt
149
150##############################
151# Rule to compile boot_entry.o
152build/boot_entry.o: boot_entry.S   \
153                                                                boot_config.h  \
154                                                                ../../hard_config.h
155        $(CC) $(BOOT_INCLUDE) $(CFLAGS) -c -o $@ $<
156        $(DU) -D $@ > $@.txt
157
158#####################################################################
159# Rule to generate boot.elf
160build/boot.elf: $(BOOT_OBJS) boot.ld
161        $(LD) -o $@ -T boot.ld $(BOOT_OBJS)
162        $(DU) -D $@ > $@.txt
Note: See TracBrowser for help on using the repository browser.