473,386 Members | 1,773 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

ANSI C code testing

Hi,

I am writing c code for ATMEL 8051 core in ANSI c. we are using KEIL
compiler for it. I want to test my c code and improve my programming
skills. Can any one suggest the software tool that can test my c code
for runtime errors?

Dec 15 '06 #1
6 2938
praveen wrote:
Hi,

I am writing c code for ATMEL 8051 core in ANSI c. we are using KEIL
compiler for it. I want to test my c code and improve my programming
skills. Can any one suggest the software tool that can test my c code
for runtime errors?
Unit tests?

--
Ian Collins.
Dec 15 '06 #2
praveen wrote:
Hi,

I am writing c code for ATMEL 8051 core in ANSI c. we are using KEIL
compiler for it. I want to test my c code and improve my programming
skills. Can any one suggest the software tool that can test my c code
for runtime errors?
Ian Collins gave the most correct answer. The number of potential kinds
of runtime errors are infinite. Some kinds can certainly be discovered
programatically, some can't. Some can be determined by examining the
source code, some can't. Errors in logic, for instance, are runtime
errors, and yet completely impossible to catch automatically in some
general way. These, especially, benefit from the use of unit tests.

Memory abuse is a common runtime error, and fortunately there are many
tools available for at least /helping/ to catch these. Tools like
Valgrind or Electric Fence will help here.

A good "lint" program can also be very useful for this sort of thing.

Dec 16 '06 #3
praveen a écrit :
Hi,

I am writing c code for ATMEL 8051 core in ANSI c. we are using KEIL
compiler for it. I want to test my c code and improve my programming
skills. Can any one suggest the software tool that can test my c code
for runtime errors?
You can run your code in the 8051 emulator
http://sourceforge.net/projects/emu51/
Dec 16 '06 #4
"Micah Cowan" <mi***@cowan.namewrote in
praveen wrote:
>Hi,

I am writing c code for ATMEL 8051 core in ANSI c. we are using KEIL
compiler for it. I want to test my c code and improve my programming
skills. Can any one suggest the software tool that can test my c code
for runtime errors?

Ian Collins gave the most correct answer. The number of potential kinds
of runtime errors are infinite. Some kinds can certainly be discovered
programatically, some can't. Some can be determined by examining the
source code, some can't. Errors in logic, for instance, are runtime
errors, and yet completely impossible to catch automatically in some
general way. These, especially, benefit from the use of unit tests.

Memory abuse is a common runtime error, and fortunately there are many
tools available for at least /helping/ to catch these. Tools like
Valgrind or Electric Fence will help here.

A good "lint" program can also be very useful for this sort of thing.
The snag is that embedded code that interacts with hardware is difficult to
unit test, except in an emulator, and an emulator is as hard to write as the
actual program.

Separate out the IO from the the logic, or as I put it, the procedures from
the functions. The logic can be unit tested. The IO will probaly need
testing on hardware.
--
www.personal.leeds.ac.uk/~bgy1mm
freeware games to download.
Dec 17 '06 #5
Malcolm a écrit :
"Micah Cowan" <mi***@cowan.namewrote in
>>praveen wrote:
>>>Hi,

I am writing c code for ATMEL 8051 core in ANSI c. we are using KEIL
compiler for it. I want to test my c code and improve my programming
skills. Can any one suggest the software tool that can test my c code
for runtime errors?

Ian Collins gave the most correct answer. The number of potential kinds
of runtime errors are infinite. Some kinds can certainly be discovered
programatically, some can't. Some can be determined by examining the
source code, some can't. Errors in logic, for instance, are runtime
errors, and yet completely impossible to catch automatically in some
general way. These, especially, benefit from the use of unit tests.

Memory abuse is a common runtime error, and fortunately there are many
tools available for at least /helping/ to catch these. Tools like
Valgrind or Electric Fence will help here.

A good "lint" program can also be very useful for this sort of thing.

The snag is that embedded code that interacts with hardware is difficult to
unit test, except in an emulator, and an emulator is as hard to write as the
actual program.
But there is an emulator for the 8051 ALREADY written,
as I pointed out in my answer.

The "expanded" version of that minuscule chip has 256
BYTES of RAM...

With so few bytes available even a "brute force" approach
to testing could work...
Separate out the IO from the the logic, or as I put it, the procedures from
the functions. The logic can be unit tested. The IO will probaly need
testing on hardware.
Dec 17 '06 #6
Malcolm wrote:
"Micah Cowan" <mi***@cowan.namewrote in
>>praveen wrote:
>>>Hi,

I am writing c code for ATMEL 8051 core in ANSI c. we are using KEIL
compiler for it. I want to test my c code and improve my programming
skills. Can any one suggest the software tool that can test my c code
for runtime errors?

Ian Collins gave the most correct answer. The number of potential kinds
of runtime errors are infinite. Some kinds can certainly be discovered
programatically, some can't. Some can be determined by examining the
source code, some can't. Errors in logic, for instance, are runtime
errors, and yet completely impossible to catch automatically in some
general way. These, especially, benefit from the use of unit tests.

Memory abuse is a common runtime error, and fortunately there are many
tools available for at least /helping/ to catch these. Tools like
Valgrind or Electric Fence will help here.

A good "lint" program can also be very useful for this sort of thing.

The snag is that embedded code that interacts with hardware is difficult to
unit test, except in an emulator, and an emulator is as hard to write as the
actual program.
But often way more fun!
>
Separate out the IO from the the logic, or as I put it, the procedures from
the functions. The logic can be unit tested. The IO will probaly need
testing on hardware.
Agreed, assuming you neither have nor want to write an emulation.

--
Ian Collins.
Dec 18 '06 #7

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

100
by: Roose | last post by:
Just to make a tangential point here, in case anyone new to C doesn't understand what all these flame wars are about. Shorthand title: "My boss would fire me if I wrote 100% ANSI C code" We...
17
by: hugo27 | last post by:
hugo27 July 13, 2004 > >The teachy books and documentation I've read do not >mention the Escape key, but everytime I hit it during >runtime my programs go bananas. > >This relates to a larger...
6
by: Nitin | last post by:
Hi All, Is there any ANSI library ( header file ) which contains functions to extract or tokenize arguments of main( ) ? We have strtok( ), but thats non re-entrant, as it maintains static...
2
by: Martín Marconcini | last post by:
Hello there, I'm writting (or trying to) a Console Application in C#. I has to be console. I remember back in the old days of Cobol (Unisys), Clipper and even Basic, I used to use a program...
2
by: Ziver MALHASOGLU | last post by:
Hi, I produce a text file using my windows application written with c#. -- System.Text.Encoding encOutput=null; encOutput=System.Text.Encoding.UTF8; StreamWriter sw=new...
10
by: Michael B. Trausch | last post by:
Alright... I am attempting to find a way to parse ANSI text from a telnet application. However, I am experiencing a bit of trouble. What I want to do is have all ANSI sequences _removed_ from...
1
by: praveen | last post by:
Hi, I am writing c code for ATMEL 8051 core in ANSI c. we are using KEIL compiler for it. I want to test my c code and improve my programming skills. Can any one suggest the software tool that...
1
by: pbaldridge | last post by:
I'm trying to code a simple function that will prompt a user if they want to see another set of problems. The error I receive is "ANSI C++ forbids comparison between pointer and integer" int...
0
by: info | last post by:
Cognaxon has released "NIST (ANSI/NIST-ITL 1-2000) library" which adds the power of NIST (ANSI/NIST-ITL 1-2000) file format to your software projects using only a few lines of code. Additionally...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.