From 3c7094087ed544beff2535a5190deb5bcdc9326e Mon Sep 17 00:00:00 2001 From: Joel Sherrill Date: Tue, 22 Feb 2022 14:08:25 -0600 Subject: tracing: Add a special ticker variant to show tracing. This was complicating both_hello which was designed for another purpose entirely. --- hello/both_hello/hello-deep.ini | 47 ------------------ hello/both_hello/hello.ini | 45 ----------------- hello/both_hello/wscript | 22 ++++----- ticker/ticker_trace/Makefile | 23 +++++++++ ticker/ticker_trace/init.c | 99 +++++++++++++++++++++++++++++++++++++ ticker/ticker_trace/ticker-deep.ini | 46 +++++++++++++++++ ticker/ticker_trace/ticker.ini | 43 ++++++++++++++++ ticker/ticker_trace/wscript | 26 ++++++++++ ticker/wscript | 1 + 9 files changed, 249 insertions(+), 103 deletions(-) delete mode 100644 hello/both_hello/hello-deep.ini delete mode 100644 hello/both_hello/hello.ini create mode 100644 ticker/ticker_trace/Makefile create mode 100644 ticker/ticker_trace/init.c create mode 100644 ticker/ticker_trace/ticker-deep.ini create mode 100644 ticker/ticker_trace/ticker.ini create mode 100644 ticker/ticker_trace/wscript diff --git a/hello/both_hello/hello-deep.ini b/hello/both_hello/hello-deep.ini deleted file mode 100644 index 84466fc..0000000 --- a/hello/both_hello/hello-deep.ini +++ /dev/null @@ -1,47 +0,0 @@ -; -; RTEMS Trace Linker Configuration: hello deep -; -; This script configure the both hello example to perform deep -; tracing of RTEMS via the printf trace generator. -; -[tracer] -; -; Name of the trace. -; -name = Hello Deep RTEMS Tracer -; -; Options can be defined here or on the command line. -; -;options = verbose -; -; Functions to trace. -; -traces = hello-deep-trace -traces = rtems-score-object-all -traces = rtems-score-thread-all -traces = rtems-score-threadq-all -traces = rtems-score-heap-all -; -; Define the function sets. These are the function's that can be -; added to the trace lists. -; -functions = hello-deep-trace -functions = rtems-score -; -; Include RTEMS Trace support. -; -include = rtems.ini, rtld-base.ini - -; -; User application trace example. -; -[hello-deep-trace] -generator = printk-generator -signatures = hello-signatures -trace = exit, Init, POSIX_Init -header = "#include " - -[hello-signatures] -exit=void, int -Init = void, rtems_task_argument -POSIX_Init = void*, void* diff --git a/hello/both_hello/hello.ini b/hello/both_hello/hello.ini deleted file mode 100644 index 7056414..0000000 --- a/hello/both_hello/hello.ini +++ /dev/null @@ -1,45 +0,0 @@ -; -; 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 = 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 " -header = "#include " -header = "#include " - -[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/wscript b/hello/both_hello/wscript index 2cb1d76..5e784b4 100644 --- a/hello/both_hello/wscript +++ b/hello/both_hello/wscript @@ -10,17 +10,17 @@ 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 rtrace', - target = 'hello-deep.texe', - source = ['test.c'], - rtrace_cfg = '../../hello/both_hello/hello-deep.ini', - rtrace_wrapper = 'hello-deep') +# 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 rtrace', +# target = 'hello-deep.texe', +# source = ['test.c'], +# rtrace_cfg = '../../hello/both_hello/hello-deep.ini', +# rtrace_wrapper = 'hello-deep') bld(features = 'c cprogram', target = 'both_hello.exe', diff --git a/ticker/ticker_trace/Makefile b/ticker/ticker_trace/Makefile new file mode 100644 index 0000000..4347705 --- /dev/null +++ b/ticker/ticker_trace/Makefile @@ -0,0 +1,23 @@ +# +# RTEMS_MAKEFILE_PATH is typically set in an environment variable +# + +PGM=${ARCH}/ticker.exe + +# optional managers required +MANAGERS=all + +# C source names +CSRCS = init.c +COBJS = $(CSRCS:%.c=${ARCH}/%.o) + +include $(RTEMS_MAKEFILE_PATH)/Makefile.inc +include $(RTEMS_CUSTOM) +include $(PROJECT_ROOT)/make/leaf.cfg + +OBJS= $(COBJS) $(CXXOBJS) $(ASOBJS) + +all: ${ARCH} $(PGM) + +$(PGM): $(OBJS) + $(make-exe) diff --git a/ticker/ticker_trace/init.c b/ticker/ticker_trace/init.c new file mode 100644 index 0000000..4d86cf6 --- /dev/null +++ b/ticker/ticker_trace/init.c @@ -0,0 +1,99 @@ +/* + * 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. + */ + +#include +#include + +#include + +#include "../../testmacros.h" + +rtems_id Task_id[ 4 ]; /* array of task ids */ +rtems_name Task_name[ 4 ]; /* array of task names */ + +rtems_task Test_task( + rtems_task_argument task_index +) +{ + rtems_time_of_day time; + rtems_interval ticks; + + ticks = task_index * 5 * rtems_clock_get_ticks_per_second(); + + for ( ; ; ) { + (void) rtems_clock_get_tod( &time ); + if ( time.second >= 35 ) { + puts( "*** END OF CLOCK TICK TEST ***" ); + exit( 0 ); + } + put_name( Task_name[ task_index ], FALSE ); + print_time( " - rtems_clock_get_tod - ", &time, "\n" ); + (void) rtems_task_wake_after( ticks ); + } +} + +rtems_task Init( + rtems_task_argument argument +) +{ + rtems_time_of_day time; + + puts( "\n\n*** CLOCK TICK TEST ***" ); + + time.year = 1988; + time.month = 12; + time.day = 31; + time.hour = 9; + time.minute = 0; + time.second = 0; + time.ticks = 0; + + (void) rtems_clock_set( &time ); + + Task_name[ 1 ] = rtems_build_name( 'T', 'A', '1', ' ' ); + Task_name[ 2 ] = rtems_build_name( 'T', 'A', '2', ' ' ); + Task_name[ 3 ] = rtems_build_name( 'T', 'A', '3', ' ' ); + + (void) rtems_task_create( + Task_name[ 1 ], 1, RTEMS_MINIMUM_STACK_SIZE * 2, RTEMS_DEFAULT_MODES, + RTEMS_DEFAULT_ATTRIBUTES, &Task_id[ 1 ] + ); + (void) rtems_task_create( + Task_name[ 2 ], 1, RTEMS_MINIMUM_STACK_SIZE * 2, RTEMS_DEFAULT_MODES, + RTEMS_DEFAULT_ATTRIBUTES, &Task_id[ 2 ] + ); + (void) rtems_task_create( + Task_name[ 3 ], 1, RTEMS_MINIMUM_STACK_SIZE * 2, RTEMS_DEFAULT_MODES, + RTEMS_DEFAULT_ATTRIBUTES, &Task_id[ 3 ] + ); + + (void) rtems_task_start( Task_id[ 1 ], Test_task, 1 ); + (void) rtems_task_start( Task_id[ 2 ], Test_task, 2 ); + (void) rtems_task_start( Task_id[ 3 ], Test_task, 3 ); + + (void) rtems_task_delete( RTEMS_SELF ); +} + +/**************** START OF CONFIGURATION INFORMATION ****************/ + +#define CONFIGURE_APPLICATION_NEEDS_CONSOLE_DRIVER +#define CONFIGURE_APPLICATION_NEEDS_CLOCK_DRIVER + +#define CONFIGURE_MAXIMUM_TASKS 4 + +#define CONFIGURE_RTEMS_INIT_TASKS_TABLE +#define CONFIGURE_INIT_TASK_STACK_SIZE (2 * RTEMS_MINIMUM_STACK_SIZE) + +#define CONFIGURE_EXTRA_TASK_STACKS (4 * RTEMS_MINIMUM_STACK_SIZE) + +#define CONFIGURE_INIT +#include + +/**************** END OF CONFIGURATION INFORMATION ****************/ + diff --git a/ticker/ticker_trace/ticker-deep.ini b/ticker/ticker_trace/ticker-deep.ini new file mode 100644 index 0000000..863d671 --- /dev/null +++ b/ticker/ticker_trace/ticker-deep.ini @@ -0,0 +1,46 @@ +; +; RTEMS Trace Linker Configuration: hello deep +; +; This script configure the both hello example to perform deep +; tracing of RTEMS via the printf trace generator. +; +[tracer] +; +; Name of the trace. +; +name = Hello Deep RTEMS Tracer +; +; Options can be defined here or on the command line. +; +;options = verbose +; +; Functions to trace. +; +traces = hello-deep-trace +traces = rtems-score-object-all +traces = rtems-score-thread-all +traces = rtems-score-threadq-all +traces = rtems-score-heap-all +; +; Define the function sets. These are the function's that can be +; added to the trace lists. +; +functions = hello-deep-trace +functions = rtems-score +; +; Include RTEMS Trace support. +; +include = rtems.ini, rtld-base.ini + +; +; User application trace example. +; +[hello-deep-trace] +generator = printk-generator +signatures = hello-signatures +trace = exit, Init +header = "#include " + +[hello-signatures] +exit=void, int +Init = void, rtems_task_argument diff --git a/ticker/ticker_trace/ticker.ini b/ticker/ticker_trace/ticker.ini new file mode 100644 index 0000000..ca738b0 --- /dev/null +++ b/ticker/ticker_trace/ticker.ini @@ -0,0 +1,43 @@ +; +; 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 = 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 +header = "#include " +header = "#include " +header = "#include " + +[hello-signatures] +exit=void, int +Init = void, rtems_task_argument diff --git a/ticker/ticker_trace/wscript b/ticker/ticker_trace/wscript new file mode 100644 index 0000000..9b5e5d0 --- /dev/null +++ b/ticker/ticker_trace/wscript @@ -0,0 +1,26 @@ +# Copyright 2022 Joel Sherrill (joel@rtems.org) +# +# This file's license is 2-clause BSD as in this distribution's LICENSE.2 file. +# + +# Waf build script for an RTEMS Hello +import rtems_waf.rtems as rtems + +def build(bld): + rtems.build(bld) + + bld(features = 'c cprogram', + target = 'ticker_trace.exe', + source = ['init.c']) + + if rtems.check_env(bld, 'RTEMS_TLD'): + bld(features = 'c rtrace', + target = 'ticker_trace.texe', + source = ['init.c'], + rtrace_cfg = '../../ticker/ticker_trace/ticker.ini', + rtrace_wrapper = 'ticker-test') + bld(features = 'c rtrace', + target = 'ticker_trace-deep.texe', + source = ['init.c'], + rtrace_cfg = '../../ticker/ticker_trace/ticker-deep.ini', + rtrace_wrapper = 'ticker-deep') diff --git a/ticker/wscript b/ticker/wscript index df7a45e..178a68d 100644 --- a/ticker/wscript +++ b/ticker/wscript @@ -8,6 +8,7 @@ import rtems_waf.rtems as rtems def build(bld): bld.recurse(['ticker', 'ticker_stackchk', + 'ticker_trace', 'low_ticker', 'low_ticker1', 'low_ticker2']) -- cgit v1.2.3