| 1 |
30 |
unneback |
#
|
| 2 |
|
|
# Config file for the PC 386 BSP
|
| 3 |
|
|
#
|
| 4 |
|
|
# $Id: pc386.cfg,v 1.2 2001-09-27 12:02:52 chris Exp $
|
| 5 |
|
|
#
|
| 6 |
|
|
|
| 7 |
|
|
include $(RTEMS_ROOT)/make/custom/default.cfg
|
| 8 |
|
|
|
| 9 |
|
|
RTEMS_CPU=i386
|
| 10 |
|
|
ifeq ($(RTEMS_CPU_MODEL),)
|
| 11 |
|
|
RTEMS_CPU_MODEL=i386_fp
|
| 12 |
|
|
endif
|
| 13 |
|
|
|
| 14 |
|
|
# This is the actual bsp directory used during the build process.
|
| 15 |
|
|
RTEMS_BSP_FAMILY=pc386
|
| 16 |
|
|
|
| 17 |
|
|
# This contains the compiler options necessary to select the CPU model
|
| 18 |
|
|
# and (hopefully) optimize for it.
|
| 19 |
|
|
#
|
| 20 |
|
|
# NOTE: CPU_CFLAGS is set by pc386 variants.
|
| 21 |
|
|
# CPU_CFLAGS =
|
| 22 |
|
|
|
| 23 |
|
|
# optimize flag: typically -0, could use -O4 or -fast
|
| 24 |
|
|
# -O4 is ok for RTEMS
|
| 25 |
|
|
# -fomit-frame-pointer breaks debugging and C++ exceptions
|
| 26 |
|
|
CFLAGS_OPTIMIZE_V=-O4
|
| 27 |
|
|
|
| 28 |
|
|
# This section makes the target dependent options file.
|
| 29 |
|
|
|
| 30 |
|
|
# NDEBUG (C library)
|
| 31 |
|
|
# if defined asserts do not generate code. This is commonly used
|
| 32 |
|
|
# as a command line option.
|
| 33 |
|
|
#
|
| 34 |
|
|
# RTEMS_TEST_NO_PAUSE (RTEMS tests)
|
| 35 |
|
|
# do not pause between screens of output in the rtems tests
|
| 36 |
|
|
#
|
| 37 |
|
|
# RTEMS_DEBUG (RTEMS)
|
| 38 |
|
|
# If defined, debug checks in RTEMS and support library code are enabled.
|
| 39 |
|
|
|
| 40 |
|
|
define make-target-options
|
| 41 |
|
|
@echo "/* #define NDEBUG 1 */ " >>$@
|
| 42 |
|
|
@echo "/* #define RTEMS_TEST_NO_PAUSE 1 */" >>$@
|
| 43 |
|
|
@echo "/* #define RTEMS_DEBUG 1 */" >>$@
|
| 44 |
|
|
endef
|
| 45 |
|
|
|
| 46 |
|
|
# Here is the rule to actually build a $(ARCH)/foo.exe
|
| 47 |
|
|
# It also builds $(ARCH)/foo.sr and $(ARCH)/foo.nm
|
| 48 |
|
|
# Usage ref: src/tests/sptest/sp1/Makefile
|
| 49 |
|
|
|
| 50 |
|
|
#+--------------------------------------------------------------------------+
|
| 51 |
|
|
#| Set the value of RELOCADDR to the address where you want your image to
|
| 52 |
|
|
#| load. If you'll be using GRUB to load the images it will have to be >=
|
| 53 |
|
|
#| 0x100000 (1024K). If you are using NetBoot to load the images it can be
|
| 54 |
|
|
#| >= 0x10000 (64K) AND <= 0x97C00 (607K) OR >= 0x100000 (1024K). The memory
|
| 55 |
|
|
#| top is of course another limit. Make sure there is enough space before the
|
| 56 |
|
|
#| upper memory limits for the image and the memory allocated by it to fit.
|
| 57 |
|
|
#| Make sure the value you choose is aligned to 4 bytes.
|
| 58 |
|
|
#+--------------------------------------------------------------------------+
|
| 59 |
|
|
RELOCADDR=0x00100000
|
| 60 |
|
|
|
| 61 |
|
|
START16FILE=$(PROJECT_RELEASE)/lib/start16$(LIB_VARIANT).bin
|
| 62 |
|
|
START16ADDR=0x00097C00
|
| 63 |
|
|
HEADERADDR=0x00097E00
|
| 64 |
|
|
|
| 65 |
|
|
# The following are definitions of make-exe which will work using ld as
|
| 66 |
|
|
# is currently required. It is expected that as of gcc 2.8, the end user
|
| 67 |
|
|
# will be able to override parts of the compilers specs and link using gcc.
|
| 68 |
|
|
|
| 69 |
|
|
ifeq ($(RTEMS_USE_GCC272),yes)
|
| 70 |
|
|
define make-exe
|
| 71 |
|
|
$(LD) -N -T $(LINKCMDS) -Ttext $(RELOCADDR) -e start -nostdlib \
|
| 72 |
|
|
-o $(basename $@).obj \
|
| 73 |
|
|
$(START_FILE) $(LINK_OBJS) --start-group $(LINK_LIBS) --end-group
|
| 74 |
|
|
$(OBJCOPY) -O a.out-i386 \
|
| 75 |
|
|
--remove-section=.rodata \
|
| 76 |
|
|
--remove-section=.comment \
|
| 77 |
|
|
--remove-section=.note \
|
| 78 |
|
|
--strip-unneeded $(basename $@).obj $@
|
| 79 |
|
|
$(OBJCOPY) -O binary $(basename $@).obj $(basename $@).bin
|
| 80 |
|
|
$(BIN2BOOT) -v $(basename $@).bt $(HEADERADDR)\
|
| 81 |
|
|
$(START16FILE) $(START16ADDR) 0 $(basename $@).bin $(RELOCADDR) 0
|
| 82 |
|
|
$(NM) -g -n $(basename $@).obj > $(basename $@).num
|
| 83 |
|
|
$(SIZE) $(basename $@).obj
|
| 84 |
|
|
test -d ${PROJECT_RELEASE}/BootImgs \
|
| 85 |
|
|
|| mkdir ${PROJECT_RELEASE}/BootImgs
|
| 86 |
|
|
cp $(basename $@).bt \
|
| 87 |
|
|
${PROJECT_RELEASE}/BootImgs/$(basename $@)$(LIB_VARIANT).bt
|
| 88 |
|
|
chmod 755 \
|
| 89 |
|
|
${PROJECT_RELEASE}/BootImgs/$(basename $@)$(LIB_VARIANT).bt
|
| 90 |
|
|
endef
|
| 91 |
|
|
else
|
| 92 |
|
|
define make-exe
|
| 93 |
|
|
$(LINK.c) $(AM_CFLAGS) $(AM_LDFLAGS) -Wl,-Ttext,$(RELOCADDR) \
|
| 94 |
|
|
-o $(basename $@).obj \
|
| 95 |
|
|
$(LINK_OBJS) $(LINK_LIBS)
|
| 96 |
|
|
$(OBJCOPY) -O elf32-i386 \
|
| 97 |
|
|
--remove-section=.rodata \
|
| 98 |
|
|
--remove-section=.comment \
|
| 99 |
|
|
--remove-section=.note \
|
| 100 |
|
|
--strip-unneeded $(basename $@).obj $@
|
| 101 |
|
|
$(OBJCOPY) -O binary $(basename $@).obj $(basename $@).bin
|
| 102 |
|
|
$(PROJECT_TOOLS)/bin2boot -v $(basename $@).bt $(HEADERADDR)\
|
| 103 |
|
|
$(START16FILE) $(START16ADDR) 0 $(basename $@).bin $(RELOCADDR) 0
|
| 104 |
|
|
$(NM) -g -n $(basename $@).obj > $(basename $@).num
|
| 105 |
|
|
$(SIZE) $(basename $@).obj
|
| 106 |
|
|
test -d ${PROJECT_RELEASE}/BootImgs \
|
| 107 |
|
|
|| mkdir ${PROJECT_RELEASE}/BootImgs
|
| 108 |
|
|
f=`basename $@ .exe`; \
|
| 109 |
|
|
cp $(basename $@).bt \
|
| 110 |
|
|
${PROJECT_RELEASE}/BootImgs/$${f}$(LIB_VARIANT).bt \
|
| 111 |
|
|
&& chmod 755 \
|
| 112 |
|
|
${PROJECT_RELEASE}/BootImgs/$${f}$(LIB_VARIANT).bt
|
| 113 |
|
|
$(LINK.c) $(AM_CFLAGS) $(AM_LDFLAGS) -Wl,-Ttext,$(RELOCADDR) \
|
| 114 |
|
|
-o $@ $(LINK_OBJS) $(LINK_LIBS)
|
| 115 |
|
|
endef
|
| 116 |
|
|
define make-cxx-exe
|
| 117 |
|
|
$(LINK.cc) $(AM_CFLAGS) $(AM_CXXFLAGS) $(AM_LDFLAGS) \
|
| 118 |
|
|
-Wl,-Ttext,$(RELOCADDR) -o $(basename $@).obj \
|
| 119 |
|
|
$(LINK_OBJS) $(LINK_LIBS)
|
| 120 |
|
|
$(OBJCOPY) -O elf32-i386 \
|
| 121 |
|
|
--remove-section=.rodata \
|
| 122 |
|
|
--remove-section=.comment \
|
| 123 |
|
|
--remove-section=.note \
|
| 124 |
|
|
--strip-unneeded $(basename $@).obj $@
|
| 125 |
|
|
$(OBJCOPY) -O binary $(basename $@).obj $(basename $@).bin
|
| 126 |
|
|
$(PROJECT_TOOLS)/bin2boot -v $(basename $@).bt $(HEADERADDR)\
|
| 127 |
|
|
$(START16FILE) $(START16ADDR) 0 $(basename $@).bin $(RELOCADDR) 0
|
| 128 |
|
|
$(NM) -g -n $(basename $@).obj > $(basename $@).num
|
| 129 |
|
|
$(SIZE) $(basename $@).obj
|
| 130 |
|
|
test -d ${PROJECT_RELEASE}/BootImgs \
|
| 131 |
|
|
|| mkdir ${PROJECT_RELEASE}/BootImgs
|
| 132 |
|
|
f=`basename $@ .exe`; \
|
| 133 |
|
|
cp $(basename $@).bt \
|
| 134 |
|
|
${PROJECT_RELEASE}/BootImgs/$${f}$(LIB_VARIANT).bt \
|
| 135 |
|
|
&& chmod 755 \
|
| 136 |
|
|
${PROJECT_RELEASE}/BootImgs/$${f}$(LIB_VARIANT).bt
|
| 137 |
|
|
$(LINK.cc) $(AM_CFLAGS) $(AM_CXXFLAGS) $(AM_LDFLAGS) \
|
| 138 |
|
|
-Wl,-Ttext,$(RELOCADDR) \
|
| 139 |
|
|
-o $(basename $@).coff $(LINK_OBJS) $(LINK_LIBS)
|
| 140 |
|
|
endef
|
| 141 |
|
|
endif
|
| 142 |
|
|
|
| 143 |
|
|
# Miscellaneous additions go here
|
| 144 |
|
|
|
| 145 |
|
|
# BSP-specific tools
|
| 146 |
|
|
BIN2BOOT=$(PROJECT_TOOLS)/bin2boot
|