[bffb938] | 1 | # |
---|
| 2 | # Config file for the PC 386 BSP |
---|
| 3 | # |
---|
| 4 | # $Id$ |
---|
| 5 | # |
---|
| 6 | |
---|
| 7 | include $(RTEMS_ROOT)/make/custom/default.cfg |
---|
| 8 | |
---|
| 9 | RTEMS_CPU=i386 |
---|
[6d3ab0f] | 10 | ifeq ($(RTEMS_CPU_MODEL),) |
---|
[bffb938] | 11 | RTEMS_CPU_MODEL=i386_fp |
---|
[6d3ab0f] | 12 | endif |
---|
[bffb938] | 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 | # |
---|
[6d3ab0f] | 20 | # NOTE: CPU_CFLAGS is set by pc386 variants. |
---|
| 21 | # CPU_CFLAGS = |
---|
[bffb938] | 22 | |
---|
[0c642539] | 23 | # optimize flag: typically -O2 |
---|
[7d12e020] | 24 | CFLAGS_OPTIMIZE_V = -O2 -g |
---|
[bffb938] | 25 | |
---|
| 26 | # Here is the rule to actually build a $(ARCH)/foo.exe |
---|
| 27 | # It also builds $(ARCH)/foo.sr and $(ARCH)/foo.nm |
---|
| 28 | # Usage ref: src/tests/sptest/sp1/Makefile |
---|
| 29 | |
---|
| 30 | #+--------------------------------------------------------------------------+ |
---|
[96d56b3] | 31 | #| Set the value of RELOCADDR to the address where you want your image to |
---|
| 32 | #| load. If you'll be using GRUB to load the images it will have to be >= |
---|
| 33 | #| 0x100000 (1024K). If you are using NetBoot to load the images it can be |
---|
| 34 | #| >= 0x10000 (64K) AND <= 0x97C00 (607K) OR >= 0x100000 (1024K). The memory |
---|
| 35 | #| top is of course another limit. Make sure there is enough space before the |
---|
| 36 | #| upper memory limits for the image and the memory allocated by it to fit. |
---|
| 37 | #| Make sure the value you choose is aligned to 4 bytes. |
---|
[bffb938] | 38 | #+--------------------------------------------------------------------------+ |
---|
[96d56b3] | 39 | RELOCADDR=0x00100000 |
---|
| 40 | |
---|
[d6f28200] | 41 | START16FILE=$(PROJECT_RELEASE)/lib/start16$(LIB_VARIANT).bin |
---|
[2d7d605] | 42 | START16ADDR=0x00097C00 |
---|
[0e3c0096] | 43 | HEADERADDR=0x00097E00 |
---|
[bffb938] | 44 | |
---|
| 45 | # The following are definitions of make-exe which will work using ld as |
---|
[d2d3482] | 46 | # is currently required. |
---|
[bffb938] | 47 | |
---|
| 48 | define make-exe |
---|
[df49c60] | 49 | $(LINK.c) $(AM_CFLAGS) $(AM_LDFLAGS) -Wl,-Ttext,$(RELOCADDR) \ |
---|
[63606e2] | 50 | -o $(basename $@).elf \ |
---|
[98100d2] | 51 | $(LINK_OBJS) $(LINK_LIBS) |
---|
[9e7d42dd] | 52 | $(OBJCOPY) -O elf32-i386 \ |
---|
[5f92a6a3] | 53 | --remove-section=.rodata \ |
---|
| 54 | --remove-section=.comment \ |
---|
| 55 | --remove-section=.note \ |
---|
[63606e2] | 56 | --strip-unneeded $(basename $@).elf $@ |
---|
| 57 | $(OBJCOPY) -O binary $(basename $@).elf $(basename $@).bin |
---|
[96d56b3] | 58 | $(PROJECT_TOOLS)/bin2boot -v $(basename $@).bt $(HEADERADDR)\ |
---|
| 59 | $(START16FILE) $(START16ADDR) 0 $(basename $@).bin $(RELOCADDR) 0 |
---|
[63606e2] | 60 | $(NM) -g -n $(basename $@).elf > $(basename $@).num |
---|
| 61 | $(SIZE) $(basename $@).elf |
---|
[511374e4] | 62 | # test -d ${PROJECT_RELEASE}/BootImgs \ |
---|
| 63 | # || mkdir ${PROJECT_RELEASE}/BootImgs |
---|
| 64 | # f=`basename $@ .exe`; \ |
---|
| 65 | # cp $(basename $@).bt \ |
---|
| 66 | # ${PROJECT_RELEASE}/BootImgs/$${f}$(LIB_VARIANT).bt \ |
---|
| 67 | # && chmod 755 \ |
---|
| 68 | # ${PROJECT_RELEASE}/BootImgs/$${f}$(LIB_VARIANT).bt |
---|
| 69 | # $(LINK.c) $(AM_CFLAGS) $(AM_LDFLAGS) -Wl,-Ttext,$(RELOCADDR) \ |
---|
| 70 | # -o $@ $(LINK_OBJS) $(LINK_LIBS) |
---|
[bffb938] | 71 | endef |
---|
[9e7d42dd] | 72 | define make-cxx-exe |
---|
[df49c60] | 73 | $(LINK.cc) $(AM_CFLAGS) $(AM_CXXFLAGS) $(AM_LDFLAGS) \ |
---|
[63606e2] | 74 | -Wl,-Ttext,$(RELOCADDR) -o $(basename $@).elf \ |
---|
[9e7d42dd] | 75 | $(LINK_OBJS) $(LINK_LIBS) |
---|
| 76 | $(OBJCOPY) -O elf32-i386 \ |
---|
| 77 | --remove-section=.rodata \ |
---|
| 78 | --remove-section=.comment \ |
---|
| 79 | --remove-section=.note \ |
---|
[63606e2] | 80 | --strip-unneeded $(basename $@).elf $@ |
---|
| 81 | $(OBJCOPY) -O binary $(basename $@).elf $(basename $@).bin |
---|
[9e7d42dd] | 82 | $(PROJECT_TOOLS)/bin2boot -v $(basename $@).bt $(HEADERADDR)\ |
---|
| 83 | $(START16FILE) $(START16ADDR) 0 $(basename $@).bin $(RELOCADDR) 0 |
---|
[63606e2] | 84 | $(NM) -g -n $(basename $@).elf > $(basename $@).num |
---|
| 85 | $(SIZE) $(basename $@).elf |
---|
[9e7d42dd] | 86 | endef |
---|
[bffb938] | 87 | |
---|
| 88 | # Miscellaneous additions go here |
---|
[011677f] | 89 | |
---|
| 90 | # BSP-specific tools |
---|
| 91 | BIN2BOOT=$(PROJECT_TOOLS)/bin2boot |
---|