summaryrefslogtreecommitdiffstats
path: root/hello_world_ada
diff options
context:
space:
mode:
authorJoel Sherrill <joel.sherrill@OARcorp.com>2007-09-27 14:40:55 +0000
committerJoel Sherrill <joel.sherrill@OARcorp.com>2007-09-27 14:40:55 +0000
commitdb9a1d193035dde6cba8fe4123dc23def5462962 (patch)
treebbb3f5c46b2345f4489a5f615f5031f6ffbdf893 /hello_world_ada
parent2007-09-27 Joel Sherrill <joel.sherrill@oarcorp.com> (diff)
downloadada-examples-db9a1d193035dde6cba8fe4123dc23def5462962.tar.bz2
2007-09-27 Joel Sherrill <joel.sherrill@oarcorp.com>
* README: New tests. Clean up. Rework so all tests use the same shared Makefile for the hard logic of producing an executable. * Makefile, pc386-elf2boot: New files. * Makefile.anybsp: Removed.
Diffstat (limited to 'hello_world_ada')
-rw-r--r--hello_world_ada/ChangeLog7
-rw-r--r--hello_world_ada/Makefile25
-rw-r--r--hello_world_ada/Makefile.anybsp75
-rw-r--r--hello_world_ada/README29
-rwxr-xr-xhello_world_ada/pc386-elf2boot57
5 files changed, 92 insertions, 101 deletions
diff --git a/hello_world_ada/ChangeLog b/hello_world_ada/ChangeLog
index 7e8ff74..e1aefc2 100644
--- a/hello_world_ada/ChangeLog
+++ b/hello_world_ada/ChangeLog
@@ -1,3 +1,10 @@
+2007-09-27 Joel Sherrill <joel.sherrill@oarcorp.com>
+
+ * README: New tests. Clean up. Rework so all tests use the same shared
+ Makefile for the hard logic of producing an executable.
+ * Makefile, pc386-elf2boot: New files.
+ * Makefile.anybsp: Removed.
+
2007-09-17 Joel Sherrill <joel.sherrill@oarcorp.com>
* Makefile.anybsp: pc86 now builds with Makefile.anybsp.
diff --git a/hello_world_ada/Makefile b/hello_world_ada/Makefile
new file mode 100644
index 0000000..8602dcb
--- /dev/null
+++ b/hello_world_ada/Makefile
@@ -0,0 +1,25 @@
+#
+# Makefile for Ada Dump URL example
+#
+# See README.Makefiles in the main ada-examples directory.
+#
+
+PROGRAM=hello
+
+include $(RTEMS_MAKEFILE_PATH)/Makefile.inc
+include $(RTEMS_CUSTOM)
+include $(PROJECT_ROOT)/make/leaf.cfg
+
+# stack size for the first Ada thread
+CFLAGS +=-DGNAT_MAIN_STACKSPACE=100
+
+# initialize the network stack -- assumes existence of networkconfig.h
+# CFLAGS +=-DMAIN_USE_NETWORKING=1
+
+# Should we prompt for command line arguments?
+# DEFINES +=-DMAIN_USE_REQUIRES_COMMAND_LINE
+
+# If you want to hard-code the command line, define this to a string
+# DEFINES += -DMAIN_COMMAND_LINE="ARGS"
+
+include ../Makefile.shared
diff --git a/hello_world_ada/Makefile.anybsp b/hello_world_ada/Makefile.anybsp
deleted file mode 100644
index 2d6972f..0000000
--- a/hello_world_ada/Makefile.anybsp
+++ /dev/null
@@ -1,75 +0,0 @@
-#
-# Makefile for Ada sockets example
-#
-# Directly produces an executable for a BSP which directly runs
-# the format (usually ELF) produced by just linking an application.
-# There are a couple of BSP families which require just a bit of
-# assistance that this Makefile knows about -- gen5200 and pc386.
-# The executables produced by this Makefile should run on at least the
-# following BSPs:
-# arm/edb7312
-# i386/pc386
-# mips/jmr3904
-# powerpc/icecube
-# powerpc/psim
-# powerpc/score603e
-# sparc/erc32
-# sparc/leon2
-# sparc/leon3
-#
-# Some BSPs require extra manipulation of the ELF file before it can
-# be run on the target hardware.
-#
-
-PROGRAM=hello
-
-include $(RTEMS_MAKEFILE_PATH)/Makefile.inc
-include $(RTEMS_CUSTOM)
-include $(PROJECT_ROOT)/make/leaf.cfg
-
-# GEN5200 Specific Information
-ifeq ($(RTEMS_BSP_FAMILY),gen5200)
- LINKARGS+=-qnolinkcmds -T$(RTEMS_LINKCMDS)
-endif
-
-# PC386 Specific Information
-ifeq ($(RTEMS_BSP_FAMILY),pc386)
- HEADERADDR=0x00097E00
- START16FILE=$(RTEMS_MAKEFILE_PATH)/lib/start16.bin
- START16ADDR=0x00097C00
- RELOCADDR=0x00100000
- LINKARGS+= -Wl,-Ttext,$(RELOCADDR)
-endif
-
-# Tool helpers
-GNATMAKE=$(AS:as=gnatmake)
-CARGS =-B${RTEMS_MAKEFILE_PATH}/lib/ -specs bsp_specs -qrtems $(CPU_CFLAGS)
-CARGS+=-DGNAT_MAIN_STACKSPACE=100
-
-all: $(PROGRAM)
-
-$(PROGRAM): init.o *.adb
- $(GNATMAKE) -v -O -gnata -gnatE -gnato $(@) -g \
- -I../src \
- -bargs -Mgnat_main \
- -largs $(CARGS) $(LINKARGS) init.o
- $(SIZE) $(@)
-ifeq ($(RTEMS_BSP_FAMILY),pc386)
- mv $(@) $(@).obj
- $(OBJCOPY) -O elf32-i386 \
- --remove-section=.rodata \
- --remove-section=.comment \
- --remove-section=.note \
- --strip-unneeded $(@).obj $(@)
- $(OBJCOPY) -O binary $(@).obj $(@).bin
- $(RTEMS_MAKEFILE_PATH)/build-tools/bin2boot -v $(@).bt $(HEADERADDR) \
- $(START16FILE) $(START16ADDR) 0 $(@).bin $(RELOCADDR) 0
-else
-endif
-
-init.o: init.c
- $(CC) $(CFLAGS) $(CPU_CFLAGS) -c init.c
-
-clean:
- rm -f b~*.* *.o *.ali $(EXAMPLES)
- rm -f *.num *.exe *.obj *.bin *.bt
diff --git a/hello_world_ada/README b/hello_world_ada/README
index a57bfda..cdf926f 100644
--- a/hello_world_ada/README
+++ b/hello_world_ada/README
@@ -2,31 +2,8 @@
# $Id$
#
-The Makefile.anybsp can be used to compile and link an executable
-for most BSPs. Some BSPs require extra transformation in order to
-download and those may require their own Makefile (e.g. pc386).
+This directory contains a hello world Ada example program.
-The following is an example of how to build this test:
-
-export RTEMS_MAKEFILE_PATH=/home/joel/rtems-4.8-work/bsp-install/CPU-rtems4.8/BSP/
-make -f Makefile.anybsp clean all
-
-This procedure has been used on the following BSPs:
-
- arm/edb7312
- bfin/eZKit533
- m68k/mcf5206elite
- mips/jmr3904
- powerpc/gen5200
- powerpc/psim
- sparc/erc32
- sparc/leon2
- sparc/leon3
- sparc/sis
-
-For the i386/pc386 BSP, you need to use the other Makefile.pc386 similar
-to the following:
-
-export RTEMS_MAKEFILE_PATH=/home/joel/rtems-4.8-work/bsp-install/i386-rtems4.8/pc386/
-make -f Makefile.pc386 clean all
+See the README.Makefiles in the top directory for instructions
+on building for most BSPs.
diff --git a/hello_world_ada/pc386-elf2boot b/hello_world_ada/pc386-elf2boot
new file mode 100755
index 0000000..05d9258
--- /dev/null
+++ b/hello_world_ada/pc386-elf2boot
@@ -0,0 +1,57 @@
+#! /bin/sh
+#
+# Script for pc386 BSP to convert ELF files to GRUB bootable images
+#
+
+if [ "X${RTEMS_MAKEFILE_PATH}" = "X" ] ; then
+ echo RTEMS_MAKEFILE_PATH is not set
+ exit 1
+fi
+
+BSPINC=${RTEMS_MAKEFILE_PATH}/Makefile.inc
+if [ ! -r ${BSPINC} ] ; then
+ echo "${BSPINC} does not exist."
+ echo "Is your BSP installed?"
+ exit 1
+fi
+
+OBJCOPY=`grep ^OBJCOPY_FOR_TARGET ${BSPINC} | cut -d'=' -f2`
+
+set -x
+
+if [ $# -ne 2 ] ; then
+ echo "Usage: $0 elf_file boot_file"
+ exit 1
+fi
+if [ ! -r ${BSPINC} ] ; then
+ echo "${BSPINC} does not exist."
+ echo "Is your BSP installed?"
+ exit 1
+fi
+
+echo ${OBJCOPY}
+elf=${1}
+bt=${2}
+
+tmpbin=${elf}.bin
+tmpbin=${elf}.bin
+exit 0
+
+# Constants for relocating
+HEADERADDR=0x00097E00
+START16FILE=$(RTEMS_MAKEFILE_PATH)/lib/start16.bin
+START16ADDR=0x00097C00
+RELOCADDR=0x00100000
+
+# Tool helpers
+${OBJCOPY} -O elf32-i386 \
+ --remove-section=.rodata \
+ --remove-section=.comment \
+ --remove-section=.note \
+ --strip-unneeded ${MAIN}.obj $@
+${OBJCOPY} -O binary ${MAIN}.obj ${MAIN}.bin
+${RTEMS_MAKEFILE_PATH}/build-tools/bin2boot -v \
+ ${MAIN}.bt ${HEADERADDR} \
+ ${START16FILE} ${START16ADDR} 0 ${MAIN}.bin ${RELOCADDR} 0
+
+exit 0