| |||||
Technical Support Support Resources
Product Information | RTX51: KERNEL AWARE DEBUGGINGInformation in this article applies to:
QUESTIONCan I get task information from the µVision Debugger when I create RTX51 programs? ANSWERYes. This is called Kernel-Aware debugging. The RTOS information may be displayed using the RTX51.DLL that comes with µVision V2.20 and later. For earlier versions of µVision, you may use the following script in the µVision Debugger:
/****************************************************************/
/* RTX-51 V5.xx dScope-51 Debug-Functions (Win-Version) */
/* */
/* TF/EG/RK 17-JUL-1997 */
/****************************************************************/
/* (c) METTLER & FUCHS AG, CH-8953 Dietikon */
/* Tel. (+41) (1) 740 41 00 / Fax (+41) (1) 740 15 67 */
/****************************************************************/
func void tasks () {
uchar i;
uchar tid;
uchar temp;
uchar temp2;
uchar state_1;
uchar state_2;
uint adr;
printf ("+----+-------+------+---------+-------------------+---------+-------+--------+\n");
printf ("| ID | Start | Prio | State | Blocked for Event | Mbx/Sem | Timer | Signal |\n");
printf ("+----+-------+------+---------+-------------------+---------+-------+--------+");
for (i = 0; i <= 18; i++) {
adr = &?RTX_TID_TABLE+i;
tid = uchar (x:adr);
if (tid != 0xef) {
/* Task-ID */
adr = &?RTX_INTERNAL_NUM_TABLE+i;
temp = uchar(x:adr);
printf ("\n|%3u | ", (uint) temp);
/* Start-Address / Prio */
temp2 = 0;
while (temp2 < 255) {
adr = &?RTX_TASKCONST+temp2*7;
if (uchar (c:adr+4) == temp) break;
temp2++;
}
printf ("%04XH | ", uint (c:adr));
printf (" %1u | ", uchar (c:adr+3));
/* Task-State */
adr = &?RTX_STATE_TABLE+i*4;
state_1 = uchar (x:adr);
adr++;
state_2 = uchar (x:adr) & 0x80; if (tid == ?RTX_RUNNING_TID) printf ("RUNNING | ");
else if ((state_1 & 0x0f) | state_2) printf ("BLOCKED | ");
else printf ("READY | ");
/* Blocked for Event / Mailbox / Timer */
adr = &?RTX_DELAY_LIST_CLK+i;
temp = uchar(x:adr);
adr = &?RTX_SYSCLK_COUNT;
temp = temp - uchar(d:adr);
temp2 = (state_1 & 0x70) / 16;
switch ((state_1 & 0x0f) | (state_2 / 8)) {
case 0: printf (" | | | ");
break;
case 1: printf ("MSG | %1u | | ", temp2);
break;
case 2: printf ("INT | | | ");
break;
case 3: printf ("MSG & INT | %1u | | ", temp2);
break;
case 4: printf ("SIG | | | ");
break;
case 5: printf ("MSG & SIG | %1u | | ", temp2);
break;
case 6: printf ("INT & SIG | | | ");
break;
case 7: printf ("MSG & INT & SIG | %1u | | ", temp2);
break;
case 8: printf ("TMO | | %3u | ", (uint) temp);
break;
case 9: printf ("MSG & TMO | %1u | %3u | ", temp2 , (uint) temp);
break;
case 10: printf ("INT & TMO | | %3u | ", temp);
break;
case 11: printf ("MSG & INT & TMO | %1u | %3u | ", temp2 , (uint) temp);
break;
case 12: printf ("SIG & TMO | | %3u | ", (uint) temp);
break;
case 13: printf ("MSG & SIG & TMO | %1u | %3u | ", temp2 , (uint) temp);
break;
case 14: printf ("INT & SIG & TMO | | %3u | ", (uint) temp);
break;
case 15: printf ("MSG&INT&SIG&TMO | %1u | %3u | ", temp2 , (uint) temp);
break;
case 16: printf ("WRITE-MAILBOX | %1u | | ", temp2);
break;
case 17: printf ("TKN | %2u | | ", temp2+8);
break;
case 19: printf ("TKN & INT | %2u | | ", temp2+8);
break;
case 21: printf ("TKN & SIG | %2u | | ", temp2+8);
break;
case 23: printf ("TKN & INT & SIG | %2u | | ", temp2+8);
break;
case 24: printf ("WRITE-MBX & TMO | %1u | %3u | ", temp2 , (uint) temp);
break;
case 25: printf ("TKN & TMO | %2u | %3u | ", temp2+8 , (uint) temp);
break;
case 27: printf ("TKN & INT & TMO | %2u | %3u | ", temp2+8 , (uint) temp);
break;
case 29: printf ("TKN & SIG & TMO | %2u | %3u | ", temp2+8 , (uint) temp);
break;
case 31: printf ("TKN&INT&SIG&TMO | %2u | %3u | ", temp2+8 , (uint) temp);
break;
default: printf ("ILLEGAL | | | ");
}
/* Signal */
if (state_1 & 0x80) printf (" 1 |");
else printf (" 0 |");
}
}
printf ("\n+----+-------+------+---------+-------------------+---------+-------+--------+\n");
}
func void mailboxes () {
uchar i;
uchar k;
uchar temp;
uint msg;
uint adr;
uint m_ptr;
printf ("+-----+-----+------+-------+-------------------------------------------------+\n");
printf ("| Mbx | Msg | Read | Write | Messages |\n");
printf ("+-----+-----+------+-------+-------------------------------------------------+");
for (i = 0; i <= 7; i++) {
printf ("\n| %1u | ", (uint) i);
adr = &?RTX_MBX_CONTROL_BASE+i*8;
temp = uchar(x:adr);
if (temp == 0) printf (" 0 | 0 | ");
else if (temp < 128) printf ("%2u | 0 | ", (uint) temp);
else printf (" 0 | %2u | ", (uint) ~temp+1);
temp = uchar(x:adr+1);
printf (" %2u | ", (uchar) temp);
temp = uchar(x:adr);
if (temp < 128) {
m_ptr = uchar(x:adr+2);
for (k = 0; k <=7; k++) {
if (k < temp) {
adr = &?RTX_MBX_PAGE+m_ptr;
msg = uchar(x:adr)*256;
m_ptr = (m_ptr+1) & 0xef;
adr = &?RTX_MBX_PAGE+m_ptr;
msg = msg + uchar(x:adr);
m_ptr = (m_ptr+1) & 0xef;
if (k+1 == temp ) printf ("%04XH ", (uint) msg);
else printf ("%04XH/", (uint) msg);
}
else printf (" ");
}
printf ("|");
}
else printf (" |");
}
printf ("\n+-----+-----+------+-------+-------------------------------------------------+\n");
}
func void semaphores () {
uchar i;
uchar k;
uchar temp1;
uchar temp2;
uchar cnt;
uint adr;
printf ("+-----+-----+------+\n");
printf ("| Sem | Tkn | Wait |\n");
printf ("+-----+-----+------+");
for (i = 0; i <= 7; i++) {
printf ("\n| %2u | ", (uint) i+8);
adr = &?RTX_SEM_TOKENS+i;
temp1 = uchar(x:adr);
if (temp1 == 0) printf (" 0 | ");
else printf (" 1 | ");
adr = &?RTX_MBX_CONTROL_BASE+i*8;
temp1 = uchar(x:adr+6);
temp2 = uchar(x:adr+7);
cnt = 0;
while (temp1 != temp2) {
if ((temp1 & 0x0F) == 0x0F) temp1 &= 0xF0;
else temp1++;
cnt++;
}
printf (" %2u |", cnt);
}
printf ("\n+-----+-----+------+\n");
}
func void mempools () {
uchar i;
uchar j;
uchar k;
uchar taskid;
uchar numblocks;
uchar output;
uint blksize;
uint poolptr;
uint adr;
output = 0;
for (i = 0; i <= 15; i++) {
adr = &?RTX_POOL_CONTR+i*6;
blksize = uint(x:adr);
numblocks = uchar(x:adr+5);
if (blksize != 0) {
output = 1;
printf ("+-------------------------------------------------------------------+\n");
printf ("| Memory Pool No. = %2u Blocksize = %5u Bytes |\n", (uint) i, blksize);
printf ("+----+-----------+----+-----------+----+-----------+----+-----------+\n");
printf ("|Task|Block/Addr |Task|Block/Addr |Task|Block/Addr |Task|Block/Addr |\n");
printf ("+----+-----------+----+-----------+----+-----------+----+-----------+");
poolptr = uint (x:adr+2);
for (j = 0; j < numblocks; j += 4) {
printf ("\n");
for (k = 0; k < 4; k++) {
if ((k+j) >= numblocks) {
printf ("| | ");
} else {
taskid = uchar(x:poolptr+1);
if (taskid == 0xef) {
printf ("|free| %3u ", (uint)k+j );
} else {
taskid &= 0x1f;
adr = &?RTX_INTERNAL_NUM_TABLE + taskid;
taskid = uchar(x:adr);
printf ("| %2u | %3u %04XH ", (uint)taskid, (uint)k+j, poolptr+2);
poolptr += blksize + 2;
}
}
}
printf ("|");
} printf ("\n+----+-----------+----+-----------+----+-----------+----+-----------+\n");
}
}
if (output == 0) {
printf ("+-------------------------+\n");
printf ("+ No Memory Pools Defined +\n");
printf ("+-------------------------+\n");
}
}
set f3 = "tasks ()"
set f4 = "mailboxes ()"
set f5 = "semaphores ()"
set f6 = "mempools()"
define button "Task State", "tasks ()"
define button "Mailboxes", "mailboxes ()"
define button "Semaphores", "semaphores ()"
define button "Mem.Pools", "mempools ()"
See below for details on receiving a copy of this file. ATTACHED FILESRequest the files attached to this knowledgebase article. FORUM THREADSThe following Discussion Forum threads may provide information related to this topic. Last Reviewed: Saturday, May 28, 2005 | ||||
| |||||