Commit 655e4f88 authored by ntfreak's avatar ntfreak
Browse files

- fixed build issues with win32

- fixed build warnings for last commit
- set svn props for last commit

git-svn-id: svn://svn.berlios.de/openocd/trunk@760 b42882b7-edfa-0310-969c-e2dbd0fdcd60
parent 163bd860
...@@ -94,5 +94,4 @@ static __inline u32 fast_target_buffer_get_u32(u8 *buffer, int little) ...@@ -94,5 +94,4 @@ static __inline u32 fast_target_buffer_get_u32(u8 *buffer, int little)
return be_to_h_u32(buffer); return be_to_h_u32(buffer);
} }
#endif /* BINARYBUFFER_H */ #endif /* BINARYBUFFER_H */
...@@ -305,14 +305,13 @@ int parse_line(char *line, char *words[], int max_words) ...@@ -305,14 +305,13 @@ int parse_line(char *line, char *words[], int max_words)
return nwords; return nwords;
} }
void command_output_text( command_context_t *context, const char *data ) void command_output_text(command_context_t *context, const char *data)
{ {
if( context && context->output_handler && data ){ if( context && context->output_handler && data ){
context->output_handler( context, data ); context->output_handler( context, data );
} }
} }
void command_print_n(command_context_t *context, char *format, ...) void command_print_n(command_context_t *context, char *format, ...)
{ {
char *string; char *string;
...@@ -728,10 +727,3 @@ int handle_time_command(struct command_context_s *cmd_ctx, char *cmd, char **arg ...@@ -728,10 +727,3 @@ int handle_time_command(struct command_context_s *cmd_ctx, char *cmd, char **arg
return retval; return retval;
} }
/*
* Local Variables: **
* tab-width: 4 **
* c-basic-offset: 4 **
* End: **
*/
...@@ -77,20 +77,11 @@ extern int command_run_line(command_context_t *context, char *line); ...@@ -77,20 +77,11 @@ extern int command_run_line(command_context_t *context, char *line);
extern int command_run_linef(command_context_t *context, char *format, ...); extern int command_run_linef(command_context_t *context, char *format, ...);
extern int command_run_line_internal(command_context_t *context, char *line); extern int command_run_line_internal(command_context_t *context, char *line);
extern int command_run_file(command_context_t *context, FILE *file, enum command_mode mode); extern int command_run_file(command_context_t *context, FILE *file, enum command_mode mode);
extern void command_output_text(command_context_t *context, const char *data);
#define ERROR_COMMAND_CLOSE_CONNECTION (-600) #define ERROR_COMMAND_CLOSE_CONNECTION (-600)
#define ERROR_COMMAND_SYNTAX_ERROR (-601) #define ERROR_COMMAND_SYNTAX_ERROR (-601)
extern int fast_and_dangerous; extern int fast_and_dangerous;
#endif /* COMMAND_H */ #endif /* COMMAND_H */
/*
* Local Variables: **
* tab-width: 4 **
* c-basic-offset: 4 **
* End: **
*/
...@@ -54,7 +54,13 @@ ...@@ -54,7 +54,13 @@
#ifndef MAX #ifndef MAX
#define MAX(a,b) (((a)>(b))?(a):(b)) #define MAX(a,b) (((a)>(b))?(a):(b))
#endif #endif
/* for systems that do not support ENOTSUP
* win32 being one of them */
#ifndef ENOTSUP
#define ENOTSUP 134 /* Not supported */
#endif
/* gettimeofday() */ /* gettimeofday() */
#ifndef HAVE_GETTIMEOFDAY #ifndef HAVE_GETTIMEOFDAY
......
...@@ -38,6 +38,8 @@ ...@@ -38,6 +38,8 @@
#include <errno.h> #include <errno.h>
#include <time.h> #include <time.h>
#include "replacements.h"
/* Include the platform dependent libraries for /* Include the platform dependent libraries for
* dynamic loading of libraries. */ * dynamic loading of libraries. */
#ifdef JIM_DYNLIB #ifdef JIM_DYNLIB
...@@ -45,7 +47,9 @@ ...@@ -45,7 +47,9 @@
#ifndef WIN32 #ifndef WIN32
#define WIN32 1 #define WIN32 1
#endif #endif
#ifndef STRICT
#define STRICT #define STRICT
#endif
#define WIN32_LEAN_AND_MEAN #define WIN32_LEAN_AND_MEAN
#include <windows.h> #include <windows.h>
#if _MSC_VER >= 1000 #if _MSC_VER >= 1000
...@@ -12027,8 +12031,7 @@ out: ...@@ -12027,8 +12031,7 @@ out:
* Jim's idea of STDIO.. * Jim's idea of STDIO..
* ---------------------------------------------------------------------------*/ * ---------------------------------------------------------------------------*/
int int Jim_fprintf( Jim_Interp *interp, void *cookie, const char *fmt, ... )
Jim_fprintf( Jim_Interp *interp, void *cookie, const char *fmt, ... )
{ {
int r; int r;
...@@ -12038,10 +12041,8 @@ Jim_fprintf( Jim_Interp *interp, void *cookie, const char *fmt, ... ) ...@@ -12038,10 +12041,8 @@ Jim_fprintf( Jim_Interp *interp, void *cookie, const char *fmt, ... )
va_end(ap); va_end(ap);
return r; return r;
} }
int int Jim_vfprintf( Jim_Interp *interp, void *cookie, const char *fmt, va_list ap )
Jim_vfprintf( Jim_Interp *interp, void *cookie, const char *fmt, va_list ap )
{ {
if( (interp == NULL) || (interp->cb_vfprintf == NULL) ){ if( (interp == NULL) || (interp->cb_vfprintf == NULL) ){
errno = ENOTSUP; errno = ENOTSUP;
...@@ -12050,8 +12051,7 @@ Jim_vfprintf( Jim_Interp *interp, void *cookie, const char *fmt, va_list ap ) ...@@ -12050,8 +12051,7 @@ Jim_vfprintf( Jim_Interp *interp, void *cookie, const char *fmt, va_list ap )
return (*(interp->cb_vfprintf))( cookie, fmt, ap ); return (*(interp->cb_vfprintf))( cookie, fmt, ap );
} }
size_t size_t Jim_fwrite( Jim_Interp *interp, const void *ptr, size_t size, size_t n, void *cookie )
Jim_fwrite( Jim_Interp *interp, const void *ptr, size_t size, size_t n, void *cookie )
{ {
if( (interp == NULL) || (interp->cb_fwrite == NULL) ){ if( (interp == NULL) || (interp->cb_fwrite == NULL) ){
errno = ENOTSUP; errno = ENOTSUP;
...@@ -12060,8 +12060,7 @@ Jim_fwrite( Jim_Interp *interp, const void *ptr, size_t size, size_t n, void *co ...@@ -12060,8 +12060,7 @@ Jim_fwrite( Jim_Interp *interp, const void *ptr, size_t size, size_t n, void *co
return (*(interp->cb_fwrite))( ptr, size, n, cookie); return (*(interp->cb_fwrite))( ptr, size, n, cookie);
} }
size_t size_t Jim_fread( Jim_Interp *interp, void *ptr, size_t size, size_t n, void *cookie )
Jim_fread( Jim_Interp *interp, void *ptr, size_t size, size_t n, void *cookie )
{ {
if( (interp == NULL) || (interp->cb_fread == NULL) ){ if( (interp == NULL) || (interp->cb_fread == NULL) ){
errno = ENOTSUP; errno = ENOTSUP;
...@@ -12070,8 +12069,7 @@ Jim_fread( Jim_Interp *interp, void *ptr, size_t size, size_t n, void *cookie ) ...@@ -12070,8 +12069,7 @@ Jim_fread( Jim_Interp *interp, void *ptr, size_t size, size_t n, void *cookie )
return (*(interp->cb_fread))( ptr, size, n, cookie); return (*(interp->cb_fread))( ptr, size, n, cookie);
} }
int int Jim_fflush( Jim_Interp *interp, void *cookie )
Jim_fflush( Jim_Interp *interp, void *cookie )
{ {
if( (interp == NULL) || (interp->cb_fflush == NULL) ){ if( (interp == NULL) || (interp->cb_fflush == NULL) ){
/* pretend all is well */ /* pretend all is well */
...@@ -12080,8 +12078,7 @@ Jim_fflush( Jim_Interp *interp, void *cookie ) ...@@ -12080,8 +12078,7 @@ Jim_fflush( Jim_Interp *interp, void *cookie )
return (*(interp->cb_fflush))( cookie ); return (*(interp->cb_fflush))( cookie );
} }
char * char* Jim_fgets( Jim_Interp *interp, char *s, int size, void *cookie )
Jim_fgets( Jim_Interp *interp, char *s, int size, void *cookie )
{ {
if( (interp == NULL) || (interp->cb_fgets == NULL) ){ if( (interp == NULL) || (interp->cb_fgets == NULL) ){
errno = ENOTSUP; errno = ENOTSUP;
...@@ -12089,16 +12086,3 @@ Jim_fgets( Jim_Interp *interp, char *s, int size, void *cookie ) ...@@ -12089,16 +12086,3 @@ Jim_fgets( Jim_Interp *interp, char *s, int size, void *cookie )
} }
return (*(interp->cb_fgets))( s, size, cookie ); return (*(interp->cb_fgets))( s, size, cookie );
} }
/*
* Local Variables: **
* tab-width: 4 **
* c-basic-offset: 4 **
* End: **
*/
...@@ -983,11 +983,3 @@ static void Jim_InitEmbedded(void) { ...@@ -983,11 +983,3 @@ static void Jim_InitEmbedded(void) {
#endif #endif
#endif /* __JIM__H */ #endif /* __JIM__H */
/*
* Local Variables: **
* tab-width: 4 **
* c-basic-offset: 4 **
* End: **
*/
/*************************************************************************** /***************************************************************************
* Copyright (C) 2005 by Dominic Rath * * Copyright (C) 2005 by Dominic Rath *
* Dominic.Rath@gmx.de * * Dominic.Rath@gmx.de *
* * * *
* This program is free software; you can redistribute it and/or modify * * 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 * * it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or * * the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. * * (at your option) any later version. *
* * * *
* This program is distributed in the hope that it will be useful, * * This program is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of * * but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU General Public License for more details. * * GNU General Public License for more details. *
* * * *
* You should have received a copy of the GNU General Public License * * You should have received a copy of the GNU General Public License *
* along with this program; if not, write to the * * along with this program; if not, write to the *
* Free Software Foundation, Inc., * * Free Software Foundation, Inc., *
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
***************************************************************************/ ***************************************************************************/
/* implementations of OpenOCD that uses multithreading needs to lock OpenOCD while calling /* implementations of OpenOCD that uses multithreading needs to lock OpenOCD while calling
* OpenOCD fn's. No-op in vanilla OpenOCD * OpenOCD fn's. No-op in vanilla OpenOCD
*/ */
void lockBigLock() void lockBigLock()
{ {
} }
void unlockBigLock() void unlockBigLock()
{ {
} }
/* /*
This is the main entry for developer PC hosted OpenOCD. This is the main entry for developer PC hosted OpenOCD.
OpenOCD can also be used as a library that is linked with OpenOCD can also be used as a library that is linked with
another application(not mainstream yet, but possible), e.g. another application(not mainstream yet, but possible), e.g.
w/as an embedded application. w/as an embedded application.
Those applications will have their own main() implementation Those applications will have their own main() implementation
and use bits and pieces from openocd.c. and use bits and pieces from openocd.c.
*/ */
extern int openocd_main(int argc, char *argv[]); extern int openocd_main(int argc, char *argv[]);
int main(int argc, char *argv[]) int main(int argc, char *argv[])
{ {
return openocd_main(argc, argv); return openocd_main(argc, argv);
} }
...@@ -50,6 +50,12 @@ ...@@ -50,6 +50,12 @@
#include <unistd.h> #include <unistd.h>
#include <errno.h> #include <errno.h>
#ifdef _WIN32
#include <malloc.h>
#else
#include <alloca.h>
#endif
#ifdef __ECOS #ifdef __ECOS
/* Jim is provied by eCos */ /* Jim is provied by eCos */
#include <cyg/jimtcl/jim.h> #include <cyg/jimtcl/jim.h>
...@@ -58,8 +64,7 @@ ...@@ -58,8 +64,7 @@
#include "jim.h" #include "jim.h"
#endif #endif
#include "replacements.h"
int launchTarget(struct command_context_s *cmd_ctx) int launchTarget(struct command_context_s *cmd_ctx)
{ {
...@@ -113,7 +118,6 @@ int handle_daemon_startup_command(struct command_context_s *cmd_ctx, char *cmd, ...@@ -113,7 +118,6 @@ int handle_daemon_startup_command(struct command_context_s *cmd_ctx, char *cmd,
return ERROR_OK; return ERROR_OK;
} }
void exit_handler(void) void exit_handler(void)
{ {
/* close JTAG interface */ /* close JTAG interface */
...@@ -121,7 +125,6 @@ void exit_handler(void) ...@@ -121,7 +125,6 @@ void exit_handler(void)
jtag->quit(); jtag->quit();
} }
/* OpenOCD can't really handle failure of this command. Patches welcome! :-) */ /* OpenOCD can't really handle failure of this command. Patches welcome! :-) */
int handle_init_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc) int handle_init_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc)
{ {
...@@ -135,7 +138,6 @@ int handle_init_command(struct command_context_s *cmd_ctx, char *cmd, char **arg ...@@ -135,7 +138,6 @@ int handle_init_command(struct command_context_s *cmd_ctx, char *cmd, char **arg
command_set_output_handler(cmd_ctx, configuration_output_handler, NULL); command_set_output_handler(cmd_ctx, configuration_output_handler, NULL);
atexit(exit_handler); atexit(exit_handler);
if (target_init(cmd_ctx) != ERROR_OK) if (target_init(cmd_ctx) != ERROR_OK)
return ERROR_FAIL; return ERROR_FAIL;
...@@ -159,7 +161,6 @@ int handle_init_command(struct command_context_s *cmd_ctx, char *cmd, char **arg ...@@ -159,7 +161,6 @@ int handle_init_command(struct command_context_s *cmd_ctx, char *cmd, char **arg
LOG_DEBUG("jtag examine complete"); LOG_DEBUG("jtag examine complete");
} }
} }
if (flash_init_drivers(cmd_ctx) != ERROR_OK) if (flash_init_drivers(cmd_ctx) != ERROR_OK)
return ERROR_FAIL; return ERROR_FAIL;
...@@ -184,28 +185,20 @@ int handle_init_command(struct command_context_s *cmd_ctx, char *cmd, char **arg ...@@ -184,28 +185,20 @@ int handle_init_command(struct command_context_s *cmd_ctx, char *cmd, char **arg
return ERROR_OK; return ERROR_OK;
} }
void lockBigLock(); void lockBigLock();
void unlockBigLock(); void unlockBigLock();
Jim_Interp *interp; Jim_Interp *interp;
command_context_t *active_cmd_ctx; command_context_t *active_cmd_ctx;
static int static int new_int_array_element(Jim_Interp * interp, const char *varname, int idx, u32 val)
new_int_array_element( Jim_Interp * interp,
const char *varname,
int idx,
u32 val )
{ {
char *namebuf; char *namebuf;
Jim_Obj *nameObjPtr, *valObjPtr; Jim_Obj *nameObjPtr, *valObjPtr;
int result; int result;
namebuf = alloc_printf("%s(%d)", varname, idx ); namebuf = alloc_printf("%s(%d)", varname, idx );
nameObjPtr = Jim_NewStringObj(interp, namebuf, -1); nameObjPtr = Jim_NewStringObj(interp, namebuf, -1);
valObjPtr = Jim_NewIntObj(interp, val ); valObjPtr = Jim_NewIntObj(interp, val );
Jim_IncrRefCount(nameObjPtr); Jim_IncrRefCount(nameObjPtr);
...@@ -218,8 +211,7 @@ new_int_array_element( Jim_Interp * interp, ...@@ -218,8 +211,7 @@ new_int_array_element( Jim_Interp * interp,
return result; return result;
} }
static int static int Jim_Command_mem2array(Jim_Interp *interp, int argc, Jim_Obj *const *argv)
Jim_Command_mem2array( Jim_Interp *interp, int argc, Jim_Obj *const *argv)
{ {
target_t *target; target_t *target;
long l; long l;
...@@ -232,7 +224,6 @@ Jim_Command_mem2array( Jim_Interp *interp, int argc, Jim_Obj *const *argv) ...@@ -232,7 +224,6 @@ Jim_Command_mem2array( Jim_Interp *interp, int argc, Jim_Obj *const *argv)
u8 buffer[4096]; u8 buffer[4096];
int i,n,e,retval; int i,n,e,retval;
/* argv[1] = name of array to receive the data /* argv[1] = name of array to receive the data
* argv[2] = desired width * argv[2] = desired width
* argv[3] = memory address * argv[3] = memory address
...@@ -245,7 +236,6 @@ Jim_Command_mem2array( Jim_Interp *interp, int argc, Jim_Obj *const *argv) ...@@ -245,7 +236,6 @@ Jim_Command_mem2array( Jim_Interp *interp, int argc, Jim_Obj *const *argv)
varname = Jim_GetString( argv[1], &len ); varname = Jim_GetString( argv[1], &len );
/* given "foo" get space for worse case "foo(%d)" .. add 20 */ /* given "foo" get space for worse case "foo(%d)" .. add 20 */
e = Jim_GetLong( interp, argv[2], &l ); e = Jim_GetLong( interp, argv[2], &l );
width = l; width = l;
if( e != JIM_OK ){ if( e != JIM_OK ){
...@@ -377,8 +367,7 @@ Jim_Command_mem2array( Jim_Interp *interp, int argc, Jim_Obj *const *argv) ...@@ -377,8 +367,7 @@ Jim_Command_mem2array( Jim_Interp *interp, int argc, Jim_Obj *const *argv)
return JIM_OK; return JIM_OK;
} }
static void tcl_output(void *privData, const char *file, int line, static void tcl_output(void *privData, const char *file, int line, const char *function, const char *string)
const char *function, const char *string)
{ {
Jim_Obj *tclOutput=(Jim_Obj *)privData; Jim_Obj *tclOutput=(Jim_Obj *)privData;
...@@ -451,11 +440,7 @@ int jim_command(command_context_t *context, char *line) ...@@ -451,11 +440,7 @@ int jim_command(command_context_t *context, char *line)
int startLoop=0; int startLoop=0;
static int static int Jim_Command_openocd_ignore(Jim_Interp *interp, int argc, Jim_Obj *const *argv, int ignore)
Jim_Command_openocd_ignore(Jim_Interp *interp,
int argc,
Jim_Obj *const *argv,
int ignore)
{ {
int retval; int retval;
char *cmd = (char*)Jim_GetString(argv[1], NULL); char *cmd = (char*)Jim_GetString(argv[1], NULL);
...@@ -485,30 +470,18 @@ Jim_Command_openocd_ignore(Jim_Interp *interp, ...@@ -485,30 +470,18 @@ Jim_Command_openocd_ignore(Jim_Interp *interp,
return (ignore||(retval==ERROR_OK))?JIM_OK:JIM_ERR; return (ignore||(retval==ERROR_OK))?JIM_OK:JIM_ERR;
} }
static int static int Jim_Command_openocd(Jim_Interp *interp, int argc, Jim_Obj *const *argv)
Jim_Command_openocd(Jim_Interp *interp,
int argc,
Jim_Obj *const *argv)
{ {
return Jim_Command_openocd_ignore(interp, argc, argv, 1); return Jim_Command_openocd_ignore(interp, argc, argv, 1);
} }
static int static int Jim_Command_openocd_throw(Jim_Interp *interp, int argc, Jim_Obj *const *argv)
Jim_Command_openocd_throw(Jim_Interp *interp,
int argc,
Jim_Obj *const *argv)
{ {
return Jim_Command_openocd_ignore(interp, argc, argv, 0); return Jim_Command_openocd_ignore(interp, argc, argv, 0);
} }
/* find full path to file */ /* find full path to file */
static int static int Jim_Command_find(Jim_Interp *interp, int argc, Jim_Obj *const *argv)
Jim_Command_find(Jim_Interp *interp,
int argc,
Jim_Obj *const *argv)
{ {
if (argc!=2) if (argc!=2)
return JIM_ERR; return JIM_ERR;
...@@ -523,10 +496,7 @@ Jim_Command_find(Jim_Interp *interp, ...@@ -523,10 +496,7 @@ Jim_Command_find(Jim_Interp *interp,
return JIM_OK; return JIM_OK;
} }
static int static int Jim_Command_echo(Jim_Interp *interp, int argc, Jim_Obj *const *argv)
Jim_Command_echo(Jim_Interp *interp,
int argc,
Jim_Obj *const *argv)
{ {
if (argc!=2) if (argc!=2)
return JIM_ERR; return JIM_ERR;
...@@ -535,10 +505,7 @@ Jim_Command_echo(Jim_Interp *interp, ...@@ -535,10 +505,7 @@ Jim_Command_echo(Jim_Interp *interp,
return JIM_OK; return JIM_OK;
} }
void command_output_text( command_context_t *context, const char *data ); static size_t openocd_jim_fwrite(const void *_ptr, size_t size, size_t n, void *cookie)
static size_t
openocd_jim_fwrite( const void *_ptr, size_t size, size_t n, void *cookie )
{ {
size_t nbytes; size_t nbytes;
const char *ptr; const char *ptr;
...@@ -556,7 +523,6 @@ openocd_jim_fwrite( const void *_ptr, size_t size, size_t n, void *cookie ) ...@@ -556,7 +523,6 @@ openocd_jim_fwrite( const void *_ptr, size_t size, size_t n, void *cookie )
return n; return n;
} }
/* do we have to chunk it? */ /* do we have to chunk it? */
if( ptr[ nbytes ] == 0 ){ if( ptr[ nbytes ] == 0 ){
/* no it is a C style string */ /* no it is a C style string */
...@@ -585,16 +551,13 @@ openocd_jim_fwrite( const void *_ptr, size_t size, size_t n, void *cookie ) ...@@ -585,16 +551,13 @@ openocd_jim_fwrite( const void *_ptr, size_t size, size_t n, void *cookie )
return n; return n;
} }
static size_t static size_t openocd_jim_fread(void *ptr, size_t size, size_t n, void *cookie )
openocd_jim_fread(void *ptr, size_t size, size_t n, void *cookie )
{ {
/* TCL wants to read... tell him no */ /* TCL wants to read... tell him no */
return 0; return 0;
} }