1# Building AdaSockets to target RTEMS.
2
3Prerequisites
4=============
5Build and install a working GNAT/RTEMS toolset and a BSP. Make sure
6networking and POSIX are enabled.  Detailed instructions are available
7online in the RTEMS Wiki at:
8
9    http://www.rtems.org/wiki/index.php/RTEMSAda
10
11Run at least one sample from the RTEMS build (e.g. `hello.exe`
12or `sample.exe`) to confirm that RTEMS itself was properly built.
13
14Build and run the RTEMS `hello_world_ada` from the `ada-examples`
15package using your GNAT/RTEMS development environment.
16
17If everything is working at this point, then you are ready to
18build AdaSockets.
19
20Generate `sockets-constants.ads`
21================================
22Subdirectory: `rtems`
23
24We will use the RTEMS you installed to build and run a program
25called `constants.exe`.  The output of this program needs to be
26saved as `sockets-constants.ads`.  To compile this program use
27the `Makefile.RTEMS`.
28
29```
30% RTEMS_MAKEFILE_PATH=install_path_of_BSP make -f Makefile.RTEMS
31```
32
33Then run the program `o-optimize/constants.exe` on the target hardware.
34Your saved target board output may end up with DOS style
35CR/LF's.  Run `dos2unix` on the file to get it back to
36Unix style.
37
38There is a version of this file generated using `psim` using
39a pre-4.8 CVS snapshot of RTEMS which should work on any target.
40You can use this but you would be safer to generate your own.
41Consider it an example of how it should look when it works.
42
43
44Building AdaSockets
45===================
46Subdirectory: `src`
47
48Now that you have a `sockets-constants.ads`, we can build the
49AdaSockets library.  `Makefile.adasockets` is provided for this
50step:
51
52```
53% RTEMS_MAKEFILE_PATH=install_patch_of_BSP make -f Makefile.RTEMS
54```
55
56After the library is compiled, it may be installed using the following:
57
58```
59% RTEMS_MAKEFILE_PATH=install_patch_of_BSP make -f Makefile.RTEMS install
60```
61
62Building examples
63=================
64Subdirectory: `examples`
65
66After building the sockets package, build the examples the same way
67
68```
69% RTEMS_MAKEFILE_PATH=install_patch_of_BSP make -f Makefile.RTEMS
70```
71
72BUGS:
73
74  - stream_listener core dumps if the endian of the `stream_sender` is not
75    the same as the listener.
76  - multicast does not yet work.  This is probably an RTEMS issue.
77
78