<p>We have a small embedded system without any video or serial ports (i.e. we can't output text via printf).<br>
We would like to track the progress of our code through the initialization sequence.<br>
Is there some simple things we can do to help with this.<br>
It is not running any OS, and the hardware platform is somewhat customizable.</p>

[{'answer_id': 69493, 'author': 'Benoit', 'author_id': 10703, 'author_profile': 'https://Stackoverflow.com/users/10703', 'pm_score': 3, 'selected': False, 'text': '<p>There are a few strategies you can employ to help with debugging:</p>\n\n<p>If you have Output Pins available, you can hook them up to LEDs (or an oscilloscope) and toggle the output pins high/low to indicate that certain points have been reached in the code.<br>\nFor example, 1 blink might be program loaded, 2 blink is foozbar initialized, 3 blink is accepting inputs...</p>\n\n<p>If you have multiple output lines available, you can use a 7 segment LED to convey more information (numbers/letters instead of blinks).</p>\n\n<p>If you have the capabilities to read memory and have some RAM available, you can use the sprint function to do printf-like debugging, but instead of going to a screen/serial port, it is written in memory.</p>\n'}, {'answer_id': 69505, 'author': 'DGentry', 'author_id': 4761, 'author_profile': 'https://Stackoverflow.com/users/4761', 'pm_score': 0, 'selected': False, 'text': '<p>A JTAG debugger is also an option, though cumbersome to set up.</p>\n'}, {'answer_id': 69509, 'author': 'Yann Ramin', 'author_id': 9167, 'author_profile': 'https://Stackoverflow.com/users/9167', 'pm_score': 4, 'selected': True, 'text': '<p>The simplest most scalable solution are state LEDs. Toggle LEDs based on actions, either in binary form or when certain actions occur if you can narrow your focus.</p>\n\n<p>The most powerful will be a hardware JTAG device. You don\'t even need to set breakpoints - simply being able to stop the application and inspect the state of memory may be enough. Note that some hardware platforms do not support "fancy" options such as memory watches or hardware breakpoints. The former is usually worked around with constantly stopping the processor and reading memory (turns your 10MHz system into a 1kHz system), while the latter is sometimes performed using code replacement (replace the targeted instruction with a different jump), which sometimes masks other problems. Be aware of these issues and which embedded processors they apply to.</p>\n'}, {'answer_id': 70666, 'author': 'Jon Mills', 'author_id': 7486, 'author_profile': 'https://Stackoverflow.com/users/7486', 'pm_score': 0, 'selected': False, 'text': "<p>If you don't have JTAG, the LEDs suggested by the others are a great idea - although you do tend to end up in a test/rebuild cycle to try to track down the issue.</p>\n\n<p>If you've got more time, and spare hardware pins, and memory to spare, you could always bit-bash a low speed serial interface. I've found that pretty useful in the past.</p>\n"}, {'answer_id': 71191, 'author': 'Andrew Edgecombe', 'author_id': 11694, 'author_profile': 'https://Stackoverflow.com/users/11694', 'pm_score': 2, 'selected': False, 'text': '<p>It depends on the type of debugging that you\'re trying to do - in particular if you\'re after a temporary method of tracing or if you are trying to provide a tool that can be used as an indication of status during the life of the project (or product).</p>\n\n<p>For one off, in depth source tracing and debugging an in-circuit debugger (eg. jtag) can be very helpful. However, they are most helpful where your debugging requires setting breakpoints and investigating memory and registers - which makes it of little benefit where you are dealing time critical problems.</p>\n\n<p>Where you need to determine program state without having a significant impact on the execution of your system the use of LEDs connected to spare I/O pins will be helpful. These can also be used as the input to a digital storage oscilloscope (DSO) or logic analyzer.\nThis technique can be made more powerful by selecting unique patterns of pulses that will be identifiable on the DSO.</p>\n\n<p>For a more versatile debugging tool, though, a serial port is a good solution. To save cost and PCB real-estate you may find it useful to use an plug-in module that contains the RS232 converters.</p>\n\n<p>If you are trying to provide a longer term indication of status as part of the normal operation of your product, LEDs are again a cheap an simple method. However in this situation it is best to choose patterns of pulses that are slow enough to be easily identified by visual inspection. This will all you over time you will learn a particular pattern that represents "normal" behavior.</p>\n'}, {'answer_id': 75717, 'author': 'Community', 'author_id': -1, 'author_profile': 'https://Stackoverflow.com/users/-1', 'pm_score': 0, 'selected': False, 'text': "<p>Others have suggested some pretty good ideas using output pins, so I won't suggest that, although it can be a very good solution, and is very cost effective. If your budget and target processor support it, a hardware trace system, (either an old fashioned emulator, or a fancy BDM with bus snooping trace support) can be great for this type of thing. It's very expensive though.</p>\n"}, {'answer_id': 84917, 'author': 'Eli Bendersky', 'author_id': 8206, 'author_profile': 'https://Stackoverflow.com/users/8206', 'pm_score': 2, 'selected': False, 'text': "<p>You can easily emulate serial communications (UARTs) using bit-banging from the IO pins of the system. Hook it to one of the card's pins and attach to a RS232 converter there (TTL to RS232 converters are easy to either buy or build), which goes to your PC's serial port.</p>\n"}, {'answer_id': 783442, 'author': 'Purple Tentacle', 'author_id': 42020, 'author_profile': 'https://Stackoverflow.com/users/42020', 'pm_score': 0, 'selected': False, 'text': "<p>The idea of using a bit-banged software UART is nice, but there's some effort required in writing one and also you need some free timers and interrupts. If your hardware has any other unused serial interface (SPI, I2C, ..), using them would be easier. With a small microcontroller you could convert the interface to RS-232.</p>\n\n<p>If you have to go for the bit-banging, making a synchronous serial might be a simpler alternative as it wouldn't be critical to timing.</p>\n"}]
['https://Stackoverflow.com/questions/69492', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/10703/']