Catalina for DS00
prof_braino
Posts: 4,313
Note: This is not a cross post, I am checking out both Catalina (here) and CGG (in a different thread). The first post is the same in both threads.
There is some C code posted for the prop chip in the DS00 Laser Range Finder.
http://www.lightware.co.za/download/software/DS00_Rev00.zip
Per the readme:
"The C source code (was) written using the ICCPROP V7.04D compiler from Imagecraft.com"
The image craft is 30-days free trial, I might want to re-do the code after 30 days. I would like to use the community tool of choice compiler.
Would you kind folks advise me which would be easier for a complete n00b to get going?
Be advised that I am not so good with C. I don't even have a "C" on my keyboard; it fell off, and I have a scratch-up "O" from a spare.
There is some C code posted for the prop chip in the DS00 Laser Range Finder.
http://www.lightware.co.za/download/software/DS00_Rev00.zip
Per the readme:
"The C source code (was) written using the ICCPROP V7.04D compiler from Imagecraft.com"
The image craft is 30-days free trial, I might want to re-do the code after 30 days. I would like to use the community tool of choice compiler.
Would you kind folks advise me which would be easier for a complete n00b to get going?
Be advised that I am not so good with C. I don't even have a "C" on my keyboard; it fell off, and I have a scratch-up "O" from a spare.
Comments
It can open the include files, but give the message could not find include file <xxx>
Do I have something configured wrong?
I have been writing a plugin for my rtc. Ross has been great getting me going and once done I will document how it works from a noobs pov.
BTW we are using Catalina in a commercial project. I am not writing the main c routines. The project uses 3 props and the catalina prop has a RamBlade3 config (512KB sram, uSD, DS1430C rtc).
I must have missed that in the installer.
I restarted Catalina, but it still won't compile the include files. Maybe I got to reboot....
So, after I boot the pc, I do cd\catalina34 and then run use_catalina. Then I cd\xxx and then I can compile.
To ensure everything is ok, follow the install instructions and then the instructions to compile and test the hello world program. This whoudl check you have everything setup/installed correctly. I will not be home til this evening. I will post my simple instructions then for you. IIRC Rayman posted some simple instructions much earlier in this thread.
They are a bit cryptic. Hopefully they will help you get running...
NOTE that you need to do a use_catalina each time you reboot the pc.
You can do...
cd %LCCDIR%
instead of
cd \catalina34
from the run command line in windoze.
The first problem is that this program is compiler-dependent. Since it is not pure ANSI C, you are pretty much going to have to make some changes no matter which compiler you port it to.
The immediate problem you are having (with it not finding it's own include files) is easily fixed - just add "-I." (that's "minus capital-eye dot") to your command. That instructs Catalina to include the current directory in the path of system include file searches. The meaning of the include directive is a bit implementation-dependent, but the generally accepted interpretation is that ...
... means to include a system-defined include file called constants.h (i.e. from a list of compiler-defined directories), whereas ..
... means to include a user-defined include file called constants.h (i.e. from the current directory).
The program you are trying to compile uses the first form for all include files, whereas for some files it should be using the second form. The "-I." will work around this by adding the current directory to the list of system search paths.
This will fix the references to "constants.h", "externals.h" and "globals.h". The next problem is that there are other include files that exist only under the ICC compiler - i.e. "propeller.h" and "asio.h". I wrote a Catalina replacement include file for "propeller.h" (called "catalina_icc.h") that could be used under either compiler and allowed code to be made portable between ICC and Catalina. This program does not use it, but it would be trivial to modify it to do so. It also uses something called "asio.h" and I have no idea what that is - perhaps "asynchronous serial I/O"?. However, I think you will find you don't need that with Catalina, since Catalina comes with built-in serial support (just add -D PC to your compile command).
When I do a bit of "hacking" (just to see what might be required to port it) I can get it to compile, apart from a symbol or two (e.g. a missing "froundf" function - obviously some kind of non-standard floating point rounding function - should be easy enough to fix).
Of course, getting it to compile is not the same as getting it to run - for that, you're on your own!
Ross.
I was using the Catalina Code blocks graphic IDE. Where do I find the command where I add the -I. -- or do I have to only use the catalina command line to compile?
So can I just comment these out? OR do I need to change "propeller.h" to "catalina_icc.h"?
Again, where is the command where I add -D PC ?
I can switch to a the "standard float round" easy enough, when I get this far.
When I open my DS00-Cat.cbp project file, the Projects tab has:
Workspace
DS00-Cat
Sources
Main.c
Is this what we expect, or will adding the -I. make all the *.c and *.h files appear in the projects list?
Do I also have to change the include from < > to " "; or is it one or the other?
In CodeBlocks the best way is to select the menu item option Settings->Compiler and debugger. Make sure that Catalina C compiler is the Selected compiler, then go to the Other settings tab. Check the box that says Explicitly add project's top-level directory to compiler search dirs. Replace <propeller.h> with <catalina_icc.h>, then replace each reference to the prop special registers (e.g. INA, OUTA) with the Catalina equivalent. For instance. I think you need to replace things like SET(OUTA, pin) with _outa(1<<pin,-1)
Select the menu item option Project->Build Options. Make sure that your desired target is selected (in the left hand pane of this dialog box, you generally want your project-name selected, and not either of Debug or Release). On the compiler flags tab, select the HMI Driver Selection category, then check PC No, you need to explicitly add all the .c and .h files to the project, not just Main.c. Select the menu item Project->Add Files, and add all the .c and .h files you see.
Any .h file that you can see in the project directory should be specified as #include "xxx.h" rather than #include <xxx.h>
Ross.