Attempt to get some applications linked for RTEMS target, just to get the footprint calculation working

git-svn-id: https://svn.pjsip.org/repos/pjproject/trunk@604 74dad513-b988-da41-8d7b-12977e46ad98
diff --git a/pjsip-apps/build/Footprint.mak b/pjsip-apps/build/Footprint.mak
index 735aef2..26055cf 100644
--- a/pjsip-apps/build/Footprint.mak
+++ b/pjsip-apps/build/Footprint.mak
@@ -44,10 +44,12 @@
 EXE := footprint.exe
 
 all: 
-	$(CC_NAME) -o $(EXE) ../src/samples/footprint.c $(FCFLAGS) $(_CFLAGS) $(_LDFLAGS)
+	$(CROSS_COMPILE)$(CC_NAME) -o $(EXE) ../src/samples/footprint.c $(FCFLAGS) $(_CFLAGS) $(_LDFLAGS)
+	$(CROSS_COMPILE)strip --strip-all $(EXE)
 
 clean:
 	rm -f $(EXE)
 
 print_name:
-	@echo $(MACHINE_NAME) $(OS_NAME) $(CC_NAME) `$(CC_NAME) -dumpversion`
+	@echo $(MACHINE_NAME) $(OS_NAME) $(CROSS_COMPILE)$(CC_NAME) `$(CROSS_COMPILE)$(CC_NAME) -dumpversion`
+
diff --git a/pjsip-apps/build/get-footprint.py b/pjsip-apps/build/get-footprint.py
index 3576b12..bef4aa3 100644
--- a/pjsip-apps/build/get-footprint.py
+++ b/pjsip-apps/build/get-footprint.py
@@ -32,8 +32,10 @@
     ['BASE',			'Empty application size'],
     ['', 			'Subtotal: empty application size on this platform'],
 
-    ['HAS_PJLIB', 		'PJLIB (pool, data structures, hash tables, ioqueue, socket, timer heap, etc.)'],
-    ['', 			'Subtotal: Minimal PJLIB application size'],
+    ['HAS_PJLIB', 		'PJLIB (pool, data structures, hash tables, ioqueue, socket, timer heap, etc.). ' +
+			        'For targets that statically link application with LIBC, the size includes ' +
+			        'various LIBC functions that are used by PJLIB.'],
+    ['', 			'Subtotal: Application linked with PJLIB'],
 
     # PJLIB-UTIL
     ['HAS_PJLIB_STUN',		'PJLIB-UTIL STUN client'],
@@ -46,7 +48,7 @@
     ['HAS_PJSIP_CORE',		'PJSIP Core - Endpoint (transport management, module management, event distribution, etc.)'],
     ['HAS_PJSIP_CORE_MSG_UTIL',	'PJSIP Core - Stateless operations, server resolution and fail-over'],
     ['HAS_PJSIP_UDP_TRANSPORT',	'PJSIP UDP transport'],
-    ['',			'Subtotal: A very minimum SIP application (parsing, UDP transport+STUN, no transaction)'],
+    ['',			'Subtotal: A minimalistic SIP application (parsing, UDP transport+STUN, no transaction)'],
    
     ['HAS_PJSIP_TCP_TRANSPORT',	'PJSIP TCP transport'],
     ['HAS_PJSIP_INFO',		'PJSIP INFO support (RFC 2976) (no special treatment, thus the zero size)'],
@@ -157,8 +159,7 @@
 #
 # Write the report to HTML file
 #
-def print_html_report(filename):
-    output = open(filename, 'w')
+def print_html_report():
 
     # Get Revision info.
     f = os.popen('svn info | grep Revision')
@@ -171,16 +172,21 @@
     o = names[1]
     cc = names[2]
     cc_ver = names[3]
-	
+
+    # Open HTML file
+    filename = 'footprint-' + m + '-' + o + '.htm'
+    output = open(filename, 'w')
+
+    title = 'PJSIP and PJMEDIA footprint report for ' + m + '-' + o + ' target'
     output.write('<HTML><HEAD>\n');
-    output.write(' <TITLE>PJSIP and PJMEDIA footprint report for ' + o + '/' + m + ' (r' + revision + ')</TITLE>\n')
+    output.write(' <TITLE>' + title + '</TITLE>\n')
     output.write(' <LINK href="/style/style.css" type="text/css" rel="stylesheet">\n')
     output.write('</HEAD>\n');
     output.write('<BODY bgcolor="white">\n');
     output.write('<!--#include virtual="/header.html" -->')
 
-    output.write(' <H1>PJSIP and PJMEDIA footprint report (r' + revision + ')</H1>\n')
-    output.write('Auto-generated by pjsip-apps/build/get-footprint.py\n')
+    output.write(' <H1>' + title + '</H1>\n')
+    output.write('Auto-generated by pjsip-apps/build/get-footprint.py script\n')
     output.write('<p>Date: ' + time.asctime() + '<BR>\n')
     output.write('Revision: r' + revision + '</p>\n\n')
     output.write('<HR>\n')
@@ -242,11 +248,18 @@
 	    output.write( '  <TD align="right">' + `string.atoi(e[4]) - string.atoi(prev[4])` + '</TD>\n' )
 	    output.write( '  <TD>' + e[5] + '</TD>\n')
 	else:
+	    empty_size = exe_size[1]
 	    output.write('<TR bgcolor="#e8e8ff">\n')
 	    output.write( '  <TD align="right">&nbsp;</TD>\n')
 	    output.write( '  <TD align="right">&nbsp;</TD>\n')
 	    output.write( '  <TD align="right">&nbsp;</TD>\n')
-	    output.write( '  <TD><strong>' + e[5] + ': .text=' + e[2]+ ', .data=' + e[3] + ', .bss=' + e[4] + '</strong></TD>\n')
+	    output.write( '  <TD><strong>' + e[5] + ': .text=' + e[2]+ ', .data=' + e[3] + ', .bss=' + e[4] )
+	    output.write( '\n </strong> <BR>(Size minus empty application size: ' + \
+			    '.text=' + `string.atoi(e[2]) - string.atoi(empty_size[2])` + \
+			    ', .data=' + `string.atoi(e[3]) - string.atoi(empty_size[3])` + \
+			    ', .data=' + `string.atoi(e[4]) - string.atoi(empty_size[4])` + \
+			    ')\n' )
+	    output.write( ' </TD>\n')
 
 	output.write('</TR>\n')
 
@@ -306,6 +319,6 @@
 	exe_size.append(n)
 	
 
-print_text_report('footprint.txt')	
-print_html_report('footprint.htm')
+#print_text_report('footprint.txt')	
+print_html_report()
 
diff --git a/pjsip-apps/src/pjsua/main_rtems.c b/pjsip-apps/src/pjsua/main_rtems.c
new file mode 100644
index 0000000..d26605a
--- /dev/null
+++ b/pjsip-apps/src/pjsua/main_rtems.c
@@ -0,0 +1,12 @@
+
+/* 
+ *  !! OIY OIY !!
+ *
+ *  The purpose of this file is only to get the executable linked. I haven't
+ *  actually tried to run this on RTEMS!!
+ *
+ */
+
+#include "../../pjlib/src/pjlib-test/main_rtems.c"
+
+
diff --git a/pjsip-apps/src/samples/footprint.c b/pjsip-apps/src/samples/footprint.c
index 06142f6..7f631a7 100644
--- a/pjsip-apps/src/samples/footprint.c
+++ b/pjsip-apps/src/samples/footprint.c
@@ -529,8 +529,17 @@
 }
 
 
-int main()
+int test_main()
 {
     return dummy_function();
 }
 
+#if defined(PJ_RTEMS) && PJ_RTEMS!=0
+#  include "../../pjlib/src/pjlib-test/main_rtems.c"
+#else
+int main()
+{
+  return test_main();
+}
+#endif
+
diff --git a/pjsip-apps/src/samples/main_rtems.c b/pjsip-apps/src/samples/main_rtems.c
new file mode 100644
index 0000000..d26605a
--- /dev/null
+++ b/pjsip-apps/src/samples/main_rtems.c
@@ -0,0 +1,12 @@
+
+/* 
+ *  !! OIY OIY !!
+ *
+ *  The purpose of this file is only to get the executable linked. I haven't
+ *  actually tried to run this on RTEMS!!
+ *
+ */
+
+#include "../../pjlib/src/pjlib-test/main_rtems.c"
+
+