• AVR Freaks

Hot!Reposted: MPLABX Cannot change variable value

Author
teenix
Starting Member
  • Total Posts : 32
  • Reward points : 0
  • Joined: 2017/12/21 13:47:21
  • Location: Australia, Melbourne
  • Status: offline
2019/11/29 04:52:18 (permalink)
0

Reposted: MPLABX Cannot change variable value

Hi,
 
Sorry, I realised the original post was in incorrect Forum.
 
Problem repeated,
 
I have been playing with a project for months and I have always been able to change RAM variable values in the watch window when a simulation is paused. The project is built in absolute mode in assembler. MPLABX 5.05, PIC18F45K40
 
Now for some reason I am not allowed to change a RAM value.
 
---------------------------
 
After some experimenting, it looks like I cannot change a variable in the RAM address range 0x0A - 0x15 which are just GP RAM registers. There is no documentation that I can find which may explain the issue so unsure why the problem exists unless it is a bug in MPLABX.
 
I tried re-installing MPLABX but no change.
 
cheers
 
Tony
#1

14 Replies Related Threads

    dan1138
    Super Member
    • Total Posts : 3289
    • Reward points : 0
    • Joined: 2007/02/21 23:04:16
    • Location: 0
    • Status: offline
    Re: Reposted: MPLABX Cannot change variable value 2019/11/29 13:34:30 (permalink)
    +2 (2)
    The MPLABX simulator is more than a little insane.
     
    In my experience the IDE and simulator seem to become unhinged from time to time.
     
    Closing all projects and shutting down the IDE then restarting has fixed this for me.
     
    So far I have been unable to determine what I have done during a simulation session that provokes this behavior.
    #2
    GeorgePauley
    Moderator
    • Total Posts : 1184
    • Reward points : 0
    • Joined: 2009/12/01 13:59:30
    • Location: Chandler AZ
    • Status: offline
    Re: Reposted: MPLABX Cannot change variable value 2019/12/02 09:49:26 (permalink)
    +1 (1)
    I'm not seeing this in 5.05 or 5.25.  Which makes me think that perhaps Dan is on to something when he suggests the software is getting into some sort of degenerate state that causes this behavior.  But you say a reinstall of MPLAB X did not solve the problem.  Perhaps whatever is wrong is embedded in the project files (the files that describe your project). 

    Could you create a new, simple, project with this device and check to see if you see the same behavior?  I'm trying to figure out if this is a MPLAB X/Simulator issue or a project issue.
    #3
    NKurzman
    A Guy on the Net
    • Total Posts : 18043
    • Reward points : 0
    • Joined: 2008/01/16 19:33:48
    • Location: 0
    • Status: online
    Re: Reposted: MPLABX Cannot change variable value 2019/12/02 13:27:42 (permalink)
    +1 (1)
    "I tried re-installing MPLABX but no change."
     
    There is also deleting the two cache Folders, sometimes that can help when MPlabX acts weird.
    #4
    teenix
    Starting Member
    • Total Posts : 32
    • Reward points : 0
    • Joined: 2017/12/21 13:47:21
    • Location: Australia, Melbourne
    • Status: offline
    Re: Reposted: MPLABX Cannot change variable value 2019/12/02 17:04:42 (permalink)
    0
    Thanks for the help.
     
    I created a new directory and a new project with the following simple code.
    There was no change to the problem. I also changed to a 18F45K50 and the same problem exists.
    I may be doing something wrong, but I can't remember having this problem before.
     
    Once I pause the simulator, I cannot change the reg15 0xFF value from the watch window, or any of the marked registers in the listing.
     
    cheers
     
    Tony

    #include "p18f45k40.inc"
    ;
    ; --------------------
    ; DEFINE GPR REGISTERS - RAM Page 0
    ; --------------------
    ;
     CBLOCK 0x00
    reg00 ; OK
    reg01 ; OK
    reg02 ; OK
    reg03 ; OK
    reg04 ; OK
    reg05 ; OK
    reg06 ; OK
    reg07 ; OK
    reg08 ; OK
    reg09 ; OK
    reg0A ; cannot change value in Watch Window
    reg0B ; same
    reg0C ; same
    reg0D ; same
    reg0E ; same
    reg0F ; same
    reg10 ; same
    reg11 ; same
    reg12 ; same
    reg13 ; same
    reg14 ; same
    reg15 ; same
    reg16 ; OK
    reg17 ; OK
     ENDC
    ;
    ; -------------
    ; PROGRAM START
    ; -------------
    ;
     org 0x0000
    Start movlw 0xFF
     movwf reg15
    here goto here
     
    end
    #5
    teenix
    Starting Member
    • Total Posts : 32
    • Reward points : 0
    • Joined: 2017/12/21 13:47:21
    • Location: Australia, Melbourne
    • Status: offline
    Re: Reposted: MPLABX Cannot change variable value 2019/12/02 17:05:48 (permalink)
    0
    NKurzman
     There is also deleting the two cache Folders, sometimes that can help when MPlabX acts weird.


    I didn't know about this, where can they be found?
     
    cheers
     
    Tony
    #6
    NKurzman
    A Guy on the Net
    • Total Posts : 18043
    • Reward points : 0
    • Joined: 2008/01/16 19:33:48
    • Location: 0
    • Status: online
    Re: Reposted: MPLABX Cannot change variable value 2019/12/02 17:18:37 (permalink)
    +1 (1)
    The Cache Folder Names are in the Tollbar Help->About 
    User Directory and Cache Directory.
    They must be deleted (or just Renamed to be safe) with MPLabX Closed.
    Not you will loose all customization's, windows, and the List of previously opened file names.
    But Your Projects will not be affected.  They have their own settings.
    Note the Folders are very large.
    #7
    1and0
    Access is Denied
    • Total Posts : 9998
    • Reward points : 0
    • Joined: 2007/05/06 12:03:20
    • Location: Harry's Gray Matter
    • Status: offline
    Re: Reposted: MPLABX Cannot change variable value 2019/12/02 17:38:54 (permalink)
    +1 (1)
    teenix
    Once I pause the simulator, I cannot change the reg15 0xFF value from the watch window, or any of the marked registers in the listing.

    With your code, I've confirmed your findings with MPLAB X v5.30. :(
    #8
    teenix
    Starting Member
    • Total Posts : 32
    • Reward points : 0
    • Joined: 2017/12/21 13:47:21
    • Location: Australia, Melbourne
    • Status: offline
    Re: Reposted: MPLABX Cannot change variable value 2019/12/02 19:17:55 (permalink)
    0
    Hi,
     
    I deleted the caches, started MPLABX, which behaved as if it was a new application, re-opened the small test project, rebuilt it and ran the simulator
     
    I paused the simulation, and entered [reg15] into the now blank watch window. This showed the expected 0xFF in [reg15].
     
    I tried to modify the [reg15] register and same problem. It will not let me change the value.
     
    When I change the code to movwf reg16, and run and pause the simulator again, I see the expected 0xFF in [reg16] and I can modify the watch value. So, same problem exists.
     
    I opened up an older project based on a PIC18F47K40 which I know works ok in a real chip, and it also has the same problem.
     
    As mentioned previously, I can alter the value from the file registers window.
     
    cheers
     
    Tony
    #9
    dan1138
    Super Member
    • Total Posts : 3289
    • Reward points : 0
    • Joined: 2007/02/21 23:04:16
    • Location: 0
    • Status: offline
    Re: Reposted: MPLABX Cannot change variable value 2019/12/03 00:28:09 (permalink)
    +1 (1)
    1and0
    teenix
    Once I pause the simulator, I cannot change the reg15 0xFF value from the watch window, or any of the marked registers in the listing.

    With your code, I've confirmed your findings with MPLAB X v5.30. :(



    I can also confirm that the MPLABX v5.25 simulator fails to update a RAM location from the watch window.
     
    I tested the same code using MPLABX v4.05 and this version does update a RAM location from the watch window.
     
    So this simulator feature was broken between  v4.05 and v5.25 of MPLABX.
     
    This seems like a bug that no tester would think to automate a regression test for.
     
    The test would be something like:
    1. Create a the source code to assign a symbolic name to every byte in RAM
    2. Insert the a symbol in the watch window
    3. Change the symbol value
    4. Verify the watch window show the new value
    5. Remove the a symbol in the watch window
    6. Repeat until all symbols have been tested
    It would take hundreds of VMs months to run this kind of test vector on all of the PIC18F targets that MPLABX builds for.
     
    It would take a multinational company with a global reach selling billions of controller per year to even conceive of testing development tools on this scale.
    #10
    mlp
    boots too small
    • Total Posts : 825
    • Reward points : 0
    • Joined: 2012/09/10 15:12:07
    • Location: previously Microchip XC8 team
    • Status: offline
    Re: Reposted: MPLABX Cannot change variable value 2019/12/04 13:08:59 (permalink)
    0
    dan1138
    It would take a multinational company with a global reach selling billions of controller per year to even conceive of testing development tools on this scale.

    And it would take one with a different budgetary outlook than MCHP to actually perform such tests.

    Mark (this opinion available for hire)
    #11
    dan1138
    Super Member
    • Total Posts : 3289
    • Reward points : 0
    • Joined: 2007/02/21 23:04:16
    • Location: 0
    • Status: offline
    Re: Reposted: MPLABX Cannot change variable value 2019/12/05 13:59:29 (permalink)
    +1 (1)
    mark.pappin
    And it would take one with a different budgetary outlook than MCHP to actually perform such tests.

    It seems to me more a matter of incentives and goals rather than available budget.

    An extreme example of goals over budget is the Apollo Guidance Computer.

    For the AGC failure was not an option so even highly improbable fault modes were identified and mitigated using cycle accurate simulation models created before the physical prototype hardware was available.

    One would think after half a century technology would have advanced enough for companies with less resources than NASA could create a simulator for a controller with similar complexity. This thread suggests this may not be the case with Microchip.
    #12
    GeorgePauley
    Moderator
    • Total Posts : 1184
    • Reward points : 0
    • Joined: 2009/12/01 13:59:30
    • Location: Chandler AZ
    • Status: offline
    Re: Reposted: MPLABX Cannot change variable value 2019/12/09 10:50:02 (permalink)
    +1 (1)
    I see it now.  It appears to be watch window only.  You can change 0x15 in the File Registers Memory view.  (Which I suggest everyone use as a work-around.)

    Normally, when one sees a change made in the watch window instantly revert back to another value, it's because the simulator is "intercepting" the new value and modifying it per read/write characteristics of the register and/or peripheral considerations.  However, that does not appear to be the case here.  To begin with, if the simulator were the root cause, we should see the file register memory window behave the same way as the watch window.  And secondly, I can confirm, through debugging, that the simulator is oblivious to the fact that someone is writing a new value in the watch window.  It really looks like the watch window, as a GUI component, is just disallowing writes to these addresses.

    I strongly suspect we'd see the same behavior with a physical device and a PICkit or ICD.  And I would love to hear confirmation or contradiction of this supposition from anyone?  (Yeah, I have to wait like a month to get devices from the sample center just like everyone else.)

    In the meantime, I would recommend opening a ticket with Microchip to start the process of getting someone on the MPLAB X IDE team looking at this.
    #13
    1and0
    Access is Denied
    • Total Posts : 9998
    • Reward points : 0
    • Joined: 2007/05/06 12:03:20
    • Location: Harry's Gray Matter
    • Status: offline
    Re: Reposted: MPLABX Cannot change variable value 2019/12/09 12:37:02 (permalink)
    +2 (2)
    GeorgePauley
    Yeah, I have to wait like a month to get devices from the sample center just like everyone else.

    Wow... one month, really! I'd had thought you guys can get them overnight or 2nd day.?! ;) I get free samples Fedex to me from Thailand usually in one week.
     
    #14
    dan1138
    Super Member
    • Total Posts : 3289
    • Reward points : 0
    • Joined: 2007/02/21 23:04:16
    • Location: 0
    • Status: offline
    Re: Reposted: MPLABX Cannot change variable value 2019/12/09 13:37:33 (permalink)
    +1 (1)
    GeorgePauley
    ... It really looks like the watch window, as a GUI component, is just disallowing writes to these addresses.

    I strongly suspect we'd see the same behavior with a physical device and a PICkit or ICD.  And I would love to hear confirmation or contradiction of this supposition from anyone?

    Are you the only one on the simulator development team that can actually test things?
     
    I can confirm that this fault exists with the In-Circuit-Debug and simulator.
     
    Controller tested: PIC18F45K20 in the DM164130-4 - PICkit 44-Pin Demo Board (PIC18F45K20)
    ICD: PICKit4
    IDE: MPLABX v5.25
    Source code:
    #include "p18f45k20.inc"
    ;
      CONFIG  FOSC = INTIO67,FCMEN = OFF,IESO = OFF
      CONFIG  PWRT = OFF,BOREN = SBORDIS,BORV = 18
      CONFIG  WDTEN = OFF,WDTPS = 32768
      CONFIG  CCP2MX = PORTC,PBADEN = OFF,LPT1OSC = OFF,HFOFST = ON,MCLRE = ON
      CONFIG  STVREN = ON,LVP = OFF,XINST = OFF
      CONFIG  CP0 = OFF,CP1 = OFF,CP2 = OFF,CP3 = OFF
      CONFIG  CPB = OFF,CPD = OFF
      CONFIG  WRT0 = OFF,WRT1 = OFF,WRT2 = OFF,WRT3 = OFF
      CONFIG  WRTC = OFF,WRTB = OFF,WRTD = OFF
      CONFIG  EBTR0 = OFF,EBTR1 = OFF,EBTR2 = OFF,EBTR3 = OFF
      CONFIG  EBTRB = OFF
    ;
    ; --------------------
    ; DEFINE GPR REGISTERS - RAM Page 0
    ; --------------------
    ;
      CBLOCK 0x00
        reg00 ; OK
        reg01 ; OK
        reg02 ; OK
        reg03 ; OK
        reg04 ; OK
        reg05 ; OK
        reg06 ; OK
        reg07 ; OK
        reg08 ; OK
        reg09 ; OK
        reg0A ; cannot change value in Watch Window
        reg0B ; same
        reg0C ; same
        reg0D ; same
        reg0E ; same
        reg0F ; same
        reg10 ; same
        reg11 ; same
        reg12 ; same
        reg13 ; same
        reg14 ; same
        reg15 ; same
        reg16 ; OK
        reg17 ; OK
      ENDC
    ;
    ; -------------
    ; PROGRAM START
    ; -------------
    ;
     org 0x0000
    Start:
        lfsr    0,reg17
        clrf    FSR0H
        clrf    INDF0
        decfsz  FSR0L
        bra     $-4
        clrf    INDF0
        nop
    here:
        movf    reg00,W,ACCESS
        movf    reg01,W,ACCESS
        movf    reg02,W,ACCESS
        movf    reg03,W,ACCESS
        movf    reg04,W,ACCESS
        movf    reg05,W,ACCESS
        movf    reg06,W,ACCESS
        movf    reg07,W,ACCESS
        movf    reg08,W,ACCESS
        movf    reg09,W,ACCESS
        movf    reg0A,W,ACCESS
        movf    reg0B,W,ACCESS
        movf    reg0C,W,ACCESS
        movf    reg0D,W,ACCESS
        movf    reg0E,W,ACCESS
        movf    reg0F,W,ACCESS
        movf    reg10,W,ACCESS
        movf    reg11,W,ACCESS
        movf    reg12,W,ACCESS
        movf    reg13,W,ACCESS
        movf    reg14,W,ACCESS
        movf    reg15,W,ACCESS
        movf    reg16,W,ACCESS
        movf    reg17,W,ACCESS
        goto here
     
        end


    GeorgePauley
    (Yeah, I have to wait like a month to get devices from the sample center just like everyone else.)

    You could do what your customers do and buy them from distribution. This usually takes leas than 48 hours in most of the USA.

    GeorgePauley
    In the meantime, I would recommend opening a ticket with Microchip to start the process of getting someone on the MPLAB X IDE team looking at this.

    Maybe someone else should do this as my past experiences when reporting issues about the simulator have not ended well for me.
    post edited by dan1138 - 2019/12/09 21:27:12
    #15
    Jump to:
    © 2019 APG vNext Commercial Version 4.5