Shop OBEX P1 Docs P2 Docs Learn Events
PSAD and variables question — Parallax Forums

PSAD and variables question

RS_JimRS_Jim Posts: 1,773
edited 2011-03-08 15:51 in Propeller 1
Hi All,
I am trying to debug some PASM code with PSAD and I haven't been able to figure out how to pass a Global variable to the cog that I am trying to debug. Any Ideas?
RS_Jim

Comments

  • lardomlardom Posts: 1,659
    edited 2011-01-27 10:48
    JonnyMac wrote an excellent article in "Nuts and Volts" which should answer your variable questions. His amost recent article is HERE.
  • AribaAriba Posts: 2,690
    edited 2011-01-27 16:22
    If you pass the address of this global variable in the par register at cognew, then you can see the value of this variable with the MainRAM viewer. This viewer points per default to the MainRAM section beginning with the address from par. So the first 4 bytes in this view window show you the value, but you can switch the view to longs.
      cog := cognew(@myAsmCode, @myGlobalVar)   'start your cog to debug
      dbg.start(31,30,@myAsmCode)               'start debugger
      ...
    
    Andy
  • davrandavran Posts: 12
    edited 2011-01-27 16:36
    say a program snippet is like below

    PUB
    ...
    global_variable_pointer := @global variable
    ... somme codes etc.
    DATA
    'your cog's asm program
    wrbyte local_cog_variable, global_variable_pointer 'moves data in local_cog_variable to global variable
    ...
    local_cog_variable byte

    or you can use the par register as below
    cognew(@cogprog,@variablex)
    ..
    cogprog
    mov par,data
    which loads data into the variablex through the par register
  • RS_JimRS_Jim Posts: 1,773
    edited 2011-01-28 05:02
    Thanks Ariba.
    Another question, can I start another cog to run in the background while I am running PSAD. Putting the debug start in a top object and starting the "debugged" obj in the same way as I would any other cog? I want to observe the interaction of the variables between the two cogs while debuging one.
    RS_Jim
  • AribaAriba Posts: 2,690
    edited 2011-01-28 06:00
    This should be possible. You need to insert the 12-long kernel at the begin of the one cog to debug, but there can run other cogs at the same time.
    Be aware that the debugged cog first goes in a Break and you have to start it with F5, while the other cog(s) run direct after the download.
    Also Breakpoints and single stepping only happens to the debugged cog, the others just continue.

    Andy
  • RS_JimRS_Jim Posts: 1,773
    edited 2011-01-29 05:48
    Thanks Andy,
    I will give that a try!.
    RS_Jim
  • RS_JimRS_Jim Posts: 1,773
    edited 2011-03-08 15:51
    Andy,
    I finally got PSAD working like it should! Now if I could just figure out what the error is in my logic! lol.
    RS_Jim
Sign In or Register to comment.