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

Chris Johns <[email protected]> Tue, 29 Apr 2008 10:52:02 +1000
Newsgroups gmane.comp.hardware.motorola.microcontrollers.coldfire
Message-ID <[email protected]>
Mark Giacobbe wrote:
> Hi all -
> 
>    I'm trying to build gdb with bdm support for the Coldfire.  I'm not a 
> linux power user, but know enough to muddle my way through things.  I'm 
> using Fedora 8 (linux 2.6.24).
> 
>   I configured gdb 6.7 (--target=m68k-bdm-elf) and gdb seems to work.
> 

The configure command does not need the bdm part any more as there is no BDM 
patch for GDB. This means '--target=m68k-elf' should work. Then again the bdm 
part does not seem to hurt.

>   I then followed the README file in m68k-bdm-1.4-pre2 from 
> sourceforge.  It took a while to get the ioperm working, but it is 
> working so far (I can connect to my custom target board at least).
> 
>   But it will only work if I run m68k-bdm-elf-gdb as root.  This is how 
> I start:
> 
> [root@localhost bin]# ./m68k-bdm-elf-gdb
> GNU gdb 6.7
> Copyright (C) 2007 Free Software Foundation, Inc.
> License GPLv3+: GNU GPL version 3 or later 
> <http://gnu.org/licenses/gpl.html>
> This is free software: you are free to change and redistribute it.
> There is NO WARRANTY, to the extent permitted by law.  Type "show copying"
> and "show warranty" for details.
> This GDB was configured as "--host=i686-pc-linux-gnu --target=m68k-bdm-elf".
> 
> (gdb) target remote | m68k-bdm-gdbserver pipe /dev/bdmcf0
> Remote debugging using | m68k-bdm-gdbserver pipe /dev/bdmcf0
> m68k-bdm: architecture 68000 connected to /dev/bdmcf0
> m68k-bdm: Coldfire debug module version is 1 (5307/5407(e))
> Process /dev/bdmcf0 created; pid = 0
> 0xb6eb7912 in ?? ()
> (gdb)

Great.

> 
> And this is what I get if I try to use it from my regular account:
> [pcmadm@localhost bin]$ ./m68k-bdm-elf-gdb
> GNU gdb 6.7
> Copyright (C) 2007 Free Software Foundation, Inc.
> License GPLv3+: GNU GPL version 3 or later 
> <http://gnu.org/licenses/gpl.html>
> This is free software: you are free to change and redistribute it.
> There is NO WARRANTY, to the extent permitted by law.  Type "show copying"
> and "show warranty" for details.
> This GDB was configured as "--host=i686-pc-linux-gnu --target=m68k-bdm-elf".
> 
> (gdb) target remote | m68k-bdm-gdbserver pipe /dev/bdmcf0
> Remote debugging using | m68k-bdm-gdbserver pipe /dev/bdmcf0
> trying kernel driver: /dev/bdmcf0
> trying bdm server: localhost:/dev/bdmcf0
> Ignoring packet error, continuing...
> warning: unrecognized item "timeout" in "qSupported" response
> m68k-bdm: error: No such device or address
> m68k-bdm-gdbserver: Exiting
> Remote communication error: Resource temporarily unavailable.
> (gdb)
> 
> What do I have to change so I can run this from my regular user account?
> 

The ioperm system call requires the program run as root. If you run gdb as a 
normal user (which I recommend you do) we need to transfer to a root program 
somehow to make the ioperm call. The bdmd server does this. If you look at the 
doco (http://bdm.sourceforge.net/doc.html) for "Step 3: Installing the Server" 
you will see the steps needed to install the server.

FYI the server is just the same BDM code from the BDM library with a socket 
interface and protocol.

It would seem I have introduced a bug in the pre2 release with the handling of 
no server present. You should get a different message and not ones relating to 
'qSupport'.

Regards
Chris
---
[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.