aboutsummaryrefslogtreecommitdiff
path: root/src/main.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/main.c')
-rw-r--r--src/main.c28
1 files changed, 18 insertions, 10 deletions
diff --git a/src/main.c b/src/main.c
index aed3e80..6109df9 100644
--- a/src/main.c
+++ b/src/main.c
@@ -18,34 +18,42 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-/* Provides main entry point. Initialise subsystems and enter GDB
+/* Provides main entry point. Initialise subsystems and enter GDB
* protocol loop.
*/
-#include <stdio.h>
-#include <stdlib.h>
-#include <assert.h>
-
+#include "general.h"
#include "gdb_if.h"
#include "gdb_main.h"
#include "jtagtap.h"
#include "jtag_scan.h"
-
#include "target.h"
+#include "exception.h"
+#include "gdb_packet.h"
+#include "morse.h"
int
main(int argc, char **argv)
{
#if defined(HOST)
- assert(platform_init(argc, argv) == 0);
+ platform_init(argc, argv);
#else
(void) argc;
(void) argv;
- assert(platform_init() == 0);
+ platform_init();
#endif
- PLATFORM_SET_FATAL_ERROR_RECOVERY();
- gdb_main();
+ while (true) {
+ volatile struct exception e;
+ TRY_CATCH(e, EXCEPTION_ALL) {
+ gdb_main();
+ }
+ if (e.type) {
+ gdb_putpacketz("EFF");
+ target_list_free();
+ morse("TARGET LOST.", 1);
+ }
+ }
/* Should never get here */
return 0;