C - SimpleIDE, GCC, ETC - Just For The Sake Of Discussion
idbruce
Posts: 6,197
A week or so ago, Dave Hein asked:
While working on the Teacup port, going through the translation of C to SPIN, I have often pondered his questions. As I look at dda_queue, I now see that it has an array of DDA structures, with a current setting of 8 elements, and to convert these DDA elements to variables and then track them properly..... Let me just say that I am considering options.
Without doing any serious research, is there any Propeller supported C language that is object oriented and supports structures and unions? For example, is there anything out there that will support the following:
Source: Teacup firmware - dda.h
Bruce, I'm curious why you are converting the Teacup software to Spin, and not just leaving it in C. I noticed that you participated in this thread that attempted to port the C Teacup code to the Propeller. Why not continue from where that thread left off? It seems that converting to Spin code would be error-prone and unnecessary unless the program wouldn't fit in C. Why are you converting it to Spin?
While working on the Teacup port, going through the translation of C to SPIN, I have often pondered his questions. As I look at dda_queue, I now see that it has an array of DDA structures, with a current setting of 8 elements, and to convert these DDA elements to variables and then track them properly..... Let me just say that I am considering options.
Without doing any serious research, is there any Propeller supported C language that is object oriented and supports structures and unions? For example, is there anything out there that will support the following:
typedef struct { TARGET endpoint; union { struct { uint8_t nullmove:1; uint8_t live:1; uint8_t done:1; uint8_t waitfor_temp :1; uint8_t x_direction:1; uint8_t y_direction:1; uint8_t z_direction:1; uint8_t e_direction:1; }; uint16_t allflags; }; uint32_t x_delta; uint32_t y_delta; uint32_t z_delta; uint32_t e_delta; uint32_t total_steps; uint32_t fast_um; uint32_t fast_spm; uint32_t c; int32_t n; uint32_t rampup_steps; uint32_t rampdown_steps; uint32_t c_min; uint8_t endstop_check; uint8_t endstop_stop_cond; } DDA;
Source: Teacup firmware - dda.h
Comments
Both propgcc and Catalina should compile that just fine.
Are you sure?
I have already downloaded SimpleIDE and PropGCC, and I am currently reviewing the documentation.
Nothing ventured, nothing gained
C has always supported structs and unions.
Object oriented programming can be done in any language. C++ and others of course provide languages features that make OOP much easier.
That code you are translating was originally written for the Arduino. The Arduino uses the same GCC compiler as the Propeller. prop-gcc is GCC with a Propeller target output as opposed to avr-gcc as used by Arduino with AVR targets.
Yes. In fact if it does not compile that is a bug that needs reporting somewhere.
Except...On the Prop the same functionality as Spin will result in much bigger executable code when written and compiled as C.
It may not fit the Prop.
Thank you very much for an informative answer.
Approximately how much bigger, percentage wise? Although I am fairly sure this will depend on the memory model chosen.
I don't recall any code size comparisons now but there has been some posted here occasionally .
prop-gcc can compile to LMM which is quite space hungry but fast. Or it can compile to CMM (Compressed Memory Model) which I believe compares in size and speed with Spin.
Personally I have not looked into these things very much.
I guess at the end of the day one has to compile the code with the various options of prop-gcc. Then, if the code fits in the Prop, run it and see what the speed is like.
David thanks for that answer - I have a Propeller Memory Card attached to the controller, so it sounds like XMMC would be a nice option.
@Heater
I suppose I will take a little time and poke a stick at it. Just between dda.c, dda_queue.c, dda_maths.c, gcode_parse.c, and gcode_process.c, a partial port might develop faster than the route that I am currently taking. Why write code if it is already written? But then again, who knows....
**Please note that I removed all includes from linked files that I had no interest in retaining.
Code submitted for compiling
And the results
Doesn't look too horrible
EDIT: I see you found config.h while I was editing this post.
I was doing that as you typed
Same time stamp on our posts