summaryrefslogtreecommitdiffstats
path: root/make/custom/pc386.cfg
blob: 8bf4440012c61c9bcede7e5abb5d86955fde0ccf (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
#
#  Config file for the PC 386 BSP
#
#  $Id$
#

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

RTEMS_CPU=i386
ifeq ($(RTEMS_CPU_MODEL),)
RTEMS_CPU_MODEL=i386_fp
endif

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

#  This contains the compiler options necessary to select the CPU model
#  and (hopefully) optimize for it. 
#
# NOTE: CPU_CFLAGS is set by pc386 variants.
# CPU_CFLAGS = 

# optimize flag: typically -0, could use -O4 or -fast
# -O4 is ok for RTEMS
# -fomit-frame-pointer breaks debugging and C++ exceptions
CFLAGS_OPTIMIZE_V=-O4

#  This section makes the target dependent options file.

#  RTEMS_TEST_NO_PAUSE (RTEMS tests)
#     do not pause between screens of output in the rtems tests
#

define make-target-options
	@echo "/* #define RTEMS_TEST_NO_PAUSE 1 */"         >>$@
endef

# Here is the rule to actually build a $(ARCH)/foo.exe
# It also builds $(ARCH)/foo.sr and $(ARCH)/foo.nm
# Usage ref: src/tests/sptest/sp1/Makefile

#+--------------------------------------------------------------------------+
#| Set the value of RELOCADDR to the address where you want your image to
#| load. If you'll be using GRUB to load the images it will have to be >=
#| 0x100000 (1024K). If you are using NetBoot to load the images it can be
#| >= 0x10000 (64K) AND <= 0x97C00 (607K) OR >= 0x100000 (1024K). The memory
#| top is of course another limit. Make sure there is enough space before the
#| upper memory limits for the image and the memory allocated by it to fit.
#| Make sure the value you choose is aligned to 4 bytes.
#+--------------------------------------------------------------------------+
  RELOCADDR=0x00100000

START16FILE=$(PROJECT_RELEASE)/lib/start16$(LIB_VARIANT).bin
START16ADDR=0x00097C00
HEADERADDR=0x00097E00

# 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)
define make-exe
	$(LD) -N -T $(LINKCMDS) -Ttext $(RELOCADDR) -e start -nostdlib \
           -o $(basename $@).obj \
	   $(START_FILE) $(LINK_OBJS) --start-group $(LINK_LIBS) --end-group
	$(OBJCOPY) -O a.out-i386 \
	    --remove-section=.rodata \
	    --remove-section=.comment \
	    --remove-section=.note \
	    --strip-unneeded $(basename $@).obj $@
	$(OBJCOPY) -O binary $(basename $@).obj $(basename $@).bin
	$(BIN2BOOT) -v $(basename $@).bt $(HEADERADDR)\
	  $(START16FILE) $(START16ADDR) 0 $(basename $@).bin $(RELOCADDR) 0
	$(NM) -g -n $(basename $@).obj > $(basename $@).num
	$(SIZE) $(basename $@).obj
	test -d ${PROJECT_RELEASE}/BootImgs \
	  || mkdir ${PROJECT_RELEASE}/BootImgs
        cp $(basename $@).bt \
	    ${PROJECT_RELEASE}/BootImgs/$(basename $@)$(LIB_VARIANT).bt
	chmod 755 \
	  ${PROJECT_RELEASE}/BootImgs/$(basename $@)$(LIB_VARIANT).bt 
endef
else
define make-exe
	$(LINK.c) $(AM_CFLAGS) $(AM_LDFLAGS) -Wl,-Ttext,$(RELOCADDR) \
	    -o $(basename $@).obj \
	    $(LINK_OBJS) $(LINK_LIBS)
	$(OBJCOPY) -O elf32-i386 \
	    --remove-section=.rodata \
	    --remove-section=.comment \
	    --remove-section=.note \
	    --strip-unneeded $(basename $@).obj $@
	$(OBJCOPY) -O binary $(basename $@).obj $(basename $@).bin
	$(PROJECT_TOOLS)/bin2boot -v $(basename $@).bt $(HEADERADDR)\
	  $(START16FILE) $(START16ADDR) 0 $(basename $@).bin $(RELOCADDR) 0
	$(NM) -g -n $(basename $@).obj > $(basename $@).num
	$(SIZE) $(basename $@).obj
	test -d ${PROJECT_RELEASE}/BootImgs \
	  || mkdir ${PROJECT_RELEASE}/BootImgs
	f=`basename $@ .exe`; \
        cp $(basename $@).bt \
	    ${PROJECT_RELEASE}/BootImgs/$${f}$(LIB_VARIANT).bt \
	&& chmod 755 \
	  ${PROJECT_RELEASE}/BootImgs/$${f}$(LIB_VARIANT).bt 
	$(LINK.c) $(AM_CFLAGS) $(AM_LDFLAGS) -Wl,-Ttext,$(RELOCADDR) \
	    -o $@ $(LINK_OBJS) $(LINK_LIBS)
endef
define make-cxx-exe
	$(LINK.cc) $(AM_CFLAGS) $(AM_CXXFLAGS) $(AM_LDFLAGS) \
	   -Wl,-Ttext,$(RELOCADDR) -o $(basename $@).obj \
	    $(LINK_OBJS) $(LINK_LIBS)
	$(OBJCOPY) -O elf32-i386 \
	    --remove-section=.rodata \
	    --remove-section=.comment \
	    --remove-section=.note \
	    --strip-unneeded $(basename $@).obj $@
	$(OBJCOPY) -O binary $(basename $@).obj $(basename $@).bin
	$(PROJECT_TOOLS)/bin2boot -v $(basename $@).bt $(HEADERADDR)\
	  $(START16FILE) $(START16ADDR) 0 $(basename $@).bin $(RELOCADDR) 0
	$(NM) -g -n $(basename $@).obj > $(basename $@).num
	$(SIZE) $(basename $@).obj
	test -d ${PROJECT_RELEASE}/BootImgs \
	  || mkdir ${PROJECT_RELEASE}/BootImgs
	f=`basename $@ .exe`; \
        cp $(basename $@).bt \
	    ${PROJECT_RELEASE}/BootImgs/$${f}$(LIB_VARIANT).bt \
	&& chmod 755 \
	  ${PROJECT_RELEASE}/BootImgs/$${f}$(LIB_VARIANT).bt 
	$(LINK.cc) $(AM_CFLAGS) $(AM_CXXFLAGS) $(AM_LDFLAGS) \
	    -Wl,-Ttext,$(RELOCADDR) \
	    -o $(basename $@).coff $(LINK_OBJS) $(LINK_LIBS)
endef
endif

# Miscellaneous additions go here

# BSP-specific tools
BIN2BOOT=$(PROJECT_TOOLS)/bin2boot