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

Subversion Repositories amber

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

Go to most recent revision | 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 2 csantifort
 
62
ifdef USE_MINI_LIBC
63
 OBJ = $(addsuffix .o,   $(basename $(SRC))) $(LIBC_OBJ)
64
else
65
 OBJ = $(addsuffix .o,   $(basename $(SRC)))
66
endif
67
 
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
 
95
ifdef USE_MINI_LIBC
96 36 csantifort
debug:  mini-libc $(ELF) $(MMP32) $(MMP128) $(DIS)
97 2 csantifort
else
98
debug:  $(ELF) $(MMP) $(DIS)
99
endif
100
 
101 36 csantifort
$(MMP32): $(MEM)
102
        $(BMF32) $(MEM) $(MMP32)
103 2 csantifort
 
104 36 csantifort
$(MMP128): $(MEM)
105
        $(BMF128) $(MEM) $(MMP128)
106
 
107 2 csantifort
$(MEM): $(TGT)
108
        $(ELF) $(TGT) > $(MEM)
109
 
110
$(TGT): $(OBJ)
111
        $(LD) $(LDFLAGS) -o $(TGT) $(TLDS) $(OBJ)
112
        $(OC) -R .comment -R .note $(TGT)
113
 
114
$(OBJ): $(DEP)
115
 
116
mini-libc:
117 31 csantifort
        $(MAKE) -s -C ../mini-libc MIN_SIZE=1
118 2 csantifort
 
119
$(ELF):
120 31 csantifort
        $(MAKE) -s -C $(TOOLSPATH)
121 2 csantifort
 
122
$(DIS): $(TGT)
123
        $(DS) $(DSFLAGS) $^ > $@
124
 
125
clean:
126 36 csantifort
        @rm -rfv *.o *.elf *.dis *.map *.mem *.v $(MMP32) $(MMP128)
127 2 csantifort
 

powered by: WebSVN 2.1.0

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