From: Zach W. <zw...@us...> - 2009-11-14 16:33:15
|
This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "Main OpenOCD repository". The branch, master has been updated via 4088b1e622cff0673f2859de5ee611da736bdba7 (commit) from ab3bdfb2cb7b0c16800195951e4ee549cf8e86a5 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit 4088b1e622cff0673f2859de5ee611da736bdba7 Author: Zachary T Welch <zw...@su...> Date: Sat Nov 14 07:29:16 2009 -0800 add openocd.h for top-level declarations Create src/openocd.h to hold declarations previously made internally by src/main.c and src/server/server.c. This ensures all functions are verified to be in-sync at compile time (rather than at link), making it easier to track down bugs. diff --git a/src/Makefile.am b/src/Makefile.am index 7721f34..77ae5ae 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -16,6 +16,10 @@ libopenocd_la_SOURCES = \ hello.c \ openocd.c +noinst_HEADERS = \ + openocd.h + + # set the include path found by configure AM_CPPFLAGS = \ -I$(top_srcdir)/src \ diff --git a/src/ecosboard.c b/src/ecosboard.c index 38f3252..e38316c 100644 --- a/src/ecosboard.c +++ b/src/ecosboard.c @@ -36,6 +36,7 @@ #include "server.h" #include "telnet_server.h" #include "gdb_server.h" +#include "openocd.h" #include <time_support.h> #include <sys/time.h> diff --git a/src/main.c b/src/main.c index c2b53da..a71977d 100644 --- a/src/main.c +++ b/src/main.c @@ -22,6 +22,7 @@ #ifdef HAVE_CONFIG_H #include "config.h" #endif +#include "openocd.h" /* This is the main entry for developer PC hosted OpenOCD. * @@ -32,8 +33,6 @@ * Those applications will have their own main() implementation * and use bits and pieces from openocd.c. */ -extern int openocd_main(int argc, char *argv[]); - int main(int argc, char *argv[]) { return openocd_main(argc, argv); diff --git a/src/main.c b/src/openocd.h similarity index 65% copy from src/main.c copy to src/openocd.h index c2b53da..1bf6b7e 100644 --- a/src/main.c +++ b/src/openocd.h @@ -1,6 +1,6 @@ /*************************************************************************** - * Copyright (C) 2005 by Dominic Rath * - * Dom...@gm... * + * Copyright (C) 2005 by Dominic Rath <Dom...@gm...> * + * Copyright (C) 2009 by Zachary T Welch <zw...@su...> * * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * @@ -18,23 +18,22 @@ * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * ***************************************************************************/ +#ifndef OPENOCD_H +#define OPENOCD_H -#ifdef HAVE_CONFIG_H -#include "config.h" -#endif - -/* This is the main entry for developer PC hosted OpenOCD. - * - * OpenOCD can also be used as a library that is linked with - * another application(not mainstream yet, but possible), e.g. - * w/as an embedded application. - * - * Those applications will have their own main() implementation - * and use bits and pieces from openocd.c. */ +/** + * Different applications can define this entry point to override + * the default openocd main function. On most systems, this will be + * defined in src/openocd.c. + * @param argc normally passed from main() + * @param argv normally passed from main() + * @returns return code for main() + */ +int openocd_main(int argc, char *argv[]); -extern int openocd_main(int argc, char *argv[]); +/// used by the server_loop() function in src/server/server.c +void openocd_sleep_prelude(void); +/// used by the server_loop() function in src/server/server.c +void openocd_sleep_postlude(void); -int main(int argc, char *argv[]) -{ - return openocd_main(argc, argv); -} +#endif diff --git a/src/server/Makefile.am b/src/server/Makefile.am index 2f07007..6e52fdf 100644 --- a/src/server/Makefile.am +++ b/src/server/Makefile.am @@ -1,4 +1,5 @@ AM_CPPFLAGS = \ + -I$(top_srcdir)/src \ -I$(top_srcdir)/src/helper \ -I$(top_srcdir)/src/target \ -I$(top_srcdir)/src/flash \ diff --git a/src/server/server.c b/src/server/server.c index 7416784..92292eb 100644 --- a/src/server/server.c +++ b/src/server/server.c @@ -29,6 +29,7 @@ #include "server.h" #include "target.h" +#include "openocd.h" #include <signal.h> @@ -285,9 +286,6 @@ int remove_services(void) return ERROR_OK; } -extern void openocd_sleep_prelude(void); -extern void openocd_sleep_postlude(void); - int server_loop(struct command_context *command_context) { struct service *service; ----------------------------------------------------------------------- Summary of changes: src/Makefile.am | 4 ++++ src/ecosboard.c | 1 + src/main.c | 3 +-- src/{flash/ocl/at91sam7x/dcc.h => openocd.h} | 26 +++++++++++++++++--------- src/server/Makefile.am | 1 + src/server/server.c | 4 +--- 6 files changed, 25 insertions(+), 14 deletions(-) copy src/{flash/ocl/at91sam7x/dcc.h => openocd.h} (65%) hooks/post-receive -- Main OpenOCD repository |