| 1 | -include build.mk |
|---|
| 2 | |
|---|
| 3 | export # export all variable to sub-Makefile |
|---|
| 4 | CC = mipsel-unknown-elf-gcc |
|---|
| 5 | AS = mipsel-unknown-elf-as |
|---|
| 6 | LD = mipsel-unknown-elf-ld |
|---|
| 7 | DU = mipsel-unknown-elf-objdump |
|---|
| 8 | AR = mipsel-unknown-elf-ar |
|---|
| 9 | |
|---|
| 10 | # Parameters definition |
|---|
| 11 | #ARCH ?= ../tsar-trunk-svn-2013/platforms/tsar_generic_iob |
|---|
| 12 | ARCH ?= ../../../tsar/platforms/tsar_generic_iob |
|---|
| 13 | X_SIZE ?= 1 |
|---|
| 14 | Y_SIZE ?= 1 |
|---|
| 15 | NB_PROCS ?= 4 |
|---|
| 16 | NB_TTYS ?= 1 |
|---|
| 17 | FBF_WIDTH ?= 128 |
|---|
| 18 | IOC_TYPE ?= HBA |
|---|
| 19 | APP ?= ocean |
|---|
| 20 | |
|---|
| 21 | |
|---|
| 22 | .PHONY: clean map.bin build |
|---|
| 23 | |
|---|
| 24 | ### FAT parameters definition for Disk image |
|---|
| 25 | ### sector_size = 512 |
|---|
| 26 | ### partition_begin_lba = 300 |
|---|
| 27 | ### sector_per_cluster = 8 |
|---|
| 28 | ### partition sectors = 524832 |
|---|
| 29 | |
|---|
| 30 | BUILD_DIRS = boot \ |
|---|
| 31 | classif \ |
|---|
| 32 | common \ |
|---|
| 33 | convol \ |
|---|
| 34 | coproc \ |
|---|
| 35 | dhrystone \ |
|---|
| 36 | display \ |
|---|
| 37 | drivers \ |
|---|
| 38 | fat32 \ |
|---|
| 39 | gameoflife\ |
|---|
| 40 | hello \ |
|---|
| 41 | kernel \ |
|---|
| 42 | libs/math \ |
|---|
| 43 | ocean \ |
|---|
| 44 | pgcd \ |
|---|
| 45 | router \ |
|---|
| 46 | sort \ |
|---|
| 47 | transpose |
|---|
| 48 | |
|---|
| 49 | ### Objects to be linked for the drivers library |
|---|
| 50 | DRIVERS_OBJS = build/drivers/dma_driver.o \ |
|---|
| 51 | build/drivers/cma_driver.o \ |
|---|
| 52 | build/drivers/xcu_driver.o \ |
|---|
| 53 | build/drivers/bdv_driver.o \ |
|---|
| 54 | build/drivers/hba_driver.o \ |
|---|
| 55 | build/drivers/sdc_driver.o \ |
|---|
| 56 | build/drivers/spi_driver.o \ |
|---|
| 57 | build/drivers/rdk_driver.o \ |
|---|
| 58 | build/drivers/iob_driver.o \ |
|---|
| 59 | build/drivers/mmc_driver.o \ |
|---|
| 60 | build/drivers/mwr_driver.o \ |
|---|
| 61 | build/drivers/nic_driver.o \ |
|---|
| 62 | build/drivers/tim_driver.o \ |
|---|
| 63 | build/drivers/tty_driver.o \ |
|---|
| 64 | build/drivers/pic_driver.o |
|---|
| 65 | |
|---|
| 66 | ### Objects to be linked for kernel.elf |
|---|
| 67 | KERNEL_OBJS = build/common/utils.o \ |
|---|
| 68 | build/common/kernel_locks.o \ |
|---|
| 69 | build/common/kernel_barriers.o \ |
|---|
| 70 | build/common/tty0.o \ |
|---|
| 71 | build/common/vmem.o \ |
|---|
| 72 | build/common/kernel_malloc.o \ |
|---|
| 73 | build/fat32/fat32.o \ |
|---|
| 74 | build/kernel/giet.o \ |
|---|
| 75 | build/kernel/switch.o \ |
|---|
| 76 | build/kernel/ctx_handler.o \ |
|---|
| 77 | build/kernel/exc_handler.o \ |
|---|
| 78 | build/kernel/sys_handler.o \ |
|---|
| 79 | build/kernel/irq_handler.o \ |
|---|
| 80 | build/kernel/kernel_init.o |
|---|
| 81 | |
|---|
| 82 | ### Objects to be linked for boot.elf |
|---|
| 83 | BOOT_OBJS = build/common/utils.o \ |
|---|
| 84 | build/common/kernel_locks.o \ |
|---|
| 85 | build/common/kernel_barriers.o \ |
|---|
| 86 | build/common/tty0.o \ |
|---|
| 87 | build/common/pmem.o \ |
|---|
| 88 | build/common/vmem.o \ |
|---|
| 89 | build/common/kernel_malloc.o \ |
|---|
| 90 | build/fat32/fat32.o \ |
|---|
| 91 | build/kernel/ctx_handler.o \ |
|---|
| 92 | build/kernel/irq_handler.o \ |
|---|
| 93 | build/kernel/switch.o \ |
|---|
| 94 | build/boot/boot.o \ |
|---|
| 95 | build/boot/boot_entry.o |
|---|
| 96 | |
|---|
| 97 | MATH_OBJ = build/libs/math/e_pow.o \ |
|---|
| 98 | build/libs/math/e_rem_pio2.o \ |
|---|
| 99 | build/libs/math/k_cos.o \ |
|---|
| 100 | build/libs/math/k_rem_pio2.o \ |
|---|
| 101 | build/libs/math/k_sin.o \ |
|---|
| 102 | build/libs/math/s_copysign.o \ |
|---|
| 103 | build/libs/math/s_fabs.o \ |
|---|
| 104 | build/libs/math/s_finite.o \ |
|---|
| 105 | build/libs/math/s_floor.o \ |
|---|
| 106 | build/libs/math/s_isnan.o \ |
|---|
| 107 | build/libs/math/sqrt.o \ |
|---|
| 108 | build/libs/math/s_rint.o \ |
|---|
| 109 | build/libs/math/s_scalbn.o \ |
|---|
| 110 | build/libs/math/s_sin.o |
|---|
| 111 | # build/libs/math/e_sqrt.o \ |
|---|
| 112 | |
|---|
| 113 | ### Objects to be linked for display.elf |
|---|
| 114 | DISPLAY_OBJS = build/display/main.o \ |
|---|
| 115 | build/libs/stdio.o |
|---|
| 116 | |
|---|
| 117 | ### Objects to be linked for router.elf |
|---|
| 118 | ROUTER_OBJS = build/router/main.o \ |
|---|
| 119 | build/libs/mwmr_channel.o \ |
|---|
| 120 | build/libs/user_lock.o \ |
|---|
| 121 | build/libs/stdio.o |
|---|
| 122 | |
|---|
| 123 | ### Objects to be linked for hello.elf |
|---|
| 124 | HELLO_OBJS = build/hello/main.o \ |
|---|
| 125 | build/libs/stdio.o |
|---|
| 126 | |
|---|
| 127 | ### Objects to be linked for pgcd.elf |
|---|
| 128 | PGCD_OBJS = build/pgcd/main.o \ |
|---|
| 129 | build/libs/stdio.o |
|---|
| 130 | |
|---|
| 131 | ### Objects to be linked for game.elf |
|---|
| 132 | GAMEOFLIFE_OBJS = build/gameoflife/main.o \ |
|---|
| 133 | build/libs/stdio.o \ |
|---|
| 134 | build/libs/user_barrier.o \ |
|---|
| 135 | build/libs/malloc.o \ |
|---|
| 136 | build/libs/user_lock.o |
|---|
| 137 | |
|---|
| 138 | ### Objects to be linked for dhrystone.elf |
|---|
| 139 | DHRYSTONE_OBJS = build/dhrystone/dhry_1.o \ |
|---|
| 140 | build/dhrystone/dhry_2.o \ |
|---|
| 141 | build/libs/stdlib.o \ |
|---|
| 142 | build/libs/stdio.o \ |
|---|
| 143 | build/libs/string.o \ |
|---|
| 144 | build/libs/user_lock.o \ |
|---|
| 145 | build/libs/malloc.o |
|---|
| 146 | |
|---|
| 147 | ### Objects to be linked for sort.elf |
|---|
| 148 | SORT_OBJS = build/sort/main.o \ |
|---|
| 149 | build/libs/stdio.o \ |
|---|
| 150 | build/libs/user_barrier.o \ |
|---|
| 151 | build/libs/malloc.o \ |
|---|
| 152 | build/libs/user_lock.o |
|---|
| 153 | |
|---|
| 154 | ### Objects to be linked for transpose.elf |
|---|
| 155 | TRANSPOSE_OBJS = build/transpose/main.o \ |
|---|
| 156 | build/libs/stdio.o \ |
|---|
| 157 | build/libs/user_barrier.o \ |
|---|
| 158 | build/libs/malloc.o \ |
|---|
| 159 | build/libs/user_lock.o |
|---|
| 160 | |
|---|
| 161 | ### Objects to be linked for convol.elf |
|---|
| 162 | CONVOL_OBJS = build/convol/main.o \ |
|---|
| 163 | build/libs/stdio.o \ |
|---|
| 164 | build/libs/stdlib.o \ |
|---|
| 165 | build/libs/user_barrier.o \ |
|---|
| 166 | build/libs/malloc.o \ |
|---|
| 167 | build/libs/user_lock.o |
|---|
| 168 | |
|---|
| 169 | ### Objects to be linked for classif.elf |
|---|
| 170 | CLASSIF_OBJS = build/classif/main.o \ |
|---|
| 171 | build/libs/stdio.o \ |
|---|
| 172 | build/libs/mwmr_channel.o \ |
|---|
| 173 | build/libs/user_barrier.o \ |
|---|
| 174 | build/libs/malloc.o \ |
|---|
| 175 | build/libs/user_lock.o |
|---|
| 176 | |
|---|
| 177 | ### Objects to be linked for coproc.elf |
|---|
| 178 | COPROC_OBJS = build/coproc/main.o \ |
|---|
| 179 | build/libs/stdio.o |
|---|
| 180 | |
|---|
| 181 | |
|---|
| 182 | ### Objects to be linked for ocean.elf |
|---|
| 183 | OCEAN_OBJS = build/libs/stdio.o \ |
|---|
| 184 | build/libs/malloc.o \ |
|---|
| 185 | build/libs/stdlib.o \ |
|---|
| 186 | build/libs/user_sqt_lock.o\ |
|---|
| 187 | build/libs/user_lock.o \ |
|---|
| 188 | build/libs/user_barrier.o \ |
|---|
| 189 | build/libs/libmath.a |
|---|
| 190 | |
|---|
| 191 | CFLAGS = -Wall -ffreestanding -mno-gpopt -mips32 -g -O2 \ |
|---|
| 192 | -fno-delete-null-pointer-checks |
|---|
| 193 | |
|---|
| 194 | GIET_INCLUDE = -Igiet_boot \ |
|---|
| 195 | -Igiet_kernel \ |
|---|
| 196 | -Igiet_xml \ |
|---|
| 197 | -Igiet_fat32 \ |
|---|
| 198 | -Igiet_drivers \ |
|---|
| 199 | -Igiet_common \ |
|---|
| 200 | -Igiet_libs \ |
|---|
| 201 | -I. |
|---|
| 202 | |
|---|
| 203 | USER_INCLUDE = -Igiet_libs \ |
|---|
| 204 | -Igiet_xml \ |
|---|
| 205 | -I. |
|---|
| 206 | |
|---|
| 207 | DISK_IMAGE := hdd/virt_hdd.dmg |
|---|
| 208 | |
|---|
| 209 | ### All the Mtools commands perform a few sanity checks before going ahead, |
|---|
| 210 | ### to make sure that the disk is indeed an MS-DOS disk. However, the size |
|---|
| 211 | ### of the disk image used by the Giet-VM is not MS-DOS compliant. |
|---|
| 212 | ### Setting this variable prevents these checks. |
|---|
| 213 | MTOOLS_SKIP_CHECK := 1 |
|---|
| 214 | |
|---|
| 215 | all: build \ |
|---|
| 216 | map.bin \ |
|---|
| 217 | hard_config.h \ |
|---|
| 218 | giet_vsegs.ld \ |
|---|
| 219 | build/boot/boot.elf \ |
|---|
| 220 | build/kernel/kernel.elf \ |
|---|
| 221 | build/display/display.elf \ |
|---|
| 222 | build/hello/hello.elf \ |
|---|
| 223 | build/pgcd/pgcd.elf \ |
|---|
| 224 | build/router/router.elf \ |
|---|
| 225 | build/dhrystone/dhrystone.elf \ |
|---|
| 226 | build/gameoflife/gameoflife.elf \ |
|---|
| 227 | build/sort/sort.elf \ |
|---|
| 228 | build/transpose/transpose.elf \ |
|---|
| 229 | build/convol/convol.elf \ |
|---|
| 230 | build/classif/classif.elf \ |
|---|
| 231 | build/coproc/coproc.elf \ |
|---|
| 232 | $(DISK_IMAGE) |
|---|
| 233 | # build/ocean/ocean.elf \ |
|---|
| 234 | ### Copy always all files into disk image |
|---|
| 235 | mcopy -o -i $(DISK_IMAGE) build/kernel/kernel.elf ::/build/kernel |
|---|
| 236 | mcopy -o -i $(DISK_IMAGE) build/display/display.elf ::/build/display |
|---|
| 237 | mcopy -o -i $(DISK_IMAGE) build/hello/hello.elf ::/build/hello |
|---|
| 238 | mcopy -o -i $(DISK_IMAGE) build/pgcd/pgcd.elf ::/build/pgcd |
|---|
| 239 | mcopy -o -i $(DISK_IMAGE) build/router/router.elf ::/build/router |
|---|
| 240 | mcopy -o -i $(DISK_IMAGE) build/dhrystone/dhrystone.elf ::/build/dhrystone |
|---|
| 241 | mcopy -o -i $(DISK_IMAGE) build/gameoflife/gameoflife.elf ::/build/gameoflife |
|---|
| 242 | mcopy -o -i $(DISK_IMAGE) build/sort/sort.elf ::/build/sort |
|---|
| 243 | mcopy -o -i $(DISK_IMAGE) build/transpose/transpose.elf ::/build/transpose |
|---|
| 244 | mcopy -o -i $(DISK_IMAGE) build/convol/convol.elf ::/build/convol |
|---|
| 245 | mcopy -o -i $(DISK_IMAGE) build/classif/classif.elf ::/build/classif |
|---|
| 246 | mcopy -o -i $(DISK_IMAGE) build/coproc/coproc.elf ::/build/coproc |
|---|
| 247 | # mcopy -o -i $(DISK_IMAGE) build/ocean/ocean.elf ::/build/ocean |
|---|
| 248 | mcopy -o -i $(DISK_IMAGE) applications/transpose/images.raw ::/misc |
|---|
| 249 | mcopy -o -i $(DISK_IMAGE) applications/convol/philips_image.raw ::/misc |
|---|
| 250 | mcopy -o -i $(DISK_IMAGE) applications/display/lena.raw ::/misc |
|---|
| 251 | mcopy -o -i $(DISK_IMAGE) map.bin ::/ |
|---|
| 252 | ### Copy bootloader into sector 2 of disk image |
|---|
| 253 | dd if=build/boot/boot.elf of=$(DISK_IMAGE) seek=2 conv=notrunc |
|---|
| 254 | ### Checking root directory |
|---|
| 255 | mdir -/ -b -i $(DISK_IMAGE) ::/ |
|---|
| 256 | |
|---|
| 257 | |
|---|
| 258 | build: |
|---|
| 259 | mkdir -p build |
|---|
| 260 | (cd build && mkdir -p $(BUILD_DIRS)) |
|---|
| 261 | |
|---|
| 262 | ### Disk image generation (no files in this step) |
|---|
| 263 | ### This requires the generic LINUX/MacOS script "create_dmg" script |
|---|
| 264 | ### written by C.Fuguet. (should be installed in GIET-VM root directory). |
|---|
| 265 | ### create the three build / misc / home directories |
|---|
| 266 | ### store the images files into misc |
|---|
| 267 | $(DISK_IMAGE): |
|---|
| 268 | ./create_dmg create $(basename $(DISK_IMAGE)) |
|---|
| 269 | dd if=$(DISK_IMAGE) of=temp.dmg count=65536 |
|---|
| 270 | mv temp.dmg $(DISK_IMAGE) |
|---|
| 271 | mmd -o -i $(DISK_IMAGE) ::/build |
|---|
| 272 | mmd -o -i $(DISK_IMAGE) ::/build/ocean |
|---|
| 273 | mmd -o -i $(DISK_IMAGE) ::/misc |
|---|
| 274 | mmd -o -i $(DISK_IMAGE) ::/home |
|---|
| 275 | # mcopy -o -i $(DISK_IMAGE) applications/transpose/images.raw ::/misc |
|---|
| 276 | # mcopy -o -i $(DISK_IMAGE) applications/convol/philips_image.raw ::/misc |
|---|
| 277 | # mcopy -o -i $(DISK_IMAGE) applications/display/lena.raw ::/misc |
|---|
| 278 | |
|---|
| 279 | ### mapping generation: map.bin / map.xml / hard_config.h / giet_vsegs.ld |
|---|
| 280 | map.bin hard_config.h giet_vsegs.ld: $(ARCH)/arch.py applications/$(APP)/$(APP).py $(DISK_IMAGE) |
|---|
| 281 | giet_python/genmap --arch=$(ARCH) \ |
|---|
| 282 | --x=$(X_SIZE) \ |
|---|
| 283 | --y=$(Y_SIZE) \ |
|---|
| 284 | --p=$(NB_PROCS) \ |
|---|
| 285 | --tty=$(NB_TTYS) \ |
|---|
| 286 | --fbf=$(FBF_WIDTH) \ |
|---|
| 287 | --ioc=$(IOC_TYPE) \ |
|---|
| 288 | --giet=. \ |
|---|
| 289 | --$(APP) \ |
|---|
| 290 | --xml=. |
|---|
| 291 | # mcopy -o -i $(DISK_IMAGE) map.bin ::/ |
|---|
| 292 | |
|---|
| 293 | ### drivers compilation |
|---|
| 294 | build/drivers/cma_driver.o: giet_drivers/cma_driver.c \ |
|---|
| 295 | giet_drivers/cma_driver.h \ |
|---|
| 296 | hard_config.h \ |
|---|
| 297 | giet_config.h |
|---|
| 298 | $(CC) $(GIET_INCLUDE) $(CFLAGS) -c -o $@ $< |
|---|
| 299 | |
|---|
| 300 | build/drivers/dma_driver.o: giet_drivers/dma_driver.c \ |
|---|
| 301 | giet_drivers/dma_driver.h \ |
|---|
| 302 | hard_config.h \ |
|---|
| 303 | giet_config.h |
|---|
| 304 | $(CC) $(GIET_INCLUDE) $(CFLAGS) -c -o $@ $< |
|---|
| 305 | |
|---|
| 306 | build/drivers/xcu_driver.o: giet_drivers/xcu_driver.c \ |
|---|
| 307 | giet_drivers/xcu_driver.h \ |
|---|
| 308 | hard_config.h \ |
|---|
| 309 | giet_config.h |
|---|
| 310 | $(CC) $(GIET_INCLUDE) $(CFLAGS) -c -o $@ $< |
|---|
| 311 | |
|---|
| 312 | build/drivers/bdv_driver.o: giet_drivers/bdv_driver.c \ |
|---|
| 313 | giet_drivers/bdv_driver.h \ |
|---|
| 314 | hard_config.h \ |
|---|
| 315 | giet_config.h |
|---|
| 316 | $(CC) $(GIET_INCLUDE) $(CFLAGS) -c -o $@ $< |
|---|
| 317 | |
|---|
| 318 | build/drivers/hba_driver.o: giet_drivers/hba_driver.c \ |
|---|
| 319 | giet_drivers/hba_driver.h \ |
|---|
| 320 | hard_config.h \ |
|---|
| 321 | giet_config.h |
|---|
| 322 | $(CC) $(GIET_INCLUDE) $(CFLAGS) -c -o $@ $< |
|---|
| 323 | |
|---|
| 324 | build/drivers/sdc_driver.o: giet_drivers/sdc_driver.c \ |
|---|
| 325 | giet_drivers/sdc_driver.h \ |
|---|
| 326 | hard_config.h \ |
|---|
| 327 | giet_config.h |
|---|
| 328 | $(CC) $(GIET_INCLUDE) $(CFLAGS) -c -o $@ $< |
|---|
| 329 | |
|---|
| 330 | build/drivers/spi_driver.o: giet_drivers/spi_driver.c \ |
|---|
| 331 | giet_drivers/spi_driver.h \ |
|---|
| 332 | hard_config.h \ |
|---|
| 333 | giet_config.h |
|---|
| 334 | $(CC) $(GIET_INCLUDE) $(CFLAGS) -c -o $@ $< |
|---|
| 335 | |
|---|
| 336 | build/drivers/rdk_driver.o: giet_drivers/rdk_driver.c \ |
|---|
| 337 | giet_drivers/rdk_driver.h \ |
|---|
| 338 | hard_config.h \ |
|---|
| 339 | giet_config.h |
|---|
| 340 | $(CC) $(GIET_INCLUDE) $(CFLAGS) -c -o $@ $< |
|---|
| 341 | |
|---|
| 342 | build/drivers/iob_driver.o: giet_drivers/iob_driver.c \ |
|---|
| 343 | giet_drivers/iob_driver.h \ |
|---|
| 344 | hard_config.h \ |
|---|
| 345 | giet_config.h |
|---|
| 346 | $(CC) $(GIET_INCLUDE) $(CFLAGS) -c -o $@ $< |
|---|
| 347 | |
|---|
| 348 | build/drivers/mmc_driver.o: giet_drivers/mmc_driver.c \ |
|---|
| 349 | giet_drivers/mmc_driver.h \ |
|---|
| 350 | hard_config.h \ |
|---|
| 351 | giet_config.h |
|---|
| 352 | $(CC) $(GIET_INCLUDE) $(CFLAGS) -c -o $@ $< |
|---|
| 353 | |
|---|
| 354 | build/drivers/mwr_driver.o: giet_drivers/mwr_driver.c \ |
|---|
| 355 | giet_drivers/mwr_driver.h \ |
|---|
| 356 | hard_config.h \ |
|---|
| 357 | giet_config.h |
|---|
| 358 | $(CC) $(GIET_INCLUDE) $(CFLAGS) -c -o $@ $< |
|---|
| 359 | |
|---|
| 360 | build/drivers/nic_driver.o: giet_drivers/nic_driver.c \ |
|---|
| 361 | giet_drivers/nic_driver.h \ |
|---|
| 362 | hard_config.h \ |
|---|
| 363 | giet_config.h |
|---|
| 364 | $(CC) $(GIET_INCLUDE) $(CFLAGS) -c -o $@ $< |
|---|
| 365 | |
|---|
| 366 | build/drivers/tim_driver.o: giet_drivers/tim_driver.c \ |
|---|
| 367 | giet_drivers/tim_driver.h \ |
|---|
| 368 | hard_config.h \ |
|---|
| 369 | giet_config.h |
|---|
| 370 | $(CC) $(GIET_INCLUDE) $(CFLAGS) -c -o $@ $< |
|---|
| 371 | |
|---|
| 372 | build/drivers/tty_driver.o: giet_drivers/tty_driver.c \ |
|---|
| 373 | giet_drivers/tty_driver.h \ |
|---|
| 374 | hard_config.h \ |
|---|
| 375 | giet_config.h |
|---|
| 376 | $(CC) $(GIET_INCLUDE) $(CFLAGS) -c -o $@ $< |
|---|
| 377 | |
|---|
| 378 | build/drivers/pic_driver.o: giet_drivers/pic_driver.c \ |
|---|
| 379 | giet_drivers/pic_driver.h \ |
|---|
| 380 | hard_config.h \ |
|---|
| 381 | giet_config.h |
|---|
| 382 | $(CC) $(GIET_INCLUDE) $(CFLAGS) -c -o $@ $< |
|---|
| 383 | |
|---|
| 384 | ################################ |
|---|
| 385 | ### drivers library compilation |
|---|
| 386 | build/drivers/libdrivers.a: $(DRIVERS_OBJS) |
|---|
| 387 | $(AR) -rcs $@ $(DRIVERS_OBJS) |
|---|
| 388 | |
|---|
| 389 | ########################## |
|---|
| 390 | ### common compilation |
|---|
| 391 | build/fat32/fat32.o: giet_fat32/fat32.c \ |
|---|
| 392 | giet_fat32/fat32.h \ |
|---|
| 393 | hard_config.h \ |
|---|
| 394 | giet_config.h |
|---|
| 395 | $(CC) $(GIET_INCLUDE) $(CFLAGS) -c -o $@ $< |
|---|
| 396 | |
|---|
| 397 | build/common/utils.o: giet_common/utils.c \ |
|---|
| 398 | giet_common/utils.h \ |
|---|
| 399 | hard_config.h \ |
|---|
| 400 | giet_config.h |
|---|
| 401 | $(CC) $(GIET_INCLUDE) $(CFLAGS) -c -o $@ $< |
|---|
| 402 | |
|---|
| 403 | build/common/kernel_locks.o: giet_common/kernel_locks.c \ |
|---|
| 404 | giet_common/kernel_locks.h \ |
|---|
| 405 | hard_config.h \ |
|---|
| 406 | giet_config.h |
|---|
| 407 | $(CC) $(GIET_INCLUDE) $(CFLAGS) -c -o $@ $< |
|---|
| 408 | |
|---|
| 409 | build/common/kernel_barriers.o: giet_common/kernel_barriers.c \ |
|---|
| 410 | giet_common/kernel_barriers.h \ |
|---|
| 411 | hard_config.h \ |
|---|
| 412 | giet_config.h |
|---|
| 413 | $(CC) $(GIET_INCLUDE) $(CFLAGS) -c -o $@ $< |
|---|
| 414 | |
|---|
| 415 | build/common/tty0.o: giet_common/tty0.c \ |
|---|
| 416 | giet_common/tty0.h \ |
|---|
| 417 | hard_config.h \ |
|---|
| 418 | giet_config.h |
|---|
| 419 | $(CC) $(GIET_INCLUDE) $(CFLAGS) -c -o $@ $< |
|---|
| 420 | |
|---|
| 421 | build/common/vmem.o: giet_common/vmem.c \ |
|---|
| 422 | giet_common/vmem.h \ |
|---|
| 423 | hard_config.h \ |
|---|
| 424 | giet_config.h |
|---|
| 425 | $(CC) $(GIET_INCLUDE) $(CFLAGS) -c -o $@ $< |
|---|
| 426 | |
|---|
| 427 | build/common/pmem.o: giet_common/pmem.c \ |
|---|
| 428 | giet_common/pmem.h \ |
|---|
| 429 | hard_config.h \ |
|---|
| 430 | giet_config.h |
|---|
| 431 | $(CC) $(GIET_INCLUDE) $(CFLAGS) -c -o $@ $< |
|---|
| 432 | |
|---|
| 433 | build/common/kernel_malloc.o: giet_common/kernel_malloc.c \ |
|---|
| 434 | giet_common/kernel_malloc.h \ |
|---|
| 435 | hard_config.h \ |
|---|
| 436 | giet_config.h |
|---|
| 437 | $(CC) $(GIET_INCLUDE) $(CFLAGS) -c -o $@ $< |
|---|
| 438 | |
|---|
| 439 | ######################## |
|---|
| 440 | ### boot compilation |
|---|
| 441 | ### Copy bootloader into sector 2 of disk image |
|---|
| 442 | |
|---|
| 443 | build/boot/boot.elf: $(BOOT_OBJS) \ |
|---|
| 444 | $(DISK_IMAGE) \ |
|---|
| 445 | giet_boot/boot.ld \ |
|---|
| 446 | build/drivers/libdrivers.a | build/boot |
|---|
| 447 | $(LD) -o $@ -T giet_boot/boot.ld $(BOOT_OBJS) -Lbuild/drivers -ldrivers |
|---|
| 448 | $(DU) -D $@ > $@.txt |
|---|
| 449 | dd if=$@ of=$(DISK_IMAGE) seek=2 conv=notrunc |
|---|
| 450 | |
|---|
| 451 | build/boot/boot.o: giet_boot/boot.c \ |
|---|
| 452 | giet_common/utils.h \ |
|---|
| 453 | giet_fat32/fat32.h \ |
|---|
| 454 | giet_common/vmem.h \ |
|---|
| 455 | hard_config.h \ |
|---|
| 456 | giet_config.h |
|---|
| 457 | $(CC) $(GIET_INCLUDE) $(CFLAGS) -c -o $@ $< |
|---|
| 458 | |
|---|
| 459 | build/boot/boot_entry.o: giet_boot/boot_entry.S \ |
|---|
| 460 | hard_config.h |
|---|
| 461 | $(CC) $(GIET_INCLUDE) $(CFLAGS) -c -o $@ $< |
|---|
| 462 | |
|---|
| 463 | ######################### |
|---|
| 464 | ### kernel compilation |
|---|
| 465 | build/kernel/kernel.elf: $(KERNEL_OBJS) \ |
|---|
| 466 | $(DISK_IMAGE) \ |
|---|
| 467 | giet_kernel/kernel.ld \ |
|---|
| 468 | build/drivers/libdrivers.a |
|---|
| 469 | $(LD) -o $@ -T giet_kernel/kernel.ld $(KERNEL_OBJS) -Lbuild/drivers -ldrivers |
|---|
| 470 | $(DU) -D $@ > $@.txt |
|---|
| 471 | mmd -o -i $(DISK_IMAGE) ::/build/kernel || true |
|---|
| 472 | # mcopy -o -i $(DISK_IMAGE) $@ ::/build/kernel |
|---|
| 473 | |
|---|
| 474 | build/kernel/%.o: giet_kernel/%.c \ |
|---|
| 475 | hard_config.h \ |
|---|
| 476 | giet_config.h |
|---|
| 477 | $(CC) $(GIET_INCLUDE) $(CFLAGS) -c -o $@ $< |
|---|
| 478 | |
|---|
| 479 | build/kernel/%.o: giet_kernel/%.s \ |
|---|
| 480 | hard_config.h \ |
|---|
| 481 | giet_config.h |
|---|
| 482 | $(CC) $(GIET_INCLUDE) $(CFLAGS) -c -o $@ $< |
|---|
| 483 | |
|---|
| 484 | ########################### |
|---|
| 485 | ### user libs compilation |
|---|
| 486 | build/libs/stdio.o: giet_libs/stdio.c \ |
|---|
| 487 | giet_libs/stdio.h \ |
|---|
| 488 | hard_config.h \ |
|---|
| 489 | giet_config.h |
|---|
| 490 | $(CC) $(CFLAGS) $(USER_INCLUDE) -c -o $@ $< |
|---|
| 491 | |
|---|
| 492 | build/libs/mwmr_channel.o: giet_libs/mwmr_channel.c \ |
|---|
| 493 | giet_libs/mwmr_channel.h \ |
|---|
| 494 | hard_config.h \ |
|---|
| 495 | giet_config.h |
|---|
| 496 | $(CC) $(CFLAGS) $(USER_INCLUDE) -c -o $@ $< |
|---|
| 497 | |
|---|
| 498 | build/libs/malloc.o: giet_libs/malloc.c \ |
|---|
| 499 | giet_libs/malloc.h \ |
|---|
| 500 | hard_config.h \ |
|---|
| 501 | giet_config.h |
|---|
| 502 | $(CC) $(CFLAGS) $(USER_INCLUDE) -c -o $@ $< |
|---|
| 503 | |
|---|
| 504 | build/libs/user_barrier.o: giet_libs/user_barrier.c \ |
|---|
| 505 | giet_libs/user_barrier.h \ |
|---|
| 506 | hard_config.h \ |
|---|
| 507 | giet_config.h |
|---|
| 508 | $(CC) $(CFLAGS) $(USER_INCLUDE) -c -o $@ $< |
|---|
| 509 | |
|---|
| 510 | build/libs/stdlib.o: giet_libs/stdlib.c \ |
|---|
| 511 | giet_libs/stdlib.h \ |
|---|
| 512 | hard_config.h \ |
|---|
| 513 | giet_config.h |
|---|
| 514 | $(CC) $(CFLAGS) $(USER_INCLUDE) -c -o $@ $< |
|---|
| 515 | |
|---|
| 516 | build/libs/string.o: giet_libs/string.c \ |
|---|
| 517 | giet_libs/string.h \ |
|---|
| 518 | hard_config.h \ |
|---|
| 519 | giet_config.h |
|---|
| 520 | $(CC) $(CFLAGS) $(USER_INCLUDE) -c -o $@ $< |
|---|
| 521 | |
|---|
| 522 | build/libs/user_lock.o: giet_libs/user_lock.c \ |
|---|
| 523 | giet_libs/user_lock.h \ |
|---|
| 524 | hard_config.h \ |
|---|
| 525 | giet_config.h |
|---|
| 526 | $(CC) $(CFLAGS) $(USER_INCLUDE) -c -o $@ $< |
|---|
| 527 | |
|---|
| 528 | build/libs/user_sqt_lock.o: giet_libs/user_sqt_lock.c \ |
|---|
| 529 | giet_libs/user_sqt_lock.h \ |
|---|
| 530 | giet_libs/user_lock.h \ |
|---|
| 531 | hard_config.h \ |
|---|
| 532 | giet_config.h |
|---|
| 533 | $(CC) $(CFLAGS) $(USER_INCLUDE) -c -o $@ $< |
|---|
| 534 | |
|---|
| 535 | build/libs/libmath.a: $(MATH_OBJ) |
|---|
| 536 | $(AR) -rcs $@ $^ |
|---|
| 537 | |
|---|
| 538 | build/libs/math/%.o: giet_libs/math/%.c giet_libs/math/math_private.h giet_libs/math.h |
|---|
| 539 | $(CC) $(CFLAGS) $(USER_INCLUDE) -c -o $@ $< |
|---|
| 540 | |
|---|
| 541 | ######################################## |
|---|
| 542 | ### display application compilation |
|---|
| 543 | build/display/display.elf: $(DISPLAY_OBJS) applications/display/display.ld hard_config.h $(DISK_IMAGE) |
|---|
| 544 | $(LD) -o $@ -T applications/display/display.ld $(DISPLAY_OBJS) |
|---|
| 545 | $(DU) -D $@ > $@.txt |
|---|
| 546 | mmd -o -i $(DISK_IMAGE) ::/build/display || true |
|---|
| 547 | # mcopy -o -i $(DISK_IMAGE) $@ ::/build/display |
|---|
| 548 | |
|---|
| 549 | build/display/main.o: applications/display/main.c hard_config.h |
|---|
| 550 | $(CC) $(USER_INCLUDE) $(CFLAGS) -c -o $@ $< |
|---|
| 551 | |
|---|
| 552 | ######################################## |
|---|
| 553 | ### router compilation |
|---|
| 554 | build/router/router.elf: $(ROUTER_OBJS) applications/router/router.ld hard_config.h $(DISK_IMAGE) |
|---|
| 555 | $(LD) -o $@ -T applications/router/router.ld $(ROUTER_OBJS) |
|---|
| 556 | $(DU) -D $@ > $@.txt |
|---|
| 557 | mmd -o -i $(DISK_IMAGE) ::/build/router || true |
|---|
| 558 | # mcopy -o -i $(DISK_IMAGE) $@ ::/build/router |
|---|
| 559 | |
|---|
| 560 | build/router/main.o: applications/router/main.c hard_config.h |
|---|
| 561 | $(CC) $(USER_INCLUDE) $(CFLAGS) -c -o $@ $< |
|---|
| 562 | |
|---|
| 563 | ######################################## |
|---|
| 564 | ### hello compilation |
|---|
| 565 | build/hello/hello.elf: $(HELLO_OBJS) applications/hello/hello.ld hard_config.h $(DISK_IMAGE) |
|---|
| 566 | $(LD) -o $@ -T applications/hello/hello.ld $(HELLO_OBJS) |
|---|
| 567 | $(DU) -D $@ > $@.txt |
|---|
| 568 | mmd -o -i $(DISK_IMAGE) ::/build/hello || true |
|---|
| 569 | # mcopy -o -i $(DISK_IMAGE) $@ ::/build/hello |
|---|
| 570 | |
|---|
| 571 | build/hello/main.o: applications/hello/main.c hard_config.h |
|---|
| 572 | $(CC) $(USER_INCLUDE) $(CFLAGS) -c -o $@ $< |
|---|
| 573 | |
|---|
| 574 | ######################################## |
|---|
| 575 | ### pgcd compilation |
|---|
| 576 | build/pgcd/pgcd.elf: $(PGCD_OBJS) applications/pgcd/pgcd.ld hard_config.h $(DISK_IMAGE) |
|---|
| 577 | $(LD) -o $@ -T applications/pgcd/pgcd.ld $(PGCD_OBJS) |
|---|
| 578 | $(DU) -D $@ > $@.txt |
|---|
| 579 | mmd -o -i $(DISK_IMAGE) ::/build/pgcd || true |
|---|
| 580 | # mcopy -o -i $(DISK_IMAGE) $@ ::/build/pgcd |
|---|
| 581 | |
|---|
| 582 | build/pgcd/main.o: applications/pgcd/main.c hard_config.h |
|---|
| 583 | $(CC) $(USER_INCLUDE) $(CFLAGS) -c -o $@ $< |
|---|
| 584 | |
|---|
| 585 | ######################################## |
|---|
| 586 | ### gameoflife compilation |
|---|
| 587 | build/gameoflife/gameoflife.elf: $(GAMEOFLIFE_OBJS) applications/gameoflife/gameoflife.ld $(DISK_IMAGE) |
|---|
| 588 | $(LD) -o $@ -T applications/gameoflife/gameoflife.ld $(GAMEOFLIFE_OBJS) |
|---|
| 589 | $(DU) -D $@ > $@.txt |
|---|
| 590 | mmd -o -i $(DISK_IMAGE) ::/build/gameoflife || true |
|---|
| 591 | # mcopy -o -i $(DISK_IMAGE) $@ ::/build/gameoflife |
|---|
| 592 | |
|---|
| 593 | build/gameoflife/main.o: applications/gameoflife/main.c |
|---|
| 594 | $(CC) $(USER_INCLUDE) $(CFLAGS) -O3 -c -o $@ $< |
|---|
| 595 | |
|---|
| 596 | ######################################## |
|---|
| 597 | ### dhrystone compilation |
|---|
| 598 | build/dhrystone/dhrystone.elf: $(DHRYSTONE_OBJS) applications/dhrystone/dhrystone.ld hard_config.h $(DISK_IMAGE) |
|---|
| 599 | $(LD) -o $@ -T applications/dhrystone/dhrystone.ld $(DHRYSTONE_OBJS) |
|---|
| 600 | $(DU) -D $@ > $@.txt |
|---|
| 601 | mmd -o -i $(DISK_IMAGE) ::/build/dhrystone || true |
|---|
| 602 | # mcopy -o -i $(DISK_IMAGE) $@ ::/build/dhrystone |
|---|
| 603 | |
|---|
| 604 | build/dhrystone/dhry_1.o: applications/dhrystone/dhry_1.c hard_config.h |
|---|
| 605 | $(CC) $(USER_INCLUDE) $(CFLAGS) -c -o $@ $< |
|---|
| 606 | |
|---|
| 607 | build/dhrystone/dhry_2.o: applications/dhrystone/dhry_2.c hard_config.h |
|---|
| 608 | $(CC) $(USER_INCLUDE) $(CFLAGS) -c -o $@ $< |
|---|
| 609 | |
|---|
| 610 | ######################################## |
|---|
| 611 | ### sort compilation |
|---|
| 612 | build/sort/sort.elf: $(SORT_OBJS) applications/sort/sort.ld hard_config.h $(DISK_IMAGE) |
|---|
| 613 | $(LD) -o $@ -T applications/sort/sort.ld $(SORT_OBJS) |
|---|
| 614 | $(DU) -D $@ > $@.txt |
|---|
| 615 | mmd -o -i $(DISK_IMAGE) ::/build/sort || true |
|---|
| 616 | # mcopy -o -i $(DISK_IMAGE) $@ ::/build/sort |
|---|
| 617 | |
|---|
| 618 | build/sort/main.o: applications/sort/main.c hard_config.h |
|---|
| 619 | $(CC) $(USER_INCLUDE) $(CFLAGS) -c -o $@ $< |
|---|
| 620 | |
|---|
| 621 | ######################################## |
|---|
| 622 | ### transpose compilation |
|---|
| 623 | build/transpose/transpose.elf: $(TRANSPOSE_OBJS) applications/transpose/transpose.ld hard_config.h $(DISK_IMAGE) |
|---|
| 624 | $(LD) -o $@ -T applications/transpose/transpose.ld $(TRANSPOSE_OBJS) |
|---|
| 625 | $(DU) -D $@ > $@.txt |
|---|
| 626 | mmd -o -i $(DISK_IMAGE) ::/build/transpose || true |
|---|
| 627 | # mcopy -o -i $(DISK_IMAGE) $@ ::/build/transpose |
|---|
| 628 | |
|---|
| 629 | build/transpose/main.o: applications/transpose/main.c hard_config.h |
|---|
| 630 | $(CC) $(USER_INCLUDE) $(CFLAGS) -c -o $@ $< |
|---|
| 631 | |
|---|
| 632 | ######################################## |
|---|
| 633 | ### convol compilation |
|---|
| 634 | build/convol/convol.elf: $(CONVOL_OBJS) applications/convol/convol.ld hard_config.h $(DISK_IMAGE) |
|---|
| 635 | $(LD) -o $@ -T applications/convol/convol.ld $(CONVOL_OBJS) |
|---|
| 636 | $(DU) -D $@ > $@.txt |
|---|
| 637 | mmd -o -i $(DISK_IMAGE) ::/build/convol || true |
|---|
| 638 | # mcopy -o -i $(DISK_IMAGE) $@ ::/build/convol |
|---|
| 639 | |
|---|
| 640 | build/convol/main.o: applications/convol/main.c hard_config.h |
|---|
| 641 | $(CC) $(USER_INCLUDE) $(CFLAGS) -O0 -c -o $@ $< |
|---|
| 642 | |
|---|
| 643 | ######################################## |
|---|
| 644 | ### classif compilation |
|---|
| 645 | build/classif/classif.elf: $(CLASSIF_OBJS) applications/classif/classif.ld hard_config.h $(DISK_IMAGE) |
|---|
| 646 | $(LD) -o $@ -T applications/classif/classif.ld $(CLASSIF_OBJS) |
|---|
| 647 | $(DU) -D $@ > $@.txt |
|---|
| 648 | mmd -o -i $(DISK_IMAGE) ::/build/classif || true |
|---|
| 649 | # mcopy -o -i $(DISK_IMAGE) $@ ::/build/classif |
|---|
| 650 | |
|---|
| 651 | build/classif/main.o: applications/classif/main.c hard_config.h |
|---|
| 652 | $(CC) $(USER_INCLUDE) $(CFLAGS) -O0 -c -o $@ $< |
|---|
| 653 | |
|---|
| 654 | ######################################## |
|---|
| 655 | ### coproc compilation |
|---|
| 656 | build/coproc/coproc.elf: $(COPROC_OBJS) applications/coproc/coproc.ld hard_config.h $(DISK_IMAGE) |
|---|
| 657 | $(LD) -o $@ -T applications/coproc/coproc.ld $(COPROC_OBJS) |
|---|
| 658 | $(DU) -D $@ > $@.txt |
|---|
| 659 | mmd -o -i $(DISK_IMAGE) ::/build/coproc || true |
|---|
| 660 | # mcopy -o -i $(DISK_IMAGE) $@ ::/build/coproc |
|---|
| 661 | |
|---|
| 662 | build/coproc/main.o: applications/coproc/main.c |
|---|
| 663 | $(CC) $(USER_INCLUDE) $(CFLAGS) -O0 -c -o $@ $< |
|---|
| 664 | |
|---|
| 665 | ######################################## |
|---|
| 666 | ### ocean compilation |
|---|
| 667 | build/ocean/ocean.elf: applications/ocean/ocean.elf |
|---|
| 668 | mv $< $@ |
|---|
| 669 | $(DU) -D $@ > $@.txt |
|---|
| 670 | |
|---|
| 671 | applications/ocean/ocean.elf: $(OCEAN_OBJS) |
|---|
| 672 | cd applications/ocean/ && $(MAKE) |
|---|
| 673 | |
|---|
| 674 | ######################################## |
|---|
| 675 | ### clean |
|---|
| 676 | clean: |
|---|
| 677 | rm -f *.o *.elf *.bin *.txt core |
|---|
| 678 | rm -f hard_config.h giet_vsegs.ld map.bin map.xml |
|---|
| 679 | rm -rf build/ |
|---|
| 680 | cd applications/ocean && $(MAKE) clean |
|---|
| 681 | |
|---|
| 682 | clean-disk: |
|---|
| 683 | rm -f $(DISK_IMAGE) |
|---|