Hello everyone
I'm having a lot of trouble debugging correctly, in my case LPC54616, because when I set a breakpoint and go step by step and then hover the mouse over a global structure, I immediately see that the content is inconsistent and after having done so, when perform one more step, I lose the connection with the microcontroller and it seems to stop executing instructions. I'm not sure if it's because the structure could be too big or something like that, but if I don't look at any variables and run the program, it works normally.
Why does this happen? Is there any debug configuration that can help me?
Hello @demian91
How about testing with a simple project?
If still has issue, please take a video show your detail steps, and send your project.
BR
Alice
I have created a LPC54616J512BD100 project with the Semihost option but the rest of the options are the default ones.
If instead of adding the structure expression I place the mouse over it, it produces the same result as I do at the end in the video, only it cannot be seen in the recording.
Hi @demian91 ,
Your test structure contains uninitialized pointers. Please initialize your test.p_map and test.p_map->p_sector pointers before viewing the test structure in the expressions window.
This also fails with CMSIS_DAP when viewing the test.p_map->p_sector pointer in the expressions window.
In my main project I have many structures and where I have members of type pointers to structures, I mostly do the initialization when I reserve dynamic memory but I don't always do it. Is there no alternative to this type of problem for the pemicro programmer? because I am stuck with this problem.
The reason why it is resetting is because the uninitialized pointer can point to an invalid memory location. When you put the uninitialized pointer into the expressions view, a read to to the invalid memory location causes the part to reset.
My suggestion is to initialize the pointers to a known good value. It is best programming practice.
Hello @demian91
I think this is related to PE debugger, I tested with CMSIS-DAP debug probe refer to your video steps, there is no issue, please see my attachment video.
Recommend you using CMSIS-DAP or J-LINK debug probe.
BR
Alice