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

Lost printf() output using ULink2

I've got code in my project to dump out a data buffer using printf.  STDOUT is redirected to the ULink2/uVision "Debug (printf) viewer".

It should produce output like this:

Fullscreen
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
00000000: 00020400 00000000 5C0C0000 5C0C0000 ........\...\...
00000010: 5C0C0000 5C0C0000 5C0C0000 5C0C0000 \...\...\...\...
00000020: 5C0C0000 5C0C0000 C2030000 5C0C0000 \...\.......\...
00000030: 5C0C0000 B4050000 5C0C0000 5C0C0000 \.......\...\...
00000040: 5C0C0000 F4050000 5C0C0000 5C0C0000 \.......\...\...
00000050: 20060000 5C0C0000 5C0C0000 5C0C0000 ...\...\...\...
00000060: 5C0C0000 5C0C0000 5C0C0000 5C0C0000 \...\...\...\...
00000070: 5C0C0000 5C0C0000 5C0C0000 5C0C0000 \...\...\...\...
00000080: 5C0C0000 5C0C0000 5C0C0000 5C0C0000 \...\...\...\...
00000090: 5C0C0000 5C0C0000 5C0C0000 5C0C0000 \...\...\...\...
000000A0: 5C0C0000 5C0C0000 5C0C0000 5C0C0000 \...\...\...\...
000000B0: 5C0C0000 5C0C0000 5C0C0000 5C0C0000 \...\...\...\...
000000C0: 5C0C0000 5C0C0000 5C0C0000 5C0C0000 \...\...\...\...
000000D0: 5C0C0000 5C0C0000 5C0C0000 5C0C0000 \...\...\...\...
000000E0: 5C0C0000 5C0C0000 5C0C0000 5C0C0000 \...\...\...\...
000000F0: 5C0C0000 5C0C0000 5C0C0000 5C0C0000 \...\...\...\...
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

but what I get in the debug viewer is this:

Fullscreen
1
2
3
4
5
6
0000 5C0C0000 \...\...\...\...
00000050: 5C0C0000 5C0C0000 5C0C0000 5C0C0000 \...\...\...\...
00000060: 5C0C0000 5C0C0000 5C0C0000 5C0C0000 \...\...\...\...
00000070: 5C0C0000 5C0C0000 5C0C0000 5C0C0000 \...\...\...\...
00000080: 5C0C0000 C8020000 5C0C0000 5C0C0000 \.......\...\...
FFFFF00 ................
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

I suspect some form of overrun is occurring.  If I step through the code I get all the output as I expect.

Code:

Fullscreen
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
void dumpHex(const void* DataPointer, size_t DataLength)
{
if (NULL != DataPointer)
{
char StringBuffer[100] = { '\0' };
const unsigned char* p = (const unsigned char*)DataPointer;
unsigned char* pd;
unsigned char* pa;
size_t PointerSize = sizeof(void*);
size_t DataOffset = (PointerSize * 2) + 2;
size_t AsciiOffset = DataOffset + 38;
size_t LineLength = AsciiOffset + 16;
size_t index, i;
int n;
index = 0;
while (index < DataLength)
{
pd = (unsigned char*)StringBuffer + DataOffset;
pa = (unsigned char*)StringBuffer + AsciiOffset;
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX


I tried adding timer delays after the printf for each line of the data but that didn't change things much :(

What do I need to do to ensure I get all the output?

Thank you, David

0