Shop OBEX P1 Docs P2 Docs Learn Events
LMM P2 Debugger - Uses Serial Tx & Rx for debugging single cog programs - Page 8 — Parallax Forums

LMM P2 Debugger - Uses Serial Tx & Rx for debugging single cog programs

1456810

Comments

  • SapiehaSapieha Posts: 2,964
    edited 2013-04-24 02:18
    Hi Cluso.

    Look's good
    Thanks
    Cluso99 wrote: »
    Sapieha,
    Here is v0.63 that incorporates your code.
    However, I am unsure about your modifications to the L command. I need to think some more on this as it removes some flexibility that I require.
    Perhaps I can put in an M4 command specifically for you?

    Others:
    I suggest for now, until I make Sapieha's code easily removed, I suggest you try v0.62 a few posts back.

    Attachment not found.
  • SapiehaSapieha Posts: 2,964
    edited 2013-04-24 02:24
    Hi Cluso.

    Next problem.

    Run code I post in attachment.


    Part 1 code function for me
    1. Part 1
    .
    '        cmp    lmm_w, #"?"        wz    '' "?" ? ---------------------------------------- 11111111111111111111111111
    '    if_z    add    lmm_pc, #(:cmd_Help-($+1))*4    '> bra fwd: store addr = long
    
    

    But Can You help me with this Part ?
    '------------------------------------------------------------------------------
    ' Display HELP TEXT
    :cmd_Help                        '' ------ 777777777777777777777777777777777777777777777777777 -------
                long    @_str_hlong            ' /
                mov    lmm_f, #_TXSTRING
    '           'FCALL    SP++, @_HubTxString        ' \            < call: tx string >
                wrlong     lmm_pc, lmm_sp            ' | PUSH PC
                add     lmm_sp, #4            ' | SP++
                rdlong     lmm_pc, lmm_pc            ' | CALL...
                long     @_HubTxString            ' / ...PC = ADDR
    '           'POP    lmm_p                ' \            < pop:  'addr' #1 >
                sub     lmm_sp, #4            ' | SP--
                rdlong     lmm_p, lmm_sp            ' / POP
    '                sub     lmm_pc, #(($+1)-:again)*4    '--------------------------> bra back
    '                sub     lmm_pc, #(($+1)-:start)*4    '--------------------------> bra back
    ''
    
    
  • SapiehaSapieha Posts: 2,964
    edited 2013-04-24 03:44
    Hi Cluso.

    Is it to that I will have routine I posted in previous post question on.

    ? on command line shall show that

    Debugger_Help.png
    830 x 600 - 25K
  • Cluso99Cluso99 Posts: 18,069
    edited 2013-04-24 04:54
    Sapieha,
    Thanks for doing the help string. Here is the command "?"<cr>
    That is all I copied from your file - I didn't look elsewhere.

    LSD_065.spin
  • SapiehaSapieha Posts: 2,964
    edited 2013-04-24 07:32
    Hi Cluso.

    Thanks.

    Nice You like it and cleaned it up.

    In attachment are version Candidate --- With cleaned up HELP text and Cleaned USER space

    .
    Cluso99 wrote: »
    Sapieha,
    Thanks for doing the help string. Here is the command "?"<cr>
    That is all I copied from your file - I didn't look elsewhere.

    LSD_065.spin
    LSD_065.png
    834 x 599 - 26K
  • SapiehaSapieha Posts: 2,964
    edited 2013-04-24 08:30
    Hi Cluso.

    Can we remade it so it becomes "P" command:
    .
    --------------------------------------------------------
    |You can Change values by enter _ 1F8-F _ 1Fx-XXXXXXXX |
    |$1F8  PINA        PINB        PINC        PIND        |
    |$1FC  DIRA        DIRB        DIRC        DIRD        |
    --------------------------------------------------------
      1F8- FFFFFFFE    FFFFF000    0FFFFFFF    00000000
      1FC- E0000000    00000000    04000000    00000000
    
  • SapiehaSapieha Posts: 2,964
    edited 2013-04-24 10:01
    Hi Cluso.

    Minor change to this string:

    Replaces previous one in "LSD_065_c.spin"
    .
    _str_vers    byte    $0D
            byte    "== Cluso's P2 Debugger v0.65_c ==",$0D,$0D
            byte    "== For List of Commands type- ?<cr> ==",$0D,$0D,0
    
    
  • Cluso99Cluso99 Posts: 18,069
    edited 2013-04-24 15:02
    Hi Sapieha
    Thanks for your input and doing the help message. I see you have added some more overnight (for me).

    I am not sure about a "P" command. I know we can do this using the "-" input command. Would you like to explain some more?

    I still have to fix...
    * Terminate the input line if the single quote is reached (the ascii portion)
    * Input mode: Add double quoted ascii characters
    * Input mode (for cog only): If input in hex pairs, grab 4 pairs for a long and place in cog. It will need to be reversed.
    * Add "M" move command: I have partially done this.

    Do you think there is any use for permitting the users program to send a string to the debugger in "DEBUG" mode so that the debugger will execute the string as if it were a user input???

    Thanks again!
  • Cluso99Cluso99 Posts: 18,069
    edited 2013-04-24 18:21
    Latest update v0.66

    Fixes introduced bug in the demo section for HEX. Some code tidyup, etc.

    Places Sapieha's demo code and my demo code in sections that can be commented out using double braces.

    I note the "." operator is now not working in LIST mode.

    LSD_066.spin
  • SapiehaSapieha Posts: 2,964
    edited 2013-04-24 19:31
    Hi Cluso.

    Look's good.

    But I see You don't added/edited this part:

    http://forums.parallax.com/showthread.php/146688-LMM_SerialDebug-Simple-Serial-Tx-amp-Rx-for-debugging-single-cog-programs?p=1179595&viewfull=1#post1179595

    Cluso99 wrote: »
    Latest update v0.66

    Fixes introduced bug in the demo section for HEX. Some code tidyup, etc.

    Places Sapieha's demo code and my demo code in sections that can be commented out using double braces.

    I note the "." operator is now not working in LIST mode.

    LSD_066.spin
  • SapiehaSapieha Posts: 2,964
    edited 2013-04-24 21:13
    Hi Cluso.

    I added That "P" command.

    Look in "?" for help.

    But I have some problems in this "cmd_P" with using "lmm_c" vartiable --- Can You look what I have for problem ?.

    Post attachment are "LSD_066_candidate"
  • SapiehaSapieha Posts: 2,964
    edited 2013-04-25 00:27
    Hi Cluso.

    I found all my problems taht I posted on in previous post.

    Look in USER area code -- I cleaned this to and made some INFO's for You.

    Attached NEW "LSD_066_candidate 2" SPIN file

    Attachment updated.
    Attachment updated one more time:
  • SapiehaSapieha Posts: 2,964
    edited 2013-04-25 02:09
    Hi Cluso.

    If You add any command to LSD --- can You add its syntax to HELP strings "_str_help"
  • Cluso99Cluso99 Posts: 18,069
    edited 2013-04-25 02:21
    Sapieha,

    Here is v0.67

    It fixes your P command, and adds the M command.

    I have leds on P10,12,14,16,18,20,22,24 on my DE0. They work fine with your P command. Beware, you cannot read the PINS and do an AND/OR and write them back as they read what is actually on the PINS and not what has been written to the output register of PINS.

    Yes, I had updated the help text. But I have not yet looked at you latest _c2 post.

    L is not working correctly - I need to see what you are overriding but have not had time yet.

    LSD_067.spin

    Postedit: I see you sorted the P command nicely. I have now updated the _str_hlong in my next rev. I have not looked at your demo section comments properly.
  • SapiehaSapieha Posts: 2,964
    edited 2013-04-25 03:13
    Hi Cluso.

    Thanks.

    Will look on it

    Cluso99 wrote: »
    Sapieha,

    Here is v0.67

    It fixes your P command, and adds the M command.

    I have leds on P10,12,14,16,18,20,22,24 on my DE0. They work fine with your P command. Beware, you cannot read the PINS and do an AND/OR and write them back as they read what is actually on the PINS and not what has been written to the output register of PINS.

    Yes, I had updated the help text. But I have not yet looked at you latest _c2 post.

    L is not working correctly - I need to see what you are overriding but have not had time yet.

    LSD_067.spin

    Postedit: I see you sorted the P command nicely. I have now updated the _str_hlong in my next rev. I have not looked at your demo section comments properly.
  • SapiehaSapieha Posts: 2,964
    edited 2013-04-25 03:13
    Hi Cluso.


    Can You help me with that.

    I will show 2 types of LONGs HEADER. I think I add it in correct place but have problem how to change them
    _str_hlong    byte    $0D," addr- - + 1 --    - + 2 --    - + 3 --    - + 4 --",$0D,0        ''For listing from COG
    _str_hlong2    byte    $0D," addr- - +$0 --    - +$4 --    - +$8 --    - +$C --",$0D,0        ''For listing from HUB
    

    :cmd19
    ..======================================================================================
    '        cmp    lmm_x, #$1FF        wz,wc    ' z|c if =<$1FF = cog mode?
    ' get Long Header type 2
    '    if_a    rdlong  lmm_w, lmm_p            ' read a long (hub)
    '        MOV    Variable,_str_hlong
    ' get Long Header type 1
    '    if_be    rdlong  lmm_op2, lmm_pc                 '\ store the following instr in lmm_op2
    '        MOV    Variable,_str_hlong2
    ''======================================================================================
    
  • SapiehaSapieha Posts: 2,964
    edited 2013-04-25 03:59
    Hi Cluso.

    I think It works as desired.

    It calculate its own counter !!!

    As this command NOT need Counter value:
    xxxxx[.yyyyy]L[n]<cr>        -From_To      -- address of cog/hub --
    
    Cluso99 wrote: »
    Sapieha,

    L is not working correctly - I need to see what you are overriding but have not had time yet.

    .


    Ps. post edited

    I tested now --- You are correct --- This command don't work as desired
  • SapiehaSapieha Posts: 2,964
    edited 2013-04-25 04:47
    Hi Cluso.

    Have problems with "M" command
    *4000- 00 00 00 00 0A 00 FC A0 14 00 FC 68 00 00 00 00
    *4010- 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
    *4020- 09 16 FC 1C 00 00 7C 1C 00 00 00 00 00 00 00 00
    *4030- 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
    *4040- 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
    *4050- 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
    *4060- 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
    *4070- 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
    *4000l
    
     addr-  0  1  2  3  4  5  6  7  8  9  A  B  C  D  E  F
     -----------------------------------------------------
    04000- 00 00 00 00 0A 00 FC A0 14 00 FC 68 00 00 00 00  '...........h....'
    04010- 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00  '................'
    04020- 09 16 FC 1C 00 00 7C 1C 00 00 00 00 00 00 00 00  '......|.........'
    04030- 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00  '................'
    04040- 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00  '................'
    04050- 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00  '................'
    04060- 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00  '................'
    04070- 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00  '................'
    *4000.4800m
    *4000.4200,10m
    ?
    *4000.000m
                                 <-------------- Hangs in this place
    .
    
  • SapiehaSapieha Posts: 2,964
    edited 2013-04-25 04:55
    Hi Cluso.

    Sorry

    It was maybe my problem -- I made some changes to file before test.

    NEED more tests.

    Ps. Reloaded from forum Yours orginal file and if function correctly
  • SapiehaSapieha Posts: 2,964
    edited 2013-04-25 05:24
    Hi Cluso.

    Post NEW "LSD_067_c.spin" candidate file

    Changes in SYSTEM text's and USER area


    Ps. post edit.
    User code that can be commented out starts one <TAB> (column) to right so it is simple for USER to see what is not needed for DEBUGGER to function
  • Cluso99Cluso99 Posts: 18,069
    edited 2013-04-25 06:57
    Sapieha,
    What are you using to edit the source? pnut doesnt have the same editting features to add/remove a column like proptool. And oonce you load into proptool the formatting gets messed..

    I noticed in your move problem above that you didnot have a count. IIRC i have not checked this error.

    I amthinking to use the same format with G to do a coginit
    xxxxx.yyyyy,cG<cr> where xxxxx is the hub start, yyyyy is the par, and c is the cog
    xxxxx.yyyyyG<cr> for this cog
    xxxxx.yyyyy,G<cr> for next avail cog
  • SapiehaSapieha Posts: 2,964
    edited 2013-04-25 07:25
    Hi Cluso.

    xxxxx.yyyyy,cG<cr>

    Maybe move "c" after "G"

    xxxxx.yyyyyG[c]<cr>

    Cluso99 wrote: »
    I amthinking to use the same format with G to do a coginit
    xxxxx.yyyyy,cG<cr> where xxxxx is the hub start, yyyyy is the par, and c is the cog
    xxxxx.yyyyyG<cr> for this cog
    xxxxx.yyyyyG<cr> for next avail cog


    Forget it --- It was my editing problem
    Function correctly
    Cluso99 wrote: »
    I noticed in your move problem above that you didnot have a count. IIRC i have not checked this error.





    I use this Program for edit my code.

    With pointing by mouse in starting line and draw it down You can add ant character to start of that lines.




    ''___NotePad++ config_____________ http://notepad-plus-plus.org/ ____

    This is part for copy and paste in Config assembly language to have all PASM instructions coloured


    In Assembler config Language Copy Block´s to theirs User configurations windows

    ''
    CPU INSTRUCTIONS

    reps setinda getptra jmptask settask setptra addspa
    incmod setptrb djnz getptrb max clkset setcog coginit
    cogid cogstop getp popbr setport decod5 cfgpins setdacs
    rdbyte setbc wrbyte setspa popar cmpr chkspa subspa pushar
    fixinda notb addptrb subr getcnt passcnt setpc getspb getspa
    chkspb setspb subcnt pushb setctra getcosa jmp muxc waitcnt
    wrlong rdlong rdbytec wrword rdword rdwordc rdlongc wrquad rdquad rdquadc
    clrp waitpne waitpeq addptra rev subptra subptrb
    cachex gettops setquad setquaz notp popb reta retb retad
    retbd addspb subspb pushbr calla callb calld callad callbd getspd
    movd locknew lockret lockset lockclr setinda setindb setinds
    fixinda fixindb fixinds chkspd sndser rcvser getmull getmulh
    getdivq getdivr getsqrt getqx getqy getqz polctra polctrb
    polvid repd getpix jmpd retd waitvid synctra synctrb
    rcfast rcslow pll xtal setmap mac maca macb scl enc jmpret
    mins maxs min movi jmpretd andn muxnc muxz muxnz addabs subabs
    sumc sumnc sumz sumnz absneg negc negnc negz negnz cmpsx addx
    subx adds subs addsx subsx cmpsub decmod ijz ijzd ijnz ijnzd
    djz djzd djnzd tjz tjnz tjzd tjnzd setpora setporb setporc setpord
    getnp offp setpnc setpz setpnz setxfr setser setxch setvid
    setvidy setvidi setvidq cfgdac0 cfgdac1 cfgdac2 cfgdac3
    cfgdacs setdac0 setdac1 setdac2 setdac3 setpix setpixu setpixv
    setpixz setpixr setpixg setpixb setpixa getphsa getphza getsina
    getphsb getphzb getcosb getsinb setwava setfrqa setphsa addphsa
    subphsa capctra setctrb setwavb setfrqb setphsb addphsb subphsb
    capctrb setskip nopx setzc popzc pushzc setbnz setbz setbnc clrb
    isob seussr seussf splitw mergew grybin bingry decpat incpat
    zercnt onecnt blmask decod2 decod3 decod4 fitacca fitaccb fitaccs
    setacca setaccb getacca getaccb clracca clraccb clraccs getlfsr
    setf movf jpd jnpd qsincos qarctan qrotate setmulu setmula setmulb
    setdivu setdiva setdivb setsqrh setsqrl setqi setqz qlog qexp fit cmpcnt b
    setp pusha mul tasksw taskswd jp jnp chkptra chkptrb popa sar setb

    ''
    MATCH INSTRUCTIONS

    if_z if_be if_nc if_c if_nz wc wz wr nr if_always if_never
    if_e if_ne if_a if_b if_ae if_c_eq_z if_c_ne_z if_c_and_z
    if_c_and_nz if_nc_and_z if_nc_and_nz if_c_or_z if_c_or_nz
    if_nc_or_z if_nc_or_nz if_z_eq_c if_z_ne_c if_z_and_c
    if_z_and_nc if_nz_and_c if_nz_and_nc if_z_or_c if_z_or_nc
    if_nz_or_c if_nz_or_nc cond nz nc

    ''
    REGISTER INSTRUCTIONS

    inda indb pina pinb pinc pind dira dirb dirc dird ptra ptrb
    spa spb spx cnt lfsr ctra ctrb frq phs sin cos mulll mullh
    dac0 dac1 dac2 dac3 ptr par ram pc0 pc1 pc2 pc3 d acca accb
    cordic vid pix xfr ser s ddddddddd ddnnnnnnn dnnnnnnnn
    dddnnnnnn dddddddnn ddnnddddd nnnnnnnnn aaaaaaaaa bbbbbbbbb
    ttttttttt iiiiiiiii wddddssss sssssssss n___nnnn_nnnnnnnnn
    cccc c z y x d.b zc1 zc0 zcn zcr z00 z01 z11 n11 nnnn phsa
    phsb frqa frqb sina sinb cosa cosb bbaa ptrx %w_dddd_ssss dd

    ''
    DIRECTIVE INSTRUCTIONS

    # n code codeend question answer example bit dat con p8x32a
    mnemonic machine operand operation flags bytes words longs
    quads msb lsb examples dir pin

    ''
    DIRECTIVE OPERAND

    long res quad task single multi tasking tasks inter
    same read write xi xo index scale four

    ''
    EXT INSTRUCTIONS

    z c pc clut hub stack cog





    Ps. post edited:

    To have NotePad++ recognize SPIN --- You need in ConfigLanguage --> Assembly -- add bottom left in usercode "spin"
  • SapiehaSapieha Posts: 2,964
    edited 2013-04-25 08:02
    Hi Cluso.

    Posted in attachment PDF how it looks in coloured form on My screen


    Ps PDF updated with some colouring changes
  • Cluso99Cluso99 Posts: 18,069
    edited 2013-04-25 17:25
    I will download Notepad++ shortly. It looks like a nice program.
    I have just downloaded your latest 067_c and will see what you have done and work on it today while you sleep.
    Thanks again for your assistance.
  • SapiehaSapieha Posts: 2,964
    edited 2013-04-25 17:31
    Hi Cluso.

    Look even in PDF to it.

    It has some minor changes

    Cluso99 wrote: »
    I will download Notepad++ shortly. It looks like a nice program.
    I have just downloaded your latest 067_c and will see what you have done and work on it today while you sleep.
    Thanks again for your assistance.
  • Cluso99Cluso99 Posts: 18,069
    edited 2013-04-26 00:18
    V0.68
    Input command "-" is terminated when a single quote is detected (ascii)
    There are a few internal code tidies.
    Sapieha: I have not brought in your demo code as yet.

    LSD_068.spin
  • SapiehaSapieha Posts: 2,964
    edited 2013-04-26 00:52
    Hi Cluso.

    One thing --- PNut don't place single quote before Garbage text!

    So I think it need even COUNT ASCII 16x2 to find start of garbage


    Cluso99 wrote: »
    V0.68
    Input command "-" is terminated when a single quote is detected (ascii)
    There are a few internal code tidies.
    Sapieha: I have not brought in your demo code as yet.

    LSD_068.spin
  • SapiehaSapieha Posts: 2,964
    edited 2013-04-26 01:05
    Hi Cluso.

    Forget previous post.

    Tested CUT and paste from PNut --- FUNCTION
    THANKS
  • Cluso99Cluso99 Posts: 18,069
    edited 2013-04-26 01:19
    V0.69
    The input command "-" now takes 4 hex bytes as a long input (reversed) and places them into the cog address correctly.

    LSD_069.spin
  • SapiehaSapieha Posts: 2,964
    edited 2013-04-26 01:40
    Hi Cluso.

    NICE - Thanks.

    Function as desired


    Cluso99 wrote: »
    V0.69
    The input command "-" now takes 4 hex bytes as a long input (reversed) and places them into the cog address correctly.

    LSD_069.spin
Sign In or Register to comment.