Hot!Is it possible to trace values in Data memory?

Author
leadinglights
Super Member
  • Total Posts : 380
  • Reward points : 0
  • Joined: 2003/11/07 12:41:48
  • Status: offline
2019/04/12 08:53:17 (permalink)
0

Is it possible to trace values in Data memory?

Is there any way to trace values in data memory in Simulator to verify that an algorithm is working correctly.

I am injecting values into ADRESL using Stimulus and each new value changes three 16 bit variables (sum of last 40 new values, sum of last 8 new values and the slope of the last 9 values) which are in the shared part of data memory. At the moment I am recording these by hand from a watch window and this is  a pain in the posterior laborious and error prone.

I seem to recall having seen almost exactly this done on MPLAB in the past but can't find any info on the procedure.

Mike
#1

11 Replies Related Threads

    NKurzman
    A Guy on the Net
    • Total Posts : 17147
    • Reward points : 0
    • Joined: 2008/01/16 19:33:48
    • Location: 0
    • Status: offline
    Re: Is it possible to trace values in Data memory? 2019/04/12 14:30:21 (permalink)
    0
    I think you can send it to the serial Port.  And that has a window.
     
    Are you using MPLab8 or MPLab X?
    #2
    leadinglights
    Super Member
    • Total Posts : 380
    • Reward points : 0
    • Joined: 2003/11/07 12:41:48
    • Status: offline
    Re: Is it possible to trace values in Data memory? 2019/04/12 15:20:38 (permalink)
    0
    Thanks NKurzman, I will try that.
     
    I use MPLab X and have been trying to wean myself off of using MPLab 8 every time I have a problem  as it is falling behind on processors and tools that it supports - It would be a little like calling somebody out of a well earned retirement simply because nobody else can do the job.
     
    Mike
    #3
    Jim Nickerson
    User 452
    • Total Posts : 5842
    • Reward points : 0
    • Joined: 2003/11/07 12:35:10
    • Location: San Diego, CA
    • Status: offline
    Re: Is it possible to trace values in Data memory? 2019/04/13 08:30:37 (permalink)
    0
    Maybe the "DMCI" plugin would be of use
    #4
    leadinglights
    Super Member
    • Total Posts : 380
    • Reward points : 0
    • Joined: 2003/11/07 12:41:48
    • Status: offline
    Re: Is it possible to trace values in Data memory? 2019/04/14 11:26:57 (permalink)
    +1 (1)
    In the end I weakened and used MPLab 8 which did a perfect job of register injection from a file and traced 3  different 16 bit variables to three seperate files.  It also did this in an intuitive and straightforward way.
     
    I will try to get to grips with SCL as I know that using MPLab 8 will keep me from getting on in the world - but going cold turkey is very hard.
     
    Edit:
        I used "Generate SCL" and got a comprehensible SCL file that I could immediately understand. Tip to all those who, like me, hide under the table when faced with SCL: Use MPLab initailly to do your register inject/ register trace. Use the advanced option to generate an SCL file and look at that - all will make sense , the sun will break through the clouds etc..
        O.K., the byte order of the trace file is the wrong way round but that is what spreadsheets are for.
     
    Mike
     
     
    post edited by leadinglights - 2019/04/14 12:02:02
    #5
    leadinglights
    Super Member
    • Total Posts : 380
    • Reward points : 0
    • Joined: 2003/11/07 12:41:48
    • Status: offline
    Re: Is it possible to trace values in Data memory? 2019/04/17 05:16:47 (permalink)
    0
    At this point I can do everything I now want to in MPLab 8 but am hoping to move this project from a PIC12F1840 to a more recent PIC (PIC16F18313 at the moment) and form PicKit 3 to PicKit 4 so I want to be able to  inject values into registers and trace multiple variables.  I tried using the .SCL file generated in MPLab 8 in MPLab X, expecting errors which I could hopefull resolve. The error generated was:-

    Error: E0103-SIM: Failed to parse SCL E9816-SCL: Invalid parameter line(27)

    I have not been able to find any of the code examples in the SCL repository, nor is the SCL PRIMER / TUTORIAL or even the thread Coding directly in SCL\SCL asd VHDL subset. In every case there is a 404 error. In addition, I have not even been able to find if this is possible in MPLab X, but tantilising clues that it is - balanced by an equal number of clues that it is not possible. Only the documentation in the MPLab X installation directory has any info and that seems sketchy.
     
    In the hopes that somebody can give a non-negative answer I have attached the code below.
     
    // 
    // C:\Projects\Software\MPLAB8\StimTry2.scl
    // Generated by Stimulus ver. 3.60.00.00
    // 4/14/2019 19:41:40
    //


    configuration for "pic12f1840" is
        shared label WayPoint;
        shared variable Slope;
        shared variable Tot_40;
        shared variable Tot_8;
    end configuration;


    testbench for "pic12f1840" is
    begin
        process is
        begin
            wait;
        end process;

        // Register Injection
        Get: process is
        begin
            accessin("C:\Projects\Software\PiezoSW\Morph.X\Stimulus files\ADCStimX16.txt", hex_mode, ADRESL, true);
            wait;
        end process Get;

        // Register Trace
        SL1: process is
        begin
            triggerout_gpr("Slope.txt", binary_mode, Slope, WayPoint, 2);
            wait;
        end process SL1;

        // Register Trace
        T8: process is
        begin
            triggerout_gpr("Tot8.txt", binary_mode, Tot_8, WayPoint, 2);
            wait;
        end process T8;

        // Register Trace
        T40: process is
        begin
            triggerout_gpr("Tot40.txt", binary_mode, Tot_40, WayPoint, 2);
            wait;
        end process T40;

    end testbench;


     
    Thanks for any enlightenment you can bring.
     
    Mikeyou can 
    #6
    GeorgePauley
    Moderator
    • Total Posts : 1092
    • Reward points : 0
    • Joined: 2009/12/01 13:59:30
    • Location: Chandler AZ
    • Status: offline
    Re: Is it possible to trace values in Data memory? 2019/04/17 09:41:07 (permalink)
    0
    Line 27 (actually 26) is the accessin call.  It works fine for me, when I put a valid filename in place of the one you use.  Which makes me suspect that you perhaps aren't a valid filename for your system?
     
    I can tell you that the triggerout stuff isn't going to work (though it still compiles).  We removed these functions in MPLAB X.  We felt that the purpose of SCL was to inject values into the simulator.  Having debug functions like triggerout that extracted values from the simulator really muddied the waters of the already overly complex SCL code. 
     
    To trace registers, use the register trace feature of the simulator.  Main menu -> Window -> Simulator -> Register Trace.
    #7
    leadinglights
    Super Member
    • Total Posts : 380
    • Reward points : 0
    • Joined: 2003/11/07 12:41:48
    • Status: offline
    Re: Is it possible to trace values in Data memory? 2019/04/17 10:56:52 (permalink)
    0
    Thanks for your help George but the time I have already spent on trying to get Register Trace to work on variables in the data memory in asseembly language programs means that, at least until the world changes, all of my stimulus and tracing will be done in MPLab 8.
     
    I will continue enjoy using MPLab X for other things - and will almost certainly be back asking for help on those things.
     
    Mike
     
     
    #8
    leadinglights
    Super Member
    • Total Posts : 380
    • Reward points : 0
    • Joined: 2003/11/07 12:41:48
    • Status: offline
    Re: Is it possible to trace values in Data memory? 2019/04/22 11:11:17 (permalink)
    0
    Although MPLab 8.92 was working well, I have already been asked to use a more recent MCU in the present project so must try to get Register Trace working in MPLab X and logging to a file. The present situation is:-
     

    MPLab X 5.15
    MPASM
    PIC12F1840 (at the moment)
     
    The variables I wish to trace are reserved and declared as global but no variables are presented in the Register Trace.
     

     

    Vars       UDATA_SHR

               ; Omitted for brevity

    Tot_40     RES 2     ; Total for running average

    Tot_8      RES 2     ; Total for limit trigger

    Slope      RES 2     ; S/G slope

       

               GLOBAL    Slope, Tot_8, Tot_40

     


       
     
    I entered Debug mode then paused the run  and selected Window - Simulator - Register Trace. Then I clicked in the area marked "Click here to add/remove trace variables". From Available Registers I selected Globals Only but no variables were available for selection.
     
     
    I have also looked at File - Project Properties - Simulator - Option category "Trace" - Data Collection Section but the only options are "Off" and "Instruction Trace".
     
    I further explored the Simulator options by following a note in the Trace category
     
     
    User Instrumented Trace
    Through the use of TRACE and LOG macros in user code, variable information may be reported to the IDE .....

     
    However I was unable to find any options for this nor do either the MPASM Users Guide (DS33014L) or MPLab X Users Guide (DS50002027D) give any clues.
     
    I have been successfully using Register Trace along with Register Injection on MPLab 8.92 but now need to look at using more recent MCUs
     
     
    Thanks for any help you can give,
    #9
    GeorgePauley
    Moderator
    • Total Posts : 1092
    • Reward points : 0
    • Joined: 2009/12/01 13:59:30
    • Location: Chandler AZ
    • Status: offline
    Re: Is it possible to trace values in Data memory? 2019/04/23 08:44:35 (permalink)
    0
    Globals likely requires a project build so that we have an elf file to extract global names and addresses from.  You should see the list of SFRs in the SFRs Only section.
    #10
    leadinglights
    Super Member
    • Total Posts : 380
    • Reward points : 0
    • Joined: 2003/11/07 12:41:48
    • Status: offline
    Re: Is it possible to trace values in Data memory? 2019/04/23 10:06:46 (permalink)
    0
    How do you build a MPASM project to produce an ELF file?
     
    I have looked through the MPASM MPLINK users guide and the MPLab X users guide and on the forum, in the Microchip Developers help  and am none the wiser. I think I understand the concept, but can't find how to change from COFF to ELF format.
     
    Thanks,
     
    Mike
    #11
    GeorgePauley
    Moderator
    • Total Posts : 1092
    • Reward points : 0
    • Joined: 2009/12/01 13:59:30
    • Location: Chandler AZ
    • Status: offline
    Re: Is it possible to trace values in Data memory? 2019/04/23 15:25:11 (permalink)
    0
    COFF is fine too.  I just said ELF because its the most common format. 
     
    The point is global variables will not be available drop down list until the internal MPLAB X component (translator) that reads the debug information out of the debug image file (COFF, ELF, DWF, etc), has that file available to read and decode.  And that can't happen until a build has occurred.
    #12
    Jump to:
    © 2019 APG vNext Commercial Version 4.5