Sunday, December 17th 2017, 1:32am UTC+1

You are not logged in.

  • Login
  • Register

Dear visitor, welcome to SEGGER Forum. If this is your first visit here, please read the Help. It explains how this page works. You must be registered before you can use all the page's features. Please use the registration form, to register here or read more information about the registration process. If you are already registered, please login here.

aphardt

Beginner

Date of registration: May 12th 2017

Posts: 4

1

Wednesday, July 19th 2017, 4:57pm

System View - No RTOS - Pseudo-Tasks

Hello

Im currently working on a system without any RTOS.
We would like to test the new tool System View.
I have so far modified the trace file, that ISRs are recorded OK, and the task description appears. As soon as i try to log the entry of a "task" entry and the exit, the system receives unknown packages and breaks down.

The current setup looks like this and works OK, except the tasks are yet not visible, just the description.

As soon as i define the

C/C++ Source code

1
#define  OS_TRACE_TASK_SWITCHED_IN(p_tcb)       	//SEGGER_SYSVIEW_OnTaskStartExec((U32)p_tcb);
and the

C/C++ Source code

1
#define  OS_TRACE_TASK_SUSPENDED(p_tcb)         	//SEGGER_SYSVIEW_OnTaskStopExec();
things start to go sideways.

Is there any advice on how to log "pseudo" tasks?

C/C++ Source code

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
// ------------- TRACE DEFINITION -----------------

typedef struct
{
  const char * NamePtr;
  unsigned Prio;
  uint32_t StkBasePtr;
  unsigned StkSize;
}trace_task_t;

#define  OS_TRACE_TASK_CREATE(p_tcb)            	if (p_tcb != 0) {                                           	\
                                                  	SEGGER_SYSVIEW_OnTaskCreate((U32)p_tcb);                  	\
                                                  	SYSVIEW_AddTask((U32)p_tcb,                               	\
                                                                  	&(((trace_task_t*)p_tcb)->NamePtr[0]),    	\
                                                                  	((trace_task_t*)p_tcb)->Prio,             	\
                                                                  	((trace_task_t*)p_tcb)->StkBasePtr,       	\
                                                                  	((trace_task_t*)p_tcb)->StkSize           	\
                                                                  	);                                        	\
                                                	}
#define  OS_TRACE_TASK_READY(p_tcb) 
#define  OS_TRACE_TASK_SWITCHED_IN(p_tcb)       	//SEGGER_SYSVIEW_OnTaskStartExec((U32)p_tcb); 	SYSVIEW_TaskSwitchedIn((U32)p_tcb)
#define  OS_TRACE_TASK_DLY(dly_ticks)
#define  OS_TRACE_TASK_SUSPEND(p_tcb) 
#define  OS_TRACE_TASK_SUSPENDED(p_tcb)         	//SEGGER_SYSVIEW_OnTaskStopExec();          	SYSVIEW_TaskSuspend((U32)p_tcb)
#define  OS_TRACE_TASK_RESUME(p_tcb) 
#define  OS_TRACE_TASK_ONIDLE()                 	SEGGER_SYSVIEW_OnIdle();

#define  OS_TRACE_ISR_BEGIN(isr_id)
#define  OS_TRACE_ISR_END()

#define  OS_TRACE_ISR_ENTER()                   	SEGGER_SYSVIEW_RecordEnterISR()
#define  OS_TRACE_ISR_EXIT()                    	SEGGER_SYSVIEW_RecordExitISR()
#define  OS_TRACE_ISR_EXIT_TO_SCHEDULER()       	SEGGER_SYSVIEW_RecordExitISRToScheduler()

void  SYSVIEW_TaskReady(U32 TaskID)
{
  (void) TaskID; 
}

void  SYSVIEW_TaskSwitchedIn(U32 TaskID)
{
  (void) TaskID;
}

void  SYSVIEW_TaskSuspend(U32 TaskID)
{
  (void) TaskID;
}

void SYSVIEW_AddTask(U32 xHandle, const char* pcTaskName, unsigned uxCurrentPriority, U32 pxStack, unsigned uStackHighWaterMark) {

  if (memcmp(pcTaskName, "IDLE", 5) == 0) {
	return;
  }

  if (_NumTasks >= SYSVIEW_NOOS_MAX_NOF_TASKS) {
	SEGGER_SYSVIEW_Warn("SYSTEMVIEW: Could not record task information. Maximum number of tasks reached.");
	return;
  }

  _aTasks[_NumTasks].xHandle = xHandle;
  _aTasks[_NumTasks].pcTaskName = pcTaskName;
  _aTasks[_NumTasks].uxCurrentPriority = uxCurrentPriority;
  _aTasks[_NumTasks].pxStack = pxStack;
  _aTasks[_NumTasks].uStackHighWaterMark = uStackHighWaterMark;

  _NumTasks++;

  SYSVIEW_SendTaskInfo(xHandle, pcTaskName,uxCurrentPriority, pxStack, uStackHighWaterMark);
}

// ------------- ISR EXAMPLE TRACE -------------------------------------

void USART0_RX_IRQHandler(void)
{
  OS_TRACE_ISR_ENTER();
  // .... handles interrupt
  OS_TRACE_ISR_EXIT_TO_SCHEDULER();
}

// ------------------ TASK EXAMPLE TRACE ------------------------

// TASK ADD
//...
	#if (defined(OS_CFG_TRACE_EN) && (OS_CFG_TRACE_EN > 0u))
	_tasks[pos].traceInformation.NamePtr    	= name;
	_tasks[pos].traceInformation.Prio       	= prio;
	_tasks[pos].traceInformation.StkBasePtr 	= (U32)NULL;
	_tasks[pos].traceInformation.StkSize    	= 0x100;
	OS_TRACE_TASK_CREATE(&(_tasks[pos].traceInformation));
	#endif
//...

// TASK EXECUTION
//...
  	OS_TRACE_TASK_SWITCHED_IN(&(_tasks[i].traceInformation));
  	_tasks[i].task();
  	OS_TRACE_TASK_SUSPENDED(&(_tasks[i].traceInformation));
//...