Coldfire GDB BDM problem

Bill Butler billb at tnex.com
Tue Feb 19 17:06:05 UTC 2002


All,

Bill Knight and I are trying to get the GDB/Insight debugger working for
a 5307 coldfire with a P&E wiggler REVA.  I am using versions gdb 5.0.
with Chris John's BDM add-ons. This is running on a 1Ghz machine under
Win 2000, with the latest Cygwin environment.

I am able to connect to the MCF5307C3 eval board and do a board setup on
it. I can load a simple App onto it but that is about it. I set the PC
to the start address but the step, step-into,... buttons are grayed out
with only the GO button active. When I go to the console on GDB and try
si, the PC register immediately goes to a flash address (resets).

To Verify that our Debugging platform( PC, Wiggler and Eval Board) works
we have used  the WinRiver's singleStep debugger. With it, I am able to
connect  to the evaluation board, load an image and step or run with it.

We have tried reducing all the variables in the process we could. I
compiled a simple app (main and one function), compiled it with
m68k-elf-gcc (without rtems patch), used GDB/Insight with only the BDM
patch (no rtems patch) with the same results. 

We have even tried to get it working on a Coldfire SBC5206 eval board
with  a different wiggler on a different development platform, all with
similar results.

A brief run down of what I have done is. 

I modified the setup-CS and Dram (I'm using sdram) routines to map the
board correctly (using a MCF5307C3 eval board). I have verified that I
can modify ram ($0-> 16meg), Mbar is set and working ($10000000), and
Flash code is at $FFFE0000.

In my home directory we have a gdb.ini file (included at bottom of file)
with the GDB routines we use. We are manually invoking them from the
console right now with Initboard5307C3

>From scratch
1) Latching GDB and it does read in the gdb.ini file.
2) Connect to the target (this completes)
3) A GDB console we call InitBoard5307C3
4) Verify register, Mbar, Ram memory. All ok
5) I load a.out (simple test program using m68k-elf-gcc and using
default 	Crt0)
6) Source window a.out asm (C source never displayed) and code starting
at 0x2000 (proper place)
7) Set the Pc to start(2000)
4) All the step buttons are grayed out.
9) go to console window and type SI
10) Board resets and pc goes back to FFFExxxx 

 
We are stuck.. Does anyone have an idea of what to try next.

PS. I have tried to walk through what is on Fiddles GDB docs using only
the GDB console and it act very similarly when I type SI



Thank you

Bill Butler 

-------------------------------

INIT file

#
# GDB Init script for the Coldfire 5207C3 processor on the
# Cybertec SFP single board computer. See :
#
#   http://www.cybertec.com.au/
#
# Copyright 2001 Cybertec Pty Ltd,
# Chris Johns <cjohns at cybertec.com.au>
#
# The main purpose of this script is to configure the 
# DRAM controller, load code, and set the program counter
# when using Insight.
#

#
# Commands to ease the C notation of GDB.
# These command read and write 8, 16 and 32 values.
#

#source ./5307c3.gdb

#
# GDB Init script for the Coldfire 5307 processor.
#
# The main purpose of this script is to configure the 
# DRAM controller so code can be loaded.
#
#
#

define setup-simregs
   set $mbar  = 0x10000001

   set $rsr   = $mbar - 1 + 0x000
   set $sypcr = $mbar - 1 + 0x001
   set $swivr = $mbar - 1 + 0x002
   set $swsr  = $mbar - 1 + 0x003
   set $simr  = $mbar - 1 + 0x003
   set $par   = $mbar - 1 + 0x004
   set $irqpar= $mbar - 1 + 0x006
   set $pllcr = $mbar - 1 + 0x008
   set $mpark = $mbar - 1 + 0x00c
   set $ipr   = $mbar - 1 + 0x040
   set $imr   = $mbar - 1 + 0x044

   set $icr0  = $mbar - 1 + 0x04c
   set $icr1  = $mbar - 1 + 0x04d
   set $icr2  = $mbar - 1 + 0x04e
   set $icr3  = $mbar - 1 + 0x04f
   set $icr4  = $mbar - 1 + 0x050
   set $icr5  = $mbar - 1 + 0x051
   set $icr6  = $mbar - 1 + 0x052
   set $icr7  = $mbar - 1 + 0x053
   set $icr8  = $mbar - 1 + 0x054
   set $icr9  = $mbar - 1 + 0x055

   set $csar0 = $mbar - 1 + 0x080
   set $csmr0 = $mbar - 1 + 0x084
   set $cscr0 = $mbar - 1 + 0x08a
   set $csar1 = $mbar - 1 + 0x08c
   set $csmr1 = $mbar - 1 + 0x090
   set $cscr1 = $mbar - 1 + 0x096
   set $csar2 = $mbar - 1 + 0x098
   set $csmr2 = $mbar - 1 + 0x09c
   set $cscr2 = $mbar - 1 + 0x0a2
   set $csar3 = $mbar - 1 + 0x0a4
   set $csmr3 = $mbar - 1 + 0x0a8
   set $cscr3 = $mbar - 1 + 0x0ae
   set $csar4 = $mbar - 1 + 0x0b0
   set $csmr4 = $mbar - 1 + 0x0b4
   set $cscr4 = $mbar - 1 + 0x0ba
   set $csar5 = $mbar - 1 + 0x0bc
   set $csmr5 = $mbar - 1 + 0x0c0
   set $cscr5 = $mbar - 1 + 0x0c6
   set $csar6 = $mbar - 1 + 0x0c8
   set $csmr6 = $mbar - 1 + 0x0cc
   set $cscr6 = $mbar - 1 + 0x0d2
   set $csar7 = $mbar - 1 + 0x0d4
   set $csmr7 = $mbar - 1 + 0x0d8
   set $cscr7 = $mbar - 1 + 0x0de

   set $dcr   = $mbar - 1 + 0x100
   set $dacr0 = $mbar - 1 + 0x108
   set $dmr0  = $mbar - 1 + 0x10c
   set $dacr1 = $mbar - 1 + 0x110
   set $dmr1  = $mbar - 1 + 0x114

   set $tmr1  = $mbar - 1 + 0x140
   set $trr1  = $mbar - 1 + 0x144
   set $tcr1  = $mbar - 1 + 0x148
   set $tcn1  = $mbar - 1 + 0x14C
   set $ter1  = $mbar - 1 + 0x151
   set $tmr2  = $mbar - 1 + 0x180
   set $trr2  = $mbar - 1 + 0x184
   set $tcr2  = $mbar - 1 + 0x188
   set $tcn2  = $mbar - 1 + 0x18C
   set $ter2  = $mbar - 1 + 0x191

   set $paddr = $mbar - 1 + 0x244
   set $padat = $mbar - 1 + 0x248
end


define setup-cs
  set *((short*)$csar0) = 0xffe0
  set *((short*)$cscr0) = 0x0d80
  set *((long* )$csmr0) = 0x000f0001

  set *((short*)$csar1) = 0x0
  set *((short*)$cscr1) = 0x0
  set *((long* )$csmr1) = 0x0

  set *((short*)$csar2) = 0x3000
  set *((long* )$csmr2) = 0x00070001
  set *((short*)$cscr2) = 0x0100

  set *((short*)$csar3) = 0x0
  set *((short*)$cscr3) = 0x0
  set *((long* )$csmr3) = 0x0

  set *((short*)$csar4) = 0x0
  set *((short*)$cscr4) = 0x0
  set *((long* )$csmr4) = 0x0

  set *((short*)$csar5) = 0x0
  set *((short*)$cscr5) = 0x0
  set *((long* )$csmr5) = 0x0

  set *((short*)$csar6) = 0x0
  set *((short*)$cscr6) = 0x0
  set *((long* )$csmr6) = 0x0

  set *((short*)$csar7) = 0x0
  set *((short*)$cscr7) = 0x0
  set *((long* )$csmr7) = 0x0

  set16 $par   0x0008

end



define setup-misc
  set *((short*)$icr0)  = 0x0
#  set *((byte*)$icr1)  = 0x0
  set *((short*)$icr2)  = 0x0
#  set *((byte*)$icr3)  = 0x0
  set *((short*)$icr4)  = 0x0
#  set *((byte*)$icr5)  = 0x0
  set *((short*)$icr6)  = 0x0
#  set *((byte*)$icr7)  = 0x0
  set *((short*)$icr8)  = 0x01E
#  set *((byte*)$icr9)  = 0x1E

  set *((long*)$imr)  =  0x0000FFFE
  set *((short*)$par)  = 0xFFFF
end


define setup-sdram
  set *((short*)$dcr)   = 0x822a
  set *((long* )$dacr0) = 0x00001404
  set *((long* )$dmr0)  = 0x007c0001
  set *((long* )$dacr1) = 0x00801404
  set *((long* )$dmr1)  = 0x007c0001
end

define initBoard5307C3
   setup-simregs
#   setup-misc
   setup-cs
   setup-sdram
end


define set8
 set *((unsigned char*) $arg0) = $arg1
end

document set8
Set 8bit memory: set8 ADDRESS VALUE
end

define set16
 set *((unsigned short*) $arg0) = $arg1
end

document set16
Set 16bit memory: set16 ADDRESS VALUE
end

define set32
 set *((unsigned long*) $arg0) = $arg1
end

document set32
Set 32bit memory: set32 ADDRESS VALUE
end

define d8
 x /$arg1b $arg0
end

document d8
Dump 8bit memory: d8 ADDRESS LENGTH
end

define d16
 x /$arg1h $arg0
end

document d16
Dump 16bit memory: d16 ADDRESS LENGTH
end

define d32
 x /$arg1w $arg0
end

document d32
Dump 32bit memory: d32 ADDRESS LENGTH 
end

define uhelp
 help user-defined
end

document uhelp
Help those who cannot RTFM such as those hard wary workers amongst us
:-)
end


#
# Dump the exception stack frame.
#

define dump-exception-sframe

 set $frsr = *(unsigned short *)((unsigned long)$sp + 2)
 set $frpc = *(unsigned long *)((unsigned long)$sp + 4)
 set $frfvo = *(unsigned short *)((unsigned long)$sp + 0)
 set $frcode = $frfvo >> 12
 set $frvect = ($frfvo & 0xFFF) >> 2
 printf "EXCEPTION -- SR:0x%X  PC:0x%X  FRAME:0x%x  VECTOR:%d\n", $frsr,
$frpc, $frcode, $frvect

end

document dump-exception-sframe
Dumps information about an exception stack frame.
end

define setup-and-load
  dir .
 initBoard5307C3
# load
# set $pc=start
end

#
# Main, execution starts here.
#
#target bdm /dev/bdmcf0
#setup-and-load

set print pretty
set print asm-demangle








More information about the users mailing list