PropGCC and the C3
Rsadeika
Posts: 3,837
Since it has been mentioned, in some other threads, that in September there will be some major announcements about SimpleIDE/PropGCC, I thought that I should get back in and check out some of the new libs that have been added. It has been noted that the libs, that are being presented in the Learn area, are not necessarily ANSI specific, which I do not have a problem with, as long as there is a big note some where that states that.
A couple of things that I should mention, the big thing with the Propeller is, the cogs. The big thing with PropGCC is, use of expanded/extended memory(XMM). In the Learn section I do not see any preliminary discussion about, maybe using all eight cogs, and being able to use all the cogs in all of the memory modes(LMM,CMM,XMM). I think that some of the new people will start asking - What about the Propellers cogs, how do we use them.
Below is my sample program where I am trying to make use of my C3 board. One thing that I did notice, when you use print() and writeLine(), there is an auto CR with it. It seems like, when you try to use it in an IO format, you get that unwanted CR.
The other thing I noticed is when you create a new project, it no longer creates a specific folder. Also, in the main() you have a couple curly brackets({}), but you do not have a while() associated with it. Does this mean that there is an assumed while(1) associated with that in the main() subroutine?
Ray
A couple of things that I should mention, the big thing with the Propeller is, the cogs. The big thing with PropGCC is, use of expanded/extended memory(XMM). In the Learn section I do not see any preliminary discussion about, maybe using all eight cogs, and being able to use all the cogs in all of the memory modes(LMM,CMM,XMM). I think that some of the new people will start asking - What about the Propellers cogs, how do we use them.
Below is my sample program where I am trying to make use of my C3 board. One thing that I did notice, when you use print() and writeLine(), there is an auto CR with it. It seems like, when you try to use it in an IO format, you get that unwanted CR.
The other thing I noticed is when you create a new project, it no longer creates a specific folder. Also, in the main() you have a couple curly brackets({}), but you do not have a while() associated with it. Does this mean that there is an assumed while(1) associated with that in the main() subroutine?
Ray
/******************************************************************************/ /* * C3test2.c * * August 24, 2013 * */ #include "simpletools.h" #include "fdserial.h" /* XBee to run in its own cog, only works with LMM and CMM. */ void XBee(void *par); unsigned int XBstack[40 + 25]; /* Test run of another cog run, only works with LMM and CMM. */ void LedNF(void *par); unsigned int Ledstack[40 + 25]; /******************************************************************************/ int main() { // Add startup code here. char inBuff[40]; int getBuff; pause(300); print("This is C3test2\n"); /* Start the cogs. */ cogstart(&LedNF, NULL, Ledstack, sizeof(Ledstack)); cogstart(&XBee, NULL, XBstack, sizeof(XBstack)); while(1) { print("#"); getBuff = getStr(inBuff,40); if(!strcmp(getBuff,"quit")) break; else { print("Invalid Command!\n"); } } return 0; } /******************************************************************************/ /* Start access to XBee in its own cog. */ void XBee(void *par) { int XBee; char inBuff[40]; char getBuff; XBee = fdserial_open(21, 22, 0, 9600); while(1) { writeLine(XBee,">"); getBuff = readStr(XBee,inBuff,40); if(!strcmp(getBuff,"quit")) break; else { writeLine(XBee,"Invalid Command!"); } // pause(2000); } writeLine(XBee,"Program Stop!n"); } /******************************************************************************/ /* Start LED on/off in its own cog. */ void LedNF(void *par) { while(1) { high(23); pause(500); low(23); pause(500); } } /******************************************************************************/
Comments
The Learn Simple Library functions are not named with ANSI-C library names, so there is no issue. All syntax is ANSI-C according to the C99 standard.
Parallax didn't want to add the cost of XMM chips to the high volume Learn products like the Activity-board. They wanted a product that would fit entirely in the Propeller HUB RAM. Simple Libraries provide that ability. Users that want XMM can use the Propeller Memory Card (PMC.cfg driver to be added to the release).
If you don't want the CR, use writeStr instead of writeLine.
Simple View New Project does not make a folder by request of Parallax. Project View New Project does make a folder.
After reading the descriptions for the simpletext.h functions, again, now I see where you do state the differences for the functions. I think that Parallax should reconsider the making of the folder in Simple View. What will they be zipping when they start to use the project zip command?
Below is my example program with some changes that reflect the commands that do a built in CR.
Ray
That is a work in progress - we have discussed it often. The earliest it can be done is with the Propeller2 release.
Like Project View, Simple View Zips whatever is in the project + whatever is found in the libraries.
I have no control over the folder decision.
I was looking for a keyboard driver in C, but I could not find one. I thought, at one time there was a C keyboard driver in the OBEX, but I did not find it. It would be nice to find a combined VGA and keyboard driver, or at least I think it would be nice. I would still like to try that with the C3 board, just too see what it would look like. I am still looking into ways of making that C3 or Demo Board(if I ever find it) into a stand-alone/wireless system.
Ray
Here's an interesting example of performance cost for you: Spin Simple_Serial.spin -vs- Propeller-C simpletext default serial library. Both are half-duplex serial port driver that do not require an extra COG. Simple_Serial.spin maximum standard speed is 19200 bps while simpletext serial maximum standard speed is 115200 bps. To achieve 115200 bps in Spin/PASM with P1, it is necessary to waste a COG.
I've spent some time making Keyboard and VGA Simple Libraries for simpletext. It will be published some time after labor day.
Ray
https://propsideworkspace.googlecode.com/hg/Learn/Simple%20Libraries%20Index.html
Link to fdserial library documentation.
https://propsideworkspace.googlecode.com/hg/Learn/Simple%20Libraries/Text%20Devices/libfdserial/Documentation%20fdserial%20Library.html
Link to fdserial_open documentation.
https://propsideworkspace.googlecode.com/hg/Learn/Simple%20Libraries/Text%20Devices/libfdserial/html/fdserial_8h.html#a43ff539c64dfbb0f2f95403a4c746788
There you see that fdserial_open returns an fdserial pointer rather than an int.
You have defined XBee as an int rather than fdserial. The compiler says you have made a mistake.
The type fdserial is another name for the struct text_t. It is common to use such typedefs in C.
C is a heavily typed language that allows such mistakes to be caught at compile time rather than run time.