summaryrefslogtreecommitdiffstats
path: root/make/custom/mbx8xx.cfg
blob: b4566046e1e6fa4ef0e50d13b5454191b125f081 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
#
#  Config file for a PowerPC MPC821- or MPC860-based MBX card
#
#  This file is derived from:
#
#  Config file for a PowerPC 403 based helas403 card
#  Config file for MPC860 based Ethernet Comm Board
#

include $(RTEMS_ROOT)/make/custom/default.cfg

RTEMS_CPU=powerpc
RTEMS_CPU_MODEL=mpc8xx

# This is the actual bsp directory used during the build process.
RTEMS_BSP_FAMILY=mbx8xx

# The value assigned to RTEMS_CPU, RTEMS_CPU_MODEL and RTEMS_BSP get
# #defined in targopts.h. Source code can switch on these values with #ifdef
# to select what code to compile for a specific CPU family member and specific
# board. The RTEMS_CPU_MODEL is also used as the name of the libcpu directory,
# while the RTEMS_BSP_FAMILY is used as the name of the libbsp directory.
# For the MBX860 and MBX821, the boards and processors are sufficiently
# similar that the ports are unified and use RTEMS_CPU_MODEL=mpc8xx and
# RTEMS_BSP_FAMILY=mbx8xx. Because there are minor differences in the CPUs
# and the boards, it is necessary to specify them fully during the build.
# Do a "make RTEMS_BSP=<your_board> <target>" See below for a list of valid
# values for <your_board>.

ifeq ($(findstring mbx821,$(RTEMS_MBX_MODEL)),mbx821)
CPU_TYPE=821
else
ifeq ($(findstring mbx860,$(RTEMS_MBX_MODEL)),mbx860)
CPU_TYPE=860
else
RTEMS_BSP = mbx860_002
RTEMS_MBX_MODEL = mbx860_002
TARGET_ARCH=o-mbx860_002
CPU_TYPE=860
endif # mbx860
endif # mbx821

#  This section makes the target dependent options file.
#
#  Note that RTEMS_BSP matches the RTEMS_MBX_MODEL. Its value must be
#  defined in targopts.h, so the few places that require different code
#  for different MBX models can be distinguished. The value of
#  RTEMS_BSP is already defined in targopts.h and is one of:
#     mbx860_001    mbx821_001
#     mbx860_002    mbx821_002
#     mbx860_003    mbx821_003
#     mbx860_004    mbx821_004
#     mbx860_005    mbx821_005
#     mbx860_001b   mbx821_001b
#     mbx860_002b   mbx821_002b
#     mbx860_003b   mbx821_003b
#     mbx860_004b   mbx821_004b
#     mbx860_005b   mbx821_005b
#     mbx860_006b   mbx821_006b

#  The specific CPU model is defined, so the few places that require
#  different code for the MPC860 and MPC821 can be distinguished.
#  Either mpc860 or mpc821 is defined.
#
#  MBX8xx-specific options:
#
#  NVRAM_CONFIGURE
#    Define to 1 if you want the console driver, network driver and caches
#    configured at boot time from parameters stored in NVRAM. If set to 1,
#    most parameters below are ignored during the build. If not set to 1,
#    then the console driver is configured at build time, the network host
#    information is obtained from application supplied data structures, and
#    the caches are configured at boot time based on the information supplied
#    in this file.
#
#  UARTS_USE_TERMIOS
#    Define to 1 if you want termios support for every port.
#    Termios support is independent of the choice of UART I/O mode.
#
#  CONSOLE_MINOR (BSP--console driver)
#    Must be defined to be one of SMC1_MINOR, SMC2_MINOR, SCC2_MINOR,
#    SCC3_MINOR, or SCC4_MINOR. Determines which device will be registered
#    as /dev/console.
#
#  UARTS_IO_MODE (BSP--console driver)
#    Define to 0 or 1 if you want polled I/O performed by RTEMS.
#    Define to 1 if you want interrupt-driven performed by RTEMS.
#    Define to 2 if you want polled I/O performed by EPPCBug.
#    There is no provision to have a mix of interrupt-driven and polled I/O
#    ports, except that the printk port may use a different mode from the
#    other ports. If this is done, do not open the printk port from an RTEMS
#    application. With EPPCBug 1.1, if mode 2 is selected, CONSOLE_MINOR must
#    be set to SMC1_MINOR. This is a deficiency of the firmware: it does not
#    perform serial I/O on any port other than its default debug port, which
#    must be SMC1.
#
#  PRINTK_MINOR (BSP--console driver)
#    Must be defined to be one of SMC1_MINOR, SMC2_MINOR, SCC2_MINOR,
#    SCC3_MINOR, or SCC4_MINOR. Determines which device is used for output
#    by printk(). If the port that printk() uses is also used for other I/O
#    (e.g. if  PRINTK_MINOR == CONSOLE_MINOR), then both ports should use
#    the same type of I/O, otherwise the drivers will likely conflict with
#    each other.
#
#  PRINTK_IO_MODE (BSP--console driver)
#    Define to 0 or 1 if you want polled I/O performed by RTEMS.
#    Define to 2 if you want polled I/O performed by EPPCBug.
#    The printk() port is not configured to use termios. With EPPCBug 1.1,
#    if mode 2 is selected, PRINTK_MINOR must be set to SMC1_MINOR.
#    This is a deficiency of the firmware: it does not perform serial I/O
#    on any port other than its default debug port, which must be SMC1.
#    Printk always uses polled output.
#
#  EPPCBUG_SMC1 (BSP--console driver)
#    If defined, SMC1 is in use by EPPC-Bug. The console driver will not
#    re-initialize that port.
#
#  INSTRUCTION_CACHE_ENABLE (BSP--RTEMS)
#    If defined, the instruction cache will be enabled after address translation
#    is turned on.
#
#  DATA_CACHE_ENABLE (BSP--RTEMS)
#    If defined, the data cache will be enabled after address translation
#    is turned on. 
#    
#  EPPCBUG_VECTORS (BSP--RTEMS)
#    If defined, vectors branch to EPPCBug, except the following: 
#    0x500 (external interrupt), 0x900 (decrementer).
#
#  PowerPC-specific options:
#       
#  PPC_USE_SPRG (RTEMS PowerPC port)
#     If defined (=1), then the PowerPC specific code in RTEMS will use some
#     of the special purpose registers to slightly optimize interrupt
#     response time.  The use of these registers can conflict with 
#     other tools like debuggers.  This should be 0 when using EPPCBug 
#     because its uses most SPRGs (do not believe the documentation!).
#
#  PPC_USE_DATA_CACHE (RTEMS PowerPC port)
#     If defined, then the PowerPC specific code in RTEMS will use 
#     data cache instructions to optimize the context switch code.
#     This code can conflict with debuggers or emulators.

define make-target-options
	@echo "#ifdef mpc$(CPU_TYPE)"                       >>$@
	@echo "#undef mpc$(CPU_TYPE)"                       >>$@
	@echo "#endif"                                      >>$@
	@echo "#define mpc$(CPU_TYPE) 1"                    >>$@
	@echo                                               >>$@
	@echo "#define NVRAM_CONFIGURE 1"                   >>$@
	@echo "#define UARTS_USE_TERMIOS 0"                 >>$@
	@echo "#define CONSOLE_MINOR SMC2_MINOR"            >>$@
	@echo "#define UARTS_IO_MODE 0"                     >>$@
	@echo "#define PRINTK_MINOR SMC2_MINOR"             >>$@
	@echo "#define PRINTK_IO_MODE 0"                    >>$@
	@echo "#define EPPCBUG_SMC1 1"                      >>$@
	@echo "#define EPPCBUG_VECTORS 1"                   >>$@
	@echo "#define INSTRUCTION_CACHE_ENABLE 1"          >>$@
	@echo "#define DATA_CACHE_ENABLE 1"                 >>$@
	@echo                                               >>$@
	@echo "#define PPC_VECTOR_FILE_BASE 0x0000"         >>$@
	@echo "#define PPC_USE_SPRG 0"                      >>$@
	@echo "#define PPC_USE_DATA_CACHE 1"                >>$@
	@echo                                               >>$@
endef

#  This contains the compiler options necessary to select the CPU model
#  and (hopefully) optimize for it.
#
CPU_CFLAGS = -mcpu=$(CPU_TYPE)

CFLAGS_DEBUG_V += -ggdb
CXXFLAGS_DEBUG_V += -ggdb

# optimize flag: typically -O, could use -O4 or -fast
# -O4 is ok for RTEMS
# NOTE: some level of -O may be actually required by inline assembler
# CFLAGS_OPTIMIZE_V=-O4 -fno-keep-inline-functions
CFLAGS_OPTIMIZE_V=-O4 -fno-keep-inline-functions
CXXFLAGS_OPTIMIZE_V=-O4

# The following are definitions of make-exe which will work using ld as
# is currently required.  It is expected that as of gcc 2.8, the end user
# will be able to override parts of the compilers specs and link using gcc.

ifeq ($(RTEMS_USE_GCC272),yes)
# The --defsym arguments define arguments which are required by the linkcmds
# file which is designed for gcc 2.8
define make-exe
	$(LD) $(XLDFLAGS) -T $(LINKCMDS) -o $(basename $@)_sym.exe \
	    --defsym __fini=0 --defsym __init=0 \
	    -u atexit -u __vectors -u start \
	    $(START_FILE) $(LINK_OBJS) --start-group $(LINK_LIBS) --end-group
	$(NM) -g -n $(basename $@)_sym.exe> $(basename $@).nm
	$(STRIP) -o $(basename $@).exe $(basename $@)_sym-exe
	$(SIZE) $(basename $@)_sym.exe
endef
else
define make-exe
	$(LINK.c) $(AM_CFLAGS) $(AM_LDFLAGS) $(MBX8xx_LDFLAGS) \
	    -o $(basename $@)_sym.exe $(LINK_OBJS) $(LINK_LIBS)
	$(NM) -g -n $(basename $@)_sym.exe > $(basename $@).nm
	$(STRIP) -o $(basename $@).exe $(basename $@)_sym.exe
	$(SIZE) $(basename $@)_sym.exe
endef
endif

# Miscellaneous additions go here

# Override default start file
START_BASE=