source: rtems/c/src/lib/libbsp/i386/pc386/make/custom/pc386.cfg @ 5e368e84

5
Last change on this file since 5e368e84 was 5e368e84, checked in by Joel Sherrill <joel@…>, on 03/11/16 at 22:07:35

pc386: Fix linker usage issues with -r and function sections

closes #2638.

  • Property mode set to 100644
File size: 2.0 KB
Line 
1#
2#  Config file for the PC 386 BSP
3#
4
5include $(RTEMS_ROOT)/make/custom/default.cfg
6
7RTEMS_CPU=i386
8ifeq ($(RTEMS_CPU_MODEL),)
9RTEMS_CPU_MODEL=i386_fp
10endif
11
12#  This contains the compiler options necessary to select the CPU model
13#  and (hopefully) optimize for it.
14#
15# NOTE: CPU_CFLAGS is set by pc386 variants.
16ifeq ($(CPU_CFLAGS),)
17  CPU_CFLAGS = -mtune=i386
18endif
19
20# optimize flag: typically -O2
21CFLAGS_OPTIMIZE_V = -O2 -g
22# Per function sections disabled per https://devel.rtems.org/ticket/2638
23CFLAGS_OPTIMIZE_V += -ffunction-sections -fdata-sections
24 
25LDFLAGS = -Wl,--gc-sections
26
27# Here is the rule to actually build a $(ARCH)/foo$(EXEEXT)
28# It also builds $(ARCH)/foo.sr and $(ARCH)/foo.nm
29# Usage ref: src/tests/sptest/sp1/Makefile
30
31#+--------------------------------------------------------------------------+
32#| Set the value of RELOCADDR to the address where you want your image to
33#| load. If you'll be using GRUB to load the images it will have to be >=
34#| 0x100000 (1024K). If you are using NetBoot to load the images it can be
35#| >= 0x10000 (64K) AND <= 0x97C00 (607K) OR >= 0x100000 (1024K). The memory
36#| top is of course another limit. Make sure there is enough space before the
37#| upper memory limits for the image and the memory allocated by it to fit.
38#| Make sure the value you choose is aligned to 4 bytes.
39#+--------------------------------------------------------------------------+
40  RELOCADDR=0x00100000
41
42START16FILE=$(PROJECT_RELEASE)/lib/start16$(LIB_VARIANT).bin
43START16ADDR=0x00097C00
44HEADERADDR=0x00097E00
45
46LDFLAGS += -Wl,-Ttext,$(RELOCADDR)
47
48define bsp-post-link
49        $(default-bsp-post-link)
50        $(OBJCOPY) -O elf32-i386 \
51            --remove-section=.comment \
52            --remove-section=.note \
53            --strip-unneeded $(basename $@)$(EXEEXT) $(basename $@).nxe
54        $(OBJCOPY) -O binary $(basename $@).nxe $(basename $@).bin
55        $(PROJECT_TOOLS)/bin2boot -v $(basename $@)$(DOWNEXT) $(HEADERADDR)\
56          $(START16FILE) $(START16ADDR) 0 $(basename $@).bin $(RELOCADDR) 0
57        rm -f $(basename $@).nxe
58endef
59
60# BSP-specific tools
61BIN2BOOT=$(PROJECT_TOOLS)/bin2boot
Note: See TracBrowser for help on using the repository browser.