Shop OBEX P1 Docs P2 Docs Learn Events
New WIKI page for the PropGCC project: In-depth Look at C for the Propeller — Parallax Forums

New WIKI page for the PropGCC project: In-depth Look at C for the Propeller

jac_goudsmitjac_goudsmit Posts: 418
edited 2012-09-30 02:51 in Propeller 1
Hello all,

I posted a new Wiki page on the Google code website, here: https://code.google.com/p/propgcc/wiki/PropGccInDepth

The page started out as an introduction to .cogc (native mode) programming but I basically wanted to write a page with all the information that I would have liked to know when I started on my own project, so I couldn't help but add all kinds of knowledge items that I thought were important. For this reason, it's not so much a programming tutorial anymore, but an in-depth guide about how the compiler works.

I'm not very familiar with the memory models other than COG and LMM but I figure I can add some more information about those later.

My own project (http://www.propeddle.com) uses a .cogc module for the low-level stuff and uses a lot of inline assembly, so I'm thinking of creating a Wiki page about inline assembly programming too, but this may take a while because I'm going to be busy with other stuff for a while.

I used a text editor (not the web page) to write the page initially, so I will need to go over the page and correct any formatting mistakes I made; I plan to do this tomorrow.

Hopefully you will find this useful.

Enjoy!

===Jac

Comments

  • mindrobotsmindrobots Posts: 6,506
    edited 2012-09-28 02:45
    This is good stuff, Jac!!

    Into the guts of the beast and all that.

    I have some things we worked on about memory models and cog starts and threads and such - not sure if it got posted before I started my "sabbatical". I'll dig it up today ang get it to you, it could be astart for more in depth memory model and multi-core use discussions and deep dives.

    This is inspiring - maybe I'll try getting back in the tutorial horse again!
  • ersmithersmith Posts: 6,054
    edited 2012-09-28 04:51
    This is a fantastic resource, thanks for adding it Jac! You've done a nice job of explaining a complicated topic.

    I did notice one small (and completely understandable) confusion:
    You can only use the *_NATIVE* function attribute with functions that are compiled in the COG memory model, because the *JMP* and *JMPRET* instructions are not allowed in other memory models. Note that the *_NATIVE* attribute only changes the calling convention, it has no influence on the way the other assembly instructions are generated. In other words, in a non-COG module, you can't force a function to be compiled to native code by adding the *_NATIVE* attribute.
    In fact _NATIVE is allowed in LMM mode, and will cause the function to be compiled in COG mode and to be linked in to the LMM kernel. There is very little room in that kernel, so this only makes sense for very small functions. This isn't really documented, but it probably should be.

    Thanks,
    Eric
  • jac_goudsmitjac_goudsmit Posts: 418
    edited 2012-09-28 07:03
    ersmith wrote: »
    In fact _NATIVE is allowed in LMM mode, and will cause the function to be compiled in COG mode and to be linked in to the LMM kernel. There is very little room in that kernel, so this only makes sense for very small functions. This isn't really documented, but it probably should be.

    I have to admit, I didn't check this particular statement and I should have. I'll modify the text to reflect this later today. Thanks!

    ===Jac
  • jazzedjazzed Posts: 11,803
    edited 2012-09-28 12:54
    @Jac, that looks good. Thanks.
  • jac_goudsmitjac_goudsmit Posts: 418
    edited 2012-09-30 02:51
    I fixed a number of layout bugs and fixed the problem that Eric noted. Thanks for the feedback, guys!

    Enjoy!

    ===Jac
Sign In or Register to comment.