Shop OBEX P1 Docs P2 Docs Learn Events
quick question about COGINIT (asm) — Parallax Forums

quick question about COGINIT (asm)

pemspems Posts: 70
edited 2008-11-04 00:58 in Propeller 1
Hi, i tried searching but couldn't find answer

I am working on a way to load a binary into the hub ram (via a small bootloader written in pasm over a byte-wide parallel IO lines), then, once received, starting this binary using COGINIT.
The binary that i am transferring is a binary file generated by the proptool.
I am unclear as to what location in memory i should be pointing COGINIT to to get the asm code. I've tried offset 0x18 from the start of the binary (as it seems thats where the first asm command resides) but that didn't work for me.

Thanks

Comments

  • BaggersBaggers Posts: 3,019
    edited 2008-11-03 10:00
    Hi pems,
    I'm guessing you're not using ANY spin in this binary download?
    also, I'm gonna take a stab at your coginit instruction, and guess that you're possibly not pointing it to a cogram long which has the ( baseaddress and the PAR value in and which cog to start it in ) ?

    eg
    StartNewCog
      shr BaseAddress,#2
      shl BaseaAdress,#4
      mov CogInitVar,ParValue
      shl CogInitVar,#2
      shl CogInitVar,#18
      or CogInitVar,BaseAddress
      or CogInitVar,CogToRunOn
      coginit CogInitVar
    StartNewCog_ret  ret    ' or you can make it cogid thiscog     cogstop thiscog
    
    ParValue long $800 'or whereever you want it to be
    BaseAddress long $18
    CogInitVar long 0
    
    



    hope that helps.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    http://www.propgfx.co.uk/forum/·home of the PropGFX Lite

    ·
  • pemspems Posts: 70
    edited 2008-11-03 13:42
    Thank you very much Baggers!

    I completely missed the part that the hub address that specifies the start execution address for coginit is supposed to be a LONG ADDRESS

    It works now!

    btw, now i have a framework that would potentially allow very fast propeller bootloading speeds.
    essentially a tiny bootloader that loads up first via p30, 31, then sucks in the actual firmware over the 8bit parallel bus as fast as it can
  • BaggersBaggers Posts: 3,019
    edited 2008-11-03 16:55
    cool pems, glad you got it sorted [noparse]:)[/noparse]

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    http://www.propgfx.co.uk/forum/·home of the PropGFX Lite

    ·
  • pemspems Posts: 70
    edited 2008-11-03 19:32
    yes, i am very happy. weekend well spent! [noparse];)[/noparse]


    I have another COGINIT question for gurus: i know it's a hub instruction: Is it guaranteed that when the COGINIT returns, the cog is up and running and hub isn't using the 2k binary chunk anymore? (i.e can one clobber the 2k block that was passed to COGINIT, as soon as COGINIT returns?) or does COGINIT simply schedules the initialization of a cog and doesn't wait (doesn't block) until the cog is finished initializing?

    Cheers
  • AribaAriba Posts: 2,687
    edited 2008-11-03 22:11
    COGINIT does only initiate the transfer from hub to cog ram. It does not wait until this transfer is finished.
    You can include a waitloop after coginit. The time for loading the whole cog is the same as 512 contiguous RDLONGs (8192 clocks, or 102.5us at 80MHz).

    Andy

    Post Edited (Ariba) : 11/3/2008 10:30:38 PM GMT
  • pemspems Posts: 70
    edited 2008-11-04 00:58
    Thanks a bunch Ariba
Sign In or Register to comment.