This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

Generating log file using debug commands problem with LPC1768

Hello.

My name is Gennadii, some time ago I was FPGA HW\SW developer, but I had to switch to embedded programming. Now my task is to perform some test on NXP LPC1768 Cortex M3 using IBM Rational Test Realtime Studio 8.0 and Keil 4.50.0.0. The problem is log file generating with ULINK Pro debugger. I have usr_writeln function which stores string to output into some buffer. I use ini file (see below) to make execution halt at the end of usr_writeln and print the content of global buffer. But printf doesn't work correct. Sometimes the first symbol is lost, sometimes printed value totally doesn't match string in buffer. A simplified source code and ini file are provided below:
---------------------------------------------------------------------------------
program.c:

#include <string.h>
#include <stdio.h>

#define BUFSIZE 30000

char _u8Rtrt_Buf[BUFSIZE];

void end_writeln()
{ }

FILE* usr_open(char *fName)
{ return (FILE*)1;
}

void usr_writeln(FILE* f,char *s)
{ unsigned long _bufIdx = 0;

while(*s && _bufIdx < BUFSIZE) { _u8Rtrt_Buf[_bufIdx++] = *s++; } _u8Rtrt_Buf[_bufIdx] = '\0';

end_writeln();
}

void usr_close(FILE* f)
{ }

void usr_exit()
{ while(1);
}

int main(int argn, char *argc[])
{ FILE* f ;

f = usr_open("cNewTdp\\atl.out");

usr_writeln(f,"Hello\n"); usr_writeln(f,"Bla bla bla\n"); usr_writeln(f,"Test has been passed!\n");

usr_exit();

return 0;
} -----------------------------------------------------------------------------------
TestRT.ini:
RESET

LOAD .\mdkarm_hw\Test.axf INCREMENTAL

FUNC void out(void)
{ int i; i=0;

while( _u8Rtrt_Buf[i]) { printf("%c", _u8Rtrt_Buf[i++]); }
}

BS end_writeln, 1, "out()"
BS usr_exit

LOG > .\mdkarm_hw\Tmpatl.out
G LOG off
BK*
EXIT
-----------------------------------------------------------------------------------
Example of generated Tmpatl.out file after running debug:
G Tello
Tello
Tello
LOG off
-----------------------------------------------------------------------------------

Could anybody explain me, what is wrong?

0