Byte-order problems with GDB and BDM driver

Dario Alcocer dalcocer at
Wed Jun 21 07:04:51 UTC 2000

>>>>> "Eric" == Eric Norum <eric at> wrote:

    Eric> I use the gdb/BDM package on a Pentium PC (RedHat 6.1) with
    Eric> a Motorola MC68360 target with no problems.

>>>>> "Dario" == Dario Alcocer <dalcocer at> wrote:

    Dario>  This would mean that the driver is using cpu32_serial_clock()
    Dario> with your board, and cf_pe_serial_clock() with mine.  I wonder
    Dario> if this would make a difference?

>>>>> "Chris" == Chris Johns <cjohns at> writes:

    Chris> I doubt this is the issue. These routines are very low
    Chris> level. So you have a Coldfire target.  Which Coldfire
    Chris> processor ?

The 5307, using the Motorola Cadre III evaluation board (2 serial,
Ethernet, 16MB, 1MB flash.)  For what it's worth, I ran the 'chk' test 
application to make sure the libBDM.a archive was built correctly.

    Chris> Are you using m68k-elf ?


    Chris> What does your gdbinit script look like ?

Here's what I'm using to set up the board (symlinked to .gdbinit which 
is in the same directory as hello.exe):

    $ cat /usr/local/rtems/tools/gdb-4.18-bdm/gdbScripts/5307.gdb
    define setup-simregs
        set $mbar  = 0x10000001

        set $csar0 = 0x10000080
        set $csmr0 = 0x10000084
        set $cscr0 = 0x1000008a

        set $csar2 = 0x10000098
        set $csmr2 = 0x1000009c
        set $cscr2 = 0x100000a2

        set $csar3 = 0x100000a4
        set $csmr3 = 0x100000a8
        set $cscr3 = 0x100000ae

        set $dcr   = 0x10000100
        set $dacr0 = 0x10000108
        set $dmr0  = 0x1000010c
        set $dacr1 = 0x10000110
        set $dmr1  = 0x10000114
    define setup-cs
        set *((short*)$csar0) = 0xffe0
        set *((short*)$cscr0) = 0x1180
        set *((long* )$csmr0) = 0x000f0001

        set *((short*)$csar2) = 0x0000
        set *((long* )$csmr2) = 0x00ff0001
        set *((short*)$cscr2) = 0x0100
    define setup-dram
        set *((short*)$dcr)   = 0x822a
        set *((long* )$dacr0) = 0x00009404
        set *((long* )$dmr0)  = 0x007c0001
        set *((long* )$dacr1) = 0x00809404
        set *((long* )$dmr1)  = 0x007c0001
    target bdm /dev/bdmcf0

I copied the DRAM controller register values from the dBUG monitor
(upgraded from the shipped v2e.1a.1a version):

    Hard Reset
    DRAM Size: 16M

    Copyright 1995-1999 Motorola, Inc.  All Rights Reserved.
    ColdFire MCF5307 EVS Firmware v2e.1a.1c (Build 270 on Mar 10 2000 13:34:35)

    Enter 'help' for help.

    dBUG> ird
    Internal Modules, MBAR, located at 0x10000000
    dBUG> ird dramc
    Module: DRAMC
       DCR (DCR   ): 822A
     DACR0 (DACR0 ): 00009404
      DMR0 (DMR0  ): 007C0001
     DACR1 (DACR1 ): 00809404
      DMR1 (DMR1  ): 007C0001
    dBUG> ird cs
    Module: CS
     CSAR0 (CSAR0 ): FFE0
     CSMR0 (CSMR0 ): 000F0001
     CSCR0 (CSCR0 ): 1180
     CSAR1 (CSAR1 ): 7FFF
     CSMR1 (CSMR1 ): 00000000
     CSCR1 (CSCR1 ): 3DF8
     CSAR2 (CSAR2 ): 3000
     CSMR2 (CSMR2 ): 00070001
     CSCR2 (CSCR2 ): 0100
     CSAR3 (CSAR3 ): 4000
     CSMR3 (CSMR3 ): 000F0001
     CSCR3 (CSCR3 ): 0080
     CSAR4 (CSAR4 ): FFFF
     CSMR4 (CSMR4 ): 00000000
     CSCR4 (CSCR4 ): 3DF8
     CSAR5 (CSAR5 ): FFFF
     CSMR5 (CSMR5 ): 00000000
     CSCR5 (CSCR5 ): 3DF8
     CSAR6 (CSAR6 ): FFEF
     CSMR6 (CSMR6 ): 00000000
     CSCR6 (CSCR6 ): 3CF0
     CSAR7 (CSAR7 ): FFFF
     CSMR7 (CSMR7 ): 00000000
     CSCR7 (CSCR7 ): 3DF8

    Eric> What version of the gdb/BDM package are you using?

    Dario>  I'm using gdb-4.18, with the BDM and RTEMS patches applied:

    Chris> Could you try a later version of GDB BDM with GDB 5.0. I do
    Chris> not think an RTEMS patch exists for 5.0 yet, but the BDM
    Chris> package supports 5.0 and should work.

Sounds like a good idea.  I'll download gdb-5.0 and apply the latest
BDM patch.  If I can get it to work, I'll take a stab at re-doing the
RTEMS patch for gdb-5.0.  Thanks for the help!

Dario Alcocer // dalcocer at

More information about the users mailing list