source: trunk/softs/tsar_boot/Makefile @ 483

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

Modifications in tsar_boot:

  • Creating new files boot_utils.[c h] containing the memcpy, memset and some ELF format debug functions
  • Introducing assert in the boot_elf_loader to show an error when some of segments to load conflicts with some of the pre-loader segments
  • Cosmetic changes in boot_elf_loader to improve code readibility
  • Fixing bug in dcache_buf_invalidate function used by boot_ioc_read when cache coherence not supported. The condition in the for loop was erroneous.
  • Modification in Makefile: The SYSCLK_FREQ parameter is not passed anymore

as a Makefile parameter but it is definesd in the defs_platform.h file

File size: 3.0 KB
Line 
1# let the user have a default configuration (ie for PLATFORM_DIR and SOCLIB)
2-include ./build.mk
3
4MAKECMDGOALS ?= none
5
6ifneq ($(MAKECMDGOALS),$(filter $(MAKECMDGOALS),clean distclean clean-doc doc))
7  ifndef PLATFORM_DIR
8    $(error please define PLATFORM_DIR 'make PLATFORM_DIR=foo')
9  else
10    ifdef SOCLIB
11      DEFS+= -DSOCLIB_IOC
12      DTS=platform_soclib.dts
13      $(info Making for $(PLATFORM_DIR), SocLib variant)
14    else
15      DTS=platform_fpga.dts
16      $(info Making for $(PLATFORM_DIR), FPGA variant)
17    endif
18  endif
19endif
20
21LD             := mipsel-unknown-elf-ld
22CC             := mipsel-unknown-elf-gcc
23AS             := mipsel-unknown-elf-as
24DU             := mipsel-unknown-elf-objdump
25RM             := rm -rf
26ECHO       := echo
27MKDIR      := mkdir
28DTC            := dtc
29HEXDUMP    := hexdump
30DOXYGEN    := doxygen
31
32BUILD_DIR  := build
33SRCS_DIR   := src
34INCS_DIR   := include
35
36# =============================================================================
37# Include files paths
38# =============================================================================
39
40INCLUDE    += -I. -I$(INCS_DIR) -I$(PLATFORM_DIR)
41
42# =============================================================================
43# Paths of sources in another directories
44# =============================================================================
45
46VPATH      += $(SRCS_DIR)
47VPATH      += $(PLATFORM_DIR)
48
49# =============================================================================
50# Object files
51# =============================================================================
52
53CFLAGS     := -Wall -mno-gpopt -ffreestanding -fomit-frame-pointer -mips32 \
54                      -ggdb -mlong-calls -Werror
55
56C_SRCS     := boot_elf_loader.c boot_ioc.c boot_utils.c boot_tty.c exceptions.c
57
58ifndef SOCLIB
59  C_SRCS   += sdcard.c spi.c
60endif
61
62S_SRCS     := reset.S
63
64OBJS       := $(subst .c,.o, $(notdir $(C_SRCS)))
65OBJS       += $(subst .S,.o, $(notdir $(S_SRCS)))
66OBJS       := $(addprefix $(BUILD_DIR)/, $(OBJS))
67
68TARGET     := bin.soft
69
70USE_DT     ?= 1
71
72all: $(TARGET)
73
74$(TARGET): $(BUILD_DIR) $(OBJS) $(PLATFORM_DIR)/ldscript $(BUILD_DIR)/platform.ld
75        $(ECHO) "[   LD    ]     $@"
76        $(LD) -o $@ -T $(PLATFORM_DIR)/ldscript $(OBJS)
77        $(DU) -D $@ > $@.txt
78
79ifeq ($(USE_DT), 1)
80$(BUILD_DIR)/platform.ld: $(BUILD_DIR)/platform.dtb
81        $(ECHO) "[ HEXDUMP ]     $(notdir $<)"
82        $(HEXDUMP) -v -e '"BYTE(0x" 1/1 "%02X" ")\n"' $< > $@
83else
84$(BUILD_DIR)/platform.ld:
85        $(ECHO) "[  TOUCH  ]     $(notdir $@)"
86        touch $@
87endif
88
89$(BUILD_DIR)/platform.dtb: $(DTS)
90        $(ECHO) "[   DTC   ]     $(notdir $<)"
91        ${DTC} -O dtb -o $@ $< &> /dev/null
92
93$(BUILD_DIR):
94        $(MKDIR) $@
95
96doc: Doxyfile
97        $(DOXYGEN) Doxyfile
98
99clean:
100        $(RM) $(TARGET).txt $(TARGET) *~ $(BUILD_DIR)
101
102clean-doc:
103        $(RM) doc
104
105distclean: clean clean-doc
106
107# =============================================================================
108# Implicit makefile rules
109
110$(BUILD_DIR)/%.o: %.c
111        $(ECHO) "[   CC    ]     $(notdir $<)"
112        $(CC) $(DEFS) $(CFLAGS) $(INCLUDE) -c -o $@ $<
113        $(DU) -D $@ > $@.txt
114
115$(BUILD_DIR)/%.o: %.S
116        $(ECHO) "[   AS    ]     $(notdir $<)"
117        $(CC) $(DEFS) ${INCLUDE} -g -mips32 -c -o $@ $<
118        $(DU) -D $@ > $@.txt
119
120.SILENT:
Note: See TracBrowser for help on using the repository browser.