If boards are rebooting randomly, it's probably due to a crash in your code that will be difficult to track down. If you want to intentionally reboot, you can call exit(0).
If you run your code in the debugger, it might stop execution before crashing and you might be able to determine what led up to the crash. You can also place printf() statements in your code so you have a log of what was happening before the reboot. It's even possible to enable those printfs() on the programming port for release builds (see Samples/STDIO_SERIAL.C).
Without a known "steps to reproduce" the reboots, you'll have a hard time tracking down the root cause. My recommendation would be to write down a list of things you did leading up to any random reboot and try to look for a pattern. If you're lucky, you can come up with those "steps to reproduce" and then start single stepping the debugger on the last step that typically results in a reboot.