From: Zach W. <zw...@us...> - 2009-12-02 22:32:32
|
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 6ec526e706483cd2de6c8de4bafa885522a782cd (commit) via eaf10f69de969652d03742809b9c970158b90719 (commit) via 34654359a918edae10ca7dd7ebc0a487fdf609a4 (commit) from 62fbb0f545213f8a813819f319e20fee8a859319 (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 6ec526e706483cd2de6c8de4bafa885522a782cd Author: Zachary T Welch <zw...@su...> Date: Tue Dec 1 19:58:32 2009 -0800 remove #if BUILD_HTTPD Add httpd_stubs.c to provide no-op implementations of httpd_start() and httpd_stop(). Allows these routines to be called unconditionally and ensures the libocdserver ABI remains unchanged regardless of whether this feature was built-in or not. Prints a DEBUG message when the stub implementation is included. diff --git a/configure.in b/configure.in index 1a4299d..9cb2b0f 100644 --- a/configure.in +++ b/configure.in @@ -614,12 +614,6 @@ else AC_DEFINE(BUILD_ZY1000, 0, [0 if you don't want ZY1000.]) fi -if test $build_httpd = yes; then - AC_DEFINE(BUILD_HTTPD, 1, [1 if you want httpd.]) -else - AC_DEFINE(BUILD_HTTPD, 0, [0 if you don't want httpd.]) -fi - if test $build_at91rm9200 = yes; then build_bitbang=yes AC_DEFINE(BUILD_AT91RM9200, 1, [1 if you want at91rm9200.]) diff --git a/src/openocd.c b/src/openocd.c index 1f45837..9a08019 100644 --- a/src/openocd.c +++ b/src/openocd.c @@ -244,10 +244,8 @@ int openocd_main(int argc, char *argv[]) if (ret != ERROR_OK) return EXIT_FAILURE; -#if BUILD_HTTPD if (httpd_start(cmd_ctx) != ERROR_OK) return EXIT_FAILURE; -#endif ret = server_init(cmd_ctx); if (ERROR_OK != ret) @@ -266,9 +264,7 @@ int openocd_main(int argc, char *argv[]) server_quit(); -#if BUILD_HTTPD httpd_stop(); -#endif unregister_all_commands(cmd_ctx, NULL); diff --git a/src/server/Makefile.am b/src/server/Makefile.am index b47b8d0..989a682 100644 --- a/src/server/Makefile.am +++ b/src/server/Makefile.am @@ -14,6 +14,7 @@ libserver_la_SOURCES = server.c telnet_server.c gdb_server.c if HTTPD libserver_la_SOURCES += httpd.c else +libserver_la_SOURCES += httpd_stubs.c if !ECOSBOARD libserver_la_SOURCES += server_stubs.c endif diff --git a/src/server/httpd_stubs.c b/src/server/httpd_stubs.c new file mode 100644 index 0000000..0a63362 --- /dev/null +++ b/src/server/httpd_stubs.c @@ -0,0 +1,32 @@ +/*************************************************************************** + * Copyright (C) 2009 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 * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + * This program is distributed in the hope that it will be useful, * + * but WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * + * GNU General Public License for more details. * + * * + * You should have received a copy of the GNU General Public License * + * along with this program; if not, write to the * + * Free Software Foundation, Inc., * + * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * + ***************************************************************************/ + +#ifdef HAVE_CONFIG_H +#include <config.h> +#endif +#include "httpd.h" + +int httpd_start(struct command_context *cmd_ctx) +{ + LOG_DEBUG("libocdserver was built without HTTPD support"); + return ERROR_OK; +} +void httpd_stop(void) +{ +} commit eaf10f69de969652d03742809b9c970158b90719 Author: Zachary T Welch <zw...@su...> Date: Tue Dec 1 19:52:00 2009 -0800 remove BUILD_IOUTIL symbol Add ioutil_stubs.c to provide an empty ioutil_init() routine. Add ioutil.h to prevent applications from needing to declare it. Allows unconditionally calling that function during startup, and the resulting libocdhelper library API is now more stable. Prints a DEBUG message when the stub implementation is included. diff --git a/configure.in b/configure.in index 81e4326..1a4299d 100644 --- a/configure.in +++ b/configure.in @@ -614,12 +614,6 @@ else AC_DEFINE(BUILD_ZY1000, 0, [0 if you don't want ZY1000.]) fi -if test $build_ioutil = yes; then - AC_DEFINE(BUILD_IOUTIL, 1, [1 if you want ioutils.]) -else - AC_DEFINE(BUILD_IOUTIL, 0, [0 if you don't want ioutils.]) -fi - if test $build_httpd = yes; then AC_DEFINE(BUILD_HTTPD, 1, [1 if you want httpd.]) else diff --git a/src/ecosboard.c b/src/ecosboard.c index dcd497c..cfb5765 100644 --- a/src/ecosboard.c +++ b/src/ecosboard.c @@ -23,6 +23,7 @@ #include "types.h" #include "jtag.h" +#include "ioutil.h" #include "configuration.h" #include "xsvf.h" #include "svf.h" @@ -942,8 +943,6 @@ static int add_default_dirs(void) return ERROR_OK; } -int ioutil_init(struct command_context *cmd_ctx); - int main(int argc, char *argv[]) { /* ramblockdevice will be the same address every time. The deflate app uses a buffer 16mBytes out, so we @@ -1080,13 +1079,8 @@ int main(int argc, char *argv[]) command_set_output_handler(cmd_ctx, configuration_output_handler, NULL); command_context_mode(cmd_ctx, COMMAND_CONFIG); -#if BUILD_IOUTIL if (ioutil_init(cmd_ctx) != ERROR_OK) - { return EXIT_FAILURE; - } -#endif - #ifdef CYGPKG_PROFILE_GPROF COMMAND_REGISTER(cmd_ctx, NULL, "ecosboard_profile", eCosBoard_handle_eCosBoard_profile_command, diff --git a/src/helper/Makefile.am b/src/helper/Makefile.am index 22b3c33..01e805e 100644 --- a/src/helper/Makefile.am +++ b/src/helper/Makefile.am @@ -27,6 +27,8 @@ libhelper_la_SOURCES = \ if IOUTIL libhelper_la_SOURCES += ioutil.c +else +libhelper_la_SOURCES += ioutil_stubs.c endif libhelper_la_CFLAGS = @@ -38,6 +40,7 @@ endif noinst_HEADERS = \ binarybuffer.h \ configuration.h \ + ioutil.h \ types.h \ log.h \ command.h \ diff --git a/src/helper/ioutil.h b/src/helper/ioutil.h new file mode 100644 index 0000000..855ae55 --- /dev/null +++ b/src/helper/ioutil.h @@ -0,0 +1,27 @@ +/*************************************************************************** + * Copyright (C) 2009 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 * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + * This program is distributed in the hope that it will be useful, * + * but WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * + * GNU General Public License for more details. * + * * + * You should have received a copy of the GNU General Public License * + * along with this program; if not, write to the * + * Free Software Foundation, Inc., * + * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * + ***************************************************************************/ + +#ifndef HELPER_IOUTILS_H +#define HELPER_IOUTILS_H + +struct command_context; + +int ioutil_init(struct command_context *cmd_ctx); + +#endif // HELPER_IOUTILS_H diff --git a/src/helper/ioutil_stubs.c b/src/helper/ioutil_stubs.c new file mode 100644 index 0000000..1171a6f --- /dev/null +++ b/src/helper/ioutil_stubs.c @@ -0,0 +1,29 @@ +/*************************************************************************** + * Copyright (C) 2009 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 * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + * This program is distributed in the hope that it will be useful, * + * but WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * + * GNU General Public License for more details. * + * * + * You should have received a copy of the GNU General Public License * + * along with this program; if not, write to the * + * Free Software Foundation, Inc., * + * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * + ***************************************************************************/ + +#ifdef HAVE_CONFIG_H +#include <config.h> +#endif +#include "ioutil.h" + +int ioutil_init(struct command_context *cmd_ctx) +{ + LOG_DEBUG("libocdhelper was built without I/O utility support"); + return ERROR_OK; +} diff --git a/src/openocd.c b/src/openocd.c index 2043a92..1f45837 100644 --- a/src/openocd.c +++ b/src/openocd.c @@ -30,6 +30,7 @@ #include "openocd.h" #include "jtag.h" +#include "ioutil.h" #include "configuration.h" #include "xsvf.h" #include "svf.h" @@ -85,8 +86,6 @@ static int log_target_callback_event_handler(struct target *target, enum target_ return ERROR_OK; } -int ioutil_init(struct command_context *cmd_ctx); - static bool init_at_startup = true; COMMAND_HANDLER(handle_noinit_command) @@ -227,12 +226,8 @@ int openocd_main(int argc, char *argv[]) cmd_ctx = setup_command_handler(NULL); -#if BUILD_IOUTIL if (ioutil_init(cmd_ctx) != ERROR_OK) - { return EXIT_FAILURE; - } -#endif LOG_OUTPUT("For bug reports, read\n\t" "http://openocd.berlios.de/doc/doxygen/bugs.html" commit 34654359a918edae10ca7dd7ebc0a487fdf609a4 Author: Zachary T Welch <zw...@su...> Date: Tue Dec 1 19:41:16 2009 -0800 remove #if logic for openocd_sleep_*lude Adds server_stubs.c to hold these routines, using automake logic to ensure it gets included under the right conditions. diff --git a/src/openocd.c b/src/openocd.c index 12bcf44..2043a92 100644 --- a/src/openocd.c +++ b/src/openocd.c @@ -215,20 +215,6 @@ struct command_context *setup_command_handler(Jim_Interp *interp) return cmd_ctx; } -#if !BUILD_HTTPD && !BUILD_ECOSBOARD -/* implementations of OpenOCD that uses multithreading needs to know when - * OpenOCD is sleeping. No-op in vanilla OpenOCD - */ -void openocd_sleep_prelude(void) -{ -} - -void openocd_sleep_postlude(void) -{ -} -#endif - - /* normally this is the main() function entry, but if OpenOCD is linked * into application, then this fn will not be invoked, but rather that * application will have it's own implementation of main(). */ diff --git a/src/openocd.h b/src/openocd.h index a91d46f..e43f156 100644 --- a/src/openocd.h +++ b/src/openocd.h @@ -31,11 +31,6 @@ */ 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); - /// provides a hard-coded command environment setup extern const char openocd_startup_tcl[]; diff --git a/src/server/Makefile.am b/src/server/Makefile.am index 95fb519..b47b8d0 100644 --- a/src/server/Makefile.am +++ b/src/server/Makefile.am @@ -13,6 +13,10 @@ libserver_la_SOURCES = server.c telnet_server.c gdb_server.c if HTTPD libserver_la_SOURCES += httpd.c +else +if !ECOSBOARD +libserver_la_SOURCES += server_stubs.c +endif endif noinst_HEADERS += httpd.h diff --git a/src/server/server.h b/src/server/server.h index 173de95..e632bf1 100644 --- a/src/server/server.h +++ b/src/server/server.h @@ -82,6 +82,15 @@ int server_loop(struct command_context *command_context); int server_register_commands(struct command_context *context); /** + * Used by server_loop(), defined in server_stubs.c, httpd.c, or ecosboard.c + */ +void openocd_sleep_prelude(void); +/** + * Used by server_loop(), defined in server_stubs.c, httpd.c, or ecosboard.c + */ +void openocd_sleep_postlude(void); + +/** * Defines an extended command handler function declaration to enable * access to (and manipulation of) the server port number. * Call server_port like a normal COMMAND_HANDLER with an extra @a out parameter diff --git a/src/openocd.h b/src/server/server_stubs.c similarity index 62% copy from src/openocd.h copy to src/server/server_stubs.c index a91d46f..dcddec0 100644 --- a/src/openocd.h +++ b/src/server/server_stubs.c @@ -1,6 +1,5 @@ /*************************************************************************** - * Copyright (C) 2005 by Dominic Rath <Dom...@gm...> * - * Copyright (C) 2009 by Zachary T Welch <zw...@su...> * + * Copyright (C) 2009 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,25 +17,16 @@ * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * ***************************************************************************/ -#ifndef OPENOCD_H -#define OPENOCD_H - -/** - * 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[]); - -/// 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); - -/// provides a hard-coded command environment setup -extern const char openocd_startup_tcl[]; - +#ifdef HAVE_CONFIG_H +#include <config.h> #endif +#include "server.h" + +void openocd_sleep_prelude(void) +{ + // no-op +} +void openocd_sleep_postlude(void) +{ + // no-op +} ----------------------------------------------------------------------- Summary of changes: configure.in | 12 ------------ src/ecosboard.c | 8 +------- src/helper/Makefile.am | 3 +++ src/{server/httpd.h => helper/ioutil.h} | 9 ++++----- src/{server/httpd.h => helper/ioutil_stubs.c} | 17 +++++++++-------- src/openocd.c | 25 +------------------------ src/openocd.h | 5 ----- src/server/Makefile.am | 5 +++++ src/server/{httpd.h => httpd_stubs.c} | 20 ++++++++++++-------- src/server/server.h | 9 +++++++++ src/server/{httpd.h => server_stubs.c} | 20 ++++++++++++-------- 11 files changed, 56 insertions(+), 77 deletions(-) copy src/{server/httpd.h => helper/ioutil.h} (89%) copy src/{server/httpd.h => helper/ioutil_stubs.c} (87%) copy src/server/{httpd.h => httpd_stubs.c} (86%) copy src/server/{httpd.h => server_stubs.c} (87%) hooks/post-receive -- Main OpenOCD repository |