I would like to do conditional compiling and include different C files based on the hardware being used. For example:
#ifdef HARDWARE_MODULE_1
#include "hardware_module_1.c"
#endif
#ifdef HARDWARE_MODULE_2
#include "hardware_module_2.c"
...
Everything works fine this way only debugging becomes a problem. Breakpoints don't work correctly when placed in the C file that's included that way. The program ends up breaking somewhere else random in the code (different C file altogether) When I manually add file to the project everything seems to be working fine. I'm using uVision V4.60.6.10
"The only problem is that you can't really debug those files which seems to be a uVision bug."
You should probably think twice about the use of the word bug. I would say, it's a question of you having made an incorrect assumption after having designing your code in a way that is quite far from normal best practices.
Don't assume that a debugger will allow you to place breakpoints in a header file, since C header files aren't intended to store the implementation of functions. The debug information is likely to point symbols into a line number for an object file. And the object file is created from a *.c file. So don't expect that a debugger will be able to find magical translation information that will tell that the source line number in the object file isn't pointing to a line in the corresponding *.c file, but is actually a line number in a *.h file. And where should then the debug information store the name of this *.h file, so the debugger knows to open the correct header file?
Incorrect assumptions are really a very large source of errors in this world.