X-Git-Url: https://review.openocd.org/gitweb?a=blobdiff_plain;f=src%2Fecosboard.c;h=2e73585d0bedfb7f591118961ef80fd5df767182;hb=ff5deeeeaa4f394931e3c5ccfb4cfd33beda0743;hp=36e807ef79e417f4d743c861d3760550b2dc7a8e;hpb=445da543d8db868466dcef7e23f75b3c2b54bc72;p=openocd.git diff --git a/src/ecosboard.c b/src/ecosboard.c index 36e807ef79..2e73585d0b 100644 --- a/src/ecosboard.c +++ b/src/ecosboard.c @@ -21,20 +21,18 @@ #include "config.h" #endif -#include "types.h" -#include "jtag.h" -#include "configuration.h" -#include "xsvf.h" -#include "svf.h" -#include "nand.h" -#include "pld.h" - -#include "server.h" -#include "telnet_server.h" -#include "gdb_server.h" -#include "openocd.h" - -#include +#include +#include +#include +#include + +#include +#include +#include +#include + +#include + #include #include #include @@ -56,33 +54,15 @@ #include #include #include -#include -#include -#include #include +#include #include -#include "rom.h" -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include -#include +#include -#include +#include "rom.h" #ifdef CYGPKG_HAL_NIOS2 +#include #define ZY1000_SER_DEV "/dev/uart_0" #else #define ZY1000_SER_DEV "/dev/ser0" @@ -166,7 +146,14 @@ static void zylinjtag_reboot(cyg_addrword_t data) diag_printf("Unmounting /config..\n"); umount("/config"); diag_printf("Rebooting..\n"); +#ifdef CYGPKG_HAL_NIOS2 + /* This will reboot & reconfigure the FPGA from the bootloader + * and on. + */ + IOWR(REMOTE_UPDATE_BASE, 0x20, 0x1); +#else HAL_PLATFORM_RESET(); +#endif } static cyg_thread zylinjtag_thread_object; static cyg_handle_t zylinjtag_thread_handle; @@ -252,11 +239,21 @@ int zy1000_configuration_output_handler_log(struct command_context *context, } #ifdef CYGPKG_PROFILE_GPROF +//extern int64_t totaltime; -int eCosBoard_handle_eCosBoard_profile_command(struct command_context *cmd_ctx, char *cmd, char **args, int argc) +static int zylinjtag_Jim_Command_profile(Jim_Interp *interp, int argc, + Jim_Obj * const *argv) { - command_print(cmd_ctx, "Profiling started"); - start_profile(); + if ((argc == 2) && (strcmp(Jim_GetString(argv[1], NULL), "stats")==0)) + { +// profile_off(); + //LOG_USER("Stats %dms sleeping in select()", (int)totaltime); + } else + { + LOG_USER("Profiling started"); + start_profile(); + //totaltime = 0; + } return ERROR_OK; } @@ -942,8 +939,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 @@ -961,7 +956,11 @@ int main(int argc, char *argv[]) diag_init_putc(_zylinjtag_diag_write_char); // We want this in the log. - diag_printf("Zylin ZY1000.\n"); +#ifdef CYGPKG_HAL_NIOS2 + diag_printf("Zylin ZY1000 PCB revc.\n"); +#else + diag_printf("Zylin ZY1000 PCB revb.\n"); +#endif err = mount("", "/ram", "ramfs"); if (err < 0) @@ -1000,6 +999,20 @@ int main(int argc, char *argv[]) copydir("/rom", "/ram/cgi"); +#ifdef CYGPKG_HAL_NIOS2 + cyg_flashaddr_t err_address; +#define UNCACHED_EXT_FLASH_BASE (0x80000000 + EXT_FLASH_BASE) + /* The revc flash is locked upon reset, unlock it */ +#ifdef CYGHWR_IO_FLASH_BLOCK_LOCKING + if ((err = flash_unlock((void *) UNCACHED_EXT_FLASH_BASE, EXT_FLASH_SPAN, + (void **) &err_address)) != 0) + { + diag_printf("Error: could not unlock flash\n"); + } +#endif +#endif + + err = mount("/dev/flash1", "/config", "jffs2"); if (err < 0) { @@ -1080,20 +1093,15 @@ 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, - COMMAND_ANY, NULL); + Jim_CreateCommand(httpstate.jim_interp, "zy1000_profile", zylinjtag_Jim_Command_profile, + NULL, NULL); #endif - Jim_CreateCommand(httpstate.jim_interp, "uart", zylinjtag_Jim_Command_uart, NULL, NULL); + Jim_CreateCommand(httpstate.jim_interp, "zy1000_uart", zylinjtag_Jim_Command_uart, NULL, NULL); log_init(); @@ -1113,6 +1121,11 @@ int main(int argc, char *argv[]) command_run_linef(cmd_ctx, "script /rom/openocd.cfg"); + int ret; + ret = server_init(cmd_ctx); + if (ERROR_OK != ret) + return EXIT_FAILURE; + /* we MUST always run the init command as it will launch telnet sessions */ command_run_line(cmd_ctx, "init");