| Debugging: |
Just like all the other tasks running inside the
EC32 system also the main application task maintains several status
machines. The required actions are triggered by events from several
locations within the source code in the following way:
DoCmd_A(__FILE__,
CHANGD_A,
SHOW_STATUS,
1000);
The function DoCmd_A() looks like this:
SWORD DoCmd_A(PSTR file, SWORD Ch, SWORD Cmd, SWORD Loc)
{
if (Ch == CHANGE_STATE){
if (AppRes_EC[Handle_A]->TraceLevel > 2){
sprintf(ac_Temp_A,"%s> State <%s> --> <%s>
Loc: %d", file,
ActionState[A_Info.State], ActionState[Cmd], Loc);
ECTraceMsg(Handle_A, NOCHAN_EC, TRCINFO_EC,
F_GEN_STRING, ac_Temp_A);
}
A_Info.State = Cmd;
}
else {
if ( (Ch >= 0) && (Ch < NumChan_A) ) {
Chan_A[Ch]->Flags[Cmd] = TRUE;
if (Ch == CHANGD_A) {
}
else {
if (AppRes_EC[Handle_A]->TraceLevel
> 3) {
sprintf(ac_Temp_A,"%s> Flag %d set for <%s> , Loc: %d",
file , Cmd, ChanNames_A[Ch], Loc);
ECTraceMsg(Handle_A,
NOCHAN_EC, TRCINFO_EC, F_GEN_STRING, ac_Temp_A);
}
}
}
else {
if (AppRes_EC[Handle_A]->TraceLevel >
1) {
sprintf(ac_Temp_A,
"%s: Flag for inv. chan. %d, Loc:%d",
file, Ch, Loc);
ECTraceMsg(Handle_A,
NOCHAN_EC, TRCERROR_EC, F_GEN_STRING,ac_Temp_A);
}
}
}
}
This feature produces an entry in the logfile
similar to the following line:
10:39:35
APP1> A_appl.c>
Flag 9 set
for
<LOG>, Loc:
1004
It shows from which source file the command
originated, which flag was set, which task has been commanded and at
which location within the source file the command was given. During
the development process these numbers are generated automatically by a
specific ultility, which updates all source files of a software
project. |