I have no JTAG and I can not afford it for my ARM Cortex M3 Chip.
I'm wondering, how professionals debug their applications ?
- Do you flash your uC every time, frequently, then you run and test, then change? is that a bad practice ?
- Do you only use UART or LCD for writing logs on the screen ?
I need tips and tricks from the professionals 🙂
Best Answer
This is more of a blog post, but here goes:
If you write in C, you can compile your code and run it on your desktop. This won't test the low-level hardware drivers, but can test all the logic code.
Recommendations on this approach:
stdint.h
and types likeuint64_t
, instead of "unsigned long int
". This lets you get the same behavior when compiled on different systems.malloc()
orfree()
.printf()
, to taste. There are a large variety of mature and useful desktop debugging tools available.main()
function at the end of a file that is#define
'd out. Thismain()
tries any tricky functions in the file and returns 0 for all-pass orasserts()
for fail. Then I add a "test" target in the makefile that compiles and runs each of the individual files' tests.If you do standalone unit-testing this way, you will find that you have very little need for on-chip debugging. In addition, you will find porting to different hardware platforms is a lot easier because the core logic and hardware drivers are well separated.