Change-Id: Iff7943eb9da3f41dcc45492acd0f36cf63b3497f Signed-off-by: Øyvind Harboe <oyvind.harboe@zylin.com> Reviewed-on: http://openocd.zylin.com/503 Reviewed-by: Øyvind Harboe <oyvindharboe@gmail.com> Tested-by: jenkinstags/v0.6.0-rc1
@@ -249,7 +249,6 @@ options may be available there: | |||
--enable-ep93xx Enable building support for EP93xx based SBCs | |||
--enable-at91rm9200 Enable building support for AT91RM9200 based SBCs | |||
--enable-ecosboard Enable building support for eCos based JTAG debugger | |||
--enable-zy1000 Enable ZY1000 interface | |||
--enable-minidriver-dummy | |||
@@ -396,10 +396,6 @@ AC_ARG_ENABLE([amtjtagaccel], | |||
AS_HELP_STRING([--enable-amtjtagaccel], [Enable building the Amontec JTAG-Accelerator driver]), | |||
[build_amtjtagaccel=$enableval], [build_amtjtagaccel=no]) | |||
AC_ARG_ENABLE([ecosboard], | |||
AS_HELP_STRING([--enable-ecosboard], [Enable building support for eCos based JTAG debugger]), | |||
[build_ecosboard=$enableval], [build_ecosboard=no]) | |||
AC_ARG_ENABLE([zy1000_master], | |||
AS_HELP_STRING([--enable-zy1000-master], [Use ZY1000 JTAG master registers]), | |||
[build_zy1000_master=$enableval], [build_zy1000_master=no]) | |||
@@ -632,12 +628,6 @@ else | |||
AC_DEFINE([BUILD_EP93XX], [0], [0 if you don't want ep93xx.]) | |||
fi | |||
if test $build_ecosboard = yes; then | |||
AC_DEFINE([BUILD_ECOSBOARD], [1], [1 if you want eCosBoard.]) | |||
else | |||
AC_DEFINE([BUILD_ECOSBOARD], [0], [0 if you don't want eCosBoard.]) | |||
fi | |||
if test $build_zy1000 = yes; then | |||
AC_DEFINE([BUILD_ZY1000], [1], [1 if you want ZY1000.]) | |||
else | |||
@@ -1104,7 +1094,6 @@ AM_CONDITIONAL([PARPORT], [test $build_parport = yes]) | |||
AM_CONDITIONAL([DUMMY], [test $build_dummy = yes]) | |||
AM_CONDITIONAL([GIVEIO], [test x$parport_use_giveio = xyes]) | |||
AM_CONDITIONAL([EP93XX], [test $build_ep93xx = yes]) | |||
AM_CONDITIONAL([ECOSBOARD], [test $build_ecosboard = yes]) | |||
AM_CONDITIONAL([ZY1000], [test $build_zy1000 = yes]) | |||
AM_CONDITIONAL([ZY1000_MASTER], [test $build_zy1000_master = yes]) | |||
AM_CONDITIONAL([IOUTIL], [test $build_ioutil = yes]) | |||
@@ -15,11 +15,7 @@ SUBDIRS = \ | |||
lib_LTLIBRARIES = libopenocd.la | |||
bin_PROGRAMS = openocd | |||
if ECOSBOARD | |||
MAINFILE = ecosboard.c | |||
else | |||
MAINFILE = main.c | |||
endif | |||
openocd_SOURCES = $(MAINFILE) | |||
openocd_LDADD = libopenocd.la | |||
@@ -3,13 +3,7 @@ include $(top_srcdir)/common.mk | |||
METASOURCES = AUTO | |||
noinst_LTLIBRARIES = libhelper.la | |||
if ECOSBOARD | |||
CONFIGFILES = time_support_ecos.c | |||
else | |||
CONFIGFILES = options.c time_support_common.c | |||
endif | |||
libhelper_la_SOURCES = \ | |||
binarybuffer.c \ | |||
@@ -31,10 +31,8 @@ | |||
#include "config.h" | |||
#endif | |||
#if !BUILD_ECOSBOARD | |||
/* see Embedder-HOWTO.txt in Jim Tcl project hosted on BerliOS*/ | |||
#define JIM_EMBEDDED | |||
#endif | |||
/* @todo the inclusion of target.h here is a layering violation */ | |||
#include <jtag/jtag.h> | |||
@@ -1280,7 +1278,6 @@ struct command_context *command_init(const char *startup_tcl, Jim_Interp *interp | |||
context->output_handler = NULL; | |||
context->output_handler_priv = NULL; | |||
#if !BUILD_ECOSBOARD | |||
/* Create a jim interpreter if we were not handed one */ | |||
if (interp == NULL) { | |||
/* Create an interpreter */ | |||
@@ -1289,7 +1286,7 @@ struct command_context *command_init(const char *startup_tcl, Jim_Interp *interp | |||
Jim_RegisterCoreCommands(interp); | |||
Jim_InitStaticExtensions(interp); | |||
} | |||
#endif | |||
context->interp = interp; | |||
/* Stick to lowercase for HostOS strings. */ | |||
@@ -1349,7 +1346,6 @@ int command_context_mode(struct command_context *cmd_ctx, enum command_mode mode | |||
void process_jim_events(struct command_context *cmd_ctx) | |||
{ | |||
#if !BUILD_ECOSBOARD | |||
static int recursion; | |||
if (recursion) | |||
return; | |||
@@ -1357,7 +1353,6 @@ void process_jim_events(struct command_context *cmd_ctx) | |||
recursion++; | |||
Jim_ProcessEvents(cmd_ctx->interp, JIM_ALL_EVENTS | JIM_DONT_WAIT); | |||
recursion--; | |||
#endif | |||
} | |||
#define DEFINE_PARSE_NUM_TYPE(name, type, func, min, max) \ | |||
@@ -26,12 +26,6 @@ | |||
#include <helper/types.h> | |||
/* Integrate the JIM TCL interpretor into the command processing. */ | |||
#if BUILD_ECOSBOARD | |||
#include <stdio.h> | |||
#include <stdarg.h> | |||
#endif | |||
#include <jim.h> | |||
#include <jim-nvp.h> | |||
@@ -48,10 +48,8 @@ | |||
#include <ifaddrs.h> | |||
#endif | |||
#ifdef HAVE_MALLOC_H | |||
#if !BUILD_ECOSBOARD | |||
#include <malloc.h> | |||
#endif | |||
#endif | |||
/* loads a file and returns a pointer to it in memory. The file contains | |||
* a 0 byte(sentinel) after len bytes - the length of the file. */ | |||
@@ -128,12 +128,8 @@ static inline unsigned usleep(unsigned int usecs) | |||
return 0; | |||
} | |||
#else | |||
#if BUILD_ECOSBOARD | |||
void usleep(int us); | |||
#else | |||
#error no usleep defined for your platform | |||
#endif | |||
#endif | |||
#endif /* HAVE_USLEEP */ | |||
/* Windows specific */ | |||
@@ -45,9 +45,6 @@ | |||
/* --- AC_HEADER_TIME --- */ | |||
/* +++ platform specific headers +++ */ | |||
#if BUILD_ECOSBOARD == 1 | |||
#include <pkgconf/system.h> | |||
#endif | |||
#ifdef _WIN32 | |||
#include <winsock2.h> | |||
#include <ws2tcpip.h> | |||
@@ -1,44 +0,0 @@ | |||
/*************************************************************************** | |||
* Copyright (C) 2006 by Dominic Rath * | |||
* Dominic.Rath@gmx.de * | |||
* * | |||
* Copyright (C) 2007,2008 Øyvind Harboe * | |||
* oyvind.harboe@zylin.com * | |||
* * | |||
* Copyright (C) 2008 by Spencer Oliver * | |||
* spen@spen-soft.co.uk * | |||
* * | |||
* 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 "time_support.h" | |||
#include <cyg/kernel/kapi.h> | |||
int64_t timeval_ms() | |||
{ | |||
/* Faster/less noisy implementation of getting ms when | |||
* profiling | |||
*/ | |||
static const int ms_per_tick = | |||
(CYGNUM_HAL_RTC_NUMERATOR / CYGNUM_HAL_RTC_DENOMINATOR) / 1000000; | |||
cyg_tick_count_t cur_time = cyg_current_time(); | |||
return ((int)cur_time) * ms_per_tick; | |||
} |
@@ -23,17 +23,10 @@ | |||
#if BUILD_ZY1000_MASTER | |||
#if BUILD_ECOSBOARD | |||
#include <cyg/hal/hal_io.h> /* low level i/o */ | |||
#include <cyg/hal/hal_intr.h> /* low level i/o */ | |||
#define ZY1000_PEEK(a, b) HAL_READ_UINT32(a, b) | |||
#define ZY1000_POKE(a, b) HAL_WRITE_UINT32(a, b) | |||
#else | |||
#define ZY1000_PEEK(a, b) do {b = *((volatile uint32_t *)(a)); } while (0) | |||
#define ZY1000_POKE(a, b) do {*((volatile uint32_t *)(a)) = b; } while (0) | |||
extern volatile void *zy1000_jtag_master; | |||
#define ZY1000_JTAG_BASE ((unsigned long)zy1000_jtag_master) | |||
#endif | |||
#else | |||
@@ -55,30 +55,8 @@ | |||
#include <netinet/tcp.h> | |||
#if BUILD_ECOSBOARD | |||
#include "zy1000_version.h" | |||
#include <cyg/hal/hal_io.h> /* low level i/o */ | |||
#include <cyg/hal/hal_diag.h> | |||
#ifdef CYGPKG_HAL_NIOS2 | |||
#include <cyg/hal/io.h> | |||
#include <cyg/firmwareutil/firmwareutil.h> | |||
#define ZYLIN_KHZ 60000 | |||
#else | |||
#define ZYLIN_KHZ 64000 | |||
#endif | |||
#define ZYLIN_VERSION GIT_ZY1000_VERSION | |||
#define ZYLIN_DATE __DATE__ | |||
#define ZYLIN_TIME __TIME__ | |||
#define ZYLIN_OPENOCD GIT_OPENOCD_VERSION | |||
#define ZYLIN_OPENOCD_VERSION "ZY1000 " ZYLIN_VERSION " " ZYLIN_DATE | |||
#else | |||
/* Assume we're connecting to a revc w/60MHz clock. */ | |||
#define ZYLIN_KHZ 60000 | |||
#endif | |||
/* The software needs to check if it's in RCLK mode or not */ | |||
static bool zy1000_rclk; | |||
@@ -312,111 +290,6 @@ static int jim_zy1000_server(Jim_Interp *interp, int argc, Jim_Obj * const *argv | |||
} | |||
#endif | |||
#if BUILD_ECOSBOARD | |||
/* Give TELNET a way to find out what version this is */ | |||
static int jim_zy1000_version(Jim_Interp *interp, int argc, Jim_Obj * const *argv) | |||
{ | |||
if ((argc < 1) || (argc > 3)) | |||
return JIM_ERR; | |||
const char *version_str = NULL; | |||
if (argc == 1) | |||
version_str = ZYLIN_OPENOCD_VERSION; | |||
else { | |||
const char *str = Jim_GetString(argv[1], NULL); | |||
const char *str2 = NULL; | |||
if (argc > 2) | |||
str2 = Jim_GetString(argv[2], NULL); | |||
if (strcmp("openocd", str) == 0) | |||
version_str = ZYLIN_OPENOCD; | |||
else if (strcmp("zy1000", str) == 0) | |||
version_str = ZYLIN_VERSION; | |||
else if (strcmp("date", str) == 0) | |||
version_str = ZYLIN_DATE; | |||
else if (strcmp("time", str) == 0) | |||
version_str = ZYLIN_TIME; | |||
else if (strcmp("pcb", str) == 0) { | |||
#ifdef CYGPKG_HAL_NIOS2 | |||
version_str = "c"; | |||
#else | |||
version_str = "b"; | |||
#endif | |||
} | |||
#ifdef CYGPKG_HAL_NIOS2 | |||
else if (strcmp("fpga", str) == 0) { | |||
/* return a list of 32 bit integers to describe the expected | |||
* and actual FPGA | |||
*/ | |||
static char *fpga_id = "0x12345678 0x12345678 0x12345678 0x12345678"; | |||
uint32_t id, timestamp; | |||
HAL_READ_UINT32(SYSID_BASE, id); | |||
HAL_READ_UINT32(SYSID_BASE+4, timestamp); | |||
sprintf(fpga_id, | |||
"0x%08x 0x%08x 0x%08x 0x%08x", | |||
id, | |||
timestamp, | |||
SYSID_ID, | |||
SYSID_TIMESTAMP); | |||
version_str = fpga_id; | |||
if ((argc > 2) && (strcmp("time", str2) == 0)) { | |||
time_t last_mod = timestamp; | |||
char *t = ctime(&last_mod); | |||
t[strlen(t)-1] = 0; | |||
version_str = t; | |||
} | |||
} | |||
#endif | |||
else | |||
return JIM_ERR; | |||
} | |||
Jim_SetResult(interp, Jim_NewStringObj(interp, version_str, -1)); | |||
return JIM_OK; | |||
} | |||
#endif | |||
#ifdef CYGPKG_HAL_NIOS2 | |||
struct info_forward { | |||
void *data; | |||
struct cyg_upgrade_info *upgraded_file; | |||
}; | |||
static void report_info(void *data, const char *format, va_list args) | |||
{ | |||
char *s = alloc_vprintf(format, args); | |||
LOG_USER_N("%s", s); | |||
free(s); | |||
} | |||
struct cyg_upgrade_info firmware_info = { | |||
(uint8_t *)0x84000000, | |||
"/ram/firmware.phi", | |||
"Firmware", | |||
0x0300000, | |||
0x1f00000 - | |||
0x0300000, | |||
"ZylinNiosFirmware\n", | |||
report_info, | |||
}; | |||
/* File written to /ram/firmware.phi before arriving at this fn */ | |||
static int jim_zy1000_writefirmware(Jim_Interp *interp, int argc, Jim_Obj * const *argv) | |||
{ | |||
if (argc != 1) | |||
return JIM_ERR; | |||
if (!cyg_firmware_upgrade(NULL, firmware_info)) | |||
return JIM_ERR; | |||
return JIM_OK; | |||
} | |||
#endif | |||
static int zylinjtag_Jim_Command_powerstatus(Jim_Interp *interp, | |||
int argc, | |||
Jim_Obj * const *argv) | |||
@@ -918,17 +791,7 @@ static const struct command_registration zy1000_commands[] = { | |||
"With no arguments, prints status.", | |||
.usage = "('on'|'off)", | |||
}, | |||
#if BUILD_ZY1000_MASTER | |||
#if BUILD_ECOSBOARD | |||
{ | |||
.name = "zy1000_version", | |||
.mode = COMMAND_ANY, | |||
.jim_handler = jim_zy1000_version, | |||
.help = "Print version info for zy1000.", | |||
.usage = "['openocd'|'zy1000'|'date'|'time'|'pcb'|'fpga']", | |||
}, | |||
#endif | |||
#else | |||
#if !BUILD_ZY1000_MASTER | |||
{ | |||
.name = "zy1000_server", | |||
.mode = COMMAND_ANY, | |||
@@ -943,15 +806,6 @@ static const struct command_registration zy1000_commands[] = { | |||
.jim_handler = zylinjtag_Jim_Command_powerstatus, | |||
.help = "Returns power status of target", | |||
}, | |||
#ifdef CYGPKG_HAL_NIOS2 | |||
{ | |||
.name = "updatezy1000firmware", | |||
.mode = COMMAND_ANY, | |||
.jim_handler = jim_zy1000_writefirmware, | |||
.help = "writes firmware to flash", | |||
/* .usage = "some_string", */ | |||
}, | |||
#endif | |||
COMMAND_REGISTRATION_DONE | |||
}; | |||
@@ -1269,12 +1123,6 @@ static void writeShiftValue(uint8_t *data, int bits) | |||
#if BUILD_ZY1000_MASTER | |||
#if BUILD_ECOSBOARD | |||
static char watchdog_stack[2048]; | |||
static cyg_thread watchdog_thread_object; | |||
static cyg_handle_t watchdog_thread_handle; | |||
#endif | |||
#ifdef WATCHDOG_BASE | |||
/* If we connect to port 8888 we must send a char every 10s or the board resets itself */ | |||
static void watchdog_server(cyg_addrword_t data) | |||
@@ -1359,16 +1207,14 @@ int interface_jtag_add_sleep(uint32_t us) | |||
} | |||
#endif | |||
#if BUILD_ZY1000_MASTER && !BUILD_ECOSBOARD | |||
#if BUILD_ZY1000_MASTER | |||
volatile void *zy1000_jtag_master; | |||
#include <sys/mman.h> | |||
#endif | |||
int zy1000_init(void) | |||
{ | |||
#if BUILD_ECOSBOARD | |||
LOG_USER("%s", ZYLIN_OPENOCD_VERSION); | |||
#elif BUILD_ZY1000_MASTER | |||
#if BUILD_ZY1000_MASTER | |||
int fd = open("/dev/mem", O_RDWR | O_SYNC); | |||
if (fd == -1) { | |||
LOG_ERROR("No access to /dev/mem"); | |||
@@ -1400,17 +1246,6 @@ int zy1000_init(void) | |||
/* deassert resets. Important to avoid infinite loop waiting for SRST to deassert */ | |||
zy1000_reset(0, 0); | |||
#if BUILD_ZY1000_MASTER | |||
#if BUILD_ECOSBOARD | |||
#ifdef WATCHDOG_BASE | |||
cyg_thread_create(1, watchdog_server, (cyg_addrword_t) 0, "watchdog tcip/ip server", | |||
(void *) watchdog_stack, sizeof(watchdog_stack), | |||
&watchdog_thread_handle, &watchdog_thread_object); | |||
cyg_thread_resume(watchdog_thread_handle); | |||
#endif | |||
#endif | |||
#endif | |||
return ERROR_OK; | |||
} | |||
@@ -5,9 +5,7 @@ noinst_LTLIBRARIES = libserver.la | |||
noinst_HEADERS = server.h telnet_server.h gdb_server.h | |||
libserver_la_SOURCES = server.c telnet_server.c gdb_server.c | |||
if !ECOSBOARD | |||
libserver_la_SOURCES += server_stubs.c | |||
endif | |||
libserver_la_CFLAGS = | |||
if IS_MINGW | |||
@@ -87,11 +87,11 @@ int connection_write(struct connection *connection, const void *data, int len); | |||
int connection_read(struct connection *connection, void *data, int len); | |||
/** | |||
* Used by server_loop(), defined in server_stubs.c or ecosboard.c | |||
* Used by server_loop(), defined in server_stubs.c | |||
*/ | |||
void openocd_sleep_prelude(void); | |||
/** | |||
* Used by server_loop(), defined in server_stubs.c or ecosboard.c | |||
* Used by server_loop(), defined in server_stubs.c | |||
*/ | |||
void openocd_sleep_postlude(void); | |||