Shop OBEX P1 Docs P2 Docs Learn Events
Proposal: A book for PropGCC? — Parallax Forums

Proposal: A book for PropGCC?

mindrobotsmindrobots Posts: 6,506
edited 2014-01-21 13:33 in Propeller 1
I might not be able but I think I'm ready and willing. I'm not sure how best to tackle this than just jump with both feet.

It's time for a book about using PropGCC and the Propeller! There's been occasional talk on the forums and I've been thinking about it for quite a while.

In case you want to read something I've written:

The Toggle Tutorials
The Zero Tutorial
Blinky
Blink2
Blinky3


I'm attaching a pdf of an outline I'm putting together. At this point, it's mostly off the top of my head with things I remember not knowing or having questions about (many I still don't know). It will more than likely just be an ebook (unless O'reilly comes up with an offer and an animal for the cover).

If you have a chance and have a care, let me know what kinds of things you'd like to see covered (or thing that shouldn't be covered)

If I stay on it and hurry, I may finish it before I start on the Propeller 2 and PASM2 book! :lol:

P.S. I know I often go off topic on threads (I'm trying to do better) - if you could stay on topic with any comments, I'd appreciate it. THANKS!!
«1

Comments

  • mindrobotsmindrobots Posts: 6,506
    edited 2014-01-18 18:30
    Reserved for drafts and other information.
  • Phil Pilgrim (PhiPi)Phil Pilgrim (PhiPi) Posts: 23,514
    edited 2014-01-18 18:51
    Well, a book on PropGCC would certainly clinch its significance in the eyes of some. I was rather hoping it would die eventually under the weight of its own archaic complexity. :)

    -Phil
  • David BetzDavid Betz Posts: 14,516
    edited 2014-01-18 18:58
    Well, a book on PropGCC would certainly clinch its significance in the eyes of some. I was rather hoping it would die eventually under the weight of its own archaic complexity. :)

    -Phil

    Not funny.
  • mindrobotsmindrobots Posts: 6,506
    edited 2014-01-18 19:04
    Well, a book on PropGCC would certainly clinch its significance in the eyes of some. I was rather hoping it would die eventually under the weight of its own archaic complexity. :)

    -Phil

    ouch! I guess that's on-topic. It DOES mention PropGCC! :smile:

    Anything that helps the adoption of Propellers by anyone is a good thing!

    Maybe it can the Perl for Propellers!
  • jazzedjazzed Posts: 11,803
    edited 2014-01-18 20:13
    There is a "living" Propeller GCC book at http://learn.parallax.com/propeller-c

    I think there is more than one audience for a Propeller GCC book.

    C is not just a piano key.
    Microcontroller is not a fire breathing high-school teacher.
    What about our Italian friend?
    Devil in the details and :) C is fun :)

    There are many programming text books that make good examples to follow.
  • Heater.Heater. Posts: 21,230
    edited 2014-01-19 04:51
    Phil,
    I was rather hoping it would die eventually under the weight of its own archaic complexity.
    Outrageous.

    A bit rich coming from a Perl monger.

    Lets get rid of propgcc, and by inference GCC, and by inference C/C++.

    Fine with me. No more C programming on the Prop. No more C++ programming on the Arduino. No more Windows or Linux or Android or BSD etc

    Best of all no more Perl (It's written in C I guess)

    Life will be so much better when we get rid of C/C++.

    :)
  • jac_goudsmitjac_goudsmit Posts: 418
    edited 2014-01-19 10:03
    Hey Mindrobots,

    When I wrote my article with in-depth information about Propeller C/C++ programming, I definitely also had in mind that it might one day be part of a book. I figured, there are probably many embedded software engineers who are ignoring or avoiding the Propeller because they are unaware of GCC and SimpleIDE. There should be an audience for a book about the Propeller for C and C++ programmers (with perhaps varying degrees of experience writing embedded software) but with little or no knowledge of the Propeller. When Ken invited me to write more articles, I started thinking about the possibility of working towards a series of articles and tutorials that might be bundled into a book some day, although I never found the time to write any more articles :-(.

    The book that I had in mind, had chapters similar to yours, though I probably had them in a different order in my head. For example, I would make a rough overview of the Propeller's architecture into Chapter One and your outline doesn't get to that subject until Chapter Two. But that's probably because I had in mind that the audience would be those who already know C and/or C++ so I probably wouldn't have included your Chapter One (intermediate C programming) at all. I'm not saying it doesn't belong there, I'm saying I would find it difficult to write such a chapter because I've used C and C++ for such a long time myself that I would have trouble stepping into the shoes of a beginning C programmer. It's just because it's been too long since I was one myself. But I didn't discover the Propeller until a couple of years ago, so I think I still have a pretty good idea of which Propeller architecture details I was wondering about back then. And I remember learning Spin and PASM and trying to imagine how the Propeller-specific hardware features would be implemented in a C/C++ compiler or in a C/C++ program, if there would have been a C/C++ compiler back then.

    Anyway, the bottom line is, apparently unlike some others (ahem) I would like to encourage you to write your book, and I would like to offer my assistance if you need it (but judging from your outline, it looks like you got this). If you want to use my article as a chapter or an appendix, feel free to do so (all I ask is that you credit me for writing it). If you have any questions or if you want me to propose any improvements to the article, let me know (I think the part about calculating stack size is still pretty weak).

    And I think I speak for everyone here when I say: keep us posted! If you put up a draft of the book for review, we'd be more than happy to review it!

    ===Jac
  • SRLMSRLM Posts: 5,045
    edited 2014-01-19 10:05
    Who's your target audience?

    If it were me, I'd want to write for professional developers and I would additionally include:
    1. Debugging techniques (hardware level, compiling on PC, serial output, GDB, ASM output)
    2. Optimization techniques (and measurement)
    3. Timing (how to schedule things, interrupt, etc.)
    4. Power performance (sleep modes, speed vs current, etc.)
    5. Comparison to other MCUs (power and performance)
    6. Bootloading (aka, replacing the current program with something newer)
    7. Multi core communication and synchronization
    8. C++

    Personally, I don't like the learn site. By breaking into all those pages I don't know what's there, I can't find my way around, and I get frustrated and leave. I suppose the content is good, but I rarely ever get to that point in my browsing. It would be better if there was a "Download Learn as PDF Book" option that bundled everything together with a nice TOC.
  • mindrobotsmindrobots Posts: 6,506
    edited 2014-01-19 10:31
    Thanks, Cody for the useful suggestions and offers. When I woke up this morning, I had decided to flip chapters 1 and 2.

    My audience is most likely other hobbyists. I don't think I have the knowledge or experience to write for professional developers or engineers.

    I have mixed reactions to Learn. I hadn't been there for a while , so today I'm covering it from front to back.
  • Heater.Heater. Posts: 21,230
    edited 2014-01-19 10:45
    Take a look at the Arduino documentation.

    It's amazing. They never even say that you program an Arduino in C++. No, they talk about "sketches" and such.

    Now, C++ is a huge and complex language, so much so that I don't believe any single human being understands how it all works together.

    But in the Arduino documentation they keep it really simple. Which is helped by the really easy to use libraries they have.

    Professionals can take care of themselves.
  • mindrobotsmindrobots Posts: 6,506
    edited 2014-01-19 11:02
    Arduino? I did, I do. It's a wonderful example like you said because of the simplicity of the library wrappers. That said, I still have a couple Arduino books. I still think humans like the book format and a linear presentation rather than the non-linear presentation of the web for some materials.
  • David BetzDavid Betz Posts: 14,516
    edited 2014-01-19 11:41
    mindrobots wrote: »
    Arduino? I did, I do. It's a wonderful example like you said because of the simplicity of the library wrappers. That said, I still have a couple Arduino books. I still think humans like the book format and a linear presentation rather than the non-linear presentation of the web for some materials.
    Yes, I liked the old Parallax books. I hope they'll do another for their C tutorials rather than just relying on the web stuff.
  • mindrobotsmindrobots Posts: 6,506
    edited 2014-01-19 12:29
    I feel very strongly that the students would be much further along in both general programming skills and robotics concepts if the curriculum had been designed around Spin with the Propeller Tool instead of C.

    -Phil

    Phil, I find this very interesting (and probably feel the same, not being a C/C++ fanboy but a reluctant adopter and band wagon jumper). I'd like to pursue this in another thread or probably more constructively off forum if we could. I don't have practical experience to support my suspicion but you do. I would hope it could be fixed somehow to make the C experience painless and productive. My first two attempts at teaching a Robotics were mixed disappointments but not because of the tools.
    Rick, any effort to cast light in the shadows is to be encouraged. I wish you success in your endeavor.

    -Phil

    Thanks for your support! I knew you'd come around! :lol:
  • Heater.Heater. Posts: 21,230
    edited 2014-01-19 12:45
    mindrobots,

    The Arduino documentation is a wonderful example. Yes the simplicity of the library wrappers is a big part of that. But as I say C++ is a huge and tortuous language and they go out of their way not to even hint at the hard parts in those tutorials.

    I do agree about the book format. On the web or in print if someone can take you by the hand and lead you "linearly" through the maze that is great.

    Phil,
    BTW, Heater, I would never want to program the Prop in Perl. Sheesh!
    I never suggested that one would want program a Prop in Perl. Any more than anyone would want to program any machine in Perl. Only that if you exterminate C, as you suggested, you exterminate Perl with it. Along with all those other "P" languages. Python, PHP...
    Which might be a good deal.

    More seriously, why not? Is it such a crappy language?

    I'm kind of dedicated to getting JavaScript working on the P2 at least. Another stupid slow interpreted language. We will see how that goes.

    Note: All language war comments are expected to be accepted in good humour.
  • David BetzDavid Betz Posts: 14,516
    edited 2014-01-19 13:12
    Heater. wrote: »
    Phil.

    I can see that this might well be true.

    There is a reason us young teenagers were introduced to the concepts of programming by means of BASIC. That's BASIC on a mainframe by the way not a C64.

    Such a system removes all the cruft and unintelligible boiler plate gibberish and gets you straight into what you want to do at the moment.

    The Prop and Spin and the Prop Tool have this property.

    The Arduino and it's IDE also has it.

    SimpleIDE and propgcc, as much as I love hem, does not have that.
    I don't see any reason that we couldn't use the Arduino IDE with PropGCC. Some of the Arduino libraries have already been ported to the Propeller.
  • 4x5n4x5n Posts: 745
    edited 2014-01-19 14:07
    Looks good and I'll buy it! I would like to see some space given to mundane things like creating libraries.
  • 4x5n4x5n Posts: 745
    edited 2014-01-19 14:08
    Did someone mention Perl for the propeller?? :-)
  • ctwardellctwardell Posts: 1,716
    edited 2014-01-19 14:13
    Two Things:

    First:
    I definitely like the idea of the book and think that the introductory/hobbyist level is the best place to start.

    Second:

    I'd like to see the discussion with Phil continue, probably on another thread though, but that's up to you and Phil.

    The first hand experience Phil is having with teaching the class will be very valuable in helping steer the educational aspect of PropGCC is a positive direction.

    C.W.
  • Heater.Heater. Posts: 21,230
    edited 2014-01-19 14:31
    4x5n
    Did someone mention Perl for the propeller?? :-)
    No, I think you misheard. It was Lisp.
  • RossHRossH Posts: 5,462
    edited 2014-01-19 14:36
    All,

    A collection of interesting articles on why you should learn C (and not C#, C++, Objective-C or any of the other C derivative languages) as your first language: http://www.softintegration.com/academic/why-learn-c-as-first-programming-language.html

    I'm not sure I agree with them all (and you do have to keep in mind that this web site is promoting it's own C-like scripting language!) but I do think the case for students learning C first in the context of a microcontroller like the Propeller is even more compelling than it would be in a desktop environment.

    However, I don't think that C can or should ever displace Spin. Spin is a great language for giving hobbyists and newcomers to microelectronics and/or programming a taste of what the Propeller can do, whereas C is more appropriate for people who are studying to make a profession of computers or programming.

    C++ of course, should simply have been drowned at birth :lol:

    Ross.
  • Phil Pilgrim (PhiPi)Phil Pilgrim (PhiPi) Posts: 23,514
    edited 2014-01-19 14:39
    I've moved the posts relating the the discusison I started in Rick's thread here:

    -Phil
  • Heater.Heater. Posts: 21,230
    edited 2014-01-19 14:48
    RossH,

    I would not quote softintegration. They sound like a bunch of illiterate sharks.
  • 4x5n4x5n Posts: 745
    edited 2014-01-19 14:53
    I could live with lisp but would prefer perl! :-)
  • mindrobotsmindrobots Posts: 6,506
    edited 2014-01-19 15:00
    4x5n wrote: »
    I could live with lisp but would prefer perl! :-)

    No LISP, No Perl!

    This is about PropGCC and how to document it and help folks get a grip on using it with the Propeller.

    If you'd like to provide a Lisp interpreter as part of the PropGCC Demo package, go for it! If you want to discuss the merits of any other language with regards to PropGCC, please take it outside.

    If you have things about PropGCC you've been confused about or would like to see better explained in a BOOK, then you are in the right thread to comment!

    Thanks for playing along!
  • mindrobotsmindrobots Posts: 6,506
    edited 2014-01-19 15:20
    QUESTION FOR C PROGRAMMERS:

    Looking at this excerpt from the Learn pages:
    General Multicore Setup

    From this example, we can see the general steps for setting up multicore code, for large or compact memory models (LMM or CMM):
    • Use static volatile to declare global variables for sharing between functions running in different cogs.
      Example: static volatile int t, n;
    • Declare a stack array with 40 longs (required) + extra for local variables and calculations. Be liberal with the extra memory, and use testing to pare it down after your prototyping is done.
      Example: unsigned int stack[40 + 25];
    • Launch a function in another cog with cogstart and the following parameters:the address of the function, an optional value (or NULL), the address of the stack array, and the size of the stack array (in bytes).
      Example: cogstart(&adder, NULL, stack, sizeof(stack));
    • The cogstart function returns the ID of the destination cog. If you need to keep track of where a particular function is running, declare an int variable assigned to the cogstart function call.
      Example: int cog = cogstart(&adder, NULL, stack, sizeof(stack));

    At what level is this OBVIOUS and would not stop someone writing C code for a Propeller and make them pause to think how to do this?

    1) Someone who has just completed a C programming class
    2) Someone who has just graduated
    3) Someone who has been in the industry programming MCUs in C for 2 or 3 years?
    4) Most people considering themselves "expert" programmers (10+ years) would still not have all this pop into their head as the solution needed.

    My first reaction when I started playing with multiCOG C was "What is all this and why is it some clumsy, cumbersome, verbose?"

    I assume that at most levels, it's just easiest if you are told these kinds of things with the appropriate level of detailed discussion.

    Thanks!
  • David BetzDavid Betz Posts: 14,516
    edited 2014-01-19 15:50
    mindrobots wrote: »
    QUESTION FOR C PROGRAMMERS:

    Looking at this excerpt from the Learn pages:


    At what level is this OBVIOUS and would not stop someone writing C code for a Propeller and make them pause to think how to do this?

    1) Someone who has just completed a C programming class
    2) Someone who has just graduated
    3) Someone who has been in the industry programming MCUs in C for 2 or 3 years?
    4) Most people considering themselves "expert" programmers (10+ years) would still not have all this pop into their head as the solution needed.

    My first reaction when I started playing with multiCOG C was "What is all this and why is it some clumsy, cumbersome, verbose?"

    I assume that at most levels, it's just easiest if you are told these kinds of things with the appropriate level of detailed discussion.

    Thanks!
    I don't think any of these points would be obvious to anyone other than someone who already knows how to program the Propeller and the details about how big a stack to allocate would only maybe be obvious to someone familiar with PropGCC. I also don't agree that shared variables need to be declared "static". I guess that is true if they are declared inside of a function but not if they are declared at the file level.

    I'm not sure about the "clumsy cumbersome and verbose" part. Even in Spin you have to pick a stack size for example.
  • 4x5n4x5n Posts: 745
    edited 2014-01-19 16:12
    mindrobots wrote: »
    No LISP, No Perl!

    This is about PropGCC and how to document it and help folks get a grip on using it with the Propeller.

    If you'd like to provide a Lisp interpreter as part of the PropGCC Demo package, go for it! If you want to discuss the merits of any other language with regards to PropGCC, please take it outside.

    If you have things about PropGCC you've been confused about or would like to see better explained in a BOOK, then you are in the right thread to comment!

    Thanks for playing along!

    Sorry about hijacking the thread. Just having fun. I think that perl or lisp on a prop would be silly.
  • mindrobotsmindrobots Posts: 6,506
    edited 2014-01-19 16:55
    David Betz wrote: »
    I don't think any of these points would be obvious to anyone other than someone who already knows how to program the Propeller and the details about how big a stack to allocate would only maybe be obvious to someone familiar with PropGCC. I also don't agree that shared variables need to be declared "static". I guess that is true if they are declared inside of a function but not if they are declared at the file level.

    I'm not sure about the "clumsy cumbersome and verbose" part. Even in Spin you have to pick a stack size for example.

    Thanks, David! That's the kind of feedback I need. The "clumsy, cumbedsome, verbose" was a bit of hyperbole - by the nature of launching a cog, all languages go through something similar.
  • Jack3Jack3 Posts: 55
    edited 2014-01-20 06:53
    As relatively inexperienced programmer, I am searching for a good GCC educational reference related to the Prop. I agree the online one at Parralax leaves much to be desired. I know the basics of coding in multiple languages. I am relearning ANSI C, and working on Spin, C#, C++. I mess around with the Arduino version of C. Also written in Pascal,VB, and Business Basic(gag me with a spoon).

    So I have the basics of structure. I grasp pointers, not so able to use them well yet. What I want to know is specific key words for the Prop, a good explanation of what each of the header files brings to the code. I am a hobbyist, not looking to make the next greatest and bestest, just want to make the Prop do what I want in parallel.

    So differences in the language related specifically to Prop (for example why print instead of printf ?). I end up getting lost searching for small answers and am having a heck of a time gathering all the information I need in one spot. I would PAY for a hardcover, paperback, kindle. For example I would want to know what that list of defines in simpletools.h such as CLREOL (11) is and where the function is so I can read it and use all of it's designated child functions. I suppose this sounds rambling, sorry I do that.

    My point is there does indeed need to be a good referencing/learning tool out there that is chronological and informative. I myself would ask baby programmers what they seek, what they don't understand related to this chip.
  • mindrobotsmindrobots Posts: 6,506
    edited 2014-01-20 08:03
    Jack3 wrote: »
    As relatively inexperienced programmer, I am searching for a good GCC educational reference related to the Prop. I agree the online one at Parralax leaves much to be desired. I know the basics of coding in multiple languages. I am relearning ANSI C, and working on Spin, C#, C++. I mess around with the Arduino version of C. Also written in Pascal,VB, and Business Basic(gag me with a spoon).

    So I have the basics of structure. I grasp pointers, not so able to use them well yet. What I want to know is specific key words for the Prop, a good explanation of what each of the header files brings to the code. I am a hobbyist, not looking to make the next greatest and bestest, just want to make the Prop do what I want in parallel.

    So differences in the language related specifically to Prop (for example why print instead of printf ?). I end up getting lost searching for small answers and am having a heck of a time gathering all the information I need in one spot. I would PAY for a hardcover, paperback, kindle. For example I would want to know what that list of defines in simpletools.h such as CLREOL (11) is and where the function is so I can read it and use all of it's designated child functions. I suppose this sounds rambling, sorry I do that.

    My point is there does indeed need to be a good referencing/learning tool out there that is chronological and informative. I myself would ask baby programmers what they seek, what they don't understand related to this chip.

    Thank you for the input. This is the kind of information I am looking for.

    It should be one book (for efficiency sake) but it is hard to target and write to both audiences, hobbyists (like you and me) and serious, professional engineers. Structuring the layers will be a challenge.

    Your questons are many of the same things I keep going out and looking for.
Sign In or Register to comment.