Debugging C code if your SIM/EVM does not support debugging

At times, especially while working at system level/product level we will not have much chance to debug the code using break points in code for example it can be in application/firmware/dsp code

so if suppose you are stuck with wrong output and landed in finding out the bug and in case your sim/evm does not support any real time debugging then what is the method you are going to approach for step by step debugging.

So here comes the solution for this kind of problems.

For example: Consider a sample code flow show below.

main()
{

mem_alloc_inp();

mem_alloc_out();

input_read();

decimation_dsp_algo();

conv_dsp_algo();

output_read();

output_write();
}

suppose decimation_dsp_algo(); module is the cause for the corruption of the total output.

Just place a loop as show below and verify the contents of input and output buffers in the memory of decimation_dsp_algo();

main()
{

mem_alloc_inp();

mem_alloc_out();

input_read();

while(); /* 1st Verify input */

decimation_dsp_algo();

while(); /* 2nd Verify output */

conv_dsp_algo();

output_read();

output_write();
}

Note: Need to remove 1st while to verify output buffer

No comments:

Post a Comment

Related Posts

Twitter Updates

Random Posts

share this post
Bookmark and Share
| More
Share/Save/Bookmark Share