Electronic – Is it possible to set a breakpoint in AVR Studio in files other than the one where the main() function is

avrdebugging

If I have a project with more than one translation unit, AVR Studio only allows me to set breakpoints in the main c file.

It doesn't matter if I include the other files directly by #include "something.c" or by using their header.

A quick search on various embedded forums didn't result in any answer or even discussion regarding this topic. Is everyone using a single translation unit when debugging, or did I miss a feature in plain sight?

The project was generated by CodeVision, if it is of any relevance.

Best Answer

Yes, you can.

It doesn't matter if the is in the main C file or not, if there is one path in the function call tree (which obviously has main at its root) where control passes the line, you should be able to set a breakpoint on it.

I use a JTAG debugger and in the debugger software I load an ELF file that links functions and variables in code to addresses in the HEX file. So if you are not able to debug through code, verify if you have something similar, and if yes, verify that it is generated properly.

Or you may have a different problem altogether. Some of your files may not be included in the compilation. Check your build log to verify this.