Porting a Program to Dynamic C

Hi Everybody,

I have purchased a Rabbit RCM6700 Standart Kit. I am using Dynamic C Compiler 10.70. I want to port my existing C project to Dynamic C to work with this board. But I am new to Dynamic C and rabbit microcontrollers. I have read the “TN203 - Porting a Program to Dynamic C” document but still no success. Please guide me through this porting process. If anyone can provide a tutorial showing all steps needed I am very pleased. I am sure it will be very useful for lots of people in this forum.

I can succesfully compile and run my project using VS2010 in windows platform. It send some commands to our special module board using serial interface and receives data back and prints on screen. I want to control our module board with RCM6700 and send received datas using ethernet interface.

Let me explain my C project structure.

This project have one “main.C” file and several “.h” header files.
In “main.C” file all necessary headers are included with “#include myheader.h” directive. And inside header files, other headers are also included.
All these headers are user-defined headers.
As I have learned Dynamic C does not support “#include” directives and “.h” header files. Am I correct?
It uses “#use myheader.lib” instead.

How can I convert my C headers to Dynamic C libraries?
Where do I copy my header files?
How can I include them to project path?

I am waiting some answers to solve this porting problem. I will try another platform if I can not find any solution.

Thank you.

The more recent versions of DC support the use of #include to make it easier to port code from standard C. Have a look in the DC Users manual for information on how to use this feature. I believe you can set up projects with the newest DC and tell it which files to include but I havent used this feature myself so can’t comment on how well it works.

Note you will lose some of the advantages of DC in terms of how it can exclude unnecessary code if you don’t go down the route of a full conversion with the proper BeginHeader/EndHeader blocks.

If you want to have a look at a large body of code that has been ported from C to Dynamic C you can compare the two versions of the BACnet stack on Sourceforge at bacnet.sourceforge.net and bacrabbit.sourceforge.net to see the type of changes required. It took me a while to do the initial port because of the sheer number of functions involved but it did work out fine in the end and I have develped a commercial product based around this stack.

Regards,
Peter

Hi petermcs,

Thank you for your reply. I will look that ported code.

I have converted my .h header files to .lib files using the tutorial on “http://shdesigns.org/tips/dclib.shtml” with BeginHeader/EndHeader blocks. Now my compiler finds my headers but I have some syntax errors about enum initializers and some other errors. I think I have lots of things to control and change to fit Dynamic C structure.

Any suggestions are welcome.

Thank you.

As Peter stated, Dynamic C 10 supports #include just as standard C does. If you want to put your .h files somewhere in particular, you can specify the path in:
Options - Project Options - Include Path.
For other errors you are getting, I suggest you send specific examples to Rabbit Tech Support.