Topic : C Language Unit Test Framework and RIDE

Forum : 8051

Original Post
Post Information Post
March 16, 2011 - 5:50pm
Guest

Hello,

I am trying to run unit tests on my 8051 board.

I was thinking about using a free C Language Unit Test Framework called CUnit.
The problem started when I tried to build, on RIDE, the project I successfully ran on my PC: It did not work! I have made a little research in my Raisonance kit 6.1 Documentation and, apparently, Rc51 does not support the usual ANSI-C file management functions and libraries we often use when working with ordinary pc-based ANSI-C programs. Maybe I am wrong so I ask you guys: Could you please confirm this information?

Do you have any ideas about free C Language Unit Test Frameworks that might work with RIDE and 8051 architecture?

Thanks for the help!

Regards,
Leandro

Replies
Post Information Post
+1
0
-1
March 21, 2011 - 9:37am
Raisonance Support Team

Hi Leandro,

I am not sure to understand what you want to do: On an 8051, there is no such thing as a "file" concept, so what would you want fopen to do?

Our Compiler implements the ANSI standard for the C language as defined in the following standards:
? ISO/IEC 9899:1990 standard (sometimes referenced as ISO C90).
? Technical Corrigendum 1 (ISO/IEC 9899 TCOR1) approved in 1995.
? Technical Corrigendum 2 (ISO/IEC 9899 TCOR2), published in 1996.

It is a "freestanding" implementation (as defined by the standard), which means that stdio.h and the like are not requested.

Best Regards,

+1
0
-1
March 21, 2011 - 1:49pm
Guest

Hello, Bruno

Thanks for the answer!

I will try to explain it better: We have made a C-Language application code for an 8051-based development kit. Although most of the modules are ANSI-C, it does not deal with file mangement as if we were dealing with a PC-based environment. We do not use standard C file functions such as fopen, fscanf or fclose.

However, We are trying to run unit automated unit tests for this code. We are stil trying to use CUnit (http://cunit.sourceforge.net/) as our main tool, running in a PC-Based environment, since most of the code is ANSI-C. Our first attempt was succesfull: we used free software tools like gcc and cunit and we could run the automated unit tests. When we tried to use RIDE, we could not compile the code because cunit apparently uses C File Management functions to generate output XML files.

As I was reading the RIDE Rc51 documentation, I discovered that RIDE does not support file management (decribed on the "few restriction" section). I need any help in order to run my unit tests. Is there any other free tool I can use with RIDE? Or, is it possible to modify RIDE (like adding a new library) in order to make it work with file management in a PC-based simulation environment?

Any help is appreciated.

Best Regards,
Leandro

+1
0
-1
March 21, 2011 - 2:24pm
Raisonance Support Team

Hi Leandro,

As there is (usually) no storage on 8051 applications, it may be wise to write some basic stubs that use the UART instead of a file: fopen, fseek, fflush and fclose would do nothing, and fwrite would perform some putchar direct to the UART. Then fread could always return EOF.

Think about a simple file management facility like that. Just connect the application board to a PC through RS-232, then you can read the XML results on the PC side.

I hope this helps (although I'm not sure)

+1
0
-1
March 21, 2011 - 2:56pm
Guest

Hello, Bruno

I will try that.

Thank you very much for the help!

Best Regards,
Leandro