I have a phenomenon that I fail to understand.
Im using an Atmel UC3C (AVR32) (together with Atmel Studio 7.0) to capture data from UART and writing it to Flash (I'm aware of the limited write cycles).
I set a breakpoint after the write instruction to check if everything went smoothly. It did, but only one time, when I clicked on "continue" and send UART data again, the data will appear in RAM but won't be written to flash.
I don't get any errors or exceptions (I'm catching uart errors and flash-erase errors). I can reproduce that at will. As soon as a breakpoint is hit (anywhere in the application), flash loses the capability to to write data.
The best part is, when I remove the breakpoint, it works flawlessly (I set a breakpoint after multiple writes and looked at all the written flashpages to see if the changes were applied).
I checked for race-conditions but havn't found any. Uart data is buffered in a circular buffer, if the buffer would overflow, then the UART is blocked and the buffer is flushed (there is no sensitive data transmitted).
My question is: Why is a breakpoint interfering with the program flow, to a point, that it breaks the flash-write capability?
edit: A reset is giving the write capability back to the flash.
These kind of phenomenon could be caused by several things:
On pretty much any MCU, the flash driver code that is writing to the flash cannot be located in the same flash bank as is currently being programmed. When you have this problem, you can usually either provoke it or make it seem to go away by introducing breakpoints, or by single-stepping. Most commonly such code might work when single-stepping, but break when free running.
The solution is to preferably place the flash driver in a different bank than the one getting programmed. A more questionable alternative is to load the flash driver into RAM and execute it from there. (The RAM method is actually recommended by several MCU vendors, even though executing code from RAM is widely known as dangerous practice for multiple reasons.)
Your breakpoint could be interrupting the flash programming. Most flash drivers do not tolerate to get interrupted in the middle of execution. You must not allow any form of interrupt to be executed during flash programming. This includes all other interrupts in your program too. Set the global interrupt mask during programming (and make sure there are no non-maskable interrupts).
Similarly, if your flash driver is based on interrupts, make sure that the debugger isn't blocking interrupts when you set a breakpoint.
Your flash clock pre-scaler could be incorrectly set, resulting in odd behavior when you alter the real-time behavior, by for example by introducing a breakpoint.
In addition, UART and other serial peripherals may have status registers that are cleared by reading them, followed by a read of a data register. Debuggers that read all registers, for example for the purpose of displaying a memory map, may destroy such status flags. This could also be the case.
Related
Foreword
Since this appears to be a bug in the d3d9 Emulation on the Windows side, this would probably best addressed to Microsoft. If you know where I could get into contact with the DirectX Team, please tell me.
For the time being, I'm assuming that the only real chance we have is working around the bug.
What
We're investigating an inresponsiveness found in the Game Test Drive Unlimited 2.
Only when opening the Map and only when having an "RTX" Card (I think the most precise we got is GDDR6, because AMD also seems affected).
After long debugging, we found out, that it's not a simple fault of the game, but instead Present returning D3DERR_DEVICELOST even when having the game in Windowed Mode.
When the Game is in Fullscreen Mode, it properly does the required roundtrip over TestCooperativeLevel and Reset, but after the next frame is rendered, Present has lost the device again, causing the Hangup.
Now I'm looking for pointers on how to solve this issue. While it's probably some internal state corruption of some sorts, it's definitely triggered by an API Call only present when rendering the Map in that Game.
We will try to dig into d3d9.dll, but my suspicion is that the error code just comes from some Kernel/Driver Call, where our knowledge and tooling ends.
Ideally I'd like to fuzzy-find the drawcall by just hooking everything and omitting random apicalls, but I guess it's just not so easy and causes a lot more errors in most conditions.
Also note that an APITrace we did, showed D3D_OK for every single call including EndScene, up until Present, so it's not as simple as checking the return codes.
Trying to use Direct X 9 in Debug/Diagnostic Mode is also not really possible on Windows 10 anymore apparently, even when installing the SDK from June 2010
Thanks in Advance for any idea and maybe addresses to direct this problem to.
I was going through various methods of debugging and stumbled upon a question. In step by step debugging using breakpoints, IDE GUI provides the register values and memory location values for verification for each step of program.I wanted to know are these values fetched from the Microcontroller hardware through JTAG or is it simply virtual simulation results by mimicking the microcontroller core in the Host computer? Is there any methodology to control the live program execution in microcontroller through IDE and see the live values of registers and memory locations for live debugging.
In fact, you need to understand first what debugging means. In debug mode the computer sets break points (program entry address) where the microcontroller need to stop and give back the status to the IDE.
In your case the register values and memory status is fetched directly from the microcontroller when it reach the break point.
JTAG debuggers are varied with many functions depending on the combination of hardware and software you use.
Choosing the right debugger is not an easy task when it come to advanced programming and realtime debugging/tracing. I recommend you to check https://www.tmartis.com/en/34-debugger-programmers for more details about the most used JTAG debuggers.
Hope that i had answered your question.
I am prototyping the driver for an 8 bit parallel image sensor on an ARM device with a built-in ISP. I will spare the details, as I seek for general guide on how to approach this particular problem I am having.
Simply put, when I load the ISP driver (not my prototype camera driver) with dyndbg=+pt flag, the camera driver usually grabs images (about ~8 out of 10 attempts). If I remove the flag, and load the ISP driver without any options, my camera driver rarely finishes its job (about 1 out of ~100 attempts). The system gets stuck saying the device has timed out.
I suspect loading the driver with debug flag is somehow altering the timing, resulting more stable interaction between the ISP and the image sensor. I mostly spend my hours debugging electrical aspects of embedded boards, and rarely delve into a deep software stack such as ISP or Video4Linux. Hence my conjecture may be completely off.
Therefore some pointers will be much appreciated. The kernel is 3.18.
You haven't provided a lot of details for us to work with here, but if enabling debug is making your device work, my suspicion would be that the debug output is introducing a delay which is required for your device to work properly. I'd read through your device datasheets carefully to see if there are any timing requirements you might not be respecting.
My delphi program (NOT for .NET) on windows 7 seems to be running for couple of days straight and then the program sort of freezes with all of its windows painted with blueish grey color as if its windows are disabled. You simply don't have control over the program anymore but has to kill its process and start it up again. You don't need to reboot the system itself.
Has anyone experience this or anything similar? If so, what did you do to resolve or try to resolve it?
Thanks,
Your question context is very vague. We do not have any information about your application, even its design and architecture.
Nethertheless, my (general-purpose) suggestions are the following:
If your application is not multi-threaded, do the process in background threads, then leave the main thread ready to process GDI messages;
If your application is multi-threaded, take care that all VCL access from background threads are made via a Synchronize call;
If your application is multi-threaded or use timers, take care that no method is re-entrant (in some circonstances, you may come into a race condition);
Hunt any memory leak;
Use a detailed logging of the program execution, logging all exceptions risen, to guess the context of the program hang (it may be used on the customer side also to hunt race conditions);
Download the great free tool named ProcessExplorer (now hosted by Microsoft), and check out the state of your frozen program: you will see detailed information about threads, CPU use, memory, network, libraries, handles - this is a must have for any serious debugging - track especially the GDI handles leaks (number of those should remain stable);
If you did not check it already, take a look at the global Windows system event log: there may be some information here;
Perhaps a third party component or library is responsible of the process hang: try to isolate the part of your code which may be responsible of this hang.
I've Delphi application running for months without any problem. Issue is definitively in application code, not in the Delphi architecture (its RTL and VCL are very stable).
The bluish grey color is probably the default window color, meaning the window is no longer painting itself. This is consistent with the other symptom that the program no longer responds to any input. This means it isn't processing any window messages.
The easiest way to debug is to run the program in a debugger, and when it's hung just stop it and see where it's at.
If you have a memory leak you may eventually run out of memory in your process space, and it's possible that the program doesn't properly respond to that condition. Check Task Manager to see the amount of memory it's using.
Yes I fixed several hangs and other problems in the past years.
I used ProcessExplorer before (to view the stack), but it needs Microsoft debug symbols. And with Delphi you can only create a .map file. With map2dbg I could convert the .map to a .dbg, but this does not always work (note: .dbg is deprecated, newer versions of Microsoft debugging tools do not use them anymore).
So I made my own tool :-)
It is part of "AsmProfiler Sampling" tool:
http://code.google.com/p/asmprofiler/downloads/detailname=AsmProfiler_Sampling%20v1.0.7.13.zip
Click on the "Stack view of Process" button in the first screen.
Then select your process from the list and double click on it:
http://code.google.com/p/asmprofiler/wiki/ProcessStackViewer
Now you can view the stack trace of each thread. If the GUI does not respond, the main thread hangs, so check the first thread. (note: sometimes you see an "emtpy" stack because a function misaligned the stack for calculation etc, use the raw strack tracing algoritm to get more the full stack again (with a lot of false positives, because every pointer on the stack which is possible a function is shown!)).
Please post the stack here if you can't solve it, so we can take a look at it.
Note: it uses the jclDebug.pas unit of the JEDI library, so it can read .map and .jdbg files (also .dbg and .pdb debug files of Windows dlls) and also internal JCLDEBUG sections (embedded .jdbg file in one .exe). So you must at least build an .exe with detailed (!) map file, see Project Options -> Compiler -> Linking.
I'm developing an application in LabView on Windows. Starting a week ago, one test machine (a ToughBook, no less) was freezing up completely once every couple days: no mouse cursor, taskbar clock frozen. So yesterday it was retired. But just now, I've seen it on another machine, also a laptop.
This is a pretty uncommon failure mode for PC's. I don't know much about Windows, but I'd expect it to indicate that the software stopped running so completely and suddenly that the kernel was unable to panic.
Is this an accurate assessment? Where do I begin to debug this problem? What controls the cursor in the Windows architecture — is it all kernel mode or is there a window server that might be getting choked by something? Would an unstable third-party hardware driver cause this, rather than a blue screen?
EDIT: I should add that the freezes don't necessarily happen while the code is running.
I'd certainly consider hardware and/or drivers as a possibility - perhaps you could say what hardware is involved?
You could test this by adding a 'debug mode' for each piece of hardware your LabVIEW code talks to, where you would use e.g. a case structure to skip the actual I/O calls and return dummy data to the rest of the application. Make sure it's a similar amount of data to what the real device returns. You'll find this much easier if you've modularised your code into subVI's with clearly defined functions! If disabling I/O calls to a particular bit of hardware stops the freezes it would suggest the problem might be with that hardware or its driver.
Hard to say what the problem is. Base on the symptoms I would check for a possible memory leak (see if your LabVIEW app memory usage is growing overtime using "windows task manager").