Add RTEMS support

This commit is contained in:
Joel Sherrill 2007-11-03 15:18:23 +01:00 committed by Samuel Tardieu
parent dd4c8acccb
commit c902363cf7
11 changed files with 928 additions and 0 deletions

76
README.RTEMS Normal file
View File

@ -0,0 +1,76 @@
#
# $Id: README.RTEMS,v 1.3 2007/09/17 20:46:23 joel Exp $
#
This file contains the instructions for building AdaSockets to target RTEMS.
Prerequisites
=============
Build and install a working GNAT/RTEMS toolset and a BSP. Make sure
networking and POSIX are enabled. Detailed instructions are available
online in the RTEMS Wiki at:
http://www.rtems.org/wiki/index.php/RTEMSAda
Run at least one sample from the RTEMS build (e.g. hello.exe
or sample.exe) to confirm that RTEMS itself was properly built.
Build and run the RTEMS hello_world_ada from the ada-examples
package using your GNAT/RTEMS development environment.
If everything is working at this point, then you are ready to
build Ada Sockets.
Generate sockets-constants.ads
==============================
Subdirectory: rtems
We will use the RTEMS you installed to build and run a program
called "constants.exe". The output of this program needs to be
saved as sockets-constants.ads. To compile this program use
the Makefile.RTEMS.
RTEMS_MAKEFILE_PATH=install_path_of_BSP \
make -f Makefile.RTEMS
Then run the program o-optimize/constants.exe on the target hardware.
Your saved target board output may end up with DOS style
CR/LF's. Run "dos2unix" on the file to get it back to
Unix style.
There is a version of this file generated using psim using
a pre-4.8 CVS snapshot of RTEMS which should work on any target.
You can use this but you would be safer to generate your own.
Consider it an example of how it should look when it works.
Building Ada Sockets
====================
Subdirectory: src
Now that you have a sockets-constants.ads, we can build the
Ada Sockets library. Makefile.adasockets is provided for this
step:
RTEMS_MAKEFILE_PATH=install_patch_of_BSP \
make -f Makefile.RTEMS
After the library is compiled, it may be installed using the following:
RTEMS_MAKEFILE_PATH=install_patch_of_BSP
make -f Makefile.RTEMS install
Building Examples
=================
Subdirectory: examples
After building the sockets package, build the examples the same way
RTEMS_MAKEFILE_PATH=install_patch_of_BSP \
make -f Makefile.RTEMS
BUGS:
+ stream_listener core dumps if the endian of the stream_sender is not
the same as the listener.
+ multicast does not yet work. This is probably an RTEMS issue.

70
examples/Makefile.RTEMS Normal file
View File

@ -0,0 +1,70 @@
#
# 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.
# The executables produced by this Makefile should run on at least the
# following BSPs:
# arm/edb7312
# mips/jmr3904
# powerpc/psim
# powerpc/score603e
# sparc/erc32
# sparc/sis
#
# Some BSPs require extra manipulation of the ELF file before it can
# be run on the target hardware.
#
EXAMPLES=stream_listener stream_sender listener multi tcprelay
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: $(EXAMPLES)
stream_listener stream_sender listener multi tcprelay: rtems_init.o *.adb
$(GNATMAKE) -v -O -gnata -gnatE -gnato $(@) -g \
-I../src \
-bargs -Mgnat_main \
-largs $(CARGS) $(LINKARGS) rtems_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
rtems_init.o: rtems_init.c
$(CC) $(CFLAGS) $(CPU_CFLAGS) -c rtems_init.c
clean:
rm -f b~*.* *.o *.ali $(EXAMPLES)
rm -f *.num *.exe *.obj *.bin *.bt

221
examples/rtems_init.c Normal file
View File

@ -0,0 +1,221 @@
/*
* COPYRIGHT (c) 1989-2007.
* On-Line Applications Research Corporation (OAR).
*
* The license and distribution terms for this file may be found in
* the file LICENSE in this distribution or at
* http://www.rtems.com/license/LICENSE.
*
* $Id: rtems_init.c,v 1.2 2007/09/17 20:46:23 joel Exp $
*/
#define MAIN_USE_NETWORKING
#define MAIN_USE_REQUIRES_COMMAND_LINE
#include <bsp.h>
#include <assert.h>
#include <pthread.h>
#include <stdlib.h>
#include <rtems/rtems_bsdnet.h>
#include "rtems_networkconfig.h"
extern rtems_configuration_table BSP_Configuration;
/*
* Using GNAT's Distributed Systems Annex support requires
* each node in the system to have different pid's. In a
* single CPU RTEMS system, it is always one. This lets the
* user override the RTEMS default.
*/
#ifdef GNAT_PID
#include <unistd.h>
pid_t getpid()
{
return GNAT_PID;
}
#endif
static int argc = 1;
static char arg0[20] = "rtems";
static char *argv[20] = { arg0 };
#if defined(MAIN_USE_REQUIRES_COMMAND_LINE)
#define COMMAND_LINE_MAXIMUM 200
#include <stdio.h>
#include <ctype.h>
void parse_arguments(
char *buffer,
size_t maximum_length
)
{
char *cp;
char *linebuf = buffer;
size_t length;
for (;;) {
/*
* Set up first argument
*/
#if 0
argc = 1;
strcpy (arg0, "rtems");
argv[0] = arg0;
#endif
#if (defined (MAIN_COMMAND_LINE))
strncpy (linebuf, MAIN_COMMAND_LINE, maximum_length);
#else
/*
* Read a line
*/
printf (">>> %s ", argv[0]);
fflush (stdout);
fgets (linebuf, maximum_length, stdin);
length = strnlen( linebuf, maximum_length );
if ( linebuf[length - 1] == '\n' || linebuf[length - 1] == '\r' ) {
linebuf[length - 1] = '\0';
}
#endif
/*
* Break line into arguments
*/
cp = linebuf;
for (;;) {
while (isspace (*cp))
*cp++ = '\0';
if (*cp == '\0')
break;
if (argc >= ((sizeof argv / sizeof argv[0]) - 1)) {
printf ("Too many arguments.\n");
argc = 0;
break;
}
argv[argc++] = cp;
while (!isspace (*cp)) {
if (*cp == '\0')
break;
cp++;
}
}
if (argc > 1) {
argv[argc] = NULL;
break;
}
printf ("You must give some arguments!\n");
}
#if 0
{
int i;
for (i=0; i<argc ; i++ ) {
printf( "argv[%d] = ***%s***\n", i, argv[i] );
}
printf( "\n" );
}
#endif
}
#endif
/*
* By having the POSIX_Init thread create a second thread just
* to invoke gnat_main, we can override all default attributes
* of the "Ada environment task". Otherwise, we would be
* stuck with the defaults set by RTEMS.
*/
void *start_gnat_main( void * argument )
{
extern int gnat_main ( int argc, char **argv, char **envp );
/*
* This is scoped to match the Ada program.
*/
char command_line[ COMMAND_LINE_MAXIMUM ];
#if defined(MAIN_USE_REQUIRES_COMMAND_LINE)
parse_arguments( command_line, COMMAND_LINE_MAXIMUM );
#endif
(void) gnat_main ( argc, argv, 0 );
exit( 0 );
return 0;
}
#ifndef GNAT_MAIN_STACKSPACE
#define GNAT_MAIN_STACKSPACE 0
#endif
void *POSIX_Init( void *argument )
{
pthread_t thread_id;
pthread_attr_t attr;
size_t stacksize;
int status;
extern size_t _ada_pthread_minimum_stack_size();
#if defined(MAIN_USE_NETWORKING)
printk("Initializing Network\n");
rtems_bsdnet_initialize_network ();
#endif
status = pthread_attr_init( &attr );
assert( !status );
stacksize = GNAT_MAIN_STACKSPACE * 1024;
if ( stacksize < _ada_pthread_minimum_stack_size() )
stacksize = _ada_pthread_minimum_stack_size();
status = pthread_attr_setstacksize( &attr, stacksize );
assert( !status );
status = pthread_create( &thread_id, &attr, start_gnat_main, NULL );
assert( !status );
pthread_exit( 0 );
return 0;
}
/* configuration information */
/* Standard output and a clock tick so time passes */
#define CONFIGURE_APPLICATION_NEEDS_CONSOLE_DRIVER
#define CONFIGURE_APPLICATION_NEEDS_CLOCK_DRIVER
/* We need to be able to create sockets */
#define CONFIGURE_LIBIO_MAXIMUM_FILE_DESCRIPTORS 20
/* This is overkill but is definitely enough to run the network stack */
#define CONFIGURE_MAXIMUM_TASKS 20
#define CONFIGURE_MAXIMUM_SEMAPHORES 20
/* We want a clock tick every millisecond */
#define CONFIGURE_MICROSECONDS_PER_TICK RTEMS_MILLISECONDS_TO_MICROSECONDS(1)
/* The initialization task is a POSIX Initialization thread with default attributes */
#define CONFIGURE_POSIX_INIT_THREAD_TABLE
/* We are using GNAT/RTEMS with a maximum of 20 Ada tasks and no fake Ada tasks. */
/* A fake Ada task is a task created outside the Ada run-time that calls into Ada. */
#define CONFIGURE_GNAT_RTEMS
#define CONFIGURE_MAXIMUM_ADA_TASKS 20
#define CONFIGURE_MAXIMUM_FAKE_ADA_TASKS 0
/* Account for any extra task stack size */
#define CONFIGURE_MEMORY_OVERHEAD (GNAT_MAIN_STACKSPACE)
#define CONFIGURE_INIT
#include <rtems/confdefs.h>

View File

@ -0,0 +1,145 @@
/*
* Network configuration for an IceCube in RTEMS Lab
*
************************************************************
* EDIT THIS FILE TO REFLECT YOUR NETWORK CONFIGURATION *
* BEFORE RUNNING ANY RTEMS PROGRAMS WHICH USE THE NETWORK! *
************************************************************
*
* $Id: rtems_networkconfig.h,v 1.1 2007/09/17 20:46:23 joel Exp $
*/
#ifndef _RTEMS_NETWORKCONFIG_H_
#define _RTEMS_NETWORKCONFIG_H_
/*
* The following will normally be set by the BSP if it supports
* a single network device driver. In the event, it supports
* multiple network device drivers, then the user's default
* network device driver will have to be selected by a BSP
* specific mechanism.
*/
#ifndef RTEMS_BSP_NETWORK_DRIVER_NAME
#warning "RTEMS_BSP_NETWORK_DRIVER_NAME is not defined"
#define RTEMS_BSP_NETWORK_DRIVER_NAME "no_network1"
#endif
#ifndef RTEMS_BSP_NETWORK_DRIVER_ATTACH
#warning "RTEMS_BSP_NETWORK_DRIVER_ATTACH is not defined"
#define RTEMS_BSP_NETWORK_DRIVER_ATTACH 0
#endif
/* #define RTEMS_USE_BOOTP */
#include <bsp.h>
/*
* Define RTEMS_SET_ETHERNET_ADDRESS if you want to specify the
* Ethernet address here. If RTEMS_SET_ETHERNET_ADDRESS is not
* defined the driver will choose an address.
*/
#define RTEMS_SET_ETHERNET_ADDRESS
#if (defined (RTEMS_SET_ETHERNET_ADDRESS))
static char ethernet_address[6] = { 0x00, 0x11, 0x22, 0x33, 0x44, 0x55 };
#endif
#ifdef RTEMS_USE_LOOPBACK
/*
* Loopback interface
*/
extern void rtems_bsdnet_loopattach();
static struct rtems_bsdnet_ifconfig loopback_config = {
"lo0", /* name */
rtems_bsdnet_loopattach, /* attach function */
NULL, /* link to next interface */
"127.0.0.1", /* IP address */
"255.0.0.0", /* IP net mask */
};
#endif
/*
* Default network interface
*/
static struct rtems_bsdnet_ifconfig netdriver_config = {
RTEMS_BSP_NETWORK_DRIVER_NAME, /* name */
RTEMS_BSP_NETWORK_DRIVER_ATTACH, /* attach function */
#ifdef RTEMS_USE_LOOPBACK
&loopback_config, /* link to next interface */
#else
NULL, /* No more interfaces */
#endif
#if (defined (RTEMS_USE_BOOTP))
NULL, /* BOOTP supplies IP address */
NULL, /* BOOTP supplies IP net mask */
#else
"192.168.1.244", /* IP address */
"255.255.255.0", /* IP net mask */
#endif /* !RTEMS_USE_BOOTP */
#if (defined (RTEMS_SET_ETHERNET_ADDRESS))
ethernet_address, /* Ethernet hardware address */
#else
NULL, /* Driver supplies hardware address */
#endif
0, /* Use default driver parameters */
0, /* mtu */
0, /* rbuf_count */
0, /* xbuf_count */
0, /* port */
0 /* irq */
};
/*
* Network configuration
*/
struct rtems_bsdnet_config rtems_bsdnet_config = {
&netdriver_config,
#if (defined (RTEMS_USE_BOOTP))
rtems_bsdnet_do_bootp,
#else
NULL,
#endif
0, /* Default network task priority */
256 * 1024, /* Default mbuf capacity */
256 * 1024, /* Default mbuf cluster capacity */
#if (!defined (RTEMS_USE_BOOTP))
"rtems", /* Host name */
"nodomain.com", /* Domain name */
"192.168.1.14", /* Gateway */
"192.168.1.1", /* Log host */
{"192.168.1.1" }, /* Name server(s) */
{"192.168.1.1" }, /* NTP server(s) */
#endif /* !RTEMS_USE_BOOTP */
};
/*
* For TFTP test application
*/
#if (defined (RTEMS_USE_BOOTP))
#define RTEMS_TFTP_TEST_HOST_NAME "BOOTP_HOST"
#define RTEMS_TFTP_TEST_FILE_NAME "BOOTP_FILE"
#else
#define RTEMS_TFTP_TEST_HOST_NAME "XXX.YYY.ZZZ.XYZ"
#define RTEMS_TFTP_TEST_FILE_NAME "tftptest"
#endif
/*
* For NFS test application
*
* NFS server/path to mount and a directory to ls once mounted
*/
#define RTEMS_NFS_SERVER "192.168.1.210"
#define RTEMS_NFS_SERVER_PATH "/home"
#define RTEMS_NFS_LS_PATH "/mnt/nfstest"
#endif /* _RTEMS_NETWORKCONFIG_H_ */

19
rtems/ChangeLog Normal file
View File

@ -0,0 +1,19 @@
2007-09-11 Joel Sherrill <joel.sherrill@oarcorp.com>
* .cvsignore: Add more to ignore.
2007-09-11 Joel Sherrill <joel.sherrill@oarcorp.com>
* README: Move instructions to top level README.RTEMS.
* Makefile.RTEMS: New file.
* Makefile.constants: Removed.
2007-09-11 Joel Sherrill <joel.sherrill@oarcorp.com>
* .cvsignore: New file.
2007-09-11 Joel Sherrill <joel.sherrill@oarcorp.com>
* ChangeLog, Makefile.constants, README, create_constants_c.sh,
rtems_main.c, sockets-constants-rtems.ads: New files.

37
rtems/Makefile.RTEMS Normal file
View File

@ -0,0 +1,37 @@
#
# Makefile.constants
#
# Build the constants.exe program that MUST be run on an RTEMS target.
# It should be able to be ANY target including a simulator since the
# constants in question should be the same across all architectures
# and BSPs
#
# $Id: Makefile.RTEMS,v 1.1 2007/09/11 15:12:56 joel Exp $
#
#
# RTEMS_MAKEFILE_PATH is typically set in an environment variable
# or make is invoked like "RTEMS_MAKEFILE_PATH=XXX make"
#
# optional managers required
MANAGERS=all
# C source names
COBJS = ${ARCH}/rtems_main.o ${ARCH}/constants.o
include $(RTEMS_MAKEFILE_PATH)/Makefile.inc
include $(RTEMS_CUSTOM)
include $(PROJECT_ROOT)/make/leaf.cfg
CLEAN_ADDITIONS += constants.c
OBJS= $(COBJS)
all: $(ARCH)/constants.exe
$(ARCH)/constants.exe: $(ARCH) $(OBJS)
$(make-exe)
constants.c: create_constants_c.sh ../vms/constants.list
sh ./create_constants_c.sh ../vms/constants.list $@

61
rtems/README Normal file
View File

@ -0,0 +1,61 @@
#
# $Id: README,v 1.2 2007/09/11 15:12:57 joel Exp $
#
This directory contains the support files for building
the sockets-constants.ads file for RTEMS. See the
README.RTEMS in the top level directory for complete
build instructions.
Prerequisites
=============
Build and install a working GNAT/RTEMS toolset and a BSP. Make sure
networking and POSIX are enabled. Detailed instructions are available
online in the RTEMS Wiki at:
http://www.rtems.org/wiki/index.php/RTEMSAda
Run at least one sample from the RTEMS build (e.g. hello.exe
or sample.exe) to confirm that RTEMS itself was properly built.
Build and run the RTEMS hello_world_ada from the ada-examples
package using your GNAT/RTEMS development environment.
If everything is working at this point, then you are ready to
build Ada Sockets.
Generate sockets-constants-ads
==============================
We will use the RTEMS you installed to build and run a program
called "constants.exe". The output of this program needs to be
saved as sockets-constants.ads. To compile this program use
the Makefile.constants.
RTEMS_MAKEFILE_PATH=install_patch_of_BSP \
make -f Makefile.constants
Then run the program o-optimize/constants.exe on the target hardware.
Your saved target board output may end up with DOS style
CR/LF's. Run "dos2unix" on the file to get it back to
Unix style.
There is a version of this file generated using psim using
a pre-4.8 CVS snapshot of RTEMS which should work on any target.
You can use this but you would be safer to generate your own.
Consider it an example of how it should look when it works.
Building Ada Sockets
====================
Now that you have a sockets-constants.ads, we can build the
Ada Sockets library. Makefile.adasockets is provided for this
step:
RTEMS_MAKEFILE_PATH=install_patch_of_BSP \
make -f Makefile.lib
After the library is compiled, it may be installed using the following:
RTEMS_MAKEFILE_PATH=install_patch_of_BSP \
make -f Makefile.lib install

111
rtems/create_constants_c.sh Normal file
View File

@ -0,0 +1,111 @@
#! /bin/sh
#
#
# This script completes the constants.c_pre file with the
# the list of defines needed to build the adasockets constant
# package.
#
# This file is part of Adasockets for RTEMS.
#
if [ $# -ne 2 ] ; then
echo $0: constantsFile outputFile
exit 1
fi
constantListFile=$1
outputFile=$2
cat >${outputFile} <<EOF
/*
* This is an incomplete C program preamble aimed to extract
* constants' values. The complete source is generated by
* create_constants_c.sh.
*
* NOTE: THIS CODE IS SPECIFIC TO RTEMS
*
*/
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <errno.h>
#include <ctype.h>
#include <sys/fcntl.h>
#include <sys/ioccom.h>
#include <sys/filio.h>
#include <netdb.h>
#include <netinet/in.h>
#include <netinet/tcp.h>
#include <arpa/inet.h>
#include <sys/socket.h>
#include <net/if.h>
static char *
capitalize (char *name)
{
int beginning = 1;
char *result = (char *) malloc (strlen (name) + 1);
char *ptr;
for (ptr = result; *name; ptr++, name++) {
*ptr = *name;
if (beginning) {
beginning = 0;
} else if (*ptr == '_') {
beginning = 1;
} else if (isupper(*ptr)) {
*ptr = tolower(*ptr);
}
}
*ptr = '\0';
return result;
}
static void
output (char *name, int value)
{
char *capitalized = capitalize (name);
if (value != -1) {
printf (" %-20s : constant := 16#%04X#;\n", capitalized, value);
} else {
printf (" %-20s : constant := %d;\n", capitalized, value);
}
}
void print_body(void);
void print_socket_constants_ads( void )
{
printf(
"-- This file has been generated automatically by\n"
"-- the constants.c file generated by create_constants_c.sh.\n"
"--\n"
"-- This file is part of adasockets port to RTEMS.\n"
"--\n"
"\n"
"package sockets.constants is\n"
);
print_body();
printf( "end sockets.constants;\n");
}
void print_body()
{
EOF
#
# Now generate the body of the function that acr
#
while read line
do
echo "#ifdef ${line}"
echo " output( \"${line}\", ${line});"
echo "#else"
echo " output( \"${line}\", -1);"
echo "#endif"
done < ${constantListFile} >>${outputFile}
echo "}" >>${outputFile}
exit 0

31
rtems/rtems_main.c Normal file
View File

@ -0,0 +1,31 @@
/*
* Simple test program -- simplified version of sample test hello.
*/
#include <bsp.h>
#include <stdlib.h>
#include <stdio.h>
rtems_task Init(
rtems_task_argument ignored
)
{
extern void print_socket_constants_ads( void );
print_socket_constants_ads();
exit( 0 );
}
/* configuration information */
#define CONFIGURE_APPLICATION_NEEDS_CONSOLE_DRIVER
#define CONFIGURE_RTEMS_INIT_TASKS_TABLE
#define CONFIGURE_MAXIMUM_TASKS 1
#define CONFIGURE_INIT
#include <rtems/confdefs.h>
/* end of file */

View File

@ -0,0 +1,85 @@
-- This file has been generated automatically by
-- the constants.c file generated by create_constants_c.sh.
--
-- This file is part of adasockets port to RTEMS.
--
package sockets.constants is
Tcp_Nodelay : constant := 16#0001#;
Af_Inet : constant := 16#0002#;
Af_Unix : constant := 16#0001#;
Sock_Stream : constant := 16#0001#;
Sock_Dgram : constant := 16#0002#;
Eintr : constant := 16#0004#;
Eagain : constant := 16#000B#;
Ewouldblock : constant := 16#000B#;
Einprogress : constant := 16#0077#;
Ealready : constant := 16#0078#;
Eisconn : constant := 16#007F#;
Econnrefused : constant := 16#006F#;
Fndelay : constant := 16#4000#;
Fasync : constant := 16#0040#;
Fioasync : constant := 16#8004667D#;
F_Getfl : constant := 16#0003#;
F_Setfl : constant := 16#0004#;
F_Setown : constant := 16#0006#;
Fiossaioown : constant := -1;
So_Rcvbuf : constant := 16#1002#;
So_Reuseaddr : constant := 16#0004#;
So_Reuseport : constant := -1;
Sol_Socket : constant := 16#FFFF#;
Sigterm : constant := 16#000F#;
Sigkill : constant := 16#0009#;
O_Rdonly : constant := 16#0000#;
O_Wronly : constant := 16#0001#;
O_Rdwr : constant := 16#0002#;
Host_Not_Found : constant := 16#0001#;
Try_Again : constant := 16#0002#;
No_Recovery : constant := 16#0003#;
No_Data : constant := 16#0004#;
No_Address : constant := 16#0004#;
Pollin : constant := -1;
Pollpri : constant := -1;
Pollout : constant := -1;
Pollerr : constant := -1;
Pollhup : constant := -1;
Pollnval : constant := -1;
I_Setsig : constant := -1;
S_Rdnorm : constant := -1;
S_Wrnorm : constant := -1;
Ipproto_Ip : constant := 16#0000#;
Ip_Add_Membership : constant := 16#000C#;
Ip_Multicast_Loop : constant := 16#000B#;
Ip_Multicast_Ttl : constant := 16#000A#;
Ip_Drop_Membership : constant := 16#000D#;
O_Nonblock : constant := 16#4000#;
Msg_Peek : constant := 16#0002#;
Fionbio : constant := 16#8004667E#;
Fionread : constant := 16#4004667F#;
So_Sndbuf : constant := 16#1001#;
Af_Inet6 : constant := 16#001C#;
Ai_Addrconfig : constant := -1;
Ai_All : constant := -1;
Ai_Canonname : constant := -1;
Ai_Default : constant := -1;
Ai_Mask : constant := -1;
Ai_Numerichost : constant := -1;
Ai_Passive : constant := -1;
Ai_V4mapped : constant := -1;
Ai_V4mapped_Cfg : constant := -1;
Ni_Dgram : constant := -1;
Ni_Maxhost : constant := -1;
Ni_Maxserv : constant := -1;
Ni_Namereqd : constant := -1;
Ni_Nofqdn : constant := -1;
Ni_Numerichost : constant := -1;
Ni_Numericserv : constant := -1;
Ni_Withscopeid : constant := -1;
Ipproto_Ipv6 : constant := 16#0029#;
Ipv6_Unicast_Hops : constant := -1;
Ipv6_Multicast_If : constant := -1;
Ipv6_Multicast_Hops : constant := -1;
Ipv6_Multicast_Loop : constant := -1;
Ipv6_Join_Group : constant := -1;
Ipv6_Leave_Group : constant := -1;
end sockets.constants;

72
src/Makefile.RTEMS Normal file
View File

@ -0,0 +1,72 @@
#
# Makefile.RTEMS
#
# Build the Ada Sockets packages for a SPECIFIC RTEMS BSP.
# This Makefile should work for any RTEMS BSP as long as
# it is installed and you set RTEMS_MAKEFILE_PATCH appropriately.
#
# RTEMS_MAKEFILE_PATH is typically set in an environment variable
# or make is invoked like "RTEMS_MAKEFILE_PATH=XXX make"
#
# $Id: Makefile.RTEMS,v 1.1 2007/09/11 22:38:24 joel Exp $
#
#
#
.PHONY: all distclean clean
.DEFAULT: all
include $(RTEMS_MAKEFILE_PATH)/Makefile.inc
include $(RTEMS_CUSTOM)
include $(PROJECT_ROOT)/make/leaf.cfg
# RTEMS specific files that are generated by copy or sed
RTEMS_FILES=\
sockets-types.ads\
sockets-thin.ads\
sockets-link.ads\
sockets-constants.ads
FILES= sockets-multicast.adb\
sockets-naming.adb\
sockets-stream_io.adb\
sockets-utils.adb\
sockets.adb\
$(RTEMS_FILES)
ADS_OBJ=$(patsubst %.ads, %.o, $(filter %.ads, $(FILES)))
ADB_OBJ=$(patsubst %.adb, %.o, $(filter %.adb, $(FILES)))
# These get removed by RTEMS clean and distclean rules
CLEAN_ADDITIONS+= *.ali *.o b$*.* $(RTEMS_FILES)
all: $(FILES) $(ADB_OBJ) $(ADS_OBJ)
sockets-types.ads: sockets-types.ads.in Makefile.RTEMS
sed -e 's/^@SA_LEN@//' \
-e '/@NO_SA_LEN@/d' <$< >$@
sockets-link.ads: sockets-link.ads.in Makefile.RTEMS
sed -e '/@WINNEEDED@/d' \
-e '/@NSLNEEDED@/d' \
-e '/@SOCKETNEEDED@/d' \
-e '/@RESOLVNEEDED@/d' $< >$@
sockets-thin.ads: sockets-thin.ads.unix
cp $< $@
sockets-constants.ads: ../rtems/sockets-constants.ads
cp $< $@
$(ADB_OBJ): %.o: %.adb
$(CC) $(CPU_CFLAGS) $(CFLAGS)-c $<
$(ADS_OBJ): %.o: %.ads
$(CC) $(CPU_CFLAGS) $(CFLAGS)-c $<
# Install this with the BSP the user has specified with RTEMS_MAKEFILE_PATH
install:
$(INSTALL_VARIANT) $(FILES) $(ADS_OBJ) $(ADB_OBJ) $(PROJECT_RELEASE)/lib/include/adainclude