• AVR Freaks

Hot!Pointer watch not working for 8-bit/16-bit, ticket opened, what is microchip doing?!!!

Author
alassaneg
New Member
  • Total Posts : 8
  • Reward points : 0
  • Joined: 2019/09/02 11:38:33
  • Location: 0
  • Status: offline
2019/10/23 03:42:18 (permalink)
0

Pointer watch not working for 8-bit/16-bit, ticket opened, what is microchip doing?!!!

I opened a ticket to microchip (on 9/29/2019) because i have an issue watching pointers in the watch windows using MPLAB 5.20 and the xc8 compiler. This issue completely prevent me from working on my prototype since i found this out.
Microchip found out that it's a bug coming from MPLAB and affecting 8-bit and 16-bit projects.
There is an internal ticket opened (MPLABX-4896) but no one can tell me when this will be fixed. 
I'm worrying about the quality support. I was told to use arrays instead of pointers. I jsut can't believe that a support team can give this kind of answer!
Also, i was told that : "we would recommend watching the release note to check the issues fixed in the upcoming releases (not necessarily the next version). Once the issue is marked as fixed, you can consider upgrading to the fixed version of the tool".
Seriously microchip peoples, i should look at myself every single day if a new microchip releas has been provided?!
Please just tell me now if i should give up my project and restart from the beginnig with another supplier...
Did anyone had the same kind of issue when opening tickets to microchip?
#1

11 Replies Related Threads

    ric
    Super Member
    • Total Posts : 24202
    • Reward points : 0
    • Joined: 2003/11/07 12:41:26
    • Location: Australia, Melbourne
    • Status: online
    Re: Pointer watch not working for 8-bit/16-bit, ticket opened, what is microchip doing?!!! 2019/10/23 05:08:56 (permalink)
    +3 (3)
    Yes, it would be nice if problems were fixed quicker, but you're never going to get everything you want.
    Why is it so critical to have a pointer visible in the watch window? I've developed several major commercial projects, and never used it. I much prefer to just do my own debugging out a serial port, not use the MPLABX debugger.
     

    I also post at: PicForum
    Links to useful PIC information: http://picforum.ric323.co...opic.php?f=59&t=15
    NEW USERS: Posting images, links and code - workaround for restrictions.
    To get a useful answer, always state which PIC you are using!
    #2
    alassaneg
    New Member
    • Total Posts : 8
    • Reward points : 0
    • Joined: 2019/09/02 11:38:33
    • Location: 0
    • Status: offline
    Re: Pointer watch not working for 8-bit/16-bit, ticket opened, what is microchip doing?!!! 2019/10/23 06:11:38 (permalink)
    0
    ric
    Yes, it would be nice if problems were fixed quicker, but you're never going to get everything you want.
    Why is it so critical to have a pointer visible in the watch window? I've developed several major commercial projects, and never used it. I much prefer to just do my own debugging out a serial port, not use the MPLABX debugger.
     


    I'm sending and receiving data through UART. I've a bluetooth module that send the data through UART to the microcontroller. I'm already unsing a usb/ttl converter to check that the correct datas are sent to the microcontroller but i can't check what has been received by the microcontroller. I need to know what is in my pointer.
    #3
    ric
    Super Member
    • Total Posts : 24202
    • Reward points : 0
    • Joined: 2003/11/07 12:41:26
    • Location: Australia, Melbourne
    • Status: online
    Re: Pointer watch not working for 8-bit/16-bit, ticket opened, what is microchip doing?!!! 2019/10/23 13:16:58 (permalink)
    +1 (1)
    You don't mention which PIC you are using. Does it only have one USART?

    I also post at: PicForum
    Links to useful PIC information: http://picforum.ric323.co...opic.php?f=59&t=15
    NEW USERS: Posting images, links and code - workaround for restrictions.
    To get a useful answer, always state which PIC you are using!
    #4
    alassaneg
    New Member
    • Total Posts : 8
    • Reward points : 0
    • Joined: 2019/09/02 11:38:33
    • Location: 0
    • Status: offline
    Re: Pointer watch not working for 8-bit/16-bit, ticket opened, what is microchip doing?!!! 2019/10/23 13:21:00 (permalink)
    0
    It's a PIC18F26J50 and it has two USART and i need to use them both.
    #5
    Nikolay_Po
    Super Member
    • Total Posts : 1909
    • Reward points : 0
    • Joined: 2012/04/01 13:49:27
    • Location: Russia, Novorossiysk
    • Status: offline
    Re: Pointer watch not working for 8-bit/16-bit, ticket opened, what is microchip doing?!!! 2019/10/23 13:52:26 (permalink)
    +3 (3)
    Alassane, sure the MPLAB X bug is not a showstopper for whole Microchip microcontroller business. So the MPLAB peoples will not prepare the fix release urgently. For such a large software projects like MPLAB X, a small urgent corrections are barely possible. Any fresh release requires extensive testing and requires a resources from development and testing teams. That is why they can't promise you to fix the bug right now.
     
    To work your problem around you can define volatile index variable and place a conversion of your pointer into an index after each pointer update or right before your breakpoint. For best convenience you may declare your buffer as an array. This way you will got a correspondence between an index and data position in a debugger. Something like this:
     
    //Before your functions
    uint8_t Buffer[128] = {0}; //Data buffer
    volatile uint8_t Index = 0; //An index for debug
    uint8_t *Pointer = NULL; //Data pointer

    //Inside of your functions
    //Initialize the pointer and index variables
    Pointer = Buffer; //Set the pointer to the beginning of a buffer
    Index = Pointer-Buffer; //Update debug index

    //Inside of function with pointer update
    *Pointer++ = NewByte; //Store fresh data and advance the pointer
    Index = Pointer - Buffer; //Update debug index

    /*
    Now Watch window will show you an index as an integer and data buffer as an array.
    Just look at the position of the buffer at the number of Index variable.
    */

     
    I have none XC8 right now and completely not sure my example will work. But you can try if you really need to watch a pointer.
    #6
    alassaneg
    New Member
    • Total Posts : 8
    • Reward points : 0
    • Joined: 2019/09/02 11:38:33
    • Location: 0
    • Status: offline
    Re: Pointer watch not working for 8-bit/16-bit, ticket opened, what is microchip doing?!!! 2019/11/06 09:26:18 (permalink)
    0
    Hi Nikolay,
     
    Sorry for late answer. 
    Thank you, that could work, but my goal is to not use arrays at all because these have a maximum size that is too small for my application and that's why i'm using pointers.
    Microchip told me last week on the ticket that a new Mplab version has been released and that my issue has been fixed. I've downloaded it but my issue is still not fixed, and my internal ticket doesn't even appear in the release note.
     
    #7
    Nikolay_Po
    Super Member
    • Total Posts : 1909
    • Reward points : 0
    • Joined: 2012/04/01 13:49:27
    • Location: Russia, Novorossiysk
    • Status: offline
    Re: Pointer watch not working for 8-bit/16-bit, ticket opened, what is microchip doing?!!! 2019/11/06 14:03:50 (permalink)
    0
    Alassane, now your point is clear to me and seems to be reasonable. Pointer operations with indirect addressing math may be hard to decrypt. Sure this is a problem to MPLAB X watch window too. I think the problem may stay unsolved for prolonged times without a deadline.
    As for your debug. Have you any larger version of similar chip? The down-sizing into small chip usually is a final stage of a design cycle. With larger RAM controller you may be able to debug with an arrays. And after the prototype is working with larger RAM and communications are tuned you may go to smaller chip. Probably the last is what you're doing now, I don't know.
    Have you tried to declare a pointer as volatile global variable? In such case fewer optimization to pointer math will be applied, the code will be somewhat larger and slower but you (probably) will be able to find a correspondence of pointer value to a RAM address. Look at the pointer value in Watch window and see for and address in PIC memory view window to find a content. It may work this way.
    #8
    JPortici
    Super Member
    • Total Posts : 811
    • Reward points : 0
    • Joined: 2012/11/17 06:27:45
    • Location: Grappaland
    • Status: online
    Re: Pointer watch not working for 8-bit/16-bit, ticket opened, what is microchip doing?!!! 2019/11/06 23:57:52 (permalink)
    0
    i can't open the jira link so i don't know what exactly is the problem.
    I recently found out that mplabxnetbeans cannot display pointers and array of pointers inside a structure correctly.
    struct {
      frame_t* ptrArray[16];
      uint16_t rdIdx;
      uint16_t wrIdx;
      bool isEmpty;
      bool isFull;
    }

    will display only the first element. Granted, that's annoying but if you declare them as single entities, outside of a structure, they will displayed correctly. Once debugged the code, put everything in structure, problem solved.
     
    But since anything related to the watch view is related to netbeans i wouldn't hold my breath. mplabx is three major versions behind, and latest two version has been rewritten from scratch by a different company.
    post edited by JPortici - 2019/11/07 06:39:46
    #9
    Nikolay_Po
    Super Member
    • Total Posts : 1909
    • Reward points : 0
    • Joined: 2012/04/01 13:49:27
    • Location: Russia, Novorossiysk
    • Status: offline
    Re: Pointer watch not working for 8-bit/16-bit, ticket opened, what is microchip doing?!!! 2019/11/07 06:28:52 (permalink)
    0
    Jacopo, without seeing a definition of ptrToBuf type it's hard to judge the fail. If ptrToBuf is an array type definition then the fact the MPLAB X shows only first pointer is somewhat correct. While passing the type, the size of an array is not passing to the structure type because it is just a pointer. And a pointer is only pointer, not an array. It is hard to guess to the debugger to know which size is an array after a pointer.
    I have tried to imagine how to declare your structure with an explicit sizes but it is possible only when you're using only an arrays and indexes instead of pointers.
    Jacopo, Alassane, I think the only reason to use the pointers is the freedom of memory distribution between different data types inside of single RAM buffer. But, if you have tired of pointers, in such case you can declare different data type and/or different designation buffers inside of common RAM area just as a union of an arrays, without of pointers at all. This way any array will have an access to all of a memory and you will be able to share a buffer between several data exchange tasks. Just control your array's indexes while writing data to not overwrite and while reading to not to misread.
    #10
    JPortici
    Super Member
    • Total Posts : 811
    • Reward points : 0
    • Joined: 2012/11/17 06:27:45
    • Location: Grappaland
    • Status: online
    Re: Pointer watch not working for 8-bit/16-bit, ticket opened, what is microchip doing?!!! 2019/11/07 06:47:06 (permalink)
    0
    I updated my code.. posting before breakfast. ugh.
     
    ptrToBuf becomes frame_t, more clear i guess.
     
    My example is a general purpose circular buffer in which the data is not necessairly contigous...
    In that particular application i'm handling variable length frames, the data is being stored in the heap.
    Another example: an array of UI elements, in either C or C++.
     
    the array of pointers by itself will be shown correctly in the watch view, the array of pointers INSIDE A STRUCTURE will not.
    see https://netbeans.org/bugzilla/show_bug.cgi?id=115913 and related/duplicated
    #11
    Howard Long
    Super Member
    • Total Posts : 721
    • Reward points : 0
    • Joined: 2005/04/04 08:50:32
    • Status: offline
    Re: Pointer watch not working for 8-bit/16-bit, ticket opened, what is microchip doing?!!! 2019/11/07 09:38:08 (permalink)
    +1 (1)
    Could the OP use SPI to dump, and a scope or LA to decode? This is a solution that I frequently use for real time medium speed debugging.
    #12
    Jump to:
    © 2019 APG vNext Commercial Version 4.5