Shop OBEX P1 Docs P2 Docs Learn Events
PASM to GAS, any more demo than toggle or a cheat sheet? — Parallax Forums

PASM to GAS, any more demo than toggle or a cheat sheet?

frank freedmanfrank freedman Posts: 1,983
edited 2012-11-26 08:33 in Propeller 1
Hard to find much in the way of GAS examples or info on porting PASM to GAS. Are there any cheat sheets with some of the gotchas i.e. jumps, wait instructions etc, those things specific to the prop only?

Thanks,

Frank

Comments

  • altosackaltosack Posts: 132
    edited 2012-10-28 07:35
    Hi Frank,

    If you are trying to write whole modules in GAS (as opposed to in-line assembly), realize that GAS always uses the underlying assembly language for each processor, so GAS *is* PASM for the Propeller. Since I didn't find much in the documentation about this (funny, most people seem to be more interested in "C" for some reason !), I detailed some of my experiences and provided what I think is a useful example in this thread:

    http://forums.parallax.com/showthread.php?142441-Native-assembly-files-(*.S)-in-propgcc

    Another tidbit: you don't need to worry about the difference in reference due to long vs. byte addressing in cog mode if you simply place the ".cog_ram" directive at the top of your file (as in my example); I much prefer this to using the "mova" pseudo-op.

    David Voss
  • frank freedmanfrank freedman Posts: 1,983
    edited 2012-10-28 12:41
    Hey David,

    Worked out the issues I was having and now the clock generator function is up and running. It actually is a bit cleaner than the original from when I originally wrote it while learning PASM. Hoping gcc will make some aspects of a project easier to do now that I can use a larger memory model while having speed sensitive functions in cogs. Should possibly finish up porting my parallel ADC object to gcc by tonight, derived from my PASM object in OBEX. After the acq module is ported, need to figure hub access time to see whether concurrent sample transfer during capture or burst mode post capture will be possible.

    Thanks for the reply,

    Frank
  • ersmithersmith Posts: 6,054
    edited 2012-10-28 15:45
    The main gotchas. I think, are (1) addresses are byte addresses instead of long, although as David mentioned the use of the .cog_ram directive helps a lot with this, and (2) local labels starting with ':' are not supported.

    spin2cpp has a --gas output option: if you say:
    spin2cpp --dat --gas foo.spin
    
    then it will produce a file "foo.S" containing a GAS translation of the DAT section of foo.spin. It's still experimental and probably needs some more work, but it may help with some of the more mechanical aspects of translation (like replacing : labels).

    Eric
  • frank freedmanfrank freedman Posts: 1,983
    edited 2012-10-28 17:31
    Well, at this point, I have now gotten my parallel ADC up and running with the main C calling the clock generator an one ADC acquisition module. Next thing is to generalize the ADC module to use only one routine and pass in which module it is as it can be one of N remaining cogs in the chip. Following that, I will need to figure out how to do an array transfer from the cog into hub ram. Only question at this point is do I do it on the fly between captures or at the end of the series of say 256 or 512 (12 bit packed 2/word) in burst mode. Options, options..........

    Thanks again,

    Frank

    Additional thought:

    Currently it should be able to push 100ksps, though if I alter the method for the clock generator, I may be able to push it to over 1Msps.....
  • SRLMSRLM Posts: 5,045
    edited 2012-11-26 08:33
    Just for completeness, this thread has a link to the Propeller GAS instruction reference: http://forums.parallax.com/showthread.php?144100-Propeller-GCC-GAS-Document-Update&p=1144520#post1144520
Sign In or Register to comment.