Re: Help with building gdb with BDM support for the Coldfire

Chris Johns <[email protected]> Thu, 22 May 2008 11:10:09 +1000
Newsgroups gmane.comp.hardware.motorola.microcontrollers.coldfire
Message-ID <[email protected]>
Hi Mark,

I am starting to suspect the register cache again. I have someone else with a 
problem related to this. Looks like I need to fix it. I will see what I can do.

Regards
Chris

Mark Giacobbe wrote:
> Well I got your tarball and it seemed to work, but I still couldn't get 
> the memory stuff to work correctly.  So going back and re-re-re-reading 
> the README files, I realized that my gdb script was still of the old 
> version, and I wasn't obvious to me that I had to change my script.  I 
> attached the new gdb script below for everyone's reference.
> 
> #
> # gdb script for the MCF5307
> #
> 
> define addresses
> 
> echo \nSetup internal registers\n
> 
> set $mbar  = 0x10000001
> # Needed for the new bdm gdbserver
> monitor bdm-ctl-set 0xc0f 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 $icr10 = $mbar - 1 + 0x056
> set $icr11 = $mbar - 1 + 0x057
> 
> 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 + 0x0c4
> set $csar6 = $mbar - 1 + 0x0c6
> set $csmr6 = $mbar - 1 + 0x0d0
> 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
> 
> #
> #  Setup RAMBAR for the internal SRAM.
> #
> 
> define setup-sram
> 
> echo \nSetup internal SRAM\n
> 
> set $rambar  = 0x20000001
> # Needed for the new bdm gdbserver
> monitor bdm-ctl-set 0xc04 0x20000001
> end
> 
> 
> #
> #       Setup Parallel I/O ports...
> #
> 
> define setup-pp
> 
> echo \nSetup GPIO\n
> 
> set *((unsigned short *) $par) = 0x0100
> set *((unsigned short *) $paddr) = 0xb0ec
> set *((unsigned short *) $padat) = 0x76fd
> end
> 
> 
> #
> #  Setup chip selects...
> #
> 
> define setup-cs
> 
> echo \nSetup Chip Selects\n
> 
> # CS1
> set *((unsigned short *) $csar1) = 0xA080
> set *((unsigned long *) $csmr1)  = 0x00010047
> set *((unsigned short *) $cscr1) = 0x1540
> 
> # CS2
> set *((unsigned short *) $csar2) = 0xA004
> set *((unsigned long *) $csmr2)  = 0x00000047
> set *((unsigned short *) $cscr2) = 0x2940
> 
> # CS3
> set *((unsigned short *) $csar3) = 0x0070
> set *((unsigned long *) $csmr3)  = 0x00070047
> set *((unsigned short *) $cscr3) = 0x0970
> 
> # CS4
> set *((unsigned short *) $csar4) = 0xA090
> set *((unsigned long *) $csmr4)  = 0x00010047
> set *((unsigned short *) $cscr4) = 0x1DA0
> 
> # CS5
> set *((unsigned short *) $csar5) = 0xA000
> set *((unsigned long *) $csmr5)  = 0x00010047
> set *((unsigned short *) $cscr5) = 0x0D80
> 
> # CS6
> set *((unsigned short *) $csar6) = 0xA070
> set *((unsigned long *) $csmr6)  = 0x00010047
> set *((unsigned short *) $cscr6) = 0x0940
> 
> # CS7
> set *((unsigned short *) $csar7) = 0xA0C0
> set *((unsigned long *) $csmr7)  = 0x00030047
> set *((unsigned short *) $cscr7) = 0x0980
> 
> # CS0
> set *((unsigned short *) $csar0) = 0x0000
> set *((unsigned long *) $csmr0)  = 0x001f0047
> set *((unsigned short *) $cscr0) = 0x0500
> 
> end
> 
> #
> # Set up SDRAM
> #
> define setup-sdram
> 
> echo \nSetup SDRAM\n
> 
> # Power up sequence
> set *((unsigned short *) $dcr) = 0x8002
> set *((unsigned long *) $dacr0) = 0xB0001404
> set *((unsigned long *) $dmr0) = 0x01FC0001
> # Pre-charge sequence
> set *((unsigned long *) $dacr0) = 0xB000140C
> set *((unsigned long *) 0xB0000000) = 0xBEADDEED
> # Refresh Sequence
> echo \n     SDRAM refresh\n
> # Mode register init sequence
> set *((unsigned long *) $dacr0) = 0xB0009444
> set *((unsigned long *) 0xB0000400) = 0xB0009444
> set *((unsigned long *) $dacr0) = 0xB0009404
> 
> end
> 
> #
> # Some useful tools
> #
> 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
> 
> 
> #
> #       Init the target...
> #
> target remote | m68k-bdm-gdbserver pipe /dev/bdmcf0
> 
> echo\nResetting uP\n
> monitor bdm-reset
> addresses
> setup-sram
> setup-cs
> setup-pp
> setup-sdram
> 
> set print pretty
> set print asm-demangle
> display/i $pc
> select-frame 0
> 
> So is there any other "gotcha" that I have to look out for in my script?
> 
> I will continue testing, but things are looking a lot better then they were.
> 
> I am also documenting all of this.  When I am finished, I will post it 
> here, and if you want to Chris, you can include it in the distro for the 
> bdm.
> 
> Chris - feel free to include the above script in the distro for the bdm.
> 
> 
> Thanks for all of your help!
> Mark
> 
> On Tue, May 20, 2008 at 2:40 AM, Chris Johns <[email protected] 
> <mailto:[email protected]>> wrote:
> 
>     X-SpamDetect-Info: ------------- Start ASpam results ---------------
>     X-SpamDetect-Info: This message may be spam. This message BODY has
>     been altered to show you the spam information X-SpamDetect: *****:
>     5.664000 URL contains username and (optional) password=1.3,
>     From3consonants=0.3, URL contains username=2.9, Uses non-standard
>     port number for HTTP=1.3, X-Verify-SMTP present=0.6, Aspam=-0.8
> 
>     X-SpamDetect-Info: ------------- End ASpam results -----------------
> 
>     Mark Giacobbe wrote:
> 
>         Hi Chris -
> 
>          Did you find anything that I missed?
> 
> 
>     I do not think so. I have not test the 5307 code.
> 
>          And is there a trick to using cvs for sourceforge?  I tried
>         several times, and keep getting:
> 
>         [pcmadm@localhost ~]$  cvs
>         -d:pserver:[email protected]:/cvsroot/bdm login
>         Logging in to
>         :pserver:[email protected]:2401/cvsroot/bdm
>         <http://pserver:[email protected]:2401/cvsroot/bdm>
>         <http://pserver:[email protected]:2401/cvsroot/bdm>
>         CVS password:
>         cvs [login aborted]: connect to [bdm.cvs.sourceforge.net
>         <http://bdm.cvs.sourceforge.net>
>         <http://bdm.cvs.sourceforge.net>]:2401 failed: Connection timed out
> 
>         [pcmadm@localhost ~]$
> 
>         I hit "ENTER" for the password.
> 
> 
>     Do you have a firewall blocking this port ?
> 
>     I have uploaded a tarball of my CVS work area here:
> 
>      http://www.rtems.org/ftp/pub/rtems/people/chrisj/bdm/
> 
>     Can you try this code and let me know how it goes ?
> 
> 
>     Regards
>     Chris
>     ---
>     [email protected] <mailto:[email protected]>            
>      Send a post to the list.
>     [email protected] <mailto:[email protected]>      
>      Join the list.
>     [email protected] <mailto:[email protected]>  
>      Join the list in digest mode.
>     [email protected] <mailto:[email protected]>    
>     Leave the list.
> 
> 
> [email protected] Send a post to the list. 
> [email protected] Join the list. [email protected] 
> Join the list in digest mode. [email protected] Leave the list.
---
[email protected]              Send a post to the list.
[email protected]        Join the list.
[email protected]    Join the list in digest mode.
[email protected]     Leave the list.