Infrastructure:
K60 , IAR emmebbed work bench,MQX4.0
Running securitytelnet program , on the shell i have a small code for the application
int_32 shell_startsource(int_32 argc, char_ptr argv[])
{
boolean print_usage, shorthelp = FALSE;
int_32 return_code = SHELL_EXIT_SUCCESS;
char *str;
const char *str1;
print_usage = Shell_check_help_request(argc, argv, &shorthelp );
if (!print_usage)
{
if (argc !=1 )
{
printf("Error, invalid number of parameters\n");
return_code = SHELL_EXIT_ERROR;
print_usage=TRUE;
}
else
{
str=":o1";
str1="/r";
str=strcat(str,str1);
openserial();
serialwrite(str);
closeserial();
}
}
if (print_usage)
{
print_usage_simple (shorthelp, argv[0], "sourcestatus");
}
return return_code;
}
void openserial(void)
{
uint_32 flags=0;
serial_fd = fopen(BSP_DEFAULT_IO_CHANNEL1, 0);
ioctl(serial_fd, IO_IOCTL_SERIAL_SET_FLAGS, &flags);
}
void serialwrite(char * data)
{
_io_serial_polled_write(serial_fd,data,5);
}
void closeserial(void)
{
fclose(serial_fd);
}
intially telnet server will created and which gives shell login and in that i have shell_startsource command .
The code is running fine till the strcat function , when perform the strcat function , the telent task is going to unhand led interrupt error . inside the strcat when it tries to execute *dp++=*sp++; line it is go it this error and the step is not breaking .
the code of strcat as follows:
char *
strcat (char *dest, const char *src)
{
char *dp;
char *sp = (char *)src;
if ((dest != NULL) && (src != NULL))
{
dp = &dest[strlen(dest)];
while (*sp != '\0')
{
*dp++ = *sp++;
}
*dp = '\0';
}
return dest;
}
So please suggest a way to debug this issue and what is causing the telnet task to go unhandled interrupt error. Used the install _int_unexpected_isr() before the strcat function but do not excat way use this function to debug.so please suggest
snapshot attached:yes
Please use C++ syntax in FULL EDITOR to simplify view of your code. Thank you
Message was edited by: Martin Kojtal