OpenCores
URL https://opencores.org/ocsvn/amber/amber/trunk

Subversion Repositories amber

[/] [amber/] [trunk/] [sw/] [include/] [common.mk] - Blame information for rev 61

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 2 csantifort
# ----------------------------------------------------------------
2
#                                                               //
3
#   common.mk                                                   //
4
#                                                               //
5
#   This file is part of the Amber project                      //
6
#   http://www.opencores.org/project,amber                      //
7
#                                                               //
8
#   Description                                                 //
9
#   Contains common makefile code.                              //
10
#                                                               //
11
#   Author(s):                                                  //
12
#       - Conor Santifort, csantifort.amber@gmail.com           //
13
#                                                               //
14
#/ ///////////////////////////////////////////////////////////////
15
#                                                               //
16
#  Copyright (C) 2010 Authors and OPENCORES.ORG                 //
17
#                                                               //
18
#  This source file may be used and distributed without         //
19
#  restriction provided that this copyright statement is not    //
20
#  removed from the file and that any derivative work contains  //
21
#  the original copyright notice and the associated disclaimer. //
22
#                                                               //
23
#  This source file is free software; you can redistribute it   //
24
#  and/or modify it under the terms of the GNU Lesser General   //
25
#  Public License as published by the Free Software Foundation; //
26
#  either version 2.1 of the License, or (at your option) any   //
27
#  later version.                                               //
28
#                                                               //
29
#  This source is distributed in the hope that it will be       //
30
#  useful, but WITHOUT ANY WARRANTY; without even the implied   //
31
#  warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR      //
32
#  PURPOSE.  See the GNU Lesser General Public License for more //
33
#  details.                                                     //
34
#                                                               //
35
#  You should have received a copy of the GNU Lesser General    //
36
#  Public License along with this source; if not, download it   //
37
#  from http://www.opencores.org/lgpl.shtml                     //
38
#                                                               //
39
# ----------------------------------------------------------------
40
 
41
LIBC_OBJ         = ../mini-libc/printf.o ../mini-libc/libc_asm.o ../mini-libc/memcpy.o
42
DEP             += ../include/amber_registers.h ../mini-libc/stdio.h
43
TOOLSPATH        = ../tools
44
AMBER_CROSSTOOL ?= amber-crosstool-not-defined
45
 
46 36 csantifort
  AS    = $(AMBER_CROSSTOOL)-as
47
  CC    = $(AMBER_CROSSTOOL)-gcc
48
 CXX    = $(AMBER_CROSSTOOL)-g++
49
  AR    = $(AMBER_CROSSTOOL)-ar
50
  LD    = $(AMBER_CROSSTOOL)-ld
51
  DS    = $(AMBER_CROSSTOOL)-objdump
52
  OC    = $(AMBER_CROSSTOOL)-objcopy
53
 ELF    = $(TOOLSPATH)/amber-elfsplitter
54
 BMF32  = ../tools/amber-memparams32.sh
55
 BMF128 = ../tools/amber-memparams128.sh
56 2 csantifort
 
57 36 csantifort
 MMP32  = $(addsuffix _memparams32.v, $(basename $(TGT)))
58
 MMP128 = $(addsuffix _memparams128.v, $(basename $(TGT)))
59
 MEM    = $(addsuffix .mem, $(basename $(TGT)))
60
 DIS    = $(addsuffix .dis, $(basename $(TGT)))
61 43 csantifort
 FLT    = $(addsuffix .flt, $(basename $(TGT)))
62 2 csantifort
 
63
ifdef USE_MINI_LIBC
64
 OBJ = $(addsuffix .o,   $(basename $(SRC))) $(LIBC_OBJ)
65
else
66
 OBJ = $(addsuffix .o,   $(basename $(SRC)))
67
endif
68
 
69
ifdef LDS
70
    TLDS = -T $(LDS)
71
else
72
    TLDS =
73
endif
74
 
75
ifndef TGT
76
    TGT = aout.elf
77
endif
78
 
79
ifdef MIN_SIZE
80
    # optimize for size
81
    OPTIMIZE = -Os
82
else
83
    # optimize for speed
84 31 csantifort
    OPTIMIZE = -O3
85 2 csantifort
endif
86
 
87
 MAP = $(addsuffix .map, $(basename $(TGT)))
88
 
89
 ASFLAGS = -I../include
90
  CFLAGS = -c $(OPTIMIZE) -march=armv2a -mno-thumb-interwork -ffreestanding -I../include
91
 DSFLAGS = -C -S -EL
92
 LDFLAGS = -Bstatic -Map $(MAP) --strip-debug --fix-v4bx
93
 
94
ifdef USE_MINI_LIBC
95 36 csantifort
debug:  mini-libc $(ELF) $(MMP32) $(MMP128) $(DIS)
96 2 csantifort
else
97 61 csantifort
debug:  $(ELF) $(MMP32) $(MMP128) $(DIS)
98 2 csantifort
endif
99
 
100 36 csantifort
$(MMP32): $(MEM)
101
        $(BMF32) $(MEM) $(MMP32)
102 2 csantifort
 
103 36 csantifort
$(MMP128): $(MEM)
104
        $(BMF128) $(MEM) $(MMP128)
105
 
106 2 csantifort
$(MEM): $(TGT)
107
        $(ELF) $(TGT) > $(MEM)
108
 
109
$(TGT): $(OBJ)
110 43 csantifort
ifdef CREATE_FLT_OUTPUT
111
        $(LD) $(LDFLAGS) -elf2flt=-v -elf2flt=-k -o $(FLT) $(TLDS) $(OBJ)
112
endif
113 2 csantifort
        $(LD) $(LDFLAGS) -o $(TGT) $(TLDS) $(OBJ)
114
        $(OC) -R .comment -R .note $(TGT)
115 61 csantifort
ifdef CHANGE_ADDRESS
116
        $(OC) --change-addresses -0x1000000 $(TGT)
117
endif
118 2 csantifort
 
119
$(OBJ): $(DEP)
120
 
121
mini-libc:
122 31 csantifort
        $(MAKE) -s -C ../mini-libc MIN_SIZE=1
123 2 csantifort
 
124
$(ELF):
125 31 csantifort
        $(MAKE) -s -C $(TOOLSPATH)
126 2 csantifort
 
127
$(DIS): $(TGT)
128
        $(DS) $(DSFLAGS) $^ > $@
129
 
130
clean:
131 43 csantifort
        @rm -rfv *.o *.elf *.flt *.gdb *.dis *.map *.mem *.v $(MMP32) $(MMP128)
132 2 csantifort
 

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.