source: trunk/softs/tsar_boot/Makefile @ 286

Last change on this file since 286 was 286, checked in by cfuguet, 11 years ago

Fixing bug in boot_tty.c:

Use address of tty status when reading with the ioread32 function.

Makefile and ioc.c:
Introducing SYSCLK_FREQ environment variable to choose a clock frequency when
using FPGA platform. 50000000 Hz by default.

File size: 3.0 KB
RevLine 
[276]1ifndef  PLATFORM_DIR
2$(error please define PLATFORM_DIR 'make PLATFORM_DIR=foo')
3else
4TOOLS    := tools
5
6ELF2MIF  := $(TOOLS)/elf_read/elf_utils.x
7LD             := mipsel-unknown-elf-ld
8CC             := mipsel-unknown-elf-gcc
9AS             := mipsel-unknown-elf-as
10DU             := mipsel-unknown-elf-objdump
11RM             := rm -rf
12ECHO           := echo
13MKDIR          := mkdir
14DTC            := dtc
15HEXDUMP        := hexdump
16
17OBJS_DIR       := objs
18MIF_DIR        := mifs
19
20# =============================================================================
21# Include files paths
22# =============================================================================
23
24INCLUDE    += -I. -Iio_drivers -I$(PLATFORM_DIR)
25
26# =============================================================================
27# Paths of sources in another directories
28# =============================================================================
29
30VPATH      += io_drivers
31VPATH      += $(PLATFORM_DIR)
32
33# =============================================================================
34# Object files
35# =============================================================================
36
37S_SRCS     += reset.s
38
39C_SRCS     += spi.c
40C_SRCS     += sdcard.c
41C_SRCS     += ioc.c
42C_SRCS     += boot_tty.c
43C_SRCS     += boot_loader_entry.c
[281]44C_SRCS     += exceptions.c
[276]45
46OBJS       := $(subst .s,.o,$(S_SRCS))
47OBJS       += $(subst .c,.o,$(C_SRCS))
48OBJS       := $(addprefix $(OBJS_DIR)/, $(OBJS))
49
50TARGET     := bin.soft
51
52ifdef   SOCLIB
53DEFS+= -DSOCLIB_IOC
54DTS=platform_soclib.dts
55$(info Making for $(PLATFORM_DIR), SocLib variant)
56else
[286]57ifdef SYSCLK_FREQ
58DEFS+= -DSYSCLK_FREQ
59endif
[276]60DTS=platform_fpga.dts
61$(info Making for $(PLATFORM_DIR), FPGA variant)
62endif
63
64CFLAGS   := -Wall -mno-gpopt -ffreestanding -fomit-frame-pointer -mips32 \
65                    -ggdb -mlong-calls
66# =============================================================================
67# ALL target. If the MIF variable is defined, the $(MIF) file is generated
68# using the $(basename $(MIF))_tab.txt file
69
70
71all: $(TARGET)
72        if [ ! -z $(MIF) ]; then\
73                if [ ! -e $(MIF_DIR) ]; then\
74                        $(MKDIR) $(MIF_DIR);\
75                fi;\
76                $(ECHO) "[   MIF  ]     $(MIF)";\
77                $(ELF2MIF) \
78                        -ELF_FILE $(TARGET) \
79                        -SEG_FILE $(basename $(MIF))_tab.txt \
80                        -MIF_FILE $(MIF_DIR)/$(MIF);\
81        fi;
82
83$(TARGET): $(OBJS_DIR) $(OBJS) ldscript $(OBJS_DIR)/platform.ld
84        @\
85        $(ECHO) "[   LD   ]     $@"
86        $(LD) -o $@ -T ldscript $(OBJS)
87        $(DU) -D $@ > $@.txt
88
89$(OBJS_DIR)/platform.ld: $(OBJS_DIR)/platform.dtb
90        $(HEXDUMP) -v -e '"BYTE(0x" 1/1 "%02X" ")\n"' $< > $@
91
92$(OBJS_DIR)/platform.dtb: $(DTS)
93        ${DTC} -O dtb -o $@ $<
94
95$(OBJS_DIR):
96        $(MKDIR) $@
97
98clean:
99        $(RM) $(TARGET).txt $(TARGET) *~ $(OBJS_DIR)
100
101distclean: clean
102        $(RM) $(MIF_DIR)
103# =============================================================================
104# Implicit makefile rules
105
106$(OBJS_DIR)/%.o: %.c
107        @\
108        $(ECHO) "[   CC   ]     $(notdir $<)"
109        $(CC) $(DEFS) $(CFLAGS) $(INCLUDE) -c -o $@ $<
110        $(DU) -D $@ > $@.txt
111
112$(OBJS_DIR)/%.o: %.S
113        @\
114        $(ECHO) "[   AS   ]     $(notdir $<)"
115        $(CC) $(DEFS) ${INCLUDE} -g -mips32 -c -o $@ $<
116        $(DU) -D $@ > $@.txt
117
118
119.SILENT:
120endif
Note: See TracBrowser for help on using the repository browser.