Page 1 of 3

OSRpt()

PostPosted: Tue May 06, 2003 9:07 am
by Phil W
Hi,

I'm just playing with OSRpt() and would like to know a couple of things.

What are the t-> e-> d-> columns representative of?

In my code I have 13 tasks defined and 14 events defined. In the printout I have 15 tasks listed and 15 events listed. What are the extra ones?

In the events list, 4 fit their definition and the rest list as type 8 x 'ERR', 2 x 'dstr' and 1 x msg. These are not like their definition, either Sem or BinSem. Please explain.

regards
Phil


Re: OSRpt()

PostPosted: Tue May 06, 2003 9:24 am
by Phil W
By the way I forgot.

When Creating the tasks and events, I test each one for noerr and none occur.


Phil


Re: OSRpt()

PostPosted: Wed May 07, 2003 6:59 am
by aek
Hi Phil.

t->, e-> and d-> are task, event and delay queue pointers, respectively.

E.g. if you follow the t-> elements for tasks that are eligible, you'll get the EligQ.

Tasks that are waiting events have e-> entries.

Tasks that are delayed, or waiting with a timeout, have d-> entries and (in the latter case) e-> entries.

Do you have OSTASKS and OSEVENTS set to 15, but you've only used 13 and 14, respectively? If so, and OSRPT_SHOW_ONLY_ACTIVE is FALSE, OSRpt() will show them all, regardless of whether they are in use or not.

'dstr': destroyed (uninitialized).

libraries have one event message defined -- are you building from a library build?

If you can, send me a screen dump of OSRpt() and your salvocfg.h and I'll take a look at it.

Regards,

------------------


Re: OSRpt()

PostPosted: Wed May 07, 2003 7:49 am
by Phil W
aek,

I use a custom built library as per following:-

//#include <msp430x14x.h>

//#undef OSBYTES_OF_COUNTS
#define OSBYTES_OF_COUNTS 2

#undef OSBYTES_OF_DELAYS
#define OSBYTES_OF_DELAYS 2

//#undef OSBYTES_OF_EVENT_FLAGS
#define OSBYTES_OF_EVENT_FLAGS 2

#undef OSBYTES_OF_TICKS
#define OSBYTES_OF_TICKS 4

//#undef OSCLEAR_WATCHDOG_TIMER()
//#define OSCLEAR_WATCHDOG_TIMER() WDTCTL = (WDTCTL & 0X00FF) | WDTPW | WDTSSEL | WDTCNTCL

#undef OSENABLE_BINARY_SEMAPHORES
#define OSENABLE_BINARY_SEMAPHORES TRUE

#undef OSENABLE_EVENT_FLAGS
#define OSENABLE_EVENT_FLAGS TRUE

#undef OSENABLE_EVENT_TRYING
#define OSENABLE_EVENT_TRYING TRUE

#undef OSENABLE_SEMAPHORES
#define OSENABLE_SEMAPHORES TRUE

#undef OSENABLE_TIMEOUTS
#define OSENABLE_TIMEOUTS TRUE

#undef OSEVENT_FLAGS
#define OSEVENT_FLAGS 4

#undef OSEVENTS
#define OSEVENTS 15

#undef OSMESSAGE_QUEUES
#define OSMESSAGE_QUEUES 0

#undef OSTASKS
#define OSTASKS 15


My Salvocfg.h is as follows:-

#include <msp430x14x.h>

#define OSUSE_LIBRARY TRUE
#define OSLIBRARY_TYPE OSL
#define OSLIBRARY_CONFIG OST
#define OSCUSTOM_LIBRARY_CONFIG 1
#define OSEVENT_FLAGS 0
#define OSEVENTS 13
#define OSTASKS 13


An OSRpt() as follows:-

code:
Salvo 3.2.0  Ticks: 4313
EligQ: t2
DelayQ: t11,t10,t7,t12 Total delay: 190 ticks
task stat prio addr t-> e-> d-> delay
1 wait 9 00001F1A t 3 t 2 2662
2 elig 9 00001C1E . n/a
3 wait 10 0000202E . t 2 3052
4 wait 7 00004E42 . 0
5 wait 7 00004D78 . 0
6 wait 8 000038D2 . 0
7 dlyd 9 000038BE t13 t12 5
8 wait 10 000051F8 . 0
9 wait 10 000055BE . 0
10 dlyd 10 000033EA . t 7 0
11 dlyd 9 00002532 t 2 t10 15
12 dlyd 10 000035C0 t10 . 170
13* elig 9 000051E2 t 2 n/a
14 dlyd 5 0000DEB2 59457
15 stop 0 00006146

evnt type t-> value
1 BSem t 5 0
2 Sem t 4 0
3 BSem t 6 0
4 BSem t 1 0
5 ERR
6 dstr
7 ERR
8 ERR
9 ERR
10 ERR
11 ERR
12 Msg 00000002
13 ERR
14 ERR
15 ERR


regards
Phil

[This message has been edited by aek (edited May 07, 2003).]


Re: OSRpt()

PostPosted: Wed May 07, 2003 9:41 am
by aek
Hmmm ... that looks weird for more than one reason ... I'll have a look at it and get back to you ...

------------------


Re: OSRpt()

PostPosted: Thu May 08, 2003 2:31 am
by Phil W
aek,

Library based on the 'it' for IAR compiler.

Make command to build:-

Make -f Makefile2 sliar430it.r43 T=OSL F=iar430 O=OSI C=OST V=OSNONE CLC=1


Phil


Re: OSRpt()

PostPosted: Thu May 08, 2003 3:04 am
by aek
Hi Phil.

Ah .. I think I see the problem ... it looks to me like OSRpt() "made it" up to the 5th event and then choked ... probably because an interrupt happened right then.

In the Notes for OSRpt() in the User Manual you'll see that "your application must control or disable interrupts while OSRpt() is executing".

Since your printf() probably requires that interrupts be enabled, you can't just blindly disable global interrupts "around" OSRpt(). Rather, you need to disable all interrupt sources that might result in an API call, e.g. the ones that call OSTimer() and/or OSSignalXyz(), etc. Normally, you would do this by disabling individual interrupt enable flags, etc.

Let me know if that works.

--Andrew

------------------


Re: OSRpt()

PostPosted: Thu May 08, 2003 4:38 am
by Phil W
aek,

Thanks for your reply.

In fact I had not disabled interupts around OSRpt(). I did so and got a slight improvement, so we are probably on the right track:-


Salvo 3.2.0 Ticks: 22445
EligQ: t2
DelayQ: t11,t10,t7,t12 Total delay: 80 ticks
task stat prio addr t-> e-> d-> delay
1 wait 9 00001F1A t 3 t 2 2436
2 elig 9 00001C1E . n/a
3 wait 10 0000202E . t 1 2426
4 wait 7 00004E42 . 0
5 wait 7 00004D78 . 0
6 wait 8 000038D2 . 0
7 dlyd 9 000038BE t13 t12 14
8 wait 10 000051FE . 0
9 wait 10 000055C4 . 0
10 dlyd 10 000033EA . t 7 1
11 dlyd 9 00002532 t 7 t10 5
12 dlyd 10 000035C0 . . 60
13* elig 9 000051E8 t 2 n/a
14 elig 6 00000554 n/a
15 wtto 10 00000548 1344

evnt type t-> value
1 BSem t 5 0
2 Sem t 4 0
3 BSem t 6 0
4 BSem t 1 0
5 BSem . 0
6 BSem . 0
7 ERR
8 dstr
9 dstr
10 ERR
11 EFlg . 00005391h
12 dstr
13 dstr
14 dstr
15 ERR


I created some macros to simulate the _monitor extension at anyplace in the code when I want to disable interrupts:-

#define _SDINT _OPC(0x1202); _DINT() // PUSH SR, DINT
#define _SEINT _OPC(0x4132) // POP SR

Here is the task that I cal OSRpt():-


void TaskWatchDog(void)
{
static unsigned char i;

for(; {
if(i++ > 100) {
i = 0;
// STATUS_LED1_TOGGLE;
_SDINT; // Disable interrupts, Remember GIE Status (PUSH SR, DINT)
WDTCTL = (WDTCTL & 0x00FF) | WDTPW | WDTHOLD; // Watchdog @32mS (ACLK=1MHz) hold it from timing out
OSRpt();
WDTCTL = ((WDTCTL & 0x00FF) & ~WDTHOLD) | WDTPW | WDTCNTCL; // Watchdog @32mS (ACLK=1MHz) reset and release from hold
_SEINT; // enable interrupts, Restore remembered GIE status (POP SR)
}
OS_Delay(20, TaskWatchDog1);
}
}

Here is my Putchar() function set up for 57600bd :-


#if (DEBUG)

#define TxBufEmpty1 (UTCTL1 & TXEPT) // true if empty (ok to send)


int putchar(int c)
{
while(!TxBufEmpty1); // wait for txbuffer to empty
U1TXBUF = (char)c;
return c;
}


#endif

I don't imagine that it would be a problem, but I have my system tick occur every 1mS.

regards
Phil


Re: OSRpt()

PostPosted: Thu May 08, 2003 7:43 am
by aek
Hi Phil.

1) OSRpt() is showing all 15 because it was compiled and placed into the library with OSTASKS and OSEVENTS set to 15. In hindsight, this is a bit silly, as it means that OSRpt() (as it currently stands) is only suitable for source-code builds. So, I am currently considering rewriting it to be called as OSRpt(num_tasks, num_events) and you would normally invoke it as OSRpt(OSTASKS, OSEVENTS).

Note that Salvo does not keep a runtime copy of OSTASKS and OSEVENTS because that's wasteful of RAM.

2. The event "dump" in your OSRpt() output is still puzzling me ...

------------------


Re: OSRpt()

PostPosted: Thu May 08, 2003 8:24 am
by Phil W
aek,

I smile with egg on my face :-)

I believe that I have stack overflow, right into salvo ram area. Not 100% sure yet, but it looks like it. I guess you'll hear from me when I clear it up.

Many thanks again
Phil