473,406 Members | 2,371 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,406 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 2942
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: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
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...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

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.