[examples-v2 commit] Add RTEMS trace support.

Chris Johns chrisj at rtems.org
Sat Sep 20 22:52:56 UTC 2014


Module:    examples-v2
Branch:    master
Commit:    cf50e5776feb5bfcb0295ae8547679c738cd2623
Changeset: http://git.rtems.org/examples-v2/commit/?id=cf50e5776feb5bfcb0295ae8547679c738cd2623

Author:    Chris Johns <chrisj at rtems.org>
Date:      Sun Sep 21 09:01:42 2014 +1000

Add RTEMS trace support.

---

 hello/both_hello/hello.ini |   45 ++++++++++++++++++++++++++++++++++++++++++++
 hello/both_hello/test.c    |   18 ++++++++++++++++-
 hello/both_hello/wscript   |    8 +++++++
 rtems_waf                  |    2 +-
 4 files changed, 71 insertions(+), 2 deletions(-)

diff --git a/hello/both_hello/hello.ini b/hello/both_hello/hello.ini
new file mode 100644
index 0000000..6790d74
--- /dev/null
+++ b/hello/both_hello/hello.ini
@@ -0,0 +1,45 @@
+;
+; RTEMS Trace Linker Configuration: hello
+;
+; This script configure the both hello example to perform some
+; tracing via the printf trace generator.
+;
+[tracer]
+;
+; Name of the trace.
+;
+name = Hello RTEMS Tracer
+;
+; Options can be defined here or on the command line.
+;
+options = all-funcs, verbose
+;
+; Functions to trace.
+;
+traces = hello-trace
+;
+; Define the function sets. These are the function's that can be
+; added to the trace lists.
+;
+functions = hello-trace
+;
+; Include RTEMS Trace support.
+;
+include = rtems.ini, rtld-base.ini
+
+;
+; User application trace example.
+;
+[hello-trace]
+generator = printk-generator
+signatures = hello-signatures
+trace = exit, Init, POSIX_Init, _Thread_Initialize
+header = "#include <rtems.h>"
+header = "#include <rtems/score/objectimpl.h>"
+header = "#include <rtems/score/scheduler.h>"
+
+[hello-signatures]
+exit=void, int
+Init = void, rtems_task_argument
+POSIX_Init = void*, void*
+_Thread_Initialize = bool, Objects_Information*, Thread_Control*, const Scheduler_Control*, void*, size_t, bool, Priority_Control, bool, Thread_CPU_budget_algorithms, Thread_CPU_budget_algorithm_callout, uint32_t, Objects_Name
diff --git a/hello/both_hello/test.c b/hello/both_hello/test.c
index 0b6af11..69dfb1a 100644
--- a/hello/both_hello/test.c
+++ b/hello/both_hello/test.c
@@ -7,20 +7,36 @@
 #include <stdlib.h>
 #include <unistd.h>
 
-rtems_task Init(
+long trace_test(int a, unsigned long b, long long c)
+{
+  printf ("int a=%i, unsigned long b=%u, long long c=%lli\n",
+          a, b, c);
+  return (long) (a + b);
+}
+
+rtems_task hello_init(
   rtems_task_argument ignored
 )
 {
   printf( "Classic -- Hello World\n" );
+  //trace_test(1, 2, 3);
   rtems_task_delete( RTEMS_SELF );
 }
 
+#define CONFIGURE_INIT_TASK_ENTRY_POINT hello_init
+
+int main(int argc, char** argv)
+{
+  hello_init(0);
+}
+
 void *POSIX_Init(
   void *argument
 )
 {
   printf( "POSIX -- Hello World\n" );
   sleep( 1 );
+  //trace_test(1, 2, 3);
   exit( 0 );
 }
 
diff --git a/hello/both_hello/wscript b/hello/both_hello/wscript
index 45c4c49..33187c4 100644
--- a/hello/both_hello/wscript
+++ b/hello/both_hello/wscript
@@ -1,4 +1,5 @@
 # Copyright 2013 Gedare Bloom (gedare at rtems.org)
+# Copyright 2014 Chris Johns (chrisj at rtems.org)
 #
 # This file's license is 2-clause BSD as in this distribution's LICENSE.2 file.
 #
@@ -9,6 +10,13 @@ import rtems_waf.rtems as rtems
 def build(bld):
     rtems.build(bld)
 
+    if rtems.check_env(bld, 'RTEMS_TLD'):
+        bld(features = 'c rtrace',
+            target = 'both_hello.texe',
+            source = ['test.c'],
+            rtrace_cfg = '../../hello/both_hello/hello.ini',
+            rtrace_wrapper = 'hello-test')
+
     bld(features = 'c cprogram',
         target = 'both_hello.exe',
         source = ['test.c'])
diff --git a/rtems_waf b/rtems_waf
index 993d33b..db8c6f0 160000
--- a/rtems_waf
+++ b/rtems_waf
@@ -1 +1 @@
-Subproject commit 993d33b3fca2e3ddfe53b75fe6434438edd1c48d
+Subproject commit db8c6f0c31efd09781e1804fcb2f3777d7904209



More information about the vc mailing list