OpenCores
URL https://opencores.org/ocsvn/or1k/or1k/trunk

Subversion Repositories or1k

[/] [or1k/] [trunk/] [gdb-5.0/] [gdb/] [remote-or1k.c] - Blame information for rev 115

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 106 markom
/* Remote debugging interface for various or1k debugging protocols.
2
   Copyright 1993-1995, 2000 Free Software Foundation, Inc.
3
   Contributed by Cygnus Support.  Written by Marko Mlinar
4
   <markom@opencores.org>
5
 
6
   This file is part of GDB.
7
 
8
   This program is free software; you can redistribute it and/or modify
9
   it under the terms of the GNU General Public License as published by
10
   the Free Software Foundation; either version 2 of the License, or
11
   (at your option) any later version.
12
 
13
   This program is distributed in the hope that it will be useful,
14
   but WITHOUT ANY WARRANTY; without even the implied warranty of
15
   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
16
   GNU General Public License for more details.
17
 
18
   You should have received a copy of the GNU General Public License
19
   along with this program; if not, write to the Free Software
20
   Foundation, Inc., 59 Temple Place - Suite 330,
21
   Boston, MA 02111-1307, USA.  */
22
 
23
#include "defs.h"
24
#include "inferior.h"
25
#include "bfd.h"
26
#include "symfile.h"
27
#include "gdb_wait.h"
28
#include "gdbcmd.h"
29
#include "gdbcore.h"
30
#include "target.h"
31
#include "remote-utils.h"
32
#include "gdb_string.h"
33
#include "tm.h"
34
 
35
#include <signal.h>
36
#include <sys/types.h>
37
#include <sys/stat.h>
38
#include <sys/ioctl.h>
39
#include <fcntl.h>
40
 
41
extern void jtag_init PARAMS ((char * args));
42 113 markom
extern unsigned long long int jtag_read_reg PARAMS ((unsigned int regno));
43
extern void jtag_write_reg PARAMS ((unsigned int regno, unsigned long long int data));
44 106 markom
extern void jtag_done PARAMS ((void));
45 113 markom
extern void jtag_set_chain PARAMS ((int chain));
46 106 markom
struct target_ops or1k_jtag_ops;
47
static struct or1k_target_ops or1k_target_jtag =
48
  {
49
    "jtag",
50
    jtag_init,
51
    jtag_done,
52
    jtag_read_reg,
53
    jtag_write_reg,
54 113 markom
    jtag_set_chain,
55 106 markom
    NULL,
56
    &or1k_jtag_ops,
57
    OPS_MAGIC
58
  };
59
 
60
struct target_ops or1k_sim_ops;
61
static struct or1k_target_ops or1k_target_sim =
62
  {
63
    "simulator",
64
    NULL,
65
    NULL,
66
    NULL,
67
    NULL,
68
    NULL,
69
    NULL,
70
    &or1k_sim_ops,
71
    OPS_MAGIC
72
  };
73
 
74
struct target_ops or1k_dummy_ops;
75
static struct or1k_target_ops or1k_target_dummy =
76
  {
77
    "dummy",
78
    NULL,
79
    NULL,
80
    NULL,
81
    NULL,
82
    NULL,
83
    NULL,
84
    &or1k_dummy_ops,
85
    OPS_MAGIC
86
  };
87
 
88
const char *str_err[] =
89
  {
90
    "None", "CRC error"
91
  };
92
 
93
const char *status_name[] =
94
  {
95
    "UNDEFINED", "CONNECTING", "DISCONNECTING", "RUNNING", "STOPPED"
96
  };
97
 
98 113 markom
/* Names for matchpoint related stuff.  */
99
static char *ct_names[] =
100
  {
101
    "DIS", "IFEA", "LEA", "SEA", "AEA", "LDATA", "SDATA", "ADATA"
102
  };
103
 
104
static char *cc_names[] =
105
  {
106
    "&", "==", "<", "<=", ">", ">=", "!=", "ERR"
107
  };
108
 
109
static char *ch_names[] =
110
  {
111
    "ERR", "&", "|", "ERR"
112
  };
113
 
114 106 markom
/* Implementation specific information.  Set by or1k_initialize.  */
115
struct struct_or1k_implementation or1k_implementation;
116
 
117
/* Current target status.  */
118
static enum target_status or1k_status = TARGET_UNDEFINED;
119
 
120
/* The target vector.  */
121
struct target_ops or1k_dummy_ops, or1k_jtag_ops, or1k_sim_ops;
122
 
123
/* Currently active target description (if or1k_is_open == 1) */
124
static struct target_ops *current_ops;
125
 
126
/* Currently active or1k target operations.  */
127
static struct or1k_target_ops *current_or1k_target = NULL;
128
 
129
/* Set to 1 if the target is open.  */
130
static int or1k_is_open = 0;
131
 
132
/* Error last occured, zero = ok.  */
133
static int err = 0;
134
 
135
/* Number of interrupts while waiting for process.  */
136
static int interrupt_count = 0;
137
 
138 113 markom
/* Reason of last stop.  */
139
static int hit_watchpoint = 0;
140
 
141 106 markom
/* Current register values.  */
142
static unsigned int dmr1 = 0;
143
static unsigned int dmr2 = 0;
144
static unsigned int dsr = 0;
145
static unsigned int drr = 0;
146
 
147
/* Current watchpoints.  */
148
static int dvr[8];
149
static struct dcr_struct dcr[8];
150
 
151
/* Handle low-level error that we can't recover from.  Note that just
152
   error()ing out from target_wait or some such low-level place will cause
153
   all hell to break loose--the rest of GDB will tend to get left in an
154
   inconsistent state.  */
155
 
156
static NORETURN void
157
or1k_error (char *string,...)
158
{
159
  va_list args;
160
 
161
  va_start (args, string);
162
 
163
  target_terminal_ours ();
164
  wrap_here ("");               /* Force out any buffered output */
165
  gdb_flush (gdb_stdout);
166
  if (error_pre_print)
167
    fprintf_filtered (gdb_stderr, error_pre_print);
168
  vfprintf_filtered (gdb_stderr, string, args);
169
  fprintf_filtered (gdb_stderr, "\n");
170
  va_end (args);
171
  gdb_flush (gdb_stderr);
172
 
173
  /* Clean up in such a way that or1k_close won't try to talk to the
174
     board (it almost surely won't work since we weren't able to talk to
175
     it).  */
176
  or1k_is_open = 0;
177
 
178
  printf_unfiltered ("Ending remote or1k debugging.\n");
179
  target_mourn_inferior ();
180
 
181
  return_to_top_level (RETURN_ERROR);
182
}
183
 
184
const char *
185
or1k_err_name (e)
186
     int e;
187
{
188
  return str_err[e];
189
}
190
 
191
/* putc_readable - print a character, displaying non-printable chars in
192
   ^x notation or in hex.  */
193
 
194
static void
195
fputc_readable (ch, file)
196
     int ch;
197
     struct ui_file *file;
198
{
199
  if (ch == '\n')
200
    fputc_unfiltered ('\n', file);
201
  else if (ch == '\r')
202
    fprintf_unfiltered (file, "\\r");
203
  else if (ch < 0x20)           /* ASCII control character */
204
    fprintf_unfiltered (file, "^%c", ch + '@');
205
  else if (ch >= 0x7f)          /* non-ASCII characters (rubout or greater) */
206
    fprintf_unfiltered (file, "[%02x]", ch & 0xff);
207
  else
208
    fputc_unfiltered (ch, file);
209
}
210
 
211
 
212
/* puts_readable - print a string, displaying non-printable chars in
213
   ^x notation or in hex.  */
214
 
215
static void
216
fputs_readable (string, file)
217
     char *string;
218
     struct ui_file *file;
219
{
220
  int c;
221
 
222
  while ((c = *string++) != '\0')
223
    fputc_readable (c, file);
224
}
225
 
226 113 markom
/* Sets scan chain.  */
227
 
228
static void
229
or1k_set_chain (chain)
230
     int chain;
231
{
232
  if (current_or1k_target != NULL && current_or1k_target->to_set_chain != NULL)
233
    current_or1k_target->to_set_chain (chain);
234
}
235
 
236 106 markom
/* Sets register/memory regno to data.  */
237
 
238 113 markom
static void
239 106 markom
or1k_write_reg (regno, data)
240
     unsigned int regno;
241 113 markom
     unsigned long long int data;
242 106 markom
{
243 113 markom
  if (current_or1k_target != NULL && current_or1k_target->to_write_reg != NULL)
244
    current_or1k_target->to_write_reg (regno, data);
245 106 markom
}
246
 
247
/* Reads register/memory from regno.  */
248
 
249 113 markom
static unsigned long long int
250 106 markom
or1k_read_reg (regno)
251
     unsigned int regno;
252
{
253 113 markom
  if (current_or1k_target != NULL && current_or1k_target->to_read_reg != NULL)
254
    return current_or1k_target->to_read_reg (regno);
255 106 markom
  else
256
    return 0x1234;
257
}
258
 
259 113 markom
/* Sets SPR register regno to data.  */
260
 
261
void
262
or1k_write_spr_reg (regno, data)
263
     unsigned int regno;
264
     unsigned int data;
265
{
266
  or1k_set_chain (SC_RISC_DEBUG);
267
  or1k_write_reg (regno + REG_SPACE, data);
268
}
269
 
270
/* Reads register SPR from regno.  */
271
 
272
unsigned int
273
or1k_read_spr_reg (regno)
274
     unsigned int regno;
275
{
276
  or1k_set_chain (SC_RISC_DEBUG);
277
  return or1k_read_reg (regno + REG_SPACE);
278
}
279
 
280 106 markom
/* Stalls the CPU.  */
281
 
282
static void
283
or1k_stall ()
284
{
285 113 markom
  int val;
286
  or1k_set_chain (SC_REGISTER);
287
  val = or1k_read_reg (JTAG_RISCOP);
288
  or1k_write_reg (JTAG_RISCOP, val | 1);
289
  or1k_flush_pipeline ();
290 106 markom
}
291
 
292
/* Unstalls the CPU.  */
293
 
294
static void
295
or1k_unstall ()
296
{
297 113 markom
  unsigned int val;
298
  or1k_set_chain (SC_REGISTER);
299
  val = or1k_read_reg (JTAG_RISCOP);
300
  or1k_write_reg (JTAG_RISCOP, val & ~1);
301 106 markom
}
302
 
303 113 markom
/* Resets the CPU and stalls it.  */
304 106 markom
static void
305 113 markom
or1k_reset ()
306
{
307
  unsigned int val;
308
  or1k_set_chain (SC_REGISTER);
309
  val = or1k_read_reg (JTAG_RISCOP);
310
  val &= ~3;
311
  or1k_write_reg (JTAG_RISCOP, val | 3); /* Assert reset signal.  */
312
  usleep (1000);  /* give it some time */
313
  or1k_flush_pipeline ();
314
  or1k_write_reg (JTAG_RISCOP, val | 1); /* Release reset signal, but keep in stall state.  */
315
  or1k_flush_pipeline ();
316
}
317
 
318
static void
319 106 markom
or1k_set_undefined_cleanups (arg)
320
     PTR arg;
321
{
322
  or1k_status = TARGET_UNDEFINED;
323
}
324
 
325
/* Initialize a new connection to the or1k board, and make sure we are
326
   really connected.  */
327
 
328
static void
329
or1k_init (args)
330
     char *args;
331
{
332
  struct cleanup *old_cleanups = make_cleanup (or1k_set_undefined_cleanups, NULL);
333
  int i;
334 115 markom
  unsigned int tmp;
335 106 markom
 
336
  /* What is this code doing here?  I don't see any way it can happen, and
337
     it might mean or1k_initializing didn't get cleared properly.
338
     So I'll make it a warning.  */
339
 
340
  if (or1k_status == TARGET_CONNECTING)
341
    {
342
      warning ("internal error: or1k_initialize called twice");
343
      return;
344
    }
345
 
346
  or1k_status = TARGET_CONNECTING;
347 113 markom
  or1k_reset ();
348 106 markom
  if (current_or1k_target != NULL && current_or1k_target->to_init != NULL)
349
    current_or1k_target->to_init (args);
350
 
351
  /* Determine implementation configuration.  */
352 113 markom
  or1k_implementation.VR = or1k_read_spr_reg (VR_SPRNUM);
353
  or1k_implementation.UPR = or1k_read_spr_reg (UPR_SPRNUM);
354 115 markom
  /* Determine number of gpr_regs.  */
355
  tmp = or1k_read_spr_reg (CPUCFGR_SPRNUM);
356
  or1k_implementation.num_gpr_regs = ((tmp >> 4) & 1)?(16):(32);
357
  /* Is any vector or floating point support present? */
358
  or1k_implementation.vf_present = ((tmp >> 7) & 7) != 0;
359
  or1k_implementation.num_vfpr_regs = (or1k_implementation.vf_present)?(32):(0);
360 106 markom
 
361 115 markom
  /* Determine max number of supported matchpoints.  */
362
  tmp = or1k_read_spr_reg (DCFGR_SPRNUM);
363
  or1k_implementation.num_matchpoints = tmp & 7;
364 113 markom
  or1k_implementation.num_used_matchpoints = 0;
365 115 markom
  or1k_implementation.has_counters = tmp & 4 == 1;
366 106 markom
 
367
  /* Is implementation supported? */
368
 
369
  /* First we should have system and debug groups implemented. */
370
  if (or1k_implementation.VR & (1 << SPR_SYSTEM_GROUP) == 0)
371
    error ("System group should be available in the or1k implementation.");
372
  if (or1k_implementation.VR & (1 << SPR_DEBUG_GROUP) == 0)
373
    error ("Debug group should be available in the or1k implementation.");
374 115 markom
  if (or1k_implementation.has_counters)
375
    warning ("Counters not supported.");
376 106 markom
 
377
  /* Delete break, watch, catch points.  */
378
  for(i = 0; i < NUM_MATCHPOINTS; i++)
379 113 markom
    or1k_write_spr_reg (DCR0_SPRNUM + i, 0);
380 106 markom
 
381
  dmr1 = 0;
382 113 markom
  or1k_write_spr_reg (DMR1_SPRNUM, dmr1);
383 106 markom
  dmr2 = 0;
384 113 markom
  or1k_write_spr_reg (DMR2_SPRNUM, dmr2);
385 106 markom
  if (err != 0)
386
    error ("Cannot connect.");
387
 
388
  /* Stop when breakpoint occurs.  */
389 113 markom
  or1k_write_spr_reg (DSR_SPRNUM, 0x1000);
390 106 markom
 
391
  do_cleanups (old_cleanups);
392
 
393
  /* This should cause an error if not connected.  */
394
  or1k_fetch_registers (-1);
395
 
396
  set_current_frame (create_new_frame (read_fp (), read_pc ()));
397
  select_frame (get_current_frame (), 0);
398
}
399
 
400
/* Kill the process running on the board.  */
401
 
402
void
403
or1k_kill ()
404
{
405
  if (or1k_status != TARGET_RUNNING)
406
    return;
407
  or1k_status = TARGET_UNDEFINED;
408 113 markom
  or1k_reset();
409
  or1k_status = TARGET_STOPPED;
410 106 markom
 
411
  inferior_pid = 0;
412
}
413
 
414
/* Open a connection to the remote board.  */
415
 
416
static void
417
or1k_open (name, from_tty)
418
     char *name;
419
     int from_tty;
420
{
421
  or1k_init (name);
422
 
423
  /* Switch to using remote target now.  */
424
  current_ops = current_or1k_target->gdb_ops;
425
  or1k_is_open = 1;
426
  push_target (current_ops);
427
 
428
  /* FIXME: Should we call start_remote here?  */
429
 
430
/* This is really the job of start_remote however, that makes an assumption
431
   that the target is about to print out a status message of some sort.  That
432
   doesn't happen here (in fact, it may not be possible to get the monitor to
433
   send the appropriate packet).  */
434
 
435
  flush_cached_frames ();
436
  registers_changed ();
437
  stop_pc = read_pc ();
438
  set_current_frame (create_new_frame (read_fp (), stop_pc));
439
  select_frame (get_current_frame (), 0);
440
  print_stack_frame (selected_frame, -1, 1);
441
}
442
 
443
/* Close a connection to the remote board.  */
444
 
445
static void
446
or1k_close (quitting)
447
     int quitting;
448
{
449
  if (or1k_is_open)
450
    {
451
      or1k_kill ();
452
      if (current_or1k_target != NULL && current_or1k_target->to_done != NULL)
453
        current_or1k_target->to_done ();
454
      current_or1k_target = NULL;
455
    }
456
  generic_mourn_inferior ();
457
}
458
 
459
/* Detach from the remote board.  */
460
 
461
static void
462
or1k_detach (args, from_tty)
463
     char *args;
464
     int from_tty;
465
{
466
  if (args)
467
    error ("Argument given to \"detach\" when remotely debugging.");
468
 
469
  pop_target ();
470
 
471
  or1k_close (1);
472
 
473
  if (from_tty)
474
    printf_unfiltered ("Ending remote or1k debugging.\n");
475
}
476
 
477
/* Resume execution of the target process.  STEP says whether to single-step
478
   or to run free; SIGGNAL is the signal value (e.g. SIGINT) to be given
479
   to the target, or zero for no signal.  */
480
 
481
static void
482
or1k_resume (pid, step, siggnal)
483
     int pid, step;
484
     enum target_signal siggnal;
485
{
486
  if (or1k_status != TARGET_STOPPED)
487
    if (or1k_status == TARGET_RUNNING)
488
      error ("Program is already running.");
489
    else
490
      error ("The program is not being run.");
491
 
492
  /* Clear reason register for later.  */
493 113 markom
  or1k_write_spr_reg (DRR_SPRNUM, 0);
494 106 markom
 
495
  if (step)
496
    {
497
      /* HW STEP.  Set DMR1_ST.  */
498
      dmr1 |= DMR1_ST;
499 113 markom
      or1k_write_spr_reg (DMR1_SPRNUM, dmr1);
500 106 markom
      dmr1 &= ~DMR1_ST;
501
    }
502
 
503
  /* Run the target. */
504
  or1k_unstall ();
505
  or1k_status = TARGET_RUNNING;
506
}
507
 
508
/* Wait until the remote stops, and return a wait status.  */
509
 
510
static int
511
or1k_wait (pid, status)
512
     int pid;
513
     struct target_waitstatus *status;
514
{
515
  interrupt_count = 0;
516
 
517
  /* If we have not sent a single step or continue command, then the
518
     board is waiting for us to do something.  Return a status
519
     indicating that it is stopped.  */
520
  if (or1k_status != TARGET_RUNNING)
521
    {
522
      if (or1k_status != TARGET_STOPPED)
523
        error("Target in invalid state.");
524
      status->kind = TARGET_WAITKIND_STOPPED;
525
      status->value.sig = TARGET_SIGNAL_TRAP;
526
      return 0;
527
    }
528
 
529
  if (err)
530
    or1k_error ("Remote failure: %s", or1k_err_name (err));
531
 
532
  /* Wait for or1k DRR register to be nonzero.  */
533
  do
534
    {
535 113 markom
      drr = or1k_read_spr_reg (DRR_SPRNUM);
536 106 markom
      usleep (10);
537
    }
538
  while (drr == 0);
539
 
540
  status->kind = TARGET_WAITKIND_STOPPED;
541 113 markom
 
542
  or1k_flush_pipeline ();
543 106 markom
 
544
  if (drr & DRR_RSTE)
545
    status->value.sig = TARGET_SIGNAL_REALTIME_33;
546
  else if (drr & DRR_BUSEE)
547
    status->value.sig = TARGET_SIGNAL_BUS;
548
  else if (drr & DRR_DPFE)
549
    status->value.sig = TARGET_SIGNAL_REALTIME_34;
550
  else if (drr & DRR_IPFE)
551
    status->value.sig = TARGET_SIGNAL_REALTIME_35;
552
  else if (drr & DRR_LPINTE)
553
    status->value.sig = TARGET_SIGNAL_INT;
554
  else if (drr & DRR_AE)
555
    status->value.sig = TARGET_SIGNAL_REALTIME_36;
556
  else if (drr & DRR_IIE)
557
    status->value.sig = TARGET_SIGNAL_ILL;
558
  else if (drr & DRR_HPINTE)
559
    status->value.sig = TARGET_SIGNAL_INT;
560
  else if (drr & DRR_DME)
561
    status->value.sig = TARGET_SIGNAL_REALTIME_37;
562
  else if (drr & DRR_IME)
563
    status->value.sig = TARGET_SIGNAL_REALTIME_38;
564
  else if (drr & DRR_RE)
565
    status->value.sig = TARGET_SIGNAL_REALTIME_39;
566
  else if (drr & DRR_SCE)
567
    status->value.sig = TARGET_SIGNAL_REALTIME_40;
568
  else if (drr & DRR_BE)
569
    status->value.sig = TARGET_SIGNAL_TRAP;
570
  else
571
    {
572
      status->value.sig = TARGET_SIGNAL_UNKNOWN;
573
      warning ("Invalid exception occured.");
574
    }
575
 
576 113 markom
  /* Log remote stop.  */
577 106 markom
  or1k_status = TARGET_STOPPED;
578 113 markom
 
579
  /* Determine what caused trap - breakpoint or watchpoint.  */
580
  if (status->value.sig == TARGET_SIGNAL_TRAP)
581
    {
582
      /* Search all active breakpoints for a match.  */
583
      CORE_ADDR pc = read_pc ();
584
      int breakpoint = 0;
585
      int i;
586
      for (i = 0; i < or1k_implementation.num_used_matchpoints; i++)
587
        if (dvr[i] == pc && dcr[i].dp && dcr[i].cc == CC_EQUAL && !dcr[i].sc && dcr[i].ct == CT_FETCH)
588
          {
589
            breakpoint = 1;
590
            break;
591
          }
592
      hit_watchpoint = !breakpoint;
593
    }
594
  else
595
    hit_watchpoint = 0;
596 106 markom
 
597
  /* If the stop PC is in the _exit function, assume
598
     we hit the 'break 0x3ff' instruction in _exit, so this
599
     is not a normal breakpoint.  */
600
  {
601
    char *func_name;
602
    CORE_ADDR func_start;
603
    CORE_ADDR pc = read_pc ();
604
 
605
    find_pc_partial_function (pc, &func_name, &func_start, NULL);
606
    if (func_name != NULL && strcmp (func_name, "_exit") == 0
607
        && func_start == pc)
608
      status->kind = TARGET_WAITKIND_EXITED;
609
  }
610
  return 0;
611
}
612
 
613 113 markom
/* Fetch a word from the target board.  All memory accesses to the
614
   remote board are word aligned.  */
615 106 markom
 
616
static unsigned int
617
or1k_fetch_word (addr)
618
     CORE_ADDR addr;
619
{
620 113 markom
  if (addr & 3)
621
    {
622
      int subaddr = addr & 3;
623
      unsigned char buf[8];
624
      unsigned int low, high;
625
      addr >>= 2;
626
      low = or1k_read_reg (addr + MEM_SPACE);
627
      high = or1k_read_reg (addr + 1 + MEM_SPACE);
628
      memcpy (&buf[0], &low, 4);
629
      memcpy (&buf[4], &high, 4);
630
      memcpy (&low, &buf[subaddr], 4);
631
      return low;
632
    }
633
  else
634
    {
635
      addr >>= 2;
636
      return or1k_read_reg (addr + MEM_SPACE);
637
    }
638 106 markom
}
639
 
640
/* Store a word to the target board.  Returns errno code or zero for
641 113 markom
   success.  All memory accesses to the remote board are word aligned.  */
642 106 markom
static int
643
or1k_store_word (addr, val)
644
     CORE_ADDR addr;
645
     unsigned int val;
646
{
647 113 markom
  if (addr & 3)
648
    {
649
      int subaddr = addr & 3;
650
      unsigned char buf[8];
651
      unsigned int low, high;
652
      addr >>= 2;
653
      low = or1k_read_reg (addr + MEM_SPACE);
654
      high = or1k_read_reg (addr + 1 + MEM_SPACE);
655
      memcpy (&buf[0], &low, 4);
656
      memcpy (&buf[4], &high, 4);
657
      memcpy (&buf[subaddr], &val, 4);
658
      memcpy (&low, &buf[0], 4);
659
      memcpy (&high, &buf[4], 4);
660
      or1k_write_reg (addr + MEM_SPACE, low);
661
      or1k_write_reg (addr + 1 + MEM_SPACE, high);
662
    }
663
  else
664
    {
665
      addr >>= 2;
666
      or1k_write_reg (addr + MEM_SPACE, val);
667
    }
668 106 markom
  return err;
669
}
670
 
671
/* Fetch the remote registers.  */
672
 
673
void
674
or1k_fetch_registers (regno)
675
     int regno;
676
{
677
  unsigned int val;
678
 
679
  if (regno == -1)
680
    {
681
      for (regno = 0; regno < NUM_REGS; regno++)
682
        or1k_fetch_registers (regno);
683
      return;
684
    }
685
 
686
  if (regno >= NUM_REGS)
687
    error("Invalid register number!");
688
 
689
  /* Convert to SPRNUM and read.  */
690 113 markom
  val = or1k_read_spr_reg (REGNUM_TO_SPRNUM(regno));
691 106 markom
 
692
  {
693
    char buf[MAX_REGISTER_RAW_SIZE];
694
 
695
    /* We got the number the register holds, but gdb expects to see a
696
       value in the target byte ordering.  */
697
    store_unsigned_integer (buf, REGISTER_RAW_SIZE (regno), val);
698
    supply_register (regno, buf);
699
  }
700
  if (err)
701
    or1k_error ("Can't read register %d(%i): %s", regno, REGNUM_TO_SPRNUM(regno) + REG_SPACE, or1k_err_name (err));
702
}
703
 
704
/* Fetch and return instruction from the specified location.  */
705
 
706
unsigned int
707
or1k_fetch_instruction (addr)
708
     CORE_ADDR addr;
709
{
710
  char buf[OR1K_INSTLEN];
711
  int status;
712
 
713
  status = read_memory_nobpt (addr, buf, OR1K_INSTLEN);
714
  if (status)
715
    memory_error (status, addr);
716
  return extract_unsigned_integer (buf, OR1K_INSTLEN);
717
}
718
 
719 113 markom
/* Currently not needed.  */
720
 
721 106 markom
static void
722
or1k_prepare_to_store ()
723
{
724
}
725
 
726
/* Store remote register(s).  */
727
 
728
static void
729
or1k_store_registers (regno)
730
     int regno;
731
{
732
  if (regno == -1)
733
    {
734
      for (regno = 0; regno < NUM_REGS; regno++)
735
        or1k_store_registers (regno);
736
      return;
737
    }
738
 
739
  if (regno >= NUM_REGS)
740
    error("Invalid register number!");
741
 
742 113 markom
  or1k_write_spr_reg (REGNUM_TO_SPRNUM(regno), or1k_read_spr_reg (REGNUM_TO_SPRNUM(regno)));
743 106 markom
  if (err)
744 113 markom
    or1k_error ("Can't write register %d(%i): %s", regno, REGNUM_TO_SPRNUM(regno), or1k_err_name (err));
745 106 markom
}
746
 
747
/* Read or write LEN bytes from inferior memory at MEMADDR,
748
   transferring to or from debugger address MYADDR.  Write to inferior
749
   if SHOULD_WRITE is nonzero.  Returns length of data written or
750
   read; 0 for error.  Note that protocol gives us the correct value
751
   for a longword, since it transfers values in ASCII.  We want the
752
   byte values, so we have to swap the longword values.  */
753
 
754
static int
755
or1k_xfer_memory (memaddr, myaddr, len, write, ignore)
756
     CORE_ADDR memaddr;
757
     char *myaddr;
758
     int len;
759
     int write;
760
     struct target_ops *ignore;
761
{
762
  register int i;
763
  /* Round starting address down to longword boundary.  */
764
  register CORE_ADDR addr = memaddr & ~3;
765
  /* Round ending address up; get number of longwords that makes.  */
766
  register int count = (((memaddr + len) - addr) + 3) / 4;
767
  /* Allocate buffer of that many longwords.  */
768
  register char *buffer = alloca (count * 4);
769
 
770
  int status;
771
 
772
  if (memaddr >= MEM_SPACE)
773
    error("Invalid address");
774
 
775
  if (write)
776
    {
777
      /* Fill start and end extra bytes of buffer with existing data.  */
778
      if (addr != memaddr || len < 4)
779
        {
780
          /* Need part of initial word -- fetch it.  */
781
          store_unsigned_integer (&buffer[0], 4, or1k_fetch_word (addr));
782
        }
783
 
784
      if (count > 1)
785
        {
786
          /* Need part of last word -- fetch it.  FIXME: we do this even
787
             if we don't need it.  */
788
          store_unsigned_integer (&buffer[(count - 1) * 4], 4,
789
                                  or1k_fetch_word (addr + (count - 1) * 4));
790
        }
791
 
792
      /* Copy data to be written over corresponding part of buffer */
793
 
794
      memcpy ((char *) buffer + (memaddr & 3), myaddr, len);
795
 
796
      /* Write the entire buffer.  */
797
 
798
      for (i = 0; i < count; i++, addr += 4)
799
        {
800
          status = or1k_store_word (addr,
801
                               extract_unsigned_integer (&buffer[i * 4], 4));
802
          /* Report each kilobyte (we download 32-bit words at a time) */
803
          if (i % 256 == 255)
804
            {
805
              printf_unfiltered ("*");
806
              gdb_flush (gdb_stdout);
807
            }
808
          if (status)
809
            {
810
              errno = status;
811
              return 0;
812
            }
813
          /* FIXME: Do we want a QUIT here?  */
814
        }
815
      if (count >= 256)
816
        printf_unfiltered ("\n");
817
    }
818
  else
819
    {
820
      /* Read all the longwords */
821
      for (i = 0; i < count; i++, addr += 4)
822
        {
823
          store_unsigned_integer (&buffer[i * 4], 4, or1k_fetch_word (addr));
824
          QUIT;
825
        }
826
 
827
      /* Copy appropriate bytes out of the buffer.  */
828
      memcpy (myaddr, buffer + (memaddr & 3), len);
829
    }
830
  return len;
831
}
832
 
833 113 markom
/* Flushes pipeline. May not be needed by all implementations, but
834
   it doen't hurt to do it. This function should be called every time
835
   or1k stops.
836
   When or1k stops it still has instructions in pipeline.
837
   We do this by inserting nop instructions.
838
   IF cycle remains unaffacted by writing to DIR, and it still holds
839
   instruction, that caused break or watchpoint. */
840
 
841
void
842
or1k_flush_pipeline ()
843
{
844
  or1k_write_spr_reg (DIR_SPRNUM, NOP_INSTR);
845
  or1k_write_spr_reg (DIR_SPRNUM, NOP_INSTR);
846
  or1k_write_spr_reg (DIR_SPRNUM, NOP_INSTR);
847
}
848
 
849 106 markom
/* Print info on this target.  */
850
 
851
static void
852
or1k_files_info (ignore)
853
     struct target_ops *ignore;
854
{
855
  char *file = "nothing";
856
 
857
  if (exec_bfd)
858
    file = bfd_get_filename (exec_bfd);
859
 
860
  printf_filtered ("or1k_files_info: file \"%s\"\n", file);
861
 
862
  if (exec_bfd)
863
    {
864
      printf_filtered ("\tAttached to %s running program %s\n",
865
                       target_shortname, file);
866
    }
867
  /* Print target info. */
868
  printf_filtered ("Status: %s\n", status_name[or1k_status]);
869
}
870
 
871
/* Tell whether we can support a hardware breakpoint.  */
872
static int
873
or1k_can_use_hardware_breakpoint ()
874
{
875
  int i;
876
  /* Search for unused breakpoint.  */
877 113 markom
  return or1k_implementation.num_used_matchpoints < or1k_implementation.num_matchpoints;
878 106 markom
}
879
 
880
/* Insert a breakpoint.  On targets that don't have built-in breakpoint
881
   support, we read the contents of the target location and stash it,
882
   then overwrite it with a breakpoint instruction.  ADDR is the target
883
   location in the target machine.  CONTENTS_CACHE is a pointer to
884
   memory allocated for saving the target contents.  It is guaranteed
885
   by the caller to be long enough to save sizeof BREAKPOINT bytes (this
886
   is accomplished via BREAKPOINT_MAX).  */
887
 
888 113 markom
int
889 106 markom
or1k_insert_breakpoint (addr, contents_cache)
890
     CORE_ADDR addr;
891
     char *contents_cache;
892
{
893
  if (or1k_can_use_hardware_breakpoint())
894
    return set_breakpoint (addr);
895
  else
896
    return memory_insert_breakpoint (addr, contents_cache);
897
}
898
 
899 113 markom
int
900 106 markom
or1k_remove_breakpoint (addr, contents_cache)
901
     CORE_ADDR addr;
902
     char *contents_cache;
903
{
904
  /* First try to remove HW breakpoint at address */
905
  if (clear_breakpoint (addr))
906
    return memory_remove_breakpoint (addr, contents_cache);
907
  else
908
    return 0;
909
}
910
 
911 113 markom
/* Tell whether this target can support a hardware breakpoint.  CNT
912
   is the number of hardware breakpoints already installed.  This
913
   implements the TARGET_CAN_USE_HARDWARE_WATCHPOINT macro.
914
   Lower bound is estimated. !!! Can we estimate better? */
915
 
916
int
917
or1k_can_use_hardware_watchpoint (bp_type, cnt)
918
     enum bptype bp_type;
919
     int cnt;
920
{
921
  /* Are there at least two matchpoints left for watch? - estimate lower bound  */
922
  return cnt + ((bp_type == bp_hardware_watchpoint)?(1):(0))
923
    <= or1k_implementation.num_matchpoints;
924
}
925
 
926
/* Sifts unused matchpoints to higher indexses.  */
927
 
928
static void
929
sift_matchpoints ()
930
{
931
  int i, first_free = 0;
932
  unsigned int u;
933
  for (i = 0; i < or1k_implementation.num_matchpoints; i++)
934
    if (dcr[i].dp)
935
      {
936
        int chaining;
937
        dvr[first_free] = dvr[i];
938
        dcr[first_free] = dcr[i];
939
 
940
        /* Copy chaining bits.  */
941
        chaining = dmr1 & (3 << (2 * i));
942
        dmr1 &= ~(3 << (2 * first_free));
943
        dmr1 |= chaining << (2 * first_free);
944
        /* Copy watchpoint bits */
945
        chaining = dmr2 & (1 << i);
946
        dmr2 &= 1 << first_free;
947
        dmr2 |= chaining << first_free;
948
        /* !!! move references also */
949
 
950
        or1k_write_spr_reg (DVR0_SPRNUM + first_free, dvr[first_free]);
951
        memcpy (&u, &dcr[first_free], sizeof(dcr[first_free]));
952
        or1k_write_spr_reg (DCR0_SPRNUM + first_free, u);
953
        first_free++;
954
      }
955
  /* Disable unused.  */
956
  for (i = first_free; i < or1k_implementation.num_matchpoints; i++)
957
    {
958
      dmr2 &= ~(1 << i);
959
      dcr[i].dp = 0;
960
    }
961
  or1k_write_spr_reg (DMR1_SPRNUM, dmr1);
962
  or1k_write_spr_reg (DMR2_SPRNUM, dmr2);
963
}
964
 
965
/* Translates gdb watchpoint type into one in DCR register.  */
966
 
967
static int
968
translate_type (gdb_type)
969
     int gdb_type;
970
{
971
  switch (gdb_type)
972
    {
973
    case 0:
974
      return CT_SDATA;
975
    case 1:
976
      return CT_LDATA;
977
    case 2:
978
      return CT_ADATA;
979
    default:
980
      error ("Invalid type.");
981
    }
982
}
983
 
984
/* Set a data watchpoint.  ADDR and LEN should be obvious.  TYPE is 0
985
   for a write watchpoint, 1 for a read watchpoint, or 2 for a read/write
986
   watchpoint. */
987
 
988
int
989
or1k_insert_watchpoint (addr, len, type)
990
     CORE_ADDR addr;
991
     int len;
992
     int type;
993
{
994
  int i;
995
  unsigned int u;
996
  if (len < 1)
997
    return -1;
998
 
999
  type = translate_type (type);
1000
 
1001
  /* Moves unused watchpoints to the top.  */
1002
  sift_matchpoints ();
1003
  /* Place at first free matchpoint.  */
1004
  i = or1k_implementation.num_used_matchpoints;
1005
  dvr[i] = addr;
1006
  dcr[i].dp = 1;
1007
  dcr[i].cc = CC_GREATE;
1008
  dcr[i].sc = 0;
1009
  dcr[i].ct = type;
1010
  or1k_write_spr_reg (DVR0_SPRNUM + i, dvr[i]);
1011
  memcpy (&u, &dcr[i], sizeof(dcr[i]));
1012
  or1k_write_spr_reg (DCR0_SPRNUM + i, u);
1013
 
1014
  /* Set && chaining here.  */
1015
  dmr1 &= ~(3 << (2 * i));
1016
  dmr1 |= 2 << (2 * i);
1017
  or1k_write_spr_reg (DMR1_SPRNUM, dmr1);
1018
 
1019
  /* Set upper watchpoint bound.  */
1020
  i++;
1021
  dvr[i] = addr + len - 1;
1022
  dcr[i].dp = 1;
1023
  dcr[i].cc = CC_LESSE;
1024
  dcr[i].sc = 0;
1025
  dcr[i].ct = type;
1026
  or1k_write_spr_reg (DVR0_SPRNUM + i, dvr[i]);
1027
  memcpy (&u, &dcr[i], sizeof(dcr[i]));
1028
  or1k_write_spr_reg (DCR0_SPRNUM + i, u);
1029
 
1030
  /* Matchpoints will cause breakpoints */
1031
  or1k_write_spr_reg (DMR2_SPRNUM, dmr2 |= (1 << i));
1032
  or1k_implementation.num_used_matchpoints += 2;
1033
  return 0;
1034
}
1035
 
1036
/* Removes a data watchpoint.  ADDR and LEN should be obvious.  TYPE is 0
1037
   for a write watchpoint, 1 for a read watchpoint, or 2 for a read/write
1038
   watchpoint. */
1039
int
1040
or1k_remove_watchpoint (addr, len, type)
1041
     CORE_ADDR addr;
1042
     int len;
1043
     int type;
1044
{
1045
  int i, found = -1;
1046
  unsigned int u;
1047
  if (len < 1)
1048
    return -1;
1049
 
1050
  type = translate_type (type);
1051
 
1052
  /* Find the right one.  */
1053
  for (i = 0; i < or1k_implementation.num_used_matchpoints; i++)
1054
    if (dvr[i] == addr && dcr[i].dp && dcr[i].cc == CC_GREATE && !dcr[i].sc && dcr[i].ct == type
1055
        && dvr[i + 1] == addr + len - 1 && dcr[i + 1].dp && dcr[i + 1].cc == CC_LESSE
1056
        && !dcr[i + 1].sc && dcr[i + 1].ct == type)
1057
      {
1058
        found = i;
1059
        break;
1060
      }
1061
 
1062
  if (found < 0)
1063
    return -1;
1064
 
1065
  dcr[found].dp = 0;
1066
  memcpy (&u, &dcr[found], sizeof(dcr[found]));
1067
  or1k_write_spr_reg (DCR0_SPRNUM + found, u);
1068
  dcr[found + 1].dp = 0;
1069
  memcpy (&u, &dcr[found + 1], sizeof(dcr[found + 1]));
1070
  or1k_write_spr_reg (DCR0_SPRNUM + found + 1, u);
1071
 
1072
  /* Matchpoints will not cause breakpoints anymore. */
1073
  or1k_write_spr_reg (DMR2_SPRNUM, dmr2 &= ~(1 << i));
1074
  or1k_implementation.num_used_matchpoints -= 2;
1075
  return 0;
1076
}
1077
 
1078
int
1079
or1k_stopped_by_watchpoint (void)
1080
{
1081
  return hit_watchpoint;
1082
}
1083
 
1084 106 markom
/* Insert a breakpoint.  */
1085
 
1086
int
1087
set_breakpoint (addr)
1088
     CORE_ADDR addr;
1089
{
1090
  int i;
1091
  unsigned int u;
1092
  /* Search for unused breakpoint.  */
1093
  for (i = 0; i < NUM_MATCHPOINTS; i++)
1094
    if (dcr[i].dp == 0) break;
1095
  if (i >= NUM_MATCHPOINTS) return 1;
1096
  dvr[i] = addr;
1097
  dcr[i].dp = 1;
1098
  dcr[i].cc = CC_EQUAL;
1099
  dcr[i].sc = 0;
1100
  dcr[i].ct = CT_FETCH;
1101 113 markom
  or1k_write_spr_reg (DVR0_SPRNUM + i, dvr[i]);
1102 106 markom
  memcpy (&u, &dcr[i], sizeof(dcr[i]));
1103 113 markom
  or1k_write_spr_reg (DCR0_SPRNUM + i, u);
1104
  or1k_implementation.num_used_matchpoints++;
1105
 
1106
  /* No chaining here.  */
1107
  dmr1 &= ~(3 << (2*i));
1108
  or1k_write_spr_reg (DMR1_SPRNUM, dmr1);
1109
  /* Matchpoints will cause breakpoints */
1110
  or1k_write_spr_reg (DMR2_SPRNUM, dmr2 |= (1 << i));
1111 106 markom
  return 0;
1112
}
1113
 
1114
/* Clear a breakpoint.  */
1115
 
1116
int
1117
clear_breakpoint (addr)
1118
     CORE_ADDR addr;
1119
{
1120
  int i;
1121
  unsigned int u;
1122
  /* Search for matching breakpoint.  */
1123
  for (i = 0; i < NUM_MATCHPOINTS; i++)
1124
    if ((dcr[i].dp == 1) && (dvr[i] == addr) && (dcr[i].cc == CC_EQUAL)
1125
        && (dcr[i].sc == 0) && (dcr[i].ct == CT_FETCH)) break;
1126
 
1127
  if (i >= NUM_MATCHPOINTS) return 1;
1128
  dcr[i].dp = 0;
1129
  memcpy (&u, &dcr[i], sizeof(dcr[i]));
1130 113 markom
  or1k_write_spr_reg (DCR0_SPRNUM + i, u);
1131
  /* Matchpoints will cause breakpoints */
1132
  or1k_write_spr_reg (DMR2_SPRNUM, dmr2 &= ~(1 << i));
1133
  or1k_implementation.num_used_matchpoints--;
1134 106 markom
  return 0;
1135
}
1136
 
1137
/* Start running on the target board.  */
1138
 
1139
static void
1140
or1k_create_inferior (execfile, args, env)
1141
     char *execfile;
1142
     char *args;
1143
     char **env;
1144
{
1145
  CORE_ADDR entry_pt;
1146
 
1147
  if (args && *args)
1148
    {
1149
      warning ("\
1150
Can't pass arguments to remote OR1K board; arguments ignored.");
1151
      /* And don't try to use them on the next "run" command.  */
1152
      execute_command ("set args", 0);
1153
    }
1154
 
1155
  if (execfile == 0 || exec_bfd == 0)
1156
    error ("No executable file specified");
1157
 
1158
  or1k_kill ();
1159
  remove_breakpoints ();
1160
 
1161
  entry_pt = (CORE_ADDR) bfd_get_start_address (exec_bfd);
1162
  init_wait_for_inferior ();
1163
 
1164
  /* FIXME: Should we set inferior_pid here?  */
1165 113 markom
 
1166 106 markom
  insert_breakpoints ();        /* Needed to get correct instruction in cache */
1167
  clear_proceed_status ();
1168
  or1k_status = TARGET_STOPPED;
1169
  proceed (entry_pt, TARGET_SIGNAL_DEFAULT, 0);
1170
}
1171
 
1172
/* Clean up after a process.  Actually nothing to do.  */
1173
 
1174
static void
1175
or1k_mourn_inferior ()
1176
{
1177
  generic_mourn_inferior ();
1178
}
1179
 
1180
static void
1181
or1k_dummy_open (name, from_tty)
1182
     char *name;
1183
     int from_tty;
1184
{
1185
  target_preopen (from_tty);
1186
  if (or1k_is_open)
1187
    unpush_target (current_ops);
1188
  current_or1k_target = &or1k_target_dummy;
1189
  or1k_open (name, from_tty);
1190
}
1191
 
1192
static void
1193
or1k_jtag_open (name, from_tty)
1194
     char *name;
1195
     int from_tty;
1196
{
1197
  target_preopen (from_tty);
1198
  if (or1k_is_open)
1199
    unpush_target (current_ops);
1200
  current_or1k_target = &or1k_target_jtag;
1201
  or1k_open (name, from_tty);
1202
}
1203
 
1204
static void
1205
or1k_sim_open (name, from_tty)
1206
     char *name;
1207
     int from_tty;
1208
{
1209
  /* target_preopen (from_tty); - do we need this ? */
1210
  if (or1k_is_open)
1211
    unpush_target (current_ops);
1212
  current_or1k_target = &or1k_target_sim;
1213
  or1k_open (name, from_tty);
1214
}
1215
 
1216
/* Executes command on the target.  */
1217
 
1218
void
1219
or1k_sim_cmd (char *args, int from_tty)
1220
{
1221
  if (current_or1k_target != NULL && current_or1k_target->to_exec_command != NULL)
1222
    current_or1k_target->to_exec_command (args, from_tty);
1223
  else
1224
    error ("Command not supported on this target. ");
1225
}
1226
 
1227 113 markom
/* Displays matchpoints usage.  */
1228
 
1229 106 markom
void
1230 113 markom
info_matchpoints_command (char *args, int from_tty)
1231
{
1232
  int i;
1233
  for (i = 0; i < or1k_implementation.num_matchpoints; i++)
1234
    {
1235
      printf_filtered ("WP%i ", i);
1236
      if (dcr[i].dp)
1237
        {
1238
          int chaining = (dmr1 << 2*i) & 3;
1239
          printf_filtered ("= %s ", ct_names[dcr[i].ct]);
1240
          if (dcr[i]. sc)
1241
            printf_filtered ("s%s %i", cc_names[dcr[i].cc], (int)dvr[i]);
1242
          else
1243
            printf_filtered ("%s %u", cc_names[dcr[i].cc], (unsigned int)dvr[i]);
1244
          if (chaining)
1245
            printf_filtered ("%s WP%i", ch_names[chaining], i - 1);
1246
        }
1247
      else
1248
        printf_filtered ("NOT USED");
1249
      if ((dmr2 >> i) & 1)
1250
        printf_filtered (", causes breakpoint");
1251
      if ((dmr2 >> (i + 11)) & 1)
1252
        printf_filtered (", increments counter");
1253
      printf_filtered ("\n");
1254
    }
1255
}
1256
 
1257
void
1258 106 markom
_initialize_remote_or1k ()
1259
{
1260
  /* Initialize the fields in or1k_ops that are common to all targets.  */
1261
  or1k_dummy_ops.to_close = or1k_close;
1262
  or1k_dummy_ops.to_detach = or1k_detach;
1263
  or1k_dummy_ops.to_resume = or1k_resume;
1264
  or1k_dummy_ops.to_wait = or1k_wait;
1265
  or1k_dummy_ops.to_fetch_registers = or1k_fetch_registers;
1266
  or1k_dummy_ops.to_store_registers = or1k_store_registers;
1267
  or1k_dummy_ops.to_prepare_to_store = or1k_prepare_to_store;
1268
  or1k_dummy_ops.to_xfer_memory = or1k_xfer_memory;
1269
  or1k_dummy_ops.to_files_info = or1k_files_info;
1270
  or1k_dummy_ops.to_insert_breakpoint = or1k_insert_breakpoint;
1271
  or1k_dummy_ops.to_remove_breakpoint = or1k_remove_breakpoint;
1272
  or1k_dummy_ops.to_kill = or1k_kill;
1273
  or1k_dummy_ops.to_load = generic_load;
1274
  or1k_dummy_ops.to_create_inferior = or1k_create_inferior;
1275
  or1k_dummy_ops.to_mourn_inferior = or1k_mourn_inferior;
1276
  or1k_dummy_ops.to_stratum = process_stratum;
1277
  or1k_dummy_ops.to_has_all_memory = 0; /* We can access memory while program is running.  */
1278
  or1k_dummy_ops.to_has_memory = 1;
1279
  or1k_dummy_ops.to_has_stack = 1;
1280
  or1k_dummy_ops.to_has_registers = 1;
1281
  or1k_dummy_ops.to_has_execution = 1;
1282
  or1k_dummy_ops.to_magic = OPS_MAGIC;
1283
 
1284
  /* Copy the common fields to all target vectors.  */
1285
  or1k_jtag_ops = or1k_sim_ops = or1k_dummy_ops;
1286
 
1287
  /* Initialize target-specific fields in the target vectors adn add targets.  */
1288
  or1k_jtag_ops.to_shortname = "jtag";
1289
  or1k_jtag_ops.to_longname = "Remote or1k debugging over JTAG port";
1290
  or1k_jtag_ops.to_doc = "\
1291
Debug a board using the OR1K remote debugging protocol over a parallel line.\n\
1292
The argument is the device it is connected to or, if it contains a colon,\n";
1293
  or1k_jtag_ops.to_open = or1k_jtag_open;
1294
  add_target (&or1k_jtag_ops);
1295
 
1296
  or1k_dummy_ops.to_shortname = "dummy";
1297
  or1k_dummy_ops.to_longname = "Dummy target";
1298
  or1k_dummy_ops.to_doc = "Actually no real target attached - more like /dev/null.\n";
1299
  or1k_dummy_ops.to_open = or1k_dummy_open;
1300
  add_target (&or1k_dummy_ops);
1301
 
1302
  or1k_sim_ops.to_shortname = "sim";
1303
  or1k_sim_ops.to_longname = "Remote or1k debugging using architecture simulator";
1304
  or1k_sim_ops.to_doc = "Debug using an architecture simulator.\n";
1305
  or1k_sim_ops.to_open = or1k_sim_open;
1306
  add_target (&or1k_sim_ops);
1307 113 markom
  add_info ("matchpoints", info_matchpoints_command, "Show current matchpoints allocation status.");
1308 106 markom
}

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.