Shop OBEX P1 Docs P2 Docs Learn Events
SimpleIDE linking a Spin/Pasm object into a C binary? — Parallax Forums

SimpleIDE linking a Spin/Pasm object into a C binary?

evanhevanh Posts: 15,921
edited 2015-02-06 13:50 in Propeller 1
I've just had my first poke at C on the Prop. Using SimpleIDE, I am particularly interested in marrying pasm code from the object exchange. My first look was to check out any existing examples and found one with libvgatext. It uses VGA.spin.

I can see in vgatext.c the Cog being launched with the VGA driver dat labelled reference. What I can't figure out is how the extern reference is filled. I'm not seeing anything in the sources.

I'm guessing there is some magic naming going on with OpenSpin compiling that is then matched up at link time?

Comments

  • DavidZemonDavidZemon Posts: 2,973
    edited 2015-02-06 12:23
    If I'm understanding you correctly, I think this may be relevant. Assembly files (the dat section from VGA.spin) and cogc files are treated similarly by PropGCC. The linking is very... magical. And difficult to get right.

    http://forums.parallax.com/showthread.php/158190-Can-t-get-cogc-files-to-compile.
  • David BetzDavid Betz Posts: 14,516
    edited 2015-02-06 12:34
    evanh wrote: »
    I've just had my first poke at C on the Prop. Using SimpleIDE, I am particularly interested in marrying pasm code from the object exchange. My first look was to check out any existing examples and found one with libvgatext. It uses VGA.spin.

    I can see in vgatext.c the Cog being launched with the VGA driver dat labelled reference. What I can't figure out is how the extern reference is filled. I'm not seeing anything in the sources.

    I'm guessing there is some magic naming going on with OpenSpin compiling that is then matched up at link time?
    The linker creates the names used by these embedded binary images. Yes, it is a bit like magic.
  • evanhevanh Posts: 15,921
    edited 2015-02-06 13:50
    Thanks. I'll have a bit more of a read.
Sign In or Register to comment.