Loading ...
Sorry, an error occurred while loading the content.

RE: Hi Tom...Re: gdb partially working with D-bug12 bdm pods

Expand Messages
  • tburrell@southwestmicrowave.com
    Sorry to be so long in responding, I ve been out sick. The stuff I was doing is for the Kevin Ross BDM, and soon the TBDML. I don t know anything about the
    Message 1 of 26 , Jun 1, 2005
    View Source
    • 0 Attachment
      Sorry to be so long in responding, I've been out sick.
      The stuff I was doing is for the Kevin Ross BDM, and soon the TBDML.
      I don't know anything about the debug 12.
      Tom

      -----Original Message-----
      From: br.professional [mailto:br_professional@...]
      Sent: Monday, April 25, 2005 2:30 AM
      To: gnu-m68hc11
      Subject: Hi Tom...Re: gdb partially working with D-bug12 bdm pods




      Hi Tom,

      Hi,
      With respect your message(msg: 5943) I would like to have some
      information about using
      gdb for MC9S12DP256 target. I am using the latest gdb tools(Release
      3.0) for HC11 on Linux host. My
      target is MC9S12DP256. I am trying debug my code running in my target
      through Debug12
      running in POD mode. But, I am unable to debug my code. Here are few
      attempts of mine to
      debug.

      Attempt1:
      =========
      #m6811-elf-gdb m.elf
      GNU gdb 6.2-m68hc1x-2004-08-01
      Copyright 2004 Free Software Foundation, Inc.
      GDB is free software, covered by the GNU General Public License, and
      you are welcome to change it and/or distribute copies of it under
      certain conditions. Type "show copying" to see the conditions. There is
      absolutely no warranty for GDB. Type "show warranty" for
      details. This GDB was configured as "--host=i686-linux --target=m6811-
      elf"...
      (gdb) set remotebaud 9600
      (gdb) set architecture m68hc12
      The target architecture is assumed to be m68hc12
      (gdb) target dbug /dev/ttyS1
      Remote target dbug connected to /dev/ttyS1
      0x00000000 in ?? ()
      (gdb) load m.elf
      Segmentation fault
      #


      Attempt2:
      =========
      #m6811-elf-gdb m.elf
      GNU gdb 6.2-m68hc1x-2004-08-01
      Copyright 2004 Free Software Foundation, Inc.
      GDB is free software, covered by the GNU General Public License, and
      you are welcome to change it and/or distribute copies of it under
      certain conditions. Type "show copying" to see the conditions. There is
      absolutely no warranty for GDB. Type "show warranty" for
      details. This GDB was configured as "--host=i686-linux --target=m6811-
      elf"...
      (gdb) set remotebaud 9600
      (gdb) set architecture m68hc12
      The target architecture is assumed to be m68hc12
      (gdb) target dbug /dev/ttyS1
      Remote target dbug connected to /dev/ttyS1
      0x00000000 in ?? ()
      (gdb) info registers
      PC=0x0000 SP=0x0003 FP=0x206e
      CCR=0x00 -------- u> != >= >
      D=0x0000 0 X=0xffffffff -1 Y=0x0000 0
      (gdb) list
      1 int main(void)
      2 {
      3 /* put your own code here */
      4
      5 asm("LDAA #5");
      6 asm("INCA");
      7 asm("INCA");
      8 asm("LDAB #0x07");
      9 asm("STAB 0x242");
      10 asm("LDAB #0");
      (gdb)
      11 asm("STAB 0x240");
      12
      13 return 0;
      14 }
      15
      (gdb) b 8
      Breakpoint 1 at 0x403d: file main.c, line 8.
      (gdb) run
      The program being debugged has been started already.
      Start it from the beginning? (y or n) y
      Starting program: /home/fr/bujji/gdb/m.elf

      Program received signal SIGTRAP, Trace/breakpoint trap. 0x00000000 in ??
      ()
      (gdb)


      My memory.x file looks this way.
      ================================

      MEMORY
      {
      page0 (rwx) : ORIGIN = 0x0, LENGTH = 256
      text (rx) : ORIGIN = 0x4000, LENGTH = 0x4000
      data : ORIGIN = 0x1000, LENGTH = 0x3000
      eeprom : ORIGIN = 0x800, LENGTH = 0x800
      vectors (rx): ORIGIN = 0xFF80, LENGTH = 0x80
      startvector (r) : ORIGIN = 0xFFFE, LENGTH = 2
      }

      /* Setup the stack on the top of the data internal ram (not used). */
      PROVIDE (_stack = 0x3FFF); PROVIDE (_io_ports = 0);

      According to your message in group(msg id 5943), it seems
      present gdb tool
      will not work as it is for MC9S12DP256 target. Is my understanding
      correct? If so please
      let me know so how can the gdb tool for this target. One more thing I
      am not using anykind
      of strtup code to create the object file which I am using for
      debugging. Will it matter?


      regards,
      br.


      --- In gnu-m68hc11@yahoogroups.com, tburrell@s... wrote:
      >
      >
      > -----Original Message-----
      > From: whitis [mailto:whitis@f...]
      > Sent: Thursday, February 03, 2005 7:13 AM
      > To: gnu-m68hc11
      > Subject: gdb partially working with D-bug12 bdm pods
      >
      >
      > I have gdb partially working on the MC9S12DP256 (HCS12 with PPAGE
      > register) with the D-bug12 v4.x based BDM pods.
      >
      > This is not heavily tested but since it is the first working remote
      bdm
      > pod driver for gdb that is capable of debugging programs >64K or
      that
      > use any of the external flash it is important to make it availible
      even
      > in is current state. I have tried every gdb command I normally use
      and
      > many I don't. They seem to work except as noted below.
      >
      > My attempts to set the number of registers earlier in the dbug pod
      > driver
      > didn't work because the crash actually happened before it reached
      that
      > point. So, though it is a crude hack, I forced the bank flag high
      in
      > elf_flags. This could adversely affect those trying to use older
      HC12
      > cpus with no ppage register; someone needs to fix the bug in gcc/ld
      that
      > causes that flag to not be set in the first place so we can
      eliminate
      > this
      > hack. The code I posted here before worked ok - it was simply
      > necessary
      > to fix/workaround some existing bugs in gdb.
      >
      > Reading memory properly sets and then restores the PPAGE register.
      The
      > disassemble command works for code in bank switched flash. Setting
      > breakpoints in flash works.
      >
      > Be aware that there are two versions of the PC register
      > $pc - synthetic 32 bit register that contains the gcc/gdb
      address
      > corresponding to the PPAGE:PC if pointing to external
      > flash.
      > $ppc = processor (raw) PC register. 16 bits.
      > $page = processor PPAGE register 8 bits.
      >
      > I will assume you know enough to replace "/dev/ttyUSB0" with the
      > appropriate port on your system and the name of your program.
      >
      > The following commands must be given:
      > # Load program using srec9s12 first.
      > m6811-elf-objcopy --verbose --output-target=srec
      pintest_load.elf \
      > pintest_intermediate.s19
      > srec9s12 <pintest_intermediate.s19 >pintest_load.s19
      > srec9s12 --send_to_pod --pod_port=/dev/ttyUSB0 \
      > --input_file=pintest_load.s19 --srec_bytes=16 --
      delay_interval=1
      > \
      > --input_map=3
      > m6811-elf-gdb pintest_load.elf
      > (gdb) set architecture m68hc12 (REQUIRED even if elf file
      loaded)
      > (gdb) set remotebaud 115200
      > (gdb) target dbugS12 /dev/ttyUSB0
      >
      > To start your program (after doing above)
      > (gdb) pod reset
      > (gdb) pod nobr // remove any leftover breakpoints on
      pod
      > (gdb) delete // remove any leftover breakpoints
      > // due to gdb bugs
      > (gdb) display/i $pc
      > (gdb) break main
      > (gdb) run
      > (breakpoint reached)
      > (gdb) clear main
      > (gdb) break emstdio_fputc
      > (gdb) cont
      > (breakpoint reached)
      > (gdb) print $ccr |= 0x10 // disable interrupts
      > (gdb) nexti // singlestep cpu instructions
      > (gdb) nexti
      > (gdb) nexti
      > (gdb) nexti
      > (gdb0 next // singlestep source lines
      > (gdb) next
      > (gdb) next
      > n
      > You don't have to stop at main as shown above before setting a
      > breakpoint somewhere eles.
      >
      > Two commands have been added to gdb: "pod" and "addrcalc9s12".
      >
      > Some useful commands:
      > set debug remote 1 // print commands sent to pod and responses
      > set debug remote 0 // turn back off
      > info program // display information about program
      > break main // set breakpoint at main()
      > info breakpoints // show breakpoints
      > clear main // clear breakpoint at main()
      > delete 1 // delete breakpoint 1
      > delete // delete all breakpoints
      > x/i $pc // show current instruction
      > display/i $pc // show current instruction each time
      program
      > stops
      > print/x $ppc // show hardware PC register
      > print/x $pc // show synthetic PC register
      > print/x $page // show PPAGE register
      > print/x $d // show D register
      > print/x $x // show X register
      > print/x $y // show Y register
      > print/x $sp // show SP register
      > print $page=0x37 // set ppage register
      > // similarly for other registers hex
      >
      > x/xh $x // show 16 bit value pointed to by X register
      > x/xw $x // show 32 bit value pointed to by X register
      > x/xb $x // show 8 bit value pointed to by X register
      > x/10xb $x // show ten 8 bit values pointed to by X
      register
      > x/256xb 0x4000 // show 256 bytes at address 0x4000 (in gcc
      > address
      > space, not banked)
      > cont // start/continue program
      > step // execute next line of source code
      > next // execute next line of source code, but
      don't
      > // trace into subroutine calls
      > stepi // execute next instruction
      > nexti // execute next instruction but don't
      > // trace into subroutine calls
      > until // try this at the bottom of a loop
      > list // show source code near $pc
      > where // stack trace
      > info frame // current stack frame info
      > info locals // show all local variables in current
      function
      > run // start program over from begining
      > print $ccr |= 0x10 // disable interrupts
      > print bar // show value of variable bar
      > print bar=123 // set value of variable bar
      > print foo(1,2,3) // run subroutine foo -- broken
      > disass foo // disassemble subroutine foo
      > info target // displays information on the various memory
      > // sections
      > where // broken
      > up // broken
      > down // broken
      > set output-radix 16
      > set input-radix 16
      > New command: "pod":
      > pod command // execute command on pod and print results
      > // up to 1023 characters
      > pod reset // resset target
      > pod rd // display registers in D-bug12 format
      instead
      > // of gdb format
      > pod help // DON'T DO THIS
      > pod ALTCLK 24000 // set alternate BDM frequency
      > pod stop // stop program
      > // may want to do "x/i $pc" afterwards
      >
      > New command: addrcalc9s12:
      > addrcalc9s12 cpu16 4000 // convert memory address
      > addrcalc9s12 banked 3E8000 // convert memory address
      > addrcalc9s12 mot_linear F4000 // convert memory address
      > addrcalc9s12 offset10000 104000 // convert memory address
      > addrcalc9s12 help
      > For example:
      > (gdb) addrcalc9s12 banked 3E89AB
      > CPU16: 49AB
      > Banked: 3E89AB
      > Motorola Linear:: F89AB
      > Offset10000: : 1089AB
      >
      > Addrcalc9s12 is also availible as a standalone program as part of
      the
      > srec9s12 package.
      >
      > Macro tricks:
      > The following commands will result in a register display each
      time
      > the system stops.
      > define hook-stop
      > pod rd
      > end
      > for some reason, "info registers" doesn't work in that macro
      > Pressing carriage return will repeat the last command. This is
      > particularly useful for step, next, stepi, nexti.
      >
      > Beware of executing any pod commands that may interfere with gdb;
      for
      > example, tampering with breakpoints could cause trouble. Any
      command
      > that does not return to a prompt could cause trouble. Commands
      such as
      > "pod help" that print what look like prompt characters can cause
      > trouble.
      >
      > If you are debugging a program that has interrupts, you may be
      surprised
      > to see next, step, nexti, and stepi proceed into the interrupt
      service
      > routine instead of the function you were debugging (at least that
      > happens using the trace instruction when using
      > d-bug12 by itself). After hitting a breakpoint, you may
      > want to issue the command:
      > print ccr |= 0x10
      > to disable interrupts.
      >
      > The stepi and step commands use the bdm pod trace command so they
      > do not require a breakpoint. However, next and nexti sometimes
      > require a breakpoint, depending on whether they encounter a
      subroutine
      > call. If you are short on breakpoints, try using step/stepi
      instead of
      > next/nexti where possible.
      >
      > Known Problems:
      > - Can't load programs. Use srec9s12 for that before starting gdb.
      > This is an exteremely low priority to fix since there is already
      > a means to load programs and it is not trivial to make loading
      > work given the flow control bugs in all known USB to serial
      adapters
      >
      > and the small receive buffer in D-bug12.
      >
      > - Printing $a and $b is broken but $d works
      >
      > - pod only supports two breakpoints.
      >
      > - next and nexti may use either trace or breakpoint commands.
      That
      > means if it needs to jump over a call instruction, it will use
      > a breakpoint. If both hardware breakpoints are in use, it will
      > fail to stop at the appointed line.
      >
      > - If more than two breakpoints are needed (including those needed
      > by "next" or "nexti" commands), it will fail to set one of the
      > breakpoints without reporting an error.
      >
      > - can't modify eeprom (but you can call a subroutine in the
      > target system that does)
      >
      > - can't modify flash
      >
      > - "where" command only shows current function many times instead
      of
      > progressing up the stack. "up" has similar problems.
      > This is probably a bug in m68hc11-tdep.c.
      > Perhaps it is getting confused by the extra byte in the return
      > address. It could also be that the target program was
      compiled
      > -fomit-frame-pointer. Actually, looks like there is a similar
      > problem on a program compiled without omit-frame-pointer.
      >
      > - may not work on older HCS12 cpus that don't support PPAGE
      > due to forcing
      > elf_flags |= E_M68HC12_BANKS;
      > in m68hc11-tdep.c
      >
      > - gdb will restore certain breakpoints if you delete them.
      >
      > - do not use the pod command (i.e. "pod reset") before issuing
      > the target command or gdb will segfault.
      >
      > - "interrupt" does not work.
      >
      > - I did find one place where gdb seemed to get hung up on a next
      > instruction. It appears that it was confused by the processor
      > being in the run state. Control-C followed by "pod stop"
      helped.
      >
      > - calling a function on the target system using the print command
      > does not work properly. I think GDB is doing a near call
      > to far functions. This is not a driver bug, it is a CPU support
      > bug. Functions with trampolines will probably work if you
      > give the name of the trampoline.
      > m68hc11_push_dummy_call looks suspect. It always pushes
      > 16 bits for the return address. This would be easy to correct
      > if I knew how to tell if the called function was near or far.
      >
      > Before running gdb:
      > - resetting the pod is recommended
      > Existing breakpoints or the
      > processor being in the run state will cause trouble for gdb.
      >
      > - make sure you don't have any other programs (such as
      > a terminal emulator) running on the same serial port.
      > Otherise, gdb will either not be able to open the port
      > or it will succeed but the other program will steal messages
      > intended for gdb.
      >
      > - make sure the pod is running D-bug12 v4.x
      >
      > - make sure the pod is in BDM mode
      >
      > - make sure the pod baud rate has been set permanently to 115200
      >
      > - make sure the pod has been set to the right xtal frequency
      > for the the target system. Also, set ALTCLK if your
      > target uses the PLL.
      >
      > - if you have two breakpoints set and try to use
      > next/step/etc. program execution will continue past
      > current line.
      >
      > - load your program into the pod using srec9s12
      >
      > - running functions on the target using the print command
      > that take string parameters requires that the target
      > code have a malloc function. I.E.
      > print printf("hello, world\r\n");
      >
      > - there is no exception handling for when the pod gets into
      > funny states: Running when it should be stopped, asking
      > how to handle a target communications failure, stuck mid
      > upload, etc.
      >
      > - remember that you can run m6811-elf-gdb under gdb.
      > If there is a segfault, use "where" to do a stack dump.
      > Also, you can use the "ulimit -c unlimited" command at the
      > shell prompt to enable core dumps on unix systems
      > which can be examined with the debugger later.
      >
      > - If you have trouble on a USB to serial adapter, try using a
      legacy
      > serial port.
      >
      > If you have programs which take 16 bit pointers to a particular
      memory
      > section in banked memory (for example, all of a particular type of
      > readonly data structure has been moved to the same bank to save
      space in
      > non-paged flash), don't expect things like
      > print *p
      > to work. This is not a problem with this driver. Limitations
      > in gcc, ld, and gdb prevent this. You will need to do some
      > fancy arithmatic and casting in your print command to translate
      > the pointer. If you step through your code until it sets
      > the appropriate ppage register value, then it might display
      properly.
      > You could call a function on the target cpu to print the function
      on the
      > serial port except that such function calls from the
      > debugger are currently broken. You can use the addrcalc9s12
      command
      > added to gdb to calculate the address and then cast that to a
      pointer of
      > the approriate type:
      > i.e. for page=37, pointer=89ab
      > addrcalc9s12 banked 3E89AB
      > print *(foo_t *) 0x1089AB
      >
      > Troubleshooting:
      > - try using control-c to exit any gdb commands that are hung up
      > and try issuing some commands to the pod such as "pod rd",
      > "pod stop", "pod nobr", and "pod reset".
      > - set debug remote 1
      > - use a terminal emulator to talk to the pod to see if
      > it is having problems communicating with target
      > - Make sure you don't have a terminal emulator running
      > concurrently with gdb on the same port
      > - make sure you have the same version of the program loaded
      > in gdb and the target.
      > - exit gdb, reset target cpu and pod, and restart gdb
      >
      > You may use DDD, KDevelop, etc. as a GUI front end to gdb.
      >
      > These patches were made against the prerelease 2.91 version of
      > m6811-elf-gdb.
      >
      > To compile:
      >
      > patch <patchile
      > cd gdb6.0/gdb
      > /configure --target=m6811-elf --prefix=/usr/bin \
      > --program-prefix=m6811-elf- --host=i686-pc-linux-gnu
      > make
      > make install
      >
      > srec9s12 is availible from
      > http://www.freelabs.com/~whitis/software/srec9s12
      >
      > The first parameter is normally passed in the D register, additional
      > paramters are passed on the stack. The return value is also passed
      > in the D register.
      >
      > --
      > Mark Whitis http://www.freelabs.com/~whitis/ NO SPAM
      > Author of many open source software packages.
      > Coauthor: Linux Programming Unleashed (1st Edition)
      >
      >
      >
      > To Post a message, send it to: gnu-m68hc11@e...
      >
      > To Unsubscribe, send a blank message to:
      > gnu-m68hc11-unsubscribe@e...
      > Yahoo! Groups Links





      To Post a message, send it to: gnu-m68hc11@...

      To Unsubscribe, send a blank message to:
      gnu-m68hc11-unsubscribe@...
      Yahoo! Groups Links
    • Tom Burrell
      Folks, Where did the Download link go? I am working on a different computer and I came Here to click on the second Gnu at the top of the page to get to the
      Message 2 of 26 , Jun 4, 2005
      View Source
      • 0 Attachment
        Folks,
        Where did the Download link go? I am working on a different computer
        and I came Here to click on the second Gnu at the top of the page to
        get to the software page and it is gone.

        Can anyone send me a new link to the page?
        Thanks,
        Tom
      • Jefferson Smith
        ... I think you are talking about http://m68hc11.serveftp.org/ I hope you found it, since you re the latest news there. If I know what you mean, the second
        Message 3 of 26 , Jun 6, 2005
        View Source
        • 0 Attachment
          --- In gnu-m68hc11@yahoogroups.com, "Tom Burrell" <tburrell@s...> wrote:
          > Folks,
          > Where did the Download link go? I am working on a different computer
          > and I came Here to click on the second Gnu at the top of the page to
          > get to the software page and it is gone.
          >
          > Can anyone send me a new link to the page?
          > Thanks,
          > Tom

          I think you are talking about
          http://m68hc11.serveftp.org/

          I hope you found it, since you're the latest news there.
          If I know what you mean, the "second Gnu at the top of the page" is
          not a link, so click the first one.
        • tburrell@southwestmicrowave.com
          Thanks, tom ... From: imajeffs [mailto:imajeffs@hotmail.com] Sent: Monday, June 06, 2005 7:42 AM To: gnu-m68hc11 Subject: Re: Where did the link info go? ... I
          Message 4 of 26 , Jun 6, 2005
          View Source
          • 0 Attachment
            Thanks,
            tom

            -----Original Message-----
            From: imajeffs [mailto:imajeffs@...]
            Sent: Monday, June 06, 2005 7:42 AM
            To: gnu-m68hc11
            Subject: Re: Where did the link info go?


            --- In gnu-m68hc11@yahoogroups.com, "Tom Burrell" <tburrell@s...> wrote:
            > Folks,
            > Where did the Download link go? I am working on a different computer
            > and I came Here to click on the second Gnu at the top of the page to
            > get to the software page and it is gone.
            >
            > Can anyone send me a new link to the page?
            > Thanks,
            > Tom

            I think you are talking about
            http://m68hc11.serveftp.org/

            I hope you found it, since you're the latest news there.
            If I know what you mean, the "second Gnu at the top of the page" is not
            a link, so click the first one.





            To Post a message, send it to: gnu-m68hc11@...

            To Unsubscribe, send a blank message to:
            gnu-m68hc11-unsubscribe@...
            Yahoo! Groups Links
          • puja1983_mishra
            Hi, I read this message.You have mentioned we can use ddd for gui support to M6811-elf-gdb.You have mentioned about some patch.I will be thankful to u if u can
            Message 5 of 26 , Jun 22, 2005
            View Source
            • 0 Attachment
              Hi,

              I read this message.You have mentioned we can use ddd for gui support
              to M6811-elf-gdb.You have mentioned about some patch.I will be
              thankful to u if u can clarify on this patch subject.

              i mean how i can get the patch and the complete procedure how to
              build the m6811-elf-gdb with ddd as gui support/

              With regards

              linux_bud



              --- In gnu-m68hc11@yahoogroups.com, tburrell@s... wrote:
              >
              >
              > -----Original Message-----
              > From: whitis [mailto:whitis@f...]
              > Sent: Thursday, February 03, 2005 7:13 AM
              > To: gnu-m68hc11
              > Subject: gdb partially working with D-bug12 bdm pods
              >
              >
              > I have gdb partially working on the MC9S12DP256 (HCS12 with PPAGE
              > register) with the D-bug12 v4.x based BDM pods.
              >
              > This is not heavily tested but since it is the first working remote
              bdm
              > pod driver for gdb that is capable of debugging programs >64K or
              that
              > use any of the external flash it is important to make it availible
              even
              > in is current state. I have tried every gdb command I normally use
              and
              > many I don't. They seem to work except as noted below.
              >
              > My attempts to set the number of registers earlier in the dbug pod
              > driver
              > didn't work because the crash actually happened before it reached
              that
              > point. So, though it is a crude hack, I forced the bank flag high
              in
              > elf_flags. This could adversely affect those trying to use older
              HC12
              > cpus with no ppage register; someone needs to fix the bug in gcc/ld
              that
              > causes that flag to not be set in the first place so we can
              eliminate
              > this
              > hack. The code I posted here before worked ok - it was simply
              > necessary
              > to fix/workaround some existing bugs in gdb.
              >
              > Reading memory properly sets and then restores the PPAGE register.
              The
              > disassemble command works for code in bank switched flash. Setting
              > breakpoints in flash works.
              >
              > Be aware that there are two versions of the PC register
              > $pc - synthetic 32 bit register that contains the gcc/gdb
              address
              > corresponding to the PPAGE:PC if pointing to external
              > flash.
              > $ppc = processor (raw) PC register. 16 bits.
              > $page = processor PPAGE register 8 bits.
              >
              > I will assume you know enough to replace "/dev/ttyUSB0" with the
              > appropriate port on your system and the name of your program.
              >
              > The following commands must be given:
              > # Load program using srec9s12 first.
              > m6811-elf-objcopy --verbose --output-target=srec
              pintest_load.elf \
              > pintest_intermediate.s19
              > srec9s12 <pintest_intermediate.s19 >pintest_load.s19
              > srec9s12 --send_to_pod --pod_port=/dev/ttyUSB0 \
              > --input_file=pintest_load.s19 --srec_bytes=16 --
              delay_interval=1
              > \
              > --input_map=3
              > m6811-elf-gdb pintest_load.elf
              > (gdb) set architecture m68hc12 (REQUIRED even if elf file
              loaded)
              > (gdb) set remotebaud 115200
              > (gdb) target dbugS12 /dev/ttyUSB0
              >
              > To start your program (after doing above)
              > (gdb) pod reset
              > (gdb) pod nobr // remove any leftover breakpoints on
              pod
              > (gdb) delete // remove any leftover breakpoints
              > // due to gdb bugs
              > (gdb) display/i $pc
              > (gdb) break main
              > (gdb) run
              > (breakpoint reached)
              > (gdb) clear main
              > (gdb) break emstdio_fputc
              > (gdb) cont
              > (breakpoint reached)
              > (gdb) print $ccr |= 0x10 // disable interrupts
              > (gdb) nexti // singlestep cpu instructions
              > (gdb) nexti
              > (gdb) nexti
              > (gdb) nexti
              > (gdb0 next // singlestep source lines
              > (gdb) next
              > (gdb) next
              > n
              > You don't have to stop at main as shown above before setting a
              > breakpoint somewhere eles.
              >
              > Two commands have been added to gdb: "pod" and "addrcalc9s12".
              >
              > Some useful commands:
              > set debug remote 1 // print commands sent to pod and responses
              > set debug remote 0 // turn back off
              > info program // display information about program
              > break main // set breakpoint at main()
              > info breakpoints // show breakpoints
              > clear main // clear breakpoint at main()
              > delete 1 // delete breakpoint 1
              > delete // delete all breakpoints
              > x/i $pc // show current instruction
              > display/i $pc // show current instruction each time
              program
              > stops
              > print/x $ppc // show hardware PC register
              > print/x $pc // show synthetic PC register
              > print/x $page // show PPAGE register
              > print/x $d // show D register
              > print/x $x // show X register
              > print/x $y // show Y register
              > print/x $sp // show SP register
              > print $page=0x37 // set ppage register
              > // similarly for other registers
              > hex
              >
              > x/xh $x // show 16 bit value pointed to by X register
              > x/xw $x // show 32 bit value pointed to by X register
              > x/xb $x // show 8 bit value pointed to by X register
              > x/10xb $x // show ten 8 bit values pointed to by X
              register
              > x/256xb 0x4000 // show 256 bytes at address 0x4000 (in gcc
              > address
              > space, not banked)
              > cont // start/continue program
              > step // execute next line of source code
              > next // execute next line of source code, but
              don't
              > // trace into subroutine calls
              > stepi // execute next instruction
              > nexti // execute next instruction but don't
              > // trace into subroutine calls
              > until // try this at the bottom of a loop
              > list // show source code near $pc
              > where // stack trace
              > info frame // current stack frame info
              > info locals // show all local variables in current
              function
              > run // start program over from begining
              > print $ccr |= 0x10 // disable interrupts
              > print bar // show value of variable bar
              > print bar=123 // set value of variable bar
              > print foo(1,2,3) // run subroutine foo -- broken
              > disass foo // disassemble subroutine foo
              > info target // displays information on the various memory
              > // sections
              > where // broken
              > up // broken
              > down // broken
              > set output-radix 16
              > set input-radix 16
              > New command: "pod":
              > pod command // execute command on pod and print results
              > // up to 1023 characters
              > pod reset // resset target
              > pod rd // display registers in D-bug12 format
              instead
              > // of gdb format
              > pod help // DON'T DO THIS
              > pod ALTCLK 24000 // set alternate BDM frequency
              > pod stop // stop program
              > // may want to do "x/i $pc" afterwards
              >
              > New command: addrcalc9s12:
              > addrcalc9s12 cpu16 4000 // convert memory address
              > addrcalc9s12 banked 3E8000 // convert memory address
              > addrcalc9s12 mot_linear F4000 // convert memory address
              > addrcalc9s12 offset10000 104000 // convert memory address
              > addrcalc9s12 help
              > For example:
              > (gdb) addrcalc9s12 banked 3E89AB
              > CPU16: 49AB
              > Banked: 3E89AB
              > Motorola Linear:: F89AB
              > Offset10000: : 1089AB
              >
              > Addrcalc9s12 is also availible as a standalone program as part of
              the
              > srec9s12 package.
              >
              > Macro tricks:
              > The following commands will result in a register display each
              time
              > the system stops.
              > define hook-stop
              > pod rd
              > end
              > for some reason, "info registers" doesn't work in that macro
              > Pressing carriage return will repeat the last command. This is
              > particularly useful for step, next, stepi, nexti.
              >
              > Beware of executing any pod commands that may interfere with gdb;
              for
              > example, tampering with breakpoints could cause trouble. Any
              command
              > that does not return to a prompt could cause trouble. Commands
              such as
              > "pod help" that print what look like prompt characters can cause
              > trouble.
              >
              > If you are debugging a program that has interrupts, you may be
              surprised
              > to see next, step, nexti, and stepi proceed into the interrupt
              service
              > routine instead of the function you were debugging (at least that
              > happens using the trace instruction when using
              > d-bug12 by itself). After hitting a breakpoint, you may
              > want to issue the command:
              > print ccr |= 0x10
              > to disable interrupts.
              >
              > The stepi and step commands use the bdm pod trace command so they
              > do not require a breakpoint. However, next and nexti sometimes
              > require a breakpoint, depending on whether they encounter a
              subroutine
              > call. If you are short on breakpoints, try using step/stepi
              instead of
              > next/nexti where possible.
              >
              > Known Problems:
              > - Can't load programs. Use srec9s12 for that before starting gdb.
              > This is an exteremely low priority to fix since there is already
              > a means to load programs and it is not trivial to make loading
              > work given the flow control bugs in all known USB to serial
              adapters
              >
              > and the small receive buffer in D-bug12.
              >
              > - Printing $a and $b is broken but $d works
              >
              > - pod only supports two breakpoints.
              >
              > - next and nexti may use either trace or breakpoint commands.
              That
              > means if it needs to jump over a call instruction, it will use
              > a breakpoint. If both hardware breakpoints are in use, it will
              > fail to stop at the appointed line.
              >
              > - If more than two breakpoints are needed (including those needed
              > by "next" or "nexti" commands), it will fail to set one of the
              > breakpoints without reporting an error.
              >
              > - can't modify eeprom (but you can call a subroutine in the
              > target system that does)
              >
              > - can't modify flash
              >
              > - "where" command only shows current function many times instead
              of
              > progressing up the stack. "up" has similar problems.
              > This is probably a bug in m68hc11-tdep.c.
              > Perhaps it is getting confused by the extra byte in the return
              > address. It could also be that the target program was
              compiled
              > -fomit-frame-pointer. Actually, looks like there is a similar
              > problem on a program compiled without omit-frame-pointer.
              >
              > - may not work on older HCS12 cpus that don't support PPAGE
              > due to forcing
              > elf_flags |= E_M68HC12_BANKS;
              > in m68hc11-tdep.c
              >
              > - gdb will restore certain breakpoints if you delete them.
              >
              > - do not use the pod command (i.e. "pod reset") before issuing
              > the target command or gdb will segfault.
              >
              > - "interrupt" does not work.
              >
              > - I did find one place where gdb seemed to get hung up on a next
              > instruction. It appears that it was confused by the processor
              > being in the run state. Control-C followed by "pod stop"
              helped.
              >
              > - calling a function on the target system using the print command
              > does not work properly. I think GDB is doing a near call
              > to far functions. This is not a driver bug, it is a CPU support
              > bug. Functions with trampolines will probably work if you
              > give the name of the trampoline.
              > m68hc11_push_dummy_call looks suspect. It always pushes
              > 16 bits for the return address. This would be easy to correct
              > if I knew how to tell if the called function was near or far.
              >
              > Before running gdb:
              > - resetting the pod is recommended
              > Existing breakpoints or the
              > processor being in the run state will cause trouble for gdb.
              >
              > - make sure you don't have any other programs (such as
              > a terminal emulator) running on the same serial port.
              > Otherise, gdb will either not be able to open the port
              > or it will succeed but the other program will steal messages
              > intended for gdb.
              >
              > - make sure the pod is running D-bug12 v4.x
              >
              > - make sure the pod is in BDM mode
              >
              > - make sure the pod baud rate has been set permanently to 115200
              >
              > - make sure the pod has been set to the right xtal frequency
              > for the the target system. Also, set ALTCLK if your
              > target uses the PLL.
              >
              > - if you have two breakpoints set and try to use
              > next/step/etc. program execution will continue past
              > current line.
              >
              > - load your program into the pod using srec9s12
              >
              > - running functions on the target using the print command
              > that take string parameters requires that the target
              > code have a malloc function. I.E.
              > print printf("hello, world\r\n");
              >
              > - there is no exception handling for when the pod gets into
              > funny states: Running when it should be stopped, asking
              > how to handle a target communications failure, stuck mid
              > upload, etc.
              >
              > - remember that you can run m6811-elf-gdb under gdb.
              > If there is a segfault, use "where" to do a stack dump.
              > Also, you can use the "ulimit -c unlimited" command at the
              > shell prompt to enable core dumps on unix systems
              > which can be examined with the debugger later.
              >
              > - If you have trouble on a USB to serial adapter, try using a
              legacy
              > serial port.
              >
              > If you have programs which take 16 bit pointers to a particular
              memory
              > section in banked memory (for example, all of a particular type of
              > readonly data structure has been moved to the same bank to save
              space in
              > non-paged flash), don't expect things like
              > print *p
              > to work. This is not a problem with this driver. Limitations
              > in gcc, ld, and gdb prevent this. You will need to do some
              > fancy arithmatic and casting in your print command to translate
              > the pointer. If you step through your code until it sets
              > the appropriate ppage register value, then it might display
              properly.
              > You could call a function on the target cpu to print the function
              on the
              > serial port except that such function calls from the
              > debugger are currently broken. You can use the addrcalc9s12
              command
              > added to gdb to calculate the address and then cast that to a
              pointer of
              > the approriate type:
              > i.e. for page=37, pointer=89ab
              > addrcalc9s12 banked 3E89AB
              > print *(foo_t *) 0x1089AB
              >
              > Troubleshooting:
              > - try using control-c to exit any gdb commands that are hung up
              > and try issuing some commands to the pod such as "pod rd",
              > "pod stop", "pod nobr", and "pod reset".
              > - set debug remote 1
              > - use a terminal emulator to talk to the pod to see if
              > it is having problems communicating with target
              > - Make sure you don't have a terminal emulator running
              > concurrently with gdb on the same port
              > - make sure you have the same version of the program loaded
              > in gdb and the target.
              > - exit gdb, reset target cpu and pod, and restart gdb
              >
              > You may use DDD, KDevelop, etc. as a GUI front end to gdb.
              >
              > These patches were made against the prerelease 2.91 version of
              > m6811-elf-gdb.
              >
              > To compile:
              >
              > patch <patchile
              > cd gdb6.0/gdb
              > /configure --target=m6811-elf --prefix=/usr/bin \
              > --program-prefix=m6811-elf- --host=i686-pc-linux-gnu
              > make
              > make install
              >
              > srec9s12 is availible from
              > http://www.freelabs.com/~whitis/software/srec9s12
              >
              > The first parameter is normally passed in the D register, additional
              > paramters are passed on the stack. The return value is also passed
              > in the D register.
              >
              > --
              > Mark Whitis http://www.freelabs.com/~whitis/ NO SPAM
              > Author of many open source software packages.
              > Coauthor: Linux Programming Unleashed (1st Edition)
              >
              >
              >
              > To Post a message, send it to: gnu-m68hc11@e...
              >
              > To Unsubscribe, send a blank message to:
              > gnu-m68hc11-unsubscribe@e...
              > Yahoo! Groups Links
            • Ioan Petrescu
              Hi, In order to use ddd with gdb, you have nothing to do specially; only the command is necessary: ddd --debug m6811-elf-gdb myfile.elf ddd is only an
              Message 6 of 26 , Jun 22, 2005
              View Source
              • 0 Attachment
                Hi,
                In order to use ddd with gdb, you have nothing to do specially; only
                the command is necessary:
                ddd --debug m6811-elf-gdb myfile.elf
                ddd is only an interface and call gdb as a subprocess.
                Once you are in ddd, type in the command window all the known commands
                to configure gdb and load files
                Regards,
                IP
                ----- Original Message -----
                From: "puja1983_mishra" <puja1983_mishra@...>
                To: <gnu-m68hc11@yahoogroups.com>
                Sent: Wednesday, June 22, 2005 12:06 PM
                Subject: Re: gdb partially working with D-bug12 bdm pods


                > Hi,
                >
                > I read this message.You have mentioned we can use ddd for gui support
                > to M6811-elf-gdb.You have mentioned about some patch.I will be
                > thankful to u if u can clarify on this patch subject.
                >
                > i mean how i can get the patch and the complete procedure how to
                > build the m6811-elf-gdb with ddd as gui support/
                >
                > With regards
                >
                > linux_bud
                >
                >
                >
                > --- In gnu-m68hc11@yahoogroups.com, tburrell@s... wrote:
                > >
                > >
                > > -----Original Message-----
                > > From: whitis [mailto:whitis@f...]
                > > Sent: Thursday, February 03, 2005 7:13 AM
                > > To: gnu-m68hc11
                > > Subject: gdb partially working with D-bug12 bdm pods
                > >
                > >
                > > I have gdb partially working on the MC9S12DP256 (HCS12 with PPAGE
                > > register) with the D-bug12 v4.x based BDM pods.
                > >
                > > This is not heavily tested but since it is the first working remote
                > bdm
                > > pod driver for gdb that is capable of debugging programs >64K or
                > that
                > > use any of the external flash it is important to make it availible
                > even
                > > in is current state. I have tried every gdb command I normally use
                > and
                > > many I don't. They seem to work except as noted below.
                > >
                > > My attempts to set the number of registers earlier in the dbug pod
                > > driver
                > > didn't work because the crash actually happened before it reached
                > that
                > > point. So, though it is a crude hack, I forced the bank flag high
                > in
                > > elf_flags. This could adversely affect those trying to use older
                > HC12
                > > cpus with no ppage register; someone needs to fix the bug in gcc/ld
                > that
                > > causes that flag to not be set in the first place so we can
                > eliminate
                > > this
                > > hack. The code I posted here before worked ok - it was simply
                > > necessary
                > > to fix/workaround some existing bugs in gdb.
                > >
                > > Reading memory properly sets and then restores the PPAGE register.
                > The
                > > disassemble command works for code in bank switched flash. Setting
                > > breakpoints in flash works.
                > >
                > > Be aware that there are two versions of the PC register
                > > $pc - synthetic 32 bit register that contains the gcc/gdb
                > address
                > > corresponding to the PPAGE:PC if pointing to external
                > > flash.
                > > $ppc = processor (raw) PC register. 16 bits.
                > > $page = processor PPAGE register 8 bits.
                > >
                > > I will assume you know enough to replace "/dev/ttyUSB0" with the
                > > appropriate port on your system and the name of your program.
                > >
                > > The following commands must be given:
                > > # Load program using srec9s12 first.
                > > m6811-elf-objcopy --verbose --output-target=srec
                > pintest_load.elf \
                > > pintest_intermediate.s19
                > > srec9s12 <pintest_intermediate.s19 >pintest_load.s19
                > > srec9s12 --send_to_pod --pod_port=/dev/ttyUSB0 \
                > > --input_file=pintest_load.s19 --srec_bytes=16 --
                > delay_interval=1
                > > \
                > > --input_map=3
                > > m6811-elf-gdb pintest_load.elf
                > > (gdb) set architecture m68hc12 (REQUIRED even if elf file
                > loaded)
                > > (gdb) set remotebaud 115200
                > > (gdb) target dbugS12 /dev/ttyUSB0
                > >
                > > To start your program (after doing above)
                > > (gdb) pod reset
                > > (gdb) pod nobr // remove any leftover breakpoints on
                > pod
                > > (gdb) delete // remove any leftover breakpoints
                > > // due to gdb bugs
                > > (gdb) display/i $pc
                > > (gdb) break main
                > > (gdb) run
                > > (breakpoint reached)
                > > (gdb) clear main
                > > (gdb) break emstdio_fputc
                > > (gdb) cont
                > > (breakpoint reached)
                > > (gdb) print $ccr |= 0x10 // disable interrupts
                > > (gdb) nexti // singlestep cpu instructions
                > > (gdb) nexti
                > > (gdb) nexti
                > > (gdb) nexti
                > > (gdb0 next // singlestep source lines
                > > (gdb) next
                > > (gdb) next
                > > n
                > > You don't have to stop at main as shown above before setting a
                > > breakpoint somewhere eles.
                > >
                > > Two commands have been added to gdb: "pod" and "addrcalc9s12".
                > >
                > > Some useful commands:
                > > set debug remote 1 // print commands sent to pod and responses
                > > set debug remote 0 // turn back off
                > > info program // display information about program
                > > break main // set breakpoint at main()
                > > info breakpoints // show breakpoints
                > > clear main // clear breakpoint at main()
                > > delete 1 // delete breakpoint 1
                > > delete // delete all breakpoints
                > > x/i $pc // show current instruction
                > > display/i $pc // show current instruction each time
                > program
                > > stops
                > > print/x $ppc // show hardware PC register
                > > print/x $pc // show synthetic PC register
                > > print/x $page // show PPAGE register
                > > print/x $d // show D register
                > > print/x $x // show X register
                > > print/x $y // show Y register
                > > print/x $sp // show SP register
                > > print $page=0x37 // set ppage register
                > > // similarly for other registers
                > > hex
                > >
                > > x/xh $x // show 16 bit value pointed to by X register
                > > x/xw $x // show 32 bit value pointed to by X register
                > > x/xb $x // show 8 bit value pointed to by X register
                > > x/10xb $x // show ten 8 bit values pointed to by X
                > register
                > > x/256xb 0x4000 // show 256 bytes at address 0x4000 (in gcc
                > > address
                > > space, not banked)
                > > cont // start/continue program
                > > step // execute next line of source code
                > > next // execute next line of source code, but
                > don't
                > > // trace into subroutine calls
                > > stepi // execute next instruction
                > > nexti // execute next instruction but don't
                > > // trace into subroutine calls
                > > until // try this at the bottom of a loop
                > > list // show source code near $pc
                > > where // stack trace
                > > info frame // current stack frame info
                > > info locals // show all local variables in current
                > function
                > > run // start program over from begining
                > > print $ccr |= 0x10 // disable interrupts
                > > print bar // show value of variable bar
                > > print bar=123 // set value of variable bar
                > > print foo(1,2,3) // run subroutine foo -- broken
                > > disass foo // disassemble subroutine foo
                > > info target // displays information on the various memory
                > > // sections
                > > where // broken
                > > up // broken
                > > down // broken
                > > set output-radix 16
                > > set input-radix 16
                > > New command: "pod":
                > > pod command // execute command on pod and print results
                > > // up to 1023 characters
                > > pod reset // resset target
                > > pod rd // display registers in D-bug12 format
                > instead
                > > // of gdb format
                > > pod help // DON'T DO THIS
                > > pod ALTCLK 24000 // set alternate BDM frequency
                > > pod stop // stop program
                > > // may want to do "x/i $pc" afterwards
                > >
                > > New command: addrcalc9s12:
                > > addrcalc9s12 cpu16 4000 // convert memory address
                > > addrcalc9s12 banked 3E8000 // convert memory address
                > > addrcalc9s12 mot_linear F4000 // convert memory address
                > > addrcalc9s12 offset10000 104000 // convert memory address
                > > addrcalc9s12 help
                > > For example:
                > > (gdb) addrcalc9s12 banked 3E89AB
                > > CPU16: 49AB
                > > Banked: 3E89AB
                > > Motorola Linear:: F89AB
                > > Offset10000: : 1089AB
                > >
                > > Addrcalc9s12 is also availible as a standalone program as part of
                > the
                > > srec9s12 package.
                > >
                > > Macro tricks:
                > > The following commands will result in a register display each
                > time
                > > the system stops.
                > > define hook-stop
                > > pod rd
                > > end
                > > for some reason, "info registers" doesn't work in that macro
                > > Pressing carriage return will repeat the last command. This is
                > > particularly useful for step, next, stepi, nexti.
                > >
                > > Beware of executing any pod commands that may interfere with gdb;
                > for
                > > example, tampering with breakpoints could cause trouble. Any
                > command
                > > that does not return to a prompt could cause trouble. Commands
                > such as
                > > "pod help" that print what look like prompt characters can cause
                > > trouble.
                > >
                > > If you are debugging a program that has interrupts, you may be
                > surprised
                > > to see next, step, nexti, and stepi proceed into the interrupt
                > service
                > > routine instead of the function you were debugging (at least that
                > > happens using the trace instruction when using
                > > d-bug12 by itself). After hitting a breakpoint, you may
                > > want to issue the command:
                > > print ccr |= 0x10
                > > to disable interrupts.
                > >
                > > The stepi and step commands use the bdm pod trace command so they
                > > do not require a breakpoint. However, next and nexti sometimes
                > > require a breakpoint, depending on whether they encounter a
                > subroutine
                > > call. If you are short on breakpoints, try using step/stepi
                > instead of
                > > next/nexti where possible.
                > >
                > > Known Problems:
                > > - Can't load programs. Use srec9s12 for that before starting gdb.
                > > This is an exteremely low priority to fix since there is already
                > > a means to load programs and it is not trivial to make loading
                > > work given the flow control bugs in all known USB to serial
                > adapters
                > >
                > > and the small receive buffer in D-bug12.
                > >
                > > - Printing $a and $b is broken but $d works
                > >
                > > - pod only supports two breakpoints.
                > >
                > > - next and nexti may use either trace or breakpoint commands.
                > That
                > > means if it needs to jump over a call instruction, it will use
                > > a breakpoint. If both hardware breakpoints are in use, it will
                > > fail to stop at the appointed line.
                > >
                > > - If more than two breakpoints are needed (including those needed
                > > by "next" or "nexti" commands), it will fail to set one of the
                > > breakpoints without reporting an error.
                > >
                > > - can't modify eeprom (but you can call a subroutine in the
                > > target system that does)
                > >
                > > - can't modify flash
                > >
                > > - "where" command only shows current function many times instead
                > of
                > > progressing up the stack. "up" has similar problems.
                > > This is probably a bug in m68hc11-tdep.c.
                > > Perhaps it is getting confused by the extra byte in the return
                > > address. It could also be that the target program was
                > compiled
                > > -fomit-frame-pointer. Actually, looks like there is a similar
                > > problem on a program compiled without omit-frame-pointer.
                > >
                > > - may not work on older HCS12 cpus that don't support PPAGE
                > > due to forcing
                > > elf_flags |= E_M68HC12_BANKS;
                > > in m68hc11-tdep.c
                > >
                > > - gdb will restore certain breakpoints if you delete them.
                > >
                > > - do not use the pod command (i.e. "pod reset") before issuing
                > > the target command or gdb will segfault.
                > >
                > > - "interrupt" does not work.
                > >
                > > - I did find one place where gdb seemed to get hung up on a next
                > > instruction. It appears that it was confused by the processor
                > > being in the run state. Control-C followed by "pod stop"
                > helped.
                > >
                > > - calling a function on the target system using the print command
                > > does not work properly. I think GDB is doing a near call
                > > to far functions. This is not a driver bug, it is a CPU support
                > > bug. Functions with trampolines will probably work if you
                > > give the name of the trampoline.
                > > m68hc11_push_dummy_call looks suspect. It always pushes
                > > 16 bits for the return address. This would be easy to correct
                > > if I knew how to tell if the called function was near or far.
                > >
                > > Before running gdb:
                > > - resetting the pod is recommended
                > > Existing breakpoints or the
                > > processor being in the run state will cause trouble for gdb.
                > >
                > > - make sure you don't have any other programs (such as
                > > a terminal emulator) running on the same serial port.
                > > Otherise, gdb will either not be able to open the port
                > > or it will succeed but the other program will steal messages
                > > intended for gdb.
                > >
                > > - make sure the pod is running D-bug12 v4.x
                > >
                > > - make sure the pod is in BDM mode
                > >
                > > - make sure the pod baud rate has been set permanently to 115200
                > >
                > > - make sure the pod has been set to the right xtal frequency
                > > for the the target system. Also, set ALTCLK if your
                > > target uses the PLL.
                > >
                > > - if you have two breakpoints set and try to use
                > > next/step/etc. program execution will continue past
                > > current line.
                > >
                > > - load your program into the pod using srec9s12
                > >
                > > - running functions on the target using the print command
                > > that take string parameters requires that the target
                > > code have a malloc function. I.E.
                > > print printf("hello, world\r\n");
                > >
                > > - there is no exception handling for when the pod gets into
                > > funny states: Running when it should be stopped, asking
                > > how to handle a target communications failure, stuck mid
                > > upload, etc.
                > >
                > > - remember that you can run m6811-elf-gdb under gdb.
                > > If there is a segfault, use "where" to do a stack dump.
                > > Also, you can use the "ulimit -c unlimited" command at the
                > > shell prompt to enable core dumps on unix systems
                > > which can be examined with the debugger later.
                > >
                > > - If you have trouble on a USB to serial adapter, try using a
                > legacy
                > > serial port.
                > >
                > > If you have programs which take 16 bit pointers to a particular
                > memory
                > > section in banked memory (for example, all of a particular type of
                > > readonly data structure has been moved to the same bank to save
                > space in
                > > non-paged flash), don't expect things like
                > > print *p
                > > to work. This is not a problem with this driver. Limitations
                > > in gcc, ld, and gdb prevent this. You will need to do some
                > > fancy arithmatic and casting in your print command to translate
                > > the pointer. If you step through your code until it sets
                > > the appropriate ppage register value, then it might display
                > properly.
                > > You could call a function on the target cpu to print the function
                > on the
                > > serial port except that such function calls from the
                > > debugger are currently broken. You can use the addrcalc9s12
                > command
                > > added to gdb to calculate the address and then cast that to a
                > pointer of
                > > the approriate type:
                > > i.e. for page=37, pointer=89ab
                > > addrcalc9s12 banked 3E89AB
                > > print *(foo_t *) 0x1089AB
                > >
                > > Troubleshooting:
                > > - try using control-c to exit any gdb commands that are hung up
                > > and try issuing some commands to the pod such as "pod rd",
                > > "pod stop", "pod nobr", and "pod reset".
                > > - set debug remote 1
                > > - use a terminal emulator to talk to the pod to see if
                > > it is having problems communicating with target
                > > - Make sure you don't have a terminal emulator running
                > > concurrently with gdb on the same port
                > > - make sure you have the same version of the program loaded
                > > in gdb and the target.
                > > - exit gdb, reset target cpu and pod, and restart gdb
                > >
                > > You may use DDD, KDevelop, etc. as a GUI front end to gdb.
                > >
                > > These patches were made against the prerelease 2.91 version of
                > > m6811-elf-gdb.
                > >
                > > To compile:
                > >
                > > patch <patchile
                > > cd gdb6.0/gdb
                > > /configure --target=m6811-elf --prefix=/usr/bin \
                > > --program-prefix=m6811-elf- --host=i686-pc-linux-gnu
                > > make
                > > make install
                > >
                > > srec9s12 is availible from
                > > http://www.freelabs.com/~whitis/software/srec9s12
                > >
                > > The first parameter is normally passed in the D register, additional
                > > paramters are passed on the stack. The return value is also passed
                > > in the D register.
                > >
                > > --
                > > Mark Whitis http://www.freelabs.com/~whitis/ NO SPAM
                > > Author of many open source software packages.
                > > Coauthor: Linux Programming Unleashed (1st Edition)
                > >
                > >
                > >
                > > To Post a message, send it to: gnu-m68hc11@e...
                > >
                > > To Unsubscribe, send a blank message to:
                > > gnu-m68hc11-unsubscribe@e...
                > > Yahoo! Groups Links
                >
                >
                >
                >
                > To Post a message, send it to: gnu-m68hc11@...
                >
                > To Unsubscribe, send a blank message to:
                gnu-m68hc11-unsubscribe@...
                > Yahoo! Groups Links
                >
                >
                >
                >
                >
                >
              • hebs_s
                Hi! Could u get some break on ddd,insght for m6811-elf-gdb? I am looking for gui for Star12 debugging. best wishes, hebs ... support ... remote ... availible
                Message 7 of 26 , Jun 22, 2005
                View Source
                • 0 Attachment
                  Hi!

                  Could u get some break on ddd,insght for m6811-elf-gdb?

                  I am looking for gui for Star12 debugging.

                  best wishes,
                  hebs

                  --- In gnu-m68hc11@yahoogroups.com, "puja1983_mishra"
                  <puja1983_mishra@y...> wrote:
                  > Hi,
                  >
                  > I read this message.You have mentioned we can use ddd for gui
                  support
                  > to M6811-elf-gdb.You have mentioned about some patch.I will be
                  > thankful to u if u can clarify on this patch subject.
                  >
                  > i mean how i can get the patch and the complete procedure how to
                  > build the m6811-elf-gdb with ddd as gui support/
                  >
                  > With regards
                  >
                  > linux_bud
                  >
                  >
                  >
                  > --- In gnu-m68hc11@yahoogroups.com, tburrell@s... wrote:
                  > >
                  > >
                  > > -----Original Message-----
                  > > From: whitis [mailto:whitis@f...]
                  > > Sent: Thursday, February 03, 2005 7:13 AM
                  > > To: gnu-m68hc11
                  > > Subject: gdb partially working with D-bug12 bdm pods
                  > >
                  > >
                  > > I have gdb partially working on the MC9S12DP256 (HCS12 with PPAGE
                  > > register) with the D-bug12 v4.x based BDM pods.
                  > >
                  > > This is not heavily tested but since it is the first working
                  remote
                  > bdm
                  > > pod driver for gdb that is capable of debugging programs >64K or
                  > that
                  > > use any of the external flash it is important to make it
                  availible
                  > even
                  > > in is current state. I have tried every gdb command I normally
                  use
                  > and
                  > > many I don't. They seem to work except as noted below.
                  > >
                  > > My attempts to set the number of registers earlier in the dbug
                  pod
                  > > driver
                  > > didn't work because the crash actually happened before it reached
                  > that
                  > > point. So, though it is a crude hack, I forced the bank flag high
                  > in
                  > > elf_flags. This could adversely affect those trying to use older
                  > HC12
                  > > cpus with no ppage register; someone needs to fix the bug in
                  gcc/ld
                  > that
                  > > causes that flag to not be set in the first place so we can
                  > eliminate
                  > > this
                  > > hack. The code I posted here before worked ok - it was simply
                  > > necessary
                  > > to fix/workaround some existing bugs in gdb.
                  > >
                  > > Reading memory properly sets and then restores the PPAGE
                  register.
                  > The
                  > > disassemble command works for code in bank switched flash.
                  Setting
                  > > breakpoints in flash works.
                  > >
                  > > Be aware that there are two versions of the PC register
                  > > $pc - synthetic 32 bit register that contains the gcc/gdb
                  > address
                  > > corresponding to the PPAGE:PC if pointing to external
                  > > flash.
                  > > $ppc = processor (raw) PC register. 16 bits.
                  > > $page = processor PPAGE register 8 bits.
                  > >
                  > > I will assume you know enough to replace "/dev/ttyUSB0" with the
                  > > appropriate port on your system and the name of your program.
                  > >
                  > > The following commands must be given:
                  > > # Load program using srec9s12 first.
                  > > m6811-elf-objcopy --verbose --output-target=srec
                  > pintest_load.elf \
                  > > pintest_intermediate.s19
                  > > srec9s12 <pintest_intermediate.s19 >pintest_load.s19
                  > > srec9s12 --send_to_pod --pod_port=/dev/ttyUSB0 \
                  > > --input_file=pintest_load.s19 --srec_bytes=16 --
                  > delay_interval=1
                  > > \
                  > > --input_map=3
                  > > m6811-elf-gdb pintest_load.elf
                  > > (gdb) set architecture m68hc12 (REQUIRED even if elf file
                  > loaded)
                  > > (gdb) set remotebaud 115200
                  > > (gdb) target dbugS12 /dev/ttyUSB0
                  > >
                  > > To start your program (after doing above)
                  > > (gdb) pod reset
                  > > (gdb) pod nobr // remove any leftover breakpoints on
                  > pod
                  > > (gdb) delete // remove any leftover breakpoints
                  > > // due to gdb bugs
                  > > (gdb) display/i $pc
                  > > (gdb) break main
                  > > (gdb) run
                  > > (breakpoint reached)
                  > > (gdb) clear main
                  > > (gdb) break emstdio_fputc
                  > > (gdb) cont
                  > > (breakpoint reached)
                  > > (gdb) print $ccr |= 0x10 // disable interrupts
                  > > (gdb) nexti // singlestep cpu instructions
                  > > (gdb) nexti
                  > > (gdb) nexti
                  > > (gdb) nexti
                  > > (gdb0 next // singlestep source lines
                  > > (gdb) next
                  > > (gdb) next
                  > > n
                  > > You don't have to stop at main as shown above before setting a
                  > > breakpoint somewhere eles.
                  > >
                  > > Two commands have been added to gdb: "pod" and "addrcalc9s12".
                  > >
                  > > Some useful commands:
                  > > set debug remote 1 // print commands sent to pod and
                  responses
                  > > set debug remote 0 // turn back off
                  > > info program // display information about program
                  > > break main // set breakpoint at main()
                  > > info breakpoints // show breakpoints
                  > > clear main // clear breakpoint at main()
                  > > delete 1 // delete breakpoint 1
                  > > delete // delete all breakpoints
                  > > x/i $pc // show current instruction
                  > > display/i $pc // show current instruction each time
                  > program
                  > > stops
                  > > print/x $ppc // show hardware PC register
                  > > print/x $pc // show synthetic PC register
                  > > print/x $page // show PPAGE register
                  > > print/x $d // show D register
                  > > print/x $x // show X register
                  > > print/x $y // show Y register
                  > > print/x $sp // show SP register
                  > > print $page=0x37 // set ppage register
                  > > // similarly for other registers
                  > > hex
                  > >
                  > > x/xh $x // show 16 bit value pointed to by X
                  register
                  > > x/xw $x // show 32 bit value pointed to by X
                  register
                  > > x/xb $x // show 8 bit value pointed to by X
                  register
                  > > x/10xb $x // show ten 8 bit values pointed to by X
                  > register
                  > > x/256xb 0x4000 // show 256 bytes at address 0x4000 (in
                  gcc
                  > > address
                  > > space, not banked)
                  > > cont // start/continue program
                  > > step // execute next line of source code
                  > > next // execute next line of source code, but
                  > don't
                  > > // trace into subroutine calls
                  > > stepi // execute next instruction
                  > > nexti // execute next instruction but don't
                  > > // trace into subroutine calls
                  > > until // try this at the bottom of a loop
                  > > list // show source code near $pc
                  > > where // stack trace
                  > > info frame // current stack frame info
                  > > info locals // show all local variables in current
                  > function
                  > > run // start program over from begining
                  > > print $ccr |= 0x10 // disable interrupts
                  > > print bar // show value of variable bar
                  > > print bar=123 // set value of variable bar
                  > > print foo(1,2,3) // run subroutine foo -- broken
                  > > disass foo // disassemble subroutine foo
                  > > info target // displays information on the various
                  memory
                  > > // sections
                  > > where // broken
                  > > up // broken
                  > > down // broken
                  > > set output-radix 16
                  > > set input-radix 16
                  > > New command: "pod":
                  > > pod command // execute command on pod and print results
                  > > // up to 1023 characters
                  > > pod reset // resset target
                  > > pod rd // display registers in D-bug12 format
                  > instead
                  > > // of gdb format
                  > > pod help // DON'T DO THIS
                  > > pod ALTCLK 24000 // set alternate BDM frequency
                  > > pod stop // stop program
                  > > // may want to do "x/i $pc" afterwards
                  > >
                  > > New command: addrcalc9s12:
                  > > addrcalc9s12 cpu16 4000 // convert memory address
                  > > addrcalc9s12 banked 3E8000 // convert memory address
                  > > addrcalc9s12 mot_linear F4000 // convert memory address
                  > > addrcalc9s12 offset10000 104000 // convert memory address
                  > > addrcalc9s12 help
                  > > For example:
                  > > (gdb) addrcalc9s12 banked 3E89AB
                  > > CPU16: 49AB
                  > > Banked: 3E89AB
                  > > Motorola Linear:: F89AB
                  > > Offset10000: : 1089AB
                  > >
                  > > Addrcalc9s12 is also availible as a standalone program as part of
                  > the
                  > > srec9s12 package.
                  > >
                  > > Macro tricks:
                  > > The following commands will result in a register display each
                  > time
                  > > the system stops.
                  > > define hook-stop
                  > > pod rd
                  > > end
                  > > for some reason, "info registers" doesn't work in that macro
                  > > Pressing carriage return will repeat the last command. This is
                  > > particularly useful for step, next, stepi, nexti.
                  > >
                  > > Beware of executing any pod commands that may interfere with gdb;
                  > for
                  > > example, tampering with breakpoints could cause trouble. Any
                  > command
                  > > that does not return to a prompt could cause trouble. Commands
                  > such as
                  > > "pod help" that print what look like prompt characters can cause
                  > > trouble.
                  > >
                  > > If you are debugging a program that has interrupts, you may be
                  > surprised
                  > > to see next, step, nexti, and stepi proceed into the interrupt
                  > service
                  > > routine instead of the function you were debugging (at least that
                  > > happens using the trace instruction when using
                  > > d-bug12 by itself). After hitting a breakpoint, you may
                  > > want to issue the command:
                  > > print ccr |= 0x10
                  > > to disable interrupts.
                  > >
                  > > The stepi and step commands use the bdm pod trace command so they
                  > > do not require a breakpoint. However, next and nexti sometimes
                  > > require a breakpoint, depending on whether they encounter a
                  > subroutine
                  > > call. If you are short on breakpoints, try using step/stepi
                  > instead of
                  > > next/nexti where possible.
                  > >
                  > > Known Problems:
                  > > - Can't load programs. Use srec9s12 for that before starting
                  gdb.
                  > > This is an exteremely low priority to fix since there is
                  already
                  > > a means to load programs and it is not trivial to make loading
                  > > work given the flow control bugs in all known USB to serial
                  > adapters
                  > >
                  > > and the small receive buffer in D-bug12.
                  > >
                  > > - Printing $a and $b is broken but $d works
                  > >
                  > > - pod only supports two breakpoints.
                  > >
                  > > - next and nexti may use either trace or breakpoint commands.
                  > That
                  > > means if it needs to jump over a call instruction, it will use
                  > > a breakpoint. If both hardware breakpoints are in use, it
                  will
                  > > fail to stop at the appointed line.
                  > >
                  > > - If more than two breakpoints are needed (including those
                  needed
                  > > by "next" or "nexti" commands), it will fail to set one of the
                  > > breakpoints without reporting an error.
                  > >
                  > > - can't modify eeprom (but you can call a subroutine in the
                  > > target system that does)
                  > >
                  > > - can't modify flash
                  > >
                  > > - "where" command only shows current function many times
                  instead
                  > of
                  > > progressing up the stack. "up" has similar problems.
                  > > This is probably a bug in m68hc11-tdep.c.
                  > > Perhaps it is getting confused by the extra byte in the return
                  > > address. It could also be that the target program was
                  > compiled
                  > > -fomit-frame-pointer. Actually, looks like there is a
                  similar
                  > > problem on a program compiled without omit-frame-pointer.
                  > >
                  > > - may not work on older HCS12 cpus that don't support PPAGE
                  > > due to forcing
                  > > elf_flags |= E_M68HC12_BANKS;
                  > > in m68hc11-tdep.c
                  > >
                  > > - gdb will restore certain breakpoints if you delete them.
                  > >
                  > > - do not use the pod command (i.e. "pod reset") before issuing
                  > > the target command or gdb will segfault.
                  > >
                  > > - "interrupt" does not work.
                  > >
                  > > - I did find one place where gdb seemed to get hung up on a next
                  > > instruction. It appears that it was confused by the processor
                  > > being in the run state. Control-C followed by "pod stop"
                  > helped.
                  > >
                  > > - calling a function on the target system using the print
                  command
                  > > does not work properly. I think GDB is doing a near call
                  > > to far functions. This is not a driver bug, it is a CPU
                  support
                  > > bug. Functions with trampolines will probably work if you
                  > > give the name of the trampoline.
                  > > m68hc11_push_dummy_call looks suspect. It always pushes
                  > > 16 bits for the return address. This would be easy to
                  correct
                  > > if I knew how to tell if the called function was near or far.
                  > >
                  > > Before running gdb:
                  > > - resetting the pod is recommended
                  > > Existing breakpoints or the
                  > > processor being in the run state will cause trouble for gdb.
                  > >
                  > > - make sure you don't have any other programs (such as
                  > > a terminal emulator) running on the same serial port.
                  > > Otherise, gdb will either not be able to open the port
                  > > or it will succeed but the other program will steal messages
                  > > intended for gdb.
                  > >
                  > > - make sure the pod is running D-bug12 v4.x
                  > >
                  > > - make sure the pod is in BDM mode
                  > >
                  > > - make sure the pod baud rate has been set permanently to
                  115200
                  > >
                  > > - make sure the pod has been set to the right xtal frequency
                  > > for the the target system. Also, set ALTCLK if your
                  > > target uses the PLL.
                  > >
                  > > - if you have two breakpoints set and try to use
                  > > next/step/etc. program execution will continue past
                  > > current line.
                  > >
                  > > - load your program into the pod using srec9s12
                  > >
                  > > - running functions on the target using the print command
                  > > that take string parameters requires that the target
                  > > code have a malloc function. I.E.
                  > > print printf("hello, world\r\n");
                  > >
                  > > - there is no exception handling for when the pod gets into
                  > > funny states: Running when it should be stopped, asking
                  > > how to handle a target communications failure, stuck mid
                  > > upload, etc.
                  > >
                  > > - remember that you can run m6811-elf-gdb under gdb.
                  > > If there is a segfault, use "where" to do a stack dump.
                  > > Also, you can use the "ulimit -c unlimited" command at the
                  > > shell prompt to enable core dumps on unix systems
                  > > which can be examined with the debugger later.
                  > >
                  > > - If you have trouble on a USB to serial adapter, try using a
                  > legacy
                  > > serial port.
                  > >
                  > > If you have programs which take 16 bit pointers to a particular
                  > memory
                  > > section in banked memory (for example, all of a particular type
                  of
                  > > readonly data structure has been moved to the same bank to save
                  > space in
                  > > non-paged flash), don't expect things like
                  > > print *p
                  > > to work. This is not a problem with this driver. Limitations
                  > > in gcc, ld, and gdb prevent this. You will need to do some
                  > > fancy arithmatic and casting in your print command to translate
                  > > the pointer. If you step through your code until it sets
                  > > the appropriate ppage register value, then it might display
                  > properly.
                  > > You could call a function on the target cpu to print the function
                  > on the
                  > > serial port except that such function calls from the
                  > > debugger are currently broken. You can use the addrcalc9s12
                  > command
                  > > added to gdb to calculate the address and then cast that to a
                  > pointer of
                  > > the approriate type:
                  > > i.e. for page=37, pointer=89ab
                  > > addrcalc9s12 banked 3E89AB
                  > > print *(foo_t *) 0x1089AB
                  > >
                  > > Troubleshooting:
                  > > - try using control-c to exit any gdb commands that are hung up
                  > > and try issuing some commands to the pod such as "pod rd",
                  > > "pod stop", "pod nobr", and "pod reset".
                  > > - set debug remote 1
                  > > - use a terminal emulator to talk to the pod to see if
                  > > it is having problems communicating with target
                  > > - Make sure you don't have a terminal emulator running
                  > > concurrently with gdb on the same port
                  > > - make sure you have the same version of the program loaded
                  > > in gdb and the target.
                  > > - exit gdb, reset target cpu and pod, and restart gdb
                  > >
                  > > You may use DDD, KDevelop, etc. as a GUI front end to gdb.
                  > >
                  > > These patches were made against the prerelease 2.91 version of
                  > > m6811-elf-gdb.
                  > >
                  > > To compile:
                  > >
                  > > patch <patchile
                  > > cd gdb6.0/gdb
                  > > /configure --target=m6811-elf --prefix=/usr/bin \
                  > > --program-prefix=m6811-elf- --host=i686-pc-linux-gnu
                  > > make
                  > > make install
                  > >
                  > > srec9s12 is availible from
                  > > http://www.freelabs.com/~whitis/software/srec9s12
                  > >
                  > > The first parameter is normally passed in the D register,
                  additional
                  > > paramters are passed on the stack. The return value is also
                  passed
                  > > in the D register.
                  > >
                  > > --
                  > > Mark Whitis http://www.freelabs.com/~whitis/ NO SPAM
                  > > Author of many open source software packages.
                  > > Coauthor: Linux Programming Unleashed (1st Edition)
                  > >
                  > >
                  > >
                  > > To Post a message, send it to: gnu-m68hc11@e...
                  > >
                  > > To Unsubscribe, send a blank message to:
                  > > gnu-m68hc11-unsubscribe@e...
                  > > Yahoo! Groups Links
                • puja rani mishra
                  Hi IP, I tried what u have written in the reply of my mail. I went to the directory where my main.elf file(the code to be debugged)is there.Then i changed to
                  Message 8 of 26 , Jun 22, 2005
                  View Source
                  • 0 Attachment
                    Hi IP,
                    I tried what u have written in the reply of my mail.
                    I went to the directory where my main.elf file(the
                    code to be debugged)is there.Then i changed to
                    superuser mode and gave the commean as per u.But it
                    gave


                    Warning: Tried to connect to session manager,
                    Authentication Rejected, reason :
                    None of the authentication protocols specified are
                    supported and host-based authentication failed

                    then one window is getting opened with message


                    --- Ioan Petrescu <yoanp@...> wrote:


                    ---------------------------------
                    Hi,
                    In order to use ddd with gdb, you have nothing to do
                    specially; only
                    the command is necessary:
                    ddd --debug m6811-elf-gdb myfile.elf
                    ddd is only an interface and call gdb as a subprocess.
                    Once you are in ddd, type in the command window all
                    the known commands
                    to configure gdb and load files
                    Regards,
                    IP
                    ----- Original Message -----
                    From: "puja1983_mishra" <puja1983_mishra@...>
                    To: <gnu-m68hc11@yahoogroups.com>
                    Sent: Wednesday, June 22, 2005 12:06 PM
                    Subject: Re: gdb partially working with D-bug12 bdm
                    pods


                    > Hi,
                    >
                    > I read this message.You have mentioned we can use
                    ddd for gui support
                    > to M6811-elf-gdb.You have mentioned about some
                    patch.I will be
                    > thankful to u if u can clarify on this patch
                    subject.
                    >
                    > i mean how i can get the patch and the complete
                    procedure how to
                    > build the m6811-elf-gdb with ddd as gui support/
                    >
                    > With regards
                    >
                    > linux_bud
                    >
                    >
                    >
                    > --- In gnu-m68hc11@yahoogroups.com, tburrell@s...
                    wrote:
                    > >
                    > >
                    > > -----Original Message-----
                    > > From: whitis [mailto:whitis@f...]
                    > > Sent: Thursday, February 03, 2005 7:13 AM
                    > > To: gnu-m68hc11
                    > > Subject: gdb partially working with D-bug12 bdm
                    pods
                    > >
                    > >
                    > > I have gdb partially working on the MC9S12DP256
                    (HCS12 with PPAGE
                    > > register) with the D-bug12 v4.x based BDM pods.
                    > >
                    > > This is not heavily tested but since it is the
                    first working remote
                    > bdm
                    > > pod driver for gdb that is capable of debugging
                    programs >64K or
                    > that
                    > > use any of the external flash it is important to
                    make it availible
                    > even
                    > > in is current state. I have tried every gdb
                    command I normally use
                    > and
                    > > many I don't. They seem to work except as noted
                    below.
                    > >
                    > > My attempts to set the number of registers earlier
                    in the dbug pod
                    > > driver
                    > > didn't work because the crash actually happened
                    before it reached
                    > that
                    > > point. So, though it is a crude hack, I forced the
                    bank flag high
                    > in
                    > > elf_flags. This could adversely affect those
                    trying to use older
                    > HC12
                    > > cpus with no ppage register; someone needs to fix
                    the bug in gcc/ld
                    > that
                    > > causes that flag to not be set in the first place
                    so we can
                    > eliminate
                    > > this
                    > > hack. The code I posted here before worked ok -
                    it was simply
                    > > necessary
                    > > to fix/workaround some existing bugs in gdb.
                    > >
                    > > Reading memory properly sets and then restores the
                    PPAGE register.
                    > The
                    > > disassemble command works for code in bank
                    switched flash. Setting
                    > > breakpoints in flash works.
                    > >
                    > > Be aware that there are two versions of the PC
                    register
                    > > $pc - synthetic 32 bit register that contains
                    the gcc/gdb
                    > address
                    > > corresponding to the PPAGE:PC if
                    pointing to external
                    > > flash.
                    > > $ppc = processor (raw) PC register. 16 bits.
                    > > $page = processor PPAGE register 8 bits.
                    > >
                    > > I will assume you know enough to replace
                    "/dev/ttyUSB0" with the
                    > > appropriate port on your system and the name of
                    your program.
                    > >
                    > > The following commands must be given:
                    > > # Load program using srec9s12 first.
                    > > m6811-elf-objcopy --verbose
                    --output-target=srec
                    > pintest_load.elf \
                    > > pintest_intermediate.s19
                    > > srec9s12 <pintest_intermediate.s19
                    >pintest_load.s19
                    > > srec9s12 --send_to_pod --pod_port=/dev/ttyUSB0
                    \
                    > > --input_file=pintest_load.s19
                    --srec_bytes=16 --
                    > delay_interval=1
                    > > \
                    > > --input_map=3
                    > > m6811-elf-gdb pintest_load.elf
                    > > (gdb) set architecture m68hc12 (REQUIRED even
                    if elf file
                    > loaded)
                    > > (gdb) set remotebaud 115200
                    > > (gdb) target dbugS12 /dev/ttyUSB0
                    > >
                    > > To start your program (after doing above)
                    > > (gdb) pod reset
                    > > (gdb) pod nobr // remove any leftover
                    breakpoints on
                    > pod
                    > > (gdb) delete // remove any leftover
                    breakpoints
                    > > // due to gdb bugs
                    > > (gdb) display/i $pc
                    > > (gdb) break main
                    > > (gdb) run
                    > > (breakpoint reached)
                    > > (gdb) clear main
                    > > (gdb) break emstdio_fputc
                    > > (gdb) cont
                    > > (breakpoint reached)
                    > > (gdb) print $ccr |= 0x10 // disable
                    interrupts
                    > > (gdb) nexti // singlestep cpu
                    instructions
                    > > (gdb) nexti
                    > > (gdb) nexti
                    > > (gdb) nexti
                    > > (gdb0 next // singlestep
                    source lines
                    > > (gdb) next
                    > > (gdb) next
                    > > n
                    > > You don't have to stop at main as shown above
                    before setting a
                    > > breakpoint somewhere eles.
                    > >
                    > > Two commands have been added to gdb: "pod" and
                    "addrcalc9s12".
                    > >
                    > > Some useful commands:
                    > > set debug remote 1 // print commands sent to
                    pod and responses
                    > > set debug remote 0 // turn back off
                    > > info program // display information
                    about program
                    > > break main // set breakpoint at main()
                    > > info breakpoints // show breakpoints
                    > > clear main // clear breakpoint at
                    main()
                    > > delete 1 // delete breakpoint 1
                    > > delete // delete all breakpoints
                    > > x/i $pc // show current instruction
                    > > display/i $pc // show current instruction
                    each time
                    > program
                    > > stops
                    > > print/x $ppc // show hardware PC
                    register
                    > > print/x $pc // show synthetic PC
                    register
                    > > print/x $page // show PPAGE register
                    > > print/x $d // show D register
                    > > print/x $x // show X register
                    > > print/x $y // show Y register
                    > > print/x $sp // show SP register
                    > > print $page=0x37 // set ppage register
                    > > // similarly for other
                    registers
                    > > hex
                    > >
                    > > x/xh $x // show 16 bit value
                    pointed to by X register
                    > > x/xw $x // show 32 bit value
                    pointed to by X register
                    > > x/xb $x // show 8 bit value pointed
                    to by X register
                    > > x/10xb $x // show ten 8 bit values
                    pointed to by X
                    > register
                    > > x/256xb 0x4000 // show 256 bytes at
                    address 0x4000 (in gcc
                    > > address
                    > > space, not banked)
                    > > cont // start/continue program
                    > > step // execute next line of
                    source code
                    > > next // execute next line of
                    source code, but
                    > don't
                    > > // trace into
                    subroutine calls
                    > > stepi // execute next instruction
                    > > nexti // execute next instruction
                    but don't
                    > > // trace into
                    subroutine calls
                    > > until // try this at the bottom of
                    a loop
                    > > list // show source code near $pc
                    > > where // stack trace
                    > > info frame // current stack frame info
                    > > info locals // show all local variables
                    in current
                    > function
                    > > run // start program over from
                    begining
                    > > print $ccr |= 0x10 // disable interrupts
                    > > print bar // show value of variable
                    bar
                    > > print bar=123 // set value of variable
                    bar
                    > > print foo(1,2,3) // run subroutine foo --
                    broken
                    > > disass foo // disassemble subroutine
                    foo
                    > > info target // displays information on
                    the various memory
                    > > // sections
                    > > where // broken
                    > > up // broken
                    > > down // broken
                    > > set output-radix 16
                    > > set input-radix 16
                    > > New command: "pod":
                    > > pod command // execute command on pod
                    and print results
                    > > // up to 1023
                    characters
                    > > pod reset // resset target
                    > > pod rd // display registers in
                    D-bug12 format
                    > instead
                    > > // of gdb format
                    > > pod help // DON'T DO THIS
                    > > pod ALTCLK 24000 // set alternate BDM
                    frequency
                    > > pod stop // stop program
                    > > // may want to do "x/i
                    $pc" afterwards
                    > >
                    > > New command: addrcalc9s12:
                    > > addrcalc9s12 cpu16 4000 // convert
                    memory address
                    > > addrcalc9s12 banked 3E8000 // convert
                    memory address
                    > > addrcalc9s12 mot_linear F4000 // convert
                    memory address
                    > > addrcalc9s12 offset10000 104000 // convert
                    memory address
                    > > addrcalc9s12 help
                    > > For example:
                    > > (gdb) addrcalc9s12 banked 3E89AB
                    > > CPU16: 49AB
                    > > Banked: 3E89AB
                    > > Motorola Linear:: F89AB
                    > > Offset10000: : 1089AB
                    > >
                    > > Addrcalc9s12 is also availible as a standalone
                    program as part of
                    > the
                    > > srec9s12 package.
                    > >
                    > > Macro tricks:
                    > > The following commands will result in a
                    register display each
                    > time
                    > > the system stops.
                    > > define hook-stop
                    > > pod rd
                    > > end
                    > > for some reason, "info registers" doesn't work
                    in that macro
                    > > Pressing carriage return will repeat the last
                    command. This is
                    > > particularly useful for step, next, stepi, nexti.
                    > >
                    > > Beware of executing any pod commands that may
                    interfere with gdb;
                    > for
                    > > example, tampering with breakpoints could cause
                    trouble. Any
                    > command
                    > > that does not return to a prompt could cause
                    trouble. Commands
                    > such as
                    > > "pod help" that print what look like prompt
                    characters can cause
                    > > trouble.
                    > >
                    > > If you are debugging a program that has
                    interrupts, you may be
                    > surprised
                    > > to see next, step, nexti, and stepi proceed into
                    the interrupt
                    > service
                    > > routine instead of the function you were debugging
                    (at least that
                    > > happens using the trace instruction when using
                    > > d-bug12 by itself). After hitting a breakpoint,
                    you may
                    > > want to issue the command:
                    > > print ccr |= 0x10
                    > > to disable interrupts.
                    > >
                    > > The stepi and step commands use the bdm pod trace
                    command so they
                    > > do not require a breakpoint. However, next and
                    nexti sometimes
                    > > require a breakpoint, depending on whether they
                    encounter a
                    > subroutine
                    > > call. If you are short on breakpoints, try using
                    step/stepi
                    > instead of
                    > > next/nexti where possible.
                    > >
                    > > Known Problems:
                    > > - Can't load programs. Use srec9s12 for that
                    before starting gdb.
                    > > This is an exteremely low priority to fix
                    since there is already
                    > > a means to load programs and it is not trivial
                    to make loading
                    > > work given the flow control bugs in all known
                    USB to serial
                    > adapters
                    > >
                    > > and the small receive buffer in D-bug12.
                    > >
                    > > - Printing $a and $b is broken but $d works
                    > >
                    > > - pod only supports two breakpoints.
                    > >
                    > > - next and nexti may use either trace or
                    breakpoint commands.
                    > That
                    > > means if it needs to jump over a call
                    instruction, it will use
                    > > a breakpoint. If both hardware breakpoints
                    are in use, it will
                    > > fail to stop at the appointed line.
                    > >
                    > > - If more than two breakpoints are needed
                    (including those needed
                    > > by "next" or "nexti" commands), it will fail
                    to set one of the
                    > > breakpoints without reporting an error.
                    > >
                    > > - can't modify eeprom (but you can call a
                    subroutine in the
                    > > target system that does)
                    > >
                    > > - can't modify flash
                    > >
                    > > - "where" command only shows current function
                    many times instead
                    > of
                    > > progressing up the stack. "up" has similar
                    problems.
                    > > This is probably a bug in m68hc11-tdep.c.
                    > > Perhaps it is getting confused by the extra
                    byte in the return
                    > > address. It could also be that the target
                    program was
                    > compiled
                    > > -fomit-frame-pointer. Actually, looks like
                    there is a similar
                    > > problem on a program compiled without
                    omit-frame-pointer.
                    > >
                    > > - may not work on older HCS12 cpus that don't
                    support PPAGE
                    > > due to forcing
                    > > elf_flags |= E_M68HC12_BANKS;
                    > > in m68hc11-tdep.c
                    > >
                    > > - gdb will restore certain breakpoints if you
                    delete them.
                    > >
                    > > - do not use the pod command (i.e. "pod reset")
                    before issuing
                    > > the target command or gdb will segfault.
                    > >
                    > > - "interrupt" does not work.
                    > >
                    > > - I did find one place where gdb seemed to get
                    hung up on a next
                    > > instruction. It appears that it was confused
                    by the processor
                    > > being in the run state. Control-C followed
                    by "pod stop"
                    > helped.
                    > >
                    > > - calling a function on the target system using
                    the print command
                    > > does not work properly. I think GDB is doing
                    a near call
                    > > to far functions. This is not a driver bug,
                    it is a CPU support
                    > > bug. Functions with trampolines will
                    probably work if you
                    > > give the name of the trampoline.
                    > > m68hc11_push_dummy_call looks suspect. It
                    always pushes
                    > > 16 bits for the return address. This would
                    be easy to correct
                    > > if I knew how to tell if the called function
                    was near or far.
                    > >
                    > > Before running gdb:
                    > > - resetting the pod is recommended
                    > > Existing breakpoints or the
                    > > processor being in the run state will cause
                    trouble for gdb.
                    > >
                    > > - make sure you don't have any other programs
                    (such as
                    > > a terminal emulator) running on the same
                    serial port.
                    > > Otherise, gdb will either not be able to open
                    the port
                    > > or it will succeed but the other program will
                    steal messages
                    > > intended for gdb.
                    > >
                    > > - make sure the pod is running D-bug12 v4.x
                    > >
                    > > - make sure the pod is in BDM mode
                    > >
                    > > - make sure the pod baud rate has been set
                    permanently to 115200
                    > >
                    > > - make sure the pod has been set to the right
                    xtal frequency
                    > > for the the target system. Also, set ALTCLK
                    if your
                    > > target uses the PLL.
                    > >
                    > > - if you have two breakpoints set and try to
                    use
                    > > next/step/etc. program execution will
                    continue past
                    > > current line.
                    > >
                    > > - load your program into the pod using srec9s12
                    > >
                    > > - running functions on the target using the
                    print command
                    > > that take string parameters requires that the
                    target
                    > > code have a malloc function. I.E.
                    > > print printf("hello, world\r\n");
                    > >
                    > > - there is no exception handling for when the
                    pod gets into
                    > > funny states: Running when it should be
                    stopped, asking
                    > > how to handle a target communications
                    failure, stuck mid
                    > > upload, etc.
                    > >
                    > > - remember that you can run m6811-elf-gdb under
                    gdb.
                    > > If there is a segfault, use "where" to do a
                    stack dump.
                    > > Also, you can use the "ulimit -c unlimited"
                    command at the
                    > > shell prompt to enable core dumps on unix
                    systems
                    > > which can be examined with the debugger
                    later.
                    > >
                    > > - If you have trouble on a USB to serial
                    adapter, try using a
                    > legacy
                    > > serial port.
                    > >
                    > > If you have programs which take 16 bit pointers to
                    a particular
                    > memory
                    > > section in banked memory (for example, all of a
                    particular type of
                    > > readonly data structure has been moved to the same
                    bank to save
                    > space in
                    > > non-paged flash), don't expect things like
                    > > print *p
                    > > to work. This is not a problem with this driver.
                    Limitations
                    > > in gcc, ld, and gdb prevent this. You will need
                    to do some
                    > > fancy arithmatic and casting in your print command
                    to translate
                    > > the pointer. If you step through your code until
                    it sets
                    > > the appropriate ppage register value, then it
                    might display
                    > properly.
                    > > You could call a function on the target cpu to
                    print the function
                    > on the
                    > > serial port except that such function calls from
                    the
                    > > debugger are currently broken. You can use the
                    addrcalc9s12
                    > command
                    > > added to gdb to calculate the address and then
                    cast that to a
                    > pointer of
                    > > the approriate type:
                    > > i.e. for page=37, pointer=89ab
                    > > addrcalc9s12 banked 3E89AB
                    > > print *(foo_t *) 0x1089AB
                    > >
                    > > Troubleshooting:
                    > > - try using control-c to exit any gdb commands
                    that are hung up
                    > > and try issuing some commands to the pod such
                    as "pod rd",
                    > > "pod stop", "pod nobr", and "pod reset".
                    > > - set debug remote 1
                    > > - use a terminal emulator to talk to the pod to
                    see if
                    > > it is having problems communicating with
                    target
                    > > - Make sure you don't have a terminal emulator
                    running
                    > > concurrently with gdb on the same port
                    > > - make sure you have the same version of the
                    program loaded
                    > > in gdb and the target.
                    > > - exit gdb, reset target cpu and pod, and
                    restart gdb
                    > >
                    > > You may use DDD, KDevelop, etc. as a GUI front
                    end to gdb.
                    > >
                    > > These patches were made against the prerelease
                    2.91 version of
                    > > m6811-elf-gdb.
                    > >
                    > > To compile:
                    > >
                    > > patch <patchile
                    > > cd gdb6.0/gdb
                    > > /configure --target=m6811-elf --prefix=/usr/bin
                    \
                    > > --program-prefix=m6811-elf-
                    --host=i686-pc-linux-gnu
                    > > make
                    > > make install
                    > >
                    > > srec9s12 is availible from
                    > >
                    http://www.freelabs.com/~whitis/software/srec9s12
                    > >
                    > > The first parameter is normally passed in the D
                    register, additional
                    > > paramters are passed on the stack. The return
                    value is also passed
                    > > in the D register.
                    > >
                    > > --
                    > > Mark Whitis http://www.freelabs.com/~whitis/
                    NO SPAM
                    > > Author of many open source software packages.
                    > > Coauthor: Linux Programming Unleashed (1st
                    Edition)
                    > >
                    > >
                    > >
                    > > To Post a message, send it to: gnu-m68hc11@e...
                    > >
                    > > To Unsubscribe, send a blank message to:
                    > > gnu-m68hc11-unsubscribe@e...
                    > > Yahoo! Groups Links
                    >
                    >
                    >
                    >
                    > To Post a message, send it to:
                    gnu-m68hc11@...
                    >
                    > To Unsubscribe, send a blank message to:
                    gnu-m68hc11-unsubscribe@...
                    > Yahoo! Groups Links
                    >
                    >
                    >
                    >
                    >
                    >



                    To Post a message, send it to:
                    gnu-m68hc11@...

                    To Unsubscribe, send a blank message to:
                    gnu-m68hc11-unsubscribe@...



                    ---------------------------------
                    Yahoo! Groups Links

                    To visit your group on the web, go to:
                    http://groups.yahoo.com/group/gnu-m68hc11/

                    To unsubscribe from this group, send an email to:
                    gnu-m68hc11-unsubscribe@yahoogroups.com

                    Your use of Yahoo! Groups is subject to the Yahoo!
                    Terms of Service.





                    __________________________________________________________
                    How much free photo storage do you get? Store your friends 'n family snaps for FREE with Yahoo! Photos http://in.photos.yahoo.com
                  • puja rani mishra
                    Hi IP, I tried with what u have written in the previous mail. I went to the directory having the main.elf(code to be debugged).I switched to superuser mode and
                    Message 9 of 26 , Jun 22, 2005
                    View Source
                    • 0 Attachment
                      Hi IP,

                      I tried with what u have written in the previous mail.
                      I went to the directory having the main.elf(code to be
                      debugged).I switched to superuser mode and started
                      ddd.

                      But it gave the message
                      Warning: Tried to connect to session manager,
                      Authentication Rejected, reason :
                      None of the authentication protocols specified are
                      supported and host-based authentication failed

                      One ddd window is getting opened with the following
                      message

                      GDB couldnot be started.

                      I have had ddd in my system

                      --- Ioan Petrescu <yoanp@...> wrote:


                      ---------------------------------
                      Hi,
                      In order to use ddd with gdb, you have nothing to do
                      specially; only
                      the command is necessary:
                      ddd --debug m6811-elf-gdb myfile.elf
                      ddd is only an interface and call gdb as a subprocess.
                      Once you are in ddd, type in the command window all
                      the known commands
                      to configure gdb and load files
                      Regards,
                      IP
                      ----- Original Message -----
                      From: "puja1983_mishra" <puja1983_mishra@...>
                      To: <gnu-m68hc11@yahoogroups.com>
                      Sent: Wednesday, June 22, 2005 12:06 PM
                      Subject: Re: gdb partially working with D-bug12 bdm
                      pods


                      > Hi,
                      >
                      > I read this message.You have mentioned we can use
                      ddd for gui support
                      > to M6811-elf-gdb.You have mentioned about some
                      patch.I will be
                      > thankful to u if u can clarify on this patch
                      subject.
                      >
                      > i mean how i can get the patch and the complete
                      procedure how to
                      > build the m6811-elf-gdb with ddd as gui support/
                      >
                      > With regards
                      >
                      > linux_bud
                      >
                      >
                      >
                      > --- In gnu-m68hc11@yahoogroups.com, tburrell@s...
                      wrote:
                      > >
                      > >
                      > > -----Original Message-----
                      > > From: whitis [mailto:whitis@f...]
                      > > Sent: Thursday, February 03, 2005 7:13 AM
                      > > To: gnu-m68hc11
                      > > Subject: gdb partially working with D-bug12 bdm
                      pods
                      > >
                      > >
                      > > I have gdb partially working on the MC9S12DP256
                      (HCS12 with PPAGE
                      > > register) with the D-bug12 v4.x based BDM pods.
                      > >
                      > > This is not heavily tested but since it is the
                      first working remote
                      > bdm
                      > > pod driver for gdb that is capable of debugging
                      programs >64K or
                      > that
                      > > use any of the external flash it is important to
                      make it availible
                      > even
                      > > in is current state. I have tried every gdb
                      command I normally use
                      > and
                      > > many I don't. They seem to work except as noted
                      below.
                      > >
                      > > My attempts to set the number of registers earlier
                      in the dbug pod
                      > > driver
                      > > didn't work because the crash actually happened
                      before it reached
                      > that
                      > > point. So, though it is a crude hack, I forced the
                      bank flag high
                      > in
                      > > elf_flags. This could adversely affect those
                      trying to use older
                      > HC12
                      > > cpus with no ppage register; someone needs to fix
                      the bug in gcc/ld
                      > that
                      > > causes that flag to not be set in the first place
                      so we can
                      > eliminate
                      > > this
                      > > hack. The code I posted here before worked ok -
                      it was simply
                      > > necessary
                      > > to fix/workaround some existing bugs in gdb.
                      > >
                      > > Reading memory properly sets and then restores the
                      PPAGE register.
                      > The
                      > > disassemble command works for code in bank
                      switched flash. Setting
                      > > breakpoints in flash works.
                      > >
                      > > Be aware that there are two versions of the PC
                      register
                      > > $pc - synthetic 32 bit register that contains
                      the gcc/gdb
                      > address
                      > > corresponding to the PPAGE:PC if
                      pointing to external
                      > > flash.
                      > > $ppc = processor (raw) PC register. 16 bits.
                      > > $page = processor PPAGE register 8 bits.
                      > >
                      > > I will assume you know enough to replace
                      "/dev/ttyUSB0" with the
                      > > appropriate port on your system and the name of
                      your program.
                      > >
                      > > The following commands must be given:
                      > > # Load program using srec9s12 first.
                      > > m6811-elf-objcopy --verbose
                      --output-target=srec
                      > pintest_load.elf \
                      > > pintest_intermediate.s19
                      > > srec9s12 <pintest_intermediate.s19
                      >pintest_load.s19
                      > > srec9s12 --send_to_pod --pod_port=/dev/ttyUSB0
                      \
                      > > --input_file=pintest_load.s19
                      --srec_bytes=16 --
                      > delay_interval=1
                      > > \
                      > > --input_map=3
                      > > m6811-elf-gdb pintest_load.elf
                      > > (gdb) set architecture m68hc12 (REQUIRED even
                      if elf file
                      > loaded)
                      > > (gdb) set remotebaud 115200
                      > > (gdb) target dbugS12 /dev/ttyUSB0
                      > >
                      > > To start your program (after doing above)
                      > > (gdb) pod reset
                      > > (gdb) pod nobr // remove any leftover
                      breakpoints on
                      > pod
                      > > (gdb) delete // remove any leftover
                      breakpoints
                      > > // due to gdb bugs
                      > > (gdb) display/i $pc
                      > > (gdb) break main
                      > > (gdb) run
                      > > (breakpoint reached)
                      > > (gdb) clear main
                      > > (gdb) break emstdio_fputc
                      > > (gdb) cont
                      > > (breakpoint reached)
                      > > (gdb) print $ccr |= 0x10 // disable
                      interrupts
                      > > (gdb) nexti // singlestep cpu
                      instructions
                      > > (gdb) nexti
                      > > (gdb) nexti
                      > > (gdb) nexti
                      > > (gdb0 next // singlestep
                      source lines
                      > > (gdb) next
                      > > (gdb) next
                      > > n
                      > > You don't have to stop at main as shown above
                      before setting a
                      > > breakpoint somewhere eles.
                      > >
                      > > Two commands have been added to gdb: "pod" and
                      "addrcalc9s12".
                      > >
                      > > Some useful commands:
                      > > set debug remote 1 // print commands sent to
                      pod and responses
                      > > set debug remote 0 // turn back off
                      > > info program // display information
                      about program
                      > > break main // set breakpoint at main()
                      > > info breakpoints // show breakpoints
                      > > clear main // clear breakpoint at
                      main()
                      > > delete 1 // delete breakpoint 1
                      > > delete // delete all breakpoints
                      > > x/i $pc // show current instruction
                      > > display/i $pc // show current instruction
                      each time
                      > program
                      > > stops
                      > > print/x $ppc // show hardware PC
                      register
                      > > print/x $pc // show synthetic PC
                      register
                      > > print/x $page // show PPAGE register
                      > > print/x $d // show D register
                      > > print/x $x // show X register
                      > > print/x $y // show Y register
                      > > print/x $sp // show SP register
                      > > print $page=0x37 // set ppage register
                      > > // similarly for other
                      registers
                      > > hex
                      > >
                      > > x/xh $x // show 16 bit value
                      pointed to by X register
                      > > x/xw $x // show 32 bit value
                      pointed to by X register
                      > > x/xb $x // show 8 bit value pointed
                      to by X register
                      > > x/10xb $x // show ten 8 bit values
                      pointed to by X
                      > register
                      > > x/256xb 0x4000 // show 256 bytes at
                      address 0x4000 (in gcc
                      > > address
                      > > space, not banked)
                      > > cont // start/continue program
                      > > step // execute next line of
                      source code
                      > > next // execute next line of
                      source code, but
                      > don't
                      > > // trace into
                      subroutine calls
                      > > stepi // execute next instruction
                      > > nexti // execute next instruction
                      but don't
                      > > // trace into
                      subroutine calls
                      > > until // try this at the bottom of
                      a loop
                      > > list // show source code near $pc
                      > > where // stack trace
                      > > info frame // current stack frame info
                      > > info locals // show all local variables
                      in current
                      > function
                      > > run // start program over from
                      begining
                      > > print $ccr |= 0x10 // disable interrupts
                      > > print bar // show value of variable
                      bar
                      > > print bar=123 // set value of variable
                      bar
                      > > print foo(1,2,3) // run subroutine foo --
                      broken
                      > > disass foo // disassemble subroutine
                      foo
                      > > info target // displays information on
                      the various memory
                      > > // sections
                      > > where // broken
                      > > up // broken
                      > > down // broken
                      > > set output-radix 16
                      > > set input-radix 16
                      > > New command: "pod":
                      > > pod command // execute command on pod
                      and print results
                      > > // up to 1023
                      characters
                      > > pod reset // resset target
                      > > pod rd // display registers in
                      D-bug12 format
                      > instead
                      > > // of gdb format
                      > > pod help // DON'T DO THIS
                      > > pod ALTCLK 24000 // set alternate BDM
                      frequency
                      > > pod stop // stop program
                      > > // may want to do "x/i
                      $pc" afterwards
                      > >
                      > > New command: addrcalc9s12:
                      > > addrcalc9s12 cpu16 4000 // convert
                      memory address
                      > > addrcalc9s12 banked 3E8000 // convert
                      memory address
                      > > addrcalc9s12 mot_linear F4000 // convert
                      memory address
                      > > addrcalc9s12 offset10000 104000 // convert
                      memory address
                      > > addrcalc9s12 help
                      > > For example:
                      > > (gdb) addrcalc9s12 banked 3E89AB
                      > > CPU16: 49AB
                      > > Banked: 3E89AB
                      > > Motorola Linear:: F89AB
                      > > Offset10000: : 1089AB
                      > >
                      > > Addrcalc9s12 is also availible as a standalone
                      program as part of
                      > the
                      > > srec9s12 package.
                      > >
                      > > Macro tricks:
                      > > The following commands will result in a
                      register display each
                      > time
                      > > the system stops.
                      > > define hook-stop
                      > > pod rd
                      > > end
                      > > for some reason, "info registers" doesn't work
                      in that macro
                      > > Pressing carriage return will repeat the last
                      command. This is
                      > > particularly useful for step, next, stepi, nexti.
                      > >
                      > > Beware of executing any pod commands that may
                      interfere with gdb;
                      > for
                      > > example, tampering with breakpoints could cause
                      trouble. Any
                      > command
                      > > that does not return to a prompt could cause
                      trouble. Commands
                      > such as
                      > > "pod help" that print what look like prompt
                      characters can cause
                      > > trouble.
                      > >
                      > > If you are debugging a program that has
                      interrupts, you may be
                      > surprised
                      > > to see next, step, nexti, and stepi proceed into
                      the interrupt
                      > service
                      > > routine instead of the function you were debugging
                      (at least that
                      > > happens using the trace instruction when using
                      > > d-bug12 by itself). After hitting a breakpoint,
                      you may
                      > > want to issue the command:
                      > > print ccr |= 0x10
                      > > to disable interrupts.
                      > >
                      > > The stepi and step commands use the bdm pod trace
                      command so they
                      > > do not require a breakpoint. However, next and
                      nexti sometimes
                      > > require a breakpoint, depending on whether they
                      encounter a
                      > subroutine
                      > > call. If you are short on breakpoints, try using
                      step/stepi
                      > instead of
                      > > next/nexti where possible.
                      > >
                      > > Known Problems:
                      > > - Can't load programs. Use srec9s12 for that
                      before starting gdb.
                      > > This is an exteremely low priority to fix
                      since there is already
                      > > a means to load programs and it is not trivial
                      to make loading
                      > > work given the flow control bugs in all known
                      USB to serial
                      > adapters
                      > >
                      > > and the small receive buffer in D-bug12.
                      > >
                      > > - Printing $a and $b is broken but $d works
                      > >
                      > > - pod only supports two breakpoints.
                      > >
                      > > - next and nexti may use either trace or
                      breakpoint commands.
                      > That
                      > > means if it needs to jump over a call
                      instruction, it will use
                      > > a breakpoint. If both hardware breakpoints
                      are in use, it will
                      > > fail to stop at the appointed line.
                      > >
                      > > - If more than two breakpoints are needed
                      (including those needed
                      > > by "next" or "nexti" commands), it will fail
                      to set one of the
                      > > breakpoints without reporting an error.
                      > >
                      > > - can't modify eeprom (but you can call a
                      subroutine in the
                      > > target system that does)
                      > >
                      > > - can't modify flash
                      > >
                      > > - "where" command only shows current function
                      many times instead
                      > of
                      > > progressing up the stack. "up" has similar
                      problems.
                      > > This is probably a bug in m68hc11-tdep.c.
                      > > Perhaps it is getting confused by the extra
                      byte in the return
                      > > address. It could also be that the target
                      program was
                      > compiled
                      > > -fomit-frame-pointer. Actually, looks like
                      there is a similar
                      > > problem on a program compiled without
                      omit-frame-pointer.
                      > >
                      > > - may not work on older HCS12 cpus that don't
                      support PPAGE
                      > > due to forcing
                      > > elf_flags |= E_M68HC12_BANKS;
                      > > in m68hc11-tdep.c
                      > >
                      > > - gdb will restore certain breakpoints if you
                      delete them.
                      > >
                      > > - do not use the pod command (i.e. "pod reset")
                      before issuing
                      > > the target command or gdb will segfault.
                      > >
                      > > - "interrupt" does not work.
                      > >
                      > > - I did find one place where gdb seemed to get
                      hung up on a next
                      > > instruction. It appears that it was confused
                      by the processor
                      > > being in the run state. Control-C followed
                      by "pod stop"
                      > helped.
                      > >
                      > > - calling a function on the target system using
                      the print command
                      > > does not work properly. I think GDB is doing
                      a near call
                      > > to far functions. This is not a driver bug,
                      it is a CPU support
                      > > bug. Functions with trampolines will
                      probably work if you
                      > > give the name of the trampoline.
                      > > m68hc11_push_dummy_call looks suspect. It
                      always pushes
                      > > 16 bits for the return address. This would
                      be easy to correct
                      > > if I knew how to tell if the called function
                      was near or far.
                      > >
                      > > Before running gdb:
                      > > - resetting the pod is recommended
                      > > Existing breakpoints or the
                      > > processor being in the run state will cause
                      trouble for gdb.
                      > >
                      > > - make sure you don't have any other programs
                      (such as
                      > > a terminal emulator) running on the same
                      serial port.
                      > > Otherise, gdb will either not be able to open
                      the port
                      > > or it will succeed but the other program will
                      steal messages
                      > > intended for gdb.
                      > >
                      > > - make sure the pod is running D-bug12 v4.x
                      > >
                      > > - make sure the pod is in BDM mode
                      > >
                      > > - make sure the pod baud rate has been set
                      permanently to 115200
                      > >
                      > > - make sure the pod has been set to the right
                      xtal frequency
                      > > for the the target system. Also, set ALTCLK
                      if your
                      > > target uses the PLL.
                      > >
                      > > - if you have two breakpoints set and try to
                      use
                      > > next/step/etc. program execution will
                      continue past
                      > > current line.
                      > >
                      > > - load your program into the pod using srec9s12
                      > >
                      > > - running functions on the target using the
                      print command
                      > > that take string parameters requires that the
                      target
                      > > code have a malloc function. I.E.
                      > > print printf("hello, world\r\n");
                      > >
                      > > - there is no exception handling for when the
                      pod gets into
                      > > funny states: Running when it should be
                      stopped, asking
                      > > how to handle a target communications
                      failure, stuck mid
                      > > upload, etc.
                      > >
                      > > - remember that you can run m6811-elf-gdb under
                      gdb.
                      > > If there is a segfault, use "where" to do a
                      stack dump.
                      > > Also, you can use the "ulimit -c unlimited"
                      command at the
                      > > shell prompt to enable core dumps on unix
                      systems
                      > > which can be examined with the debugger
                      later.
                      > >
                      > > - If you have trouble on a USB to serial
                      adapter, try using a
                      > legacy
                      > > serial port.
                      > >
                      > > If you have programs which take 16 bit pointers to
                      a particular
                      > memory
                      > > section in banked memory (for example, all of a
                      particular type of
                      > > readonly data structure has been moved to the same
                      bank to save
                      > space in
                      > > non-paged flash), don't expect things like
                      > > print *p
                      > > to work. This is not a problem with this driver.
                      Limitations
                      > > in gcc, ld, and gdb prevent this. You will need
                      to do some
                      > > fancy arithmatic and casting in your print command
                      to translate
                      > > the pointer. If you step through your code until
                      it sets
                      > > the appropriate ppage register value, then it
                      might display
                      > properly.
                      > > You could call a function on the target cpu to
                      print the function
                      > on the
                      > > serial port except that such function calls from
                      the
                      > > debugger are currently broken. You can use the
                      addrcalc9s12
                      > command
                      > > added to gdb to calculate the address and then
                      cast that to a
                      > pointer of
                      > > the approriate type:
                      > > i.e. for page=37, pointer=89ab
                      > > addrcalc9s12 banked 3E89AB
                      > > print *(foo_t *) 0x1089AB
                      > >
                      > > Troubleshooting:
                      > > - try using control-c to exit any gdb commands
                      that are hung up
                      > > and try issuing some commands to the pod such
                      as "pod rd",
                      > > "pod stop", "pod nobr", and "pod reset".
                      > > - set debug remote 1
                      > > - use a terminal emulator to talk to the pod to
                      see if
                      > > it is having problems communicating with
                      target
                      > > - Make sure you don't have a terminal emulator
                      running
                      > > concurrently with gdb on the same port
                      > > - make sure you have the same version of the
                      program loaded
                      > > in gdb and the target.
                      > > - exit gdb, reset target cpu and pod, and
                      restart gdb
                      > >
                      > > You may use DDD, KDevelop, etc. as a GUI front
                      end to gdb.
                      > >
                      > > These patches were made against the prerelease
                      2.91 version of
                      > > m6811-elf-gdb.
                      > >
                      > > To compile:
                      > >
                      > > patch <patchile
                      > > cd gdb6.0/gdb
                      > > /configure --target=m6811-elf --prefix=/usr/bin
                      \
                      > > --program-prefix=m6811-elf-
                      --host=i686-pc-linux-gnu
                      > > make
                      > > make install
                      > >
                      > > srec9s12 is availible from
                      > >
                      http://www.freelabs.com/~whitis/software/srec9s12
                      > >
                      > > The first parameter is normally passed in the D
                      register, additional
                      > > paramters are passed on the stack. The return
                      value is also passed
                      > > in the D register.
                      > >
                      > > --
                      > > Mark Whitis http://www.freelabs.com/~whitis/
                      NO SPAM
                      > > Author of many open source software packages.
                      > > Coauthor: Linux Programming Unleashed (1st
                      Edition)
                      > >
                      > >
                      > >
                      > > To Post a message, send it to: gnu-m68hc11@e...
                      > >
                      > > To Unsubscribe, send a blank message to:
                      > > gnu-m68hc11-unsubscribe@e...
                      > > Yahoo! Groups Links
                      >
                      >
                      >
                      >
                      > To Post a message, send it to:
                      gnu-m68hc11@...
                      >
                      > To Unsubscribe, send a blank message to:
                      gnu-m68hc11-unsubscribe@...
                      > Yahoo! Groups Links
                      >
                      >
                      >
                      >
                      >
                      >



                      To Post a message, send it to:
                      gnu-m68hc11@...

                      To Unsubscribe, send a blank message to:
                      gnu-m68hc11-unsubscribe@...



                      ---------------------------------
                      Yahoo! Groups Links

                      To visit your group on the web, go to:
                      http://groups.yahoo.com/group/gnu-m68hc11/

                      To unsubscribe from this group, send an email to:
                      gnu-m68hc11-unsubscribe@yahoogroups.com

                      Your use of Yahoo! Groups is subject to the Yahoo!
                      Terms of Service.





                      __________________________________________________________
                      How much free photo storage do you get? Store your friends 'n family snaps for FREE with Yahoo! Photos http://in.photos.yahoo.com
                    • puja rani mishra
                      Hi, No i am trying to use DDD.Still i am not completely able to debugg a code.I am still struggling.If u have any success plz share With regards linux_bud ...
                      Message 10 of 26 , Jun 22, 2005
                      View Source
                      • 0 Attachment
                        Hi,

                        No i am trying to use DDD.Still i am not completely
                        able to debugg a code.I am still struggling.If u have
                        any success plz share

                        With regards
                        linux_bud
                        --- hebs_s <hebs_s@...> wrote:


                        ---------------------------------
                        Hi!

                        Could u get some break on ddd,insght for
                        m6811-elf-gdb?

                        I am looking for gui for Star12 debugging.

                        best wishes,
                        hebs

                        --- In gnu-m68hc11@yahoogroups.com, "puja1983_mishra"
                        <puja1983_mishra@y...> wrote:
                        > Hi,
                        >
                        > I read this message.You have mentioned we can use
                        ddd for gui
                        support
                        > to M6811-elf-gdb.You have mentioned about some
                        patch.I will be
                        > thankful to u if u can clarify on this patch
                        subject.
                        >
                        > i mean how i can get the patch and the complete
                        procedure how to
                        > build the m6811-elf-gdb with ddd as gui support/
                        >
                        > With regards
                        >
                        > linux_bud
                        >
                        >
                        >
                        > --- In gnu-m68hc11@yahoogroups.com, tburrell@s...
                        wrote:
                        > >
                        > >
                        > > -----Original Message-----
                        > > From: whitis [mailto:whitis@f...]
                        > > Sent: Thursday, February 03, 2005 7:13 AM
                        > > To: gnu-m68hc11
                        > > Subject: gdb partially working with D-bug12 bdm
                        pods
                        > >
                        > >
                        > > I have gdb partially working on the MC9S12DP256
                        (HCS12 with PPAGE
                        > > register) with the D-bug12 v4.x based BDM pods.
                        > >
                        > > This is not heavily tested but since it is the
                        first working
                        remote
                        > bdm
                        > > pod driver for gdb that is capable of debugging
                        programs >64K or
                        > that
                        > > use any of the external flash it is important to
                        make it
                        availible
                        > even
                        > > in is current state. I have tried every gdb
                        command I normally
                        use
                        > and
                        > > many I don't. They seem to work except as noted
                        below.
                        > >
                        > > My attempts to set the number of registers earlier
                        in the dbug
                        pod
                        > > driver
                        > > didn't work because the crash actually happened
                        before it reached
                        > that
                        > > point. So, though it is a crude hack, I forced the
                        bank flag high
                        > in
                        > > elf_flags. This could adversely affect those
                        trying to use older
                        > HC12
                        > > cpus with no ppage register; someone needs to fix
                        the bug in
                        gcc/ld
                        > that
                        > > causes that flag to not be set in the first place
                        so we can
                        > eliminate
                        > > this
                        > > hack. The code I posted here before worked ok -
                        it was simply
                        > > necessary
                        > > to fix/workaround some existing bugs in gdb.
                        > >
                        > > Reading memory properly sets and then restores the
                        PPAGE
                        register.
                        > The
                        > > disassemble command works for code in bank
                        switched flash.
                        Setting
                        > > breakpoints in flash works.
                        > >
                        > > Be aware that there are two versions of the PC
                        register
                        > > $pc - synthetic 32 bit register that contains
                        the gcc/gdb
                        > address
                        > > corresponding to the PPAGE:PC if
                        pointing to external
                        > > flash.
                        > > $ppc = processor (raw) PC register. 16 bits.
                        > > $page = processor PPAGE register 8 bits.
                        > >
                        > > I will assume you know enough to replace
                        "/dev/ttyUSB0" with the
                        > > appropriate port on your system and the name of
                        your program.
                        > >
                        > > The following commands must be given:
                        > > # Load program using srec9s12 first.
                        > > m6811-elf-objcopy --verbose
                        --output-target=srec
                        > pintest_load.elf \
                        > > pintest_intermediate.s19
                        > > srec9s12 <pintest_intermediate.s19
                        >pintest_load.s19
                        > > srec9s12 --send_to_pod --pod_port=/dev/ttyUSB0
                        \
                        > > --input_file=pintest_load.s19
                        --srec_bytes=16 --
                        > delay_interval=1
                        > > \
                        > > --input_map=3
                        > > m6811-elf-gdb pintest_load.elf
                        > > (gdb) set architecture m68hc12 (REQUIRED even
                        if elf file
                        > loaded)
                        > > (gdb) set remotebaud 115200
                        > > (gdb) target dbugS12 /dev/ttyUSB0
                        > >
                        > > To start your program (after doing above)
                        > > (gdb) pod reset
                        > > (gdb) pod nobr // remove any leftover
                        breakpoints on
                        > pod
                        > > (gdb) delete // remove any leftover
                        breakpoints
                        > > // due to gdb bugs
                        > > (gdb) display/i $pc
                        > > (gdb) break main
                        > > (gdb) run
                        > > (breakpoint reached)
                        > > (gdb) clear main
                        > > (gdb) break emstdio_fputc
                        > > (gdb) cont
                        > > (breakpoint reached)
                        > > (gdb) print $ccr |= 0x10 // disable
                        interrupts
                        > > (gdb) nexti // singlestep cpu
                        instructions
                        > > (gdb) nexti
                        > > (gdb) nexti
                        > > (gdb) nexti
                        > > (gdb0 next // singlestep
                        source lines
                        > > (gdb) next
                        > > (gdb) next
                        > > n
                        > > You don't have to stop at main as shown above
                        before setting a
                        > > breakpoint somewhere eles.
                        > >
                        > > Two commands have been added to gdb: "pod" and
                        "addrcalc9s12".
                        > >
                        > > Some useful commands:
                        > > set debug remote 1 // print commands sent to
                        pod and
                        responses
                        > > set debug remote 0 // turn back off
                        > > info program // display information
                        about program
                        > > break main // set breakpoint at main()
                        > > info breakpoints // show breakpoints
                        > > clear main // clear breakpoint at
                        main()
                        > > delete 1 // delete breakpoint 1
                        > > delete // delete all breakpoints
                        > > x/i $pc // show current instruction
                        > > display/i $pc // show current instruction
                        each time
                        > program
                        > > stops
                        > > print/x $ppc // show hardware PC
                        register
                        > > print/x $pc // show synthetic PC
                        register
                        > > print/x $page // show PPAGE register
                        > > print/x $d // show D register
                        > > print/x $x // show X register
                        > > print/x $y // show Y register
                        > > print/x $sp // show SP register
                        > > print $page=0x37 // set ppage register
                        > > // similarly for other
                        registers
                        > > hex
                        > >
                        > > x/xh $x // show 16 bit value
                        pointed to by X
                        register
                        > > x/xw $x // show 32 bit value
                        pointed to by X
                        register
                        > > x/xb $x // show 8 bit value pointed
                        to by X
                        register
                        > > x/10xb $x // show ten 8 bit values
                        pointed to by X
                        > register
                        > > x/256xb 0x4000 // show 256 bytes at
                        address 0x4000 (in
                        gcc
                        > > address
                        > > space, not banked)
                        > > cont // start/continue program
                        > > step // execute next line of
                        source code
                        > > next // execute next line of
                        source code, but
                        > don't
                        > > // trace into
                        subroutine calls
                        > > stepi // execute next instruction
                        > > nexti // execute next instruction
                        but don't
                        > > // trace into
                        subroutine calls
                        > > until // try this at the bottom of
                        a loop
                        > > list // show source code near $pc
                        > > where // stack trace
                        > > info frame // current stack frame info
                        > > info locals // show all local variables
                        in current
                        > function
                        > > run // start program over from
                        begining
                        > > print $ccr |= 0x10 // disable interrupts
                        > > print bar // show value of variable
                        bar
                        > > print bar=123 // set value of variable
                        bar
                        > > print foo(1,2,3) // run subroutine foo --
                        broken
                        > > disass foo // disassemble subroutine
                        foo
                        > > info target // displays information on
                        the various
                        memory
                        > > // sections
                        > > where // broken
                        > > up // broken
                        > > down // broken
                        > > set output-radix 16
                        > > set input-radix 16
                        > > New command: "pod":
                        > > pod command // execute command on pod
                        and print results
                        > > // up to 1023
                        characters
                        > > pod reset // resset target
                        > > pod rd // display registers in
                        D-bug12 format
                        > instead
                        > > // of gdb format
                        > > pod help // DON'T DO THIS
                        > > pod ALTCLK 24000 // set alternate BDM
                        frequency
                        > > pod stop // stop program
                        > > // may want to do "x/i
                        $pc" afterwards
                        > >
                        > > New command: addrcalc9s12:
                        > > addrcalc9s12 cpu16 4000 // convert
                        memory address
                        > > addrcalc9s12 banked 3E8000 // convert
                        memory address
                        > > addrcalc9s12 mot_linear F4000 // convert
                        memory address
                        > > addrcalc9s12 offset10000 104000 // convert
                        memory address
                        > > addrcalc9s12 help
                        > > For example:
                        > > (gdb) addrcalc9s12 banked 3E89AB
                        > > CPU16: 49AB
                        > > Banked: 3E89AB
                        > > Motorola Linear:: F89AB
                        > > Offset10000: : 1089AB
                        > >
                        > > Addrcalc9s12 is also availible as a standalone
                        program as part of
                        > the
                        > > srec9s12 package.
                        > >
                        > > Macro tricks:
                        > > The following commands will result in a
                        register display each
                        > time
                        > > the system stops.
                        > > define hook-stop
                        > > pod rd
                        > > end
                        > > for some reason, "info registers" doesn't work
                        in that macro
                        > > Pressing carriage return will repeat the last
                        command. This is
                        > > particularly useful for step, next, stepi, nexti.
                        > >
                        > > Beware of executing any pod commands that may
                        interfere with gdb;
                        > for
                        > > example, tampering with breakpoints could cause
                        trouble. Any
                        > command
                        > > that does not return to a prompt could cause
                        trouble. Commands
                        > such as
                        > > "pod help" that print what look like prompt
                        characters can cause
                        > > trouble.
                        > >
                        > > If you are debugging a program that has
                        interrupts, you may be
                        > surprised
                        > > to see next, step, nexti, and stepi proceed into
                        the interrupt
                        > service
                        > > routine instead of the function you were debugging
                        (at least that
                        > > happens using the trace instruction when using
                        > > d-bug12 by itself). After hitting a breakpoint,
                        you may
                        > > want to issue the command:
                        > > print ccr |= 0x10
                        > > to disable interrupts.
                        > >
                        > > The stepi and step commands use the bdm pod trace
                        command so they
                        > > do not require a breakpoint. However, next and
                        nexti sometimes
                        > > require a breakpoint, depending on whether they
                        encounter a
                        > subroutine
                        > > call. If you are short on breakpoints, try using
                        step/stepi
                        > instead of
                        > > next/nexti where possible.
                        > >
                        > > Known Problems:
                        > > - Can't load programs. Use srec9s12 for that
                        before starting
                        gdb.
                        > > This is an exteremely low priority to fix
                        since there is
                        already
                        > > a means to load programs and it is not trivial
                        to make loading
                        > > work given the flow control bugs in all known
                        USB to serial
                        > adapters
                        > >
                        > > and the small receive buffer in D-bug12.
                        > >
                        > > - Printing $a and $b is broken but $d works
                        > >
                        > > - pod only supports two breakpoints.
                        > >
                        > > - next and nexti may use either trace or
                        breakpoint commands.
                        > That
                        > > means if it needs to jump over a call
                        instruction, it will use
                        > > a breakpoint. If both hardware breakpoints
                        are in use, it
                        will
                        > > fail to stop at the appointed line.
                        > >
                        > > - If more than two breakpoints are needed
                        (including those
                        needed
                        > > by "next" or "nexti" commands), it will fail
                        to set one of the
                        > > breakpoints without reporting an error.
                        > >
                        > > - can't modify eeprom (but you can call a
                        subroutine in the
                        > > target system that does)
                        > >
                        > > - can't modify flash
                        > >
                        > > - "where" command only shows current function
                        many times
                        instead
                        > of
                        > > progressing up the stack. "up" has similar
                        problems.
                        > > This is probably a bug in m68hc11-tdep.c.
                        > > Perhaps it is getting confused by the extra
                        byte in the return
                        > > address. It could also be that the target
                        program was
                        > compiled
                        > > -fomit-frame-pointer. Actually, looks like
                        there is a
                        similar
                        > > problem on a program compiled without
                        omit-frame-pointer.
                        > >
                        > > - may not work on older HCS12 cpus that don't
                        support PPAGE
                        > > due to forcing
                        > > elf_flags |= E_M68HC12_BANKS;
                        > > in m68hc11-tdep.c
                        > >
                        > > - gdb will restore certain breakpoints if you
                        delete them.
                        > >
                        > > - do not use the pod command (i.e. "pod reset")
                        before issuing
                        > > the target command or gdb will segfault.
                        > >
                        > > - "interrupt" does not work.
                        > >
                        > > - I did find one place where gdb seemed to get
                        hung up on a next
                        > > instruction. It appears that it was confused
                        by the processor
                        > > being in the run state. Control-C followed
                        by "pod stop"
                        > helped.
                        > >
                        > > - calling a function on the target system using
                        the print
                        command
                        > > does not work properly. I think GDB is doing
                        a near call
                        > > to far functions. This is not a driver bug,
                        it is a CPU
                        support
                        > > bug. Functions with trampolines will
                        probably work if you
                        > > give the name of the trampoline.
                        > > m68hc11_push_dummy_call looks suspect. It
                        always pushes
                        > > 16 bits for the return address. This would
                        be easy to
                        correct
                        > > if I knew how to tell if the called function
                        was near or far.
                        > >
                        > > Before running gdb:
                        > > - resetting the pod is recommended
                        > > Existing breakpoints or the
                        > > processor being in the run state will cause
                        trouble for gdb.
                        > >
                        > > - make sure you don't have any other programs
                        (such as
                        > > a terminal emulator) running on the same
                        serial port.
                        > > Otherise, gdb will either not be able to open
                        the port
                        > > or it will succeed but the other program will
                        steal messages
                        > > intended for gdb.
                        > >
                        > > - make sure the pod is running D-bug12 v4.x
                        > >
                        > > - make sure the pod is in BDM mode
                        > >
                        > > - make sure the pod baud rate has been set
                        permanently to
                        115200
                        > >
                        > > - make sure the pod has been set to the right
                        xtal frequency
                        > > for the the target system. Also, set ALTCLK
                        if your
                        > > target uses the PLL.
                        > >
                        > > - if you have two breakpoints set and try to
                        use
                        > > next/step/etc. program execution will
                        continue past
                        > > current line.
                        > >
                        > > - load your program into the pod using srec9s12

                        > >
                        > > - running functions on the target using the
                        print command
                        > > that take string parameters requires that the
                        target
                        > > code have a malloc function. I.E.
                        > > print printf("hello, world\r\n");
                        > >
                        > > - there is no exception handling for when the
                        pod gets into
                        > > funny states: Running when it should be
                        stopped, asking
                        > > how to handle a target communications
                        failure, stuck mid
                        > > upload, etc.
                        > >
                        > > - remember that you can run m6811-elf-gdb under
                        gdb.
                        > > If there is a segfault, use "where" to do a
                        stack dump.
                        > > Also, you can use the "ulimit -c unlimited"
                        command at the
                        > > shell prompt to enable core dumps on unix
                        systems
                        > > which can be examined with the debugger
                        later.
                        > >
                        > > - If you have trouble on a USB to serial
                        adapter, try using a
                        > legacy
                        > > serial port.
                        > >
                        > > If you have programs which take 16 bit pointers to
                        a particular
                        > memory
                        > > section in banked memory (for example, all of a
                        particular type
                        of
                        > > readonly data structure has been moved to the same
                        bank to save
                        > space in
                        > > non-paged flash), don't expect things like
                        > > print *p
                        > > to work. This is not a problem with this driver.
                        Limitations
                        > > in gcc, ld, and gdb prevent this. You will need
                        to do some
                        > > fancy arithmatic and casting in your print command
                        to translate
                        > > the pointer. If you step through your code until
                        it sets
                        > > the appropriate ppage register value, then it
                        might display
                        > properly.
                        > > You could call a function on the target cpu to
                        print the function
                        > on the
                        > > serial port except that such function calls from
                        the
                        > > debugger are currently broken. You can use the
                        addrcalc9s12
                        > command
                        > > added to gdb to calculate the address and then
                        cast that to a
                        > pointer of
                        > > the approriate type:
                        > > i.e. for page=37, pointer=89ab
                        > > addrcalc9s12 banked 3E89AB
                        > > print *(foo_t *) 0x1089AB
                        > >
                        > > Troubleshooting:
                        > > - try using control-c to exit any gdb commands
                        that are hung up
                        > > and try issuing some commands to the pod such
                        as "pod rd",
                        > > "pod stop", "pod nobr", and "pod reset".
                        > > - set debug remote 1
                        > > - use a terminal emulator to talk to the pod to
                        see if
                        > > it is having problems communicating with
                        target
                        > > - Make sure you don't have a terminal emulator
                        running
                        > > concurrently with gdb on the same port
                        > > - make sure you have the same version of the
                        program loaded
                        > > in gdb and the target.
                        > > - exit gdb, reset target cpu and pod, and
                        restart gdb
                        > >
                        > > You may use DDD, KDevelop, etc. as a GUI front
                        end to gdb.
                        > >
                        > > These patches were made against the prerelease
                        2.91 version of
                        > > m6811-elf-gdb.
                        > >
                        > > To compile:
                        > >
                        > > patch <patchile
                        > > cd gdb6.0/gdb
                        > > /configure --target=m6811-elf --prefix=/usr/bin
                        \
                        > > --program-prefix=m6811-elf-
                        --host=i686-pc-linux-gnu
                        > > make
                        > > make install
                        > >
                        > > srec9s12 is availible from
                        > >
                        http://www.freelabs.com/~whitis/software/srec9s12
                        > >
                        > > The first parameter is normally passed in the D
                        register,
                        additional
                        > > paramters are passed on the stack. The return
                        value is also
                        passed
                        > > in the D register.
                        > >
                        > > --
                        > > Mark Whitis http://www.freelabs.com/~whitis/
                        NO SPAM
                        > > Author of many open source software packages.
                        > > Coauthor: Linux Programming Unleashed (1st
                        Edition)
                        > >
                        > >
                        > >
                        > > To Post a message, send it to: gnu-m68hc11@e...
                        > >
                        > > To Unsubscribe, send a blank message to:
                        > > gnu-m68hc11-unsubscribe@e...
                        > > Yahoo! Groups Links




                        To Post a message, send it to:
                        gnu-m68hc11@...

                        To Unsubscribe, send a blank message to:
                        gnu-m68hc11-unsubscribe@...



                        ---------------------------------
                        Yahoo! Groups Links

                        To visit your group on the web, go to:
                        http://groups.yahoo.com/group/gnu-m68hc11/

                        To unsubscribe from this group, send an email to:
                        gnu-m68hc11-unsubscribe@yahoogroups.com

                        Your use of Yahoo! Groups is subject to the Yahoo!
                        Terms of Service.





                        __________________________________________________________
                        How much free photo storage do you get? Store your friends 'n family snaps for FREE with Yahoo! Photos http://in.photos.yahoo.com
                      • Andrew Wilson
                        Hello, I m not quite sure if this is the right group to send this question too, but I m looking for a microcontroller board to do 4-axis of servo motion (need
                        Message 11 of 26 , Jun 23, 2005
                        View Source
                        • 0 Attachment
                          Hello,
                          I'm not quite sure if this is the right group to send
                          this question too, but I'm looking for a
                          microcontroller board to do 4-axis of servo motion
                          (need 4 quadrature encoder inputs, 4 DAC's and 4
                          ADC's) I can't seem to find a vendor that provides a
                          development system with this setum. Is there a list
                          of development board microcontroller vendors anywhere?
                          Or if someone can point me to a vendor with a
                          solution?
                          THanks very much
                          Andrew




                          ____________________________________________________
                          Yahoo! Sports
                          Rekindle the Rivalries. Sign up for Fantasy Football
                          http://football.fantasysports.yahoo.com
                        • Grizzly
                          Andrew, Someone can correct me if I am wrong but I don t know of any development board that has any DAC s. I believe you will have to add external hardware (a
                          Message 12 of 26 , Jun 23, 2005
                          View Source
                          • 0 Attachment
                            Andrew,

                            Someone can correct me if I am wrong but I don't
                            know of any development board that has any DAC's.

                            I believe you will have to add external hardware (a
                            DAC ic chip).

                            Other than that I am partial to the Technological Arts
                            line of development boards. See links:
                            http://www.technologicalarts.com/
                            http://www.technologicalarts.com/myfiles/AD9S12DP256.html

                            John


                            ----- Original Message -----
                            From: "Andrew Wilson" <mapex99@...>
                            To: <gnu-m68hc11@yahoogroups.com>
                            Sent: Thursday, June 23, 2005 7:44 AM
                            Subject: 68hc1x boards


                            > Hello,
                            > I'm not quite sure if this is the right group to send
                            > this question too, but I'm looking for a
                            > microcontroller board to do 4-axis of servo motion
                            > (need 4 quadrature encoder inputs, 4 DAC's and 4
                            > ADC's) I can't seem to find a vendor that provides a
                            > development system with this setum. Is there a list
                            > of development board microcontroller vendors anywhere?
                            > Or if someone can point me to a vendor with a
                            > solution?
                            > THanks very much
                            > Andrew
                          • Ioan Petrescu
                            Hi, I don t know why this behaviour. I am not using superuser mode, I work just from my account. The command syntax is a little bit wrong - it should be ddd
                            Message 13 of 26 , Jun 23, 2005
                            View Source
                            • 0 Attachment
                              Hi,
                              I don't know why this behaviour.
                              I am not using superuser mode, I work just from my account.
                              The command syntax is a little bit wrong - it should be
                              ddd --debugger m6811-elf-gdb myfile.elf
                              IP

                              ----- Original Message -----
                              From: "puja rani mishra" <puja1983_mishra@...>
                              To: <gnu-m68hc11@yahoogroups.com>
                              Sent: Thursday, June 23, 2005 7:35 AM
                              Subject: Re: gdb partially working with D-bug12 bdm pods


                              > Hi IP,
                              > I tried what u have written in the reply of my mail.
                              > I went to the directory where my main.elf file(the
                              > code to be debugged)is there.Then i changed to
                              > superuser mode and gave the commean as per u.But it
                              > gave
                              >
                              >
                              > Warning: Tried to connect to session manager,
                              > Authentication Rejected, reason :
                              > None of the authentication protocols specified are
                              > supported and host-based authentication failed
                              >
                              > then one window is getting opened with message
                              >
                              >
                              > --- Ioan Petrescu <yoanp@...> wrote:
                              >
                              >
                              > ---------------------------------
                              > Hi,
                              > In order to use ddd with gdb, you have nothing to do
                              > specially; only
                              > the command is necessary:
                              > ddd --debug m6811-elf-gdb myfile.elf
                              > ddd is only an interface and call gdb as a subprocess.
                              > Once you are in ddd, type in the command window all
                              > the known commands
                              > to configure gdb and load files
                              > Regards,
                              > IP
                              > ----- Original Message -----
                              > From: "puja1983_mishra" <puja1983_mishra@...>
                              > To: <gnu-m68hc11@yahoogroups.com>
                              > Sent: Wednesday, June 22, 2005 12:06 PM
                              > Subject: Re: gdb partially working with D-bug12 bdm
                              > pods
                              >
                              >
                              > > Hi,
                              > >
                              > > I read this message.You have mentioned we can use
                              > ddd for gui support
                              > > to M6811-elf-gdb.You have mentioned about some
                              > patch.I will be
                              > > thankful to u if u can clarify on this patch
                              > subject.
                              > >
                              > > i mean how i can get the patch and the complete
                              > procedure how to
                              > > build the m6811-elf-gdb with ddd as gui support/
                              > >
                              > > With regards
                              > >
                              > > linux_bud
                              > >
                              > >
                              > >
                              > > --- In gnu-m68hc11@yahoogroups.com, tburrell@s...
                              > wrote:
                              > > >
                              > > >
                              > > > -----Original Message-----
                              > > > From: whitis [mailto:whitis@f...]
                              > > > Sent: Thursday, February 03, 2005 7:13 AM
                              > > > To: gnu-m68hc11
                              > > > Subject: gdb partially working with D-bug12 bdm
                              > pods
                              > > >
                              > > >
                              > > > I have gdb partially working on the MC9S12DP256
                              > (HCS12 with PPAGE
                              > > > register) with the D-bug12 v4.x based BDM pods.
                              > > >
                              > > > This is not heavily tested but since it is the
                              > first working remote
                              > > bdm
                              > > > pod driver for gdb that is capable of debugging
                              > programs >64K or
                              > > that
                              > > > use any of the external flash it is important to
                              > make it availible
                              > > even
                              > > > in is current state. I have tried every gdb
                              > command I normally use
                              > > and
                              > > > many I don't. They seem to work except as noted
                              > below.
                              > > >
                              > > > My attempts to set the number of registers earlier
                              > in the dbug pod
                              > > > driver
                              > > > didn't work because the crash actually happened
                              > before it reached
                              > > that
                              > > > point. So, though it is a crude hack, I forced the
                              > bank flag high
                              > > in
                              > > > elf_flags. This could adversely affect those
                              > trying to use older
                              > > HC12
                              > > > cpus with no ppage register; someone needs to fix
                              > the bug in gcc/ld
                              > > that
                              > > > causes that flag to not be set in the first place
                              > so we can
                              > > eliminate
                              > > > this
                              > > > hack. The code I posted here before worked ok -
                              > it was simply
                              > > > necessary
                              > > > to fix/workaround some existing bugs in gdb.
                              > > >
                              > > > Reading memory properly sets and then restores the
                              > PPAGE register.
                              > > The
                              > > > disassemble command works for code in bank
                              > switched flash. Setting
                              > > > breakpoints in flash works.
                              > > >
                              > > > Be aware that there are two versions of the PC
                              > register
                              > > > $pc - synthetic 32 bit register that contains
                              > the gcc/gdb
                              > > address
                              > > > corresponding to the PPAGE:PC if
                              > pointing to external
                              > > > flash.
                              > > > $ppc = processor (raw) PC register. 16 bits.
                              > > > $page = processor PPAGE register 8 bits.
                              > > >
                              > > > I will assume you know enough to replace
                              > "/dev/ttyUSB0" with the
                              > > > appropriate port on your system and the name of
                              > your program.
                              > > >
                              > > > The following commands must be given:
                              > > > # Load program using srec9s12 first.
                              > > > m6811-elf-objcopy --verbose
                              > --output-target=srec
                              > > pintest_load.elf \
                              > > > pintest_intermediate.s19
                              > > > srec9s12 <pintest_intermediate.s19
                              > >pintest_load.s19
                              > > > srec9s12 --send_to_pod --pod_port=/dev/ttyUSB0
                              > \
                              > > > --input_file=pintest_load.s19
                              > --srec_bytes=16 --
                              > > delay_interval=1
                              > > > \
                              > > > --input_map=3
                              > > > m6811-elf-gdb pintest_load.elf
                              > > > (gdb) set architecture m68hc12 (REQUIRED even
                              > if elf file
                              > > loaded)
                              > > > (gdb) set remotebaud 115200
                              > > > (gdb) target dbugS12 /dev/ttyUSB0
                              > > >
                              > > > To start your program (after doing above)
                              > > > (gdb) pod reset
                              > > > (gdb) pod nobr // remove any leftover
                              > breakpoints on
                              > > pod
                              > > > (gdb) delete // remove any leftover
                              > breakpoints
                              > > > // due to gdb bugs
                              > > > (gdb) display/i $pc
                              > > > (gdb) break main
                              > > > (gdb) run
                              > > > (breakpoint reached)
                              > > > (gdb) clear main
                              > > > (gdb) break emstdio_fputc
                              > > > (gdb) cont
                              > > > (breakpoint reached)
                              > > > (gdb) print $ccr |= 0x10 // disable
                              > interrupts
                              > > > (gdb) nexti // singlestep cpu
                              > instructions
                              > > > (gdb) nexti
                              > > > (gdb) nexti
                              > > > (gdb) nexti
                              > > > (gdb0 next // singlestep
                              > source lines
                              > > > (gdb) next
                              > > > (gdb) next
                              > > > n
                              > > > You don't have to stop at main as shown above
                              > before setting a
                              > > > breakpoint somewhere eles.
                              > > >
                              > > > Two commands have been added to gdb: "pod" and
                              > "addrcalc9s12".
                              > > >
                              > > > Some useful commands:
                              > > > set debug remote 1 // print commands sent to
                              > pod and responses
                              > > > set debug remote 0 // turn back off
                              > > > info program // display information
                              > about program
                              > > > break main // set breakpoint at main()
                              > > > info breakpoints // show breakpoints
                              > > > clear main // clear breakpoint at
                              > main()
                              > > > delete 1 // delete breakpoint 1
                              > > > delete // delete all breakpoints
                              > > > x/i $pc // show current instruction
                              > > > display/i $pc // show current instruction
                              > each time
                              > > program
                              > > > stops
                              > > > print/x $ppc // show hardware PC
                              > register
                              > > > print/x $pc // show synthetic PC
                              > register
                              > > > print/x $page // show PPAGE register
                              > > > print/x $d // show D register
                              > > > print/x $x // show X register
                              > > > print/x $y // show Y register
                              > > > print/x $sp // show SP register
                              > > > print $page=0x37 // set ppage register
                              > > > // similarly for other
                              > registers
                              > > > hex
                              > > >
                              > > > x/xh $x // show 16 bit value
                              > pointed to by X register
                              > > > x/xw $x // show 32 bit value
                              > pointed to by X register
                              > > > x/xb $x // show 8 bit value pointed
                              > to by X register
                              > > > x/10xb $x // show ten 8 bit values
                              > pointed to by X
                              > > register
                              > > > x/256xb 0x4000 // show 256 bytes at
                              > address 0x4000 (in gcc
                              > > > address
                              > > > space, not banked)
                              > > > cont // start/continue program
                              > > > step // execute next line of
                              > source code
                              > > > next // execute next line of
                              > source code, but
                              > > don't
                              > > > // trace into
                              > subroutine calls
                              > > > stepi // execute next instruction
                              > > > nexti // execute next instruction
                              > but don't
                              > > > // trace into
                              > subroutine calls
                              > > > until // try this at the bottom of
                              > a loop
                              > > > list // show source code near $pc
                              > > > where // stack trace
                              > > > info frame // current stack frame info
                              > > > info locals // show all local variables
                              > in current
                              > > function
                              > > > run // start program over from
                              > begining
                              > > > print $ccr |= 0x10 // disable interrupts
                              > > > print bar // show value of variable
                              > bar
                              > > > print bar=123 // set value of variable
                              > bar
                              > > > print foo(1,2,3) // run subroutine foo --
                              > broken
                              > > > disass foo // disassemble subroutine
                              > foo
                              > > > info target // displays information on
                              > the various memory
                              > > > // sections
                              > > > where // broken
                              > > > up // broken
                              > > > down // broken
                              > > > set output-radix 16
                              > > > set input-radix 16
                              > > > New command: "pod":
                              > > > pod command // execute command on pod
                              > and print results
                              > > > // up to 1023
                              > characters
                              > > > pod reset // resset target
                              > > > pod rd // display registers in
                              > D-bug12 format
                              > > instead
                              > > > // of gdb format
                              > > > pod help // DON'T DO THIS
                              > > > pod ALTCLK 24000 // set alternate BDM
                              > frequency
                              > > > pod stop // stop program
                              > > > // may want to do "x/i
                              > $pc" afterwards
                              > > >
                              > > > New command: addrcalc9s12:
                              > > > addrcalc9s12 cpu16 4000 // convert
                              > memory address
                              > > > addrcalc9s12 banked 3E8000 // convert
                              > memory address
                              > > > addrcalc9s12 mot_linear F4000 // convert
                              > memory address
                              > > > addrcalc9s12 offset10000 104000 // convert
                              > memory address
                              > > > addrcalc9s12 help
                              > > > For example:
                              > > > (gdb) addrcalc9s12 banked 3E89AB
                              > > > CPU16: 49AB
                              > > > Banked: 3E89AB
                              > > > Motorola Linear:: F89AB
                              > > > Offset10000: : 1089AB
                              > > >
                              > > > Addrcalc9s12 is also availible as a standalone
                              > program as part of
                              > > the
                              > > > srec9s12 package.
                              > > >
                              > > > Macro tricks:
                              > > > The following commands will result in a
                              > register display each
                              > > time
                              > > > the system stops.
                              > > > define hook-stop
                              > > > pod rd
                              > > > end
                              > > > for some reason, "info registers" doesn't work
                              > in that macro
                              > > > Pressing carriage return will repeat the last
                              > command. This is
                              > > > particularly useful for step, next, stepi, nexti.
                              > > >
                              > > > Beware of executing any pod commands that may
                              > interfere with gdb;
                              > > for
                              > > > example, tampering with breakpoints could cause
                              > trouble. Any
                              > > command
                              > > > that does not return to a prompt could cause
                              > trouble. Commands
                              > > such as
                              > > > "pod help" that print what look like prompt
                              > characters can cause
                              > > > trouble.
                              > > >
                              > > > If you are debugging a program that has
                              > interrupts, you may be
                              > > surprised
                              > > > to see next, step, nexti, and stepi proceed into
                              > the interrupt
                              > > service
                              > > > routine instead of the function you were debugging
                              > (at least that
                              > > > happens using the trace instruction when using
                              > > > d-bug12 by itself). After hitting a breakpoint,
                              > you may
                              > > > want to issue the command:
                              > > > print ccr |= 0x10
                              > > > to disable interrupts.
                              > > >
                              > > > The stepi and step commands use the bdm pod trace
                              > command so they
                              > > > do not require a breakpoint. However, next and
                              > nexti sometimes
                              > > > require a breakpoint, depending on whether they
                              > encounter a
                              > > subroutine
                              > > > call. If you are short on breakpoints, try using
                              > step/stepi
                              > > instead of
                              > > > next/nexti where possible.
                              > > >
                              > > > Known Problems:
                              > > > - Can't load programs. Use srec9s12 for that
                              > before starting gdb.
                              > > > This is an exteremely low priority to fix
                              > since there is already
                              > > > a means to load programs and it is not trivial
                              > to make loading
                              > > > work given the flow control bugs in all known
                              > USB to serial
                              > > adapters
                              > > >
                              > > > and the small receive buffer in D-bug12.
                              > > >
                              > > > - Printing $a and $b is broken but $d works
                              > > >
                              > > > - pod only supports two breakpoints.
                              > > >
                              > > > - next and nexti may use either trace or
                              > breakpoint commands.
                              > > That
                              > > > means if it needs to jump over a call
                              > instruction, it will use
                              > > > a breakpoint. If both hardware breakpoints
                              > are in use, it will
                              > > > fail to stop at the appointed line.
                              > > >
                              > > > - If more than two breakpoints are needed
                              > (including those needed
                              > > > by "next" or "nexti" commands), it will fail
                              > to set one of the
                              > > > breakpoints without reporting an error.
                              > > >
                              > > > - can't modify eeprom (but you can call a
                              > subroutine in the
                              > > > target system that does)
                              > > >
                              > > > - can't modify flash
                              > > >
                              > > > - "where" command only shows current function
                              > many times instead
                              > > of
                              > > > progressing up the stack. "up" has similar
                              > problems.
                              > > > This is probably a bug in m68hc11-tdep.c.
                              > > > Perhaps it is getting confused by the extra
                              > byte in the return
                              > > > address. It could also be that the target
                              > program was
                              > > compiled
                              > > > -fomit-frame-pointer. Actually, looks like
                              > there is a similar
                              > > > problem on a program compiled without
                              > omit-frame-pointer.
                              > > >
                              > > > - may not work on older HCS12 cpus that don't
                              > support PPAGE
                              > > > due to forcing
                              > > > elf_flags |= E_M68HC12_BANKS;
                              > > > in m68hc11-tdep.c
                              > > >
                              > > > - gdb will restore certain breakpoints if you
                              > delete them.
                              > > >
                              > > > - do not use the pod command (i.e. "pod reset")
                              > before issuing
                              > > > the target command or gdb will segfault.
                              > > >
                              > > > - "interrupt" does not work.
                              > > >
                              > > > - I did find one place where gdb seemed to get
                              > hung up on a next
                              > > > instruction. It appears that it was confused
                              > by the processor
                              > > > being in the run state. Control-C followed
                              > by "pod stop"
                              > > helped.
                              > > >
                              > > > - calling a function on the target system using
                              > the print command
                              > > > does not work properly. I think GDB is doing
                              > a near call
                              > > > to far functions. This is not a driver bug,
                              > it is a CPU support
                              > > > bug. Functions with trampolines will
                              > probably work if you
                              > > > give the name of the trampoline.
                              > > > m68hc11_push_dummy_call looks suspect. It
                              > always pushes
                              > > > 16 bits for the return address. This would
                              > be easy to correct
                              > > > if I knew how to tell if the called function
                              > was near or far.
                              > > >
                              > > > Before running gdb:
                              > > > - resetting the pod is recommended
                              > > > Existing breakpoints or the
                              > > > processor being in the run state will cause
                              > trouble for gdb.
                              > > >
                              > > > - make sure you don't have any other programs
                              > (such as
                              > > > a terminal emulator) running on the same
                              > serial port.
                              > > > Otherise, gdb will either not be able to open
                              > the port
                              > > > or it will succeed but the other program will
                              > steal messages
                              > > > intended for gdb.
                              > > >
                              > > > - make sure the pod is running D-bug12 v4.x
                              > > >
                              > > > - make sure the pod is in BDM mode
                              > > >
                              > > > - make sure the pod baud rate has been set
                              > permanently to 115200
                              > > >
                              > > > - make sure the pod has been set to the right
                              > xtal frequency
                              > > > for the the target system. Also, set ALTCLK
                              > if your
                              > > > target uses the PLL.
                              > > >
                              > > > - if you have two breakpoints set and try to
                              > use
                              > > > next/step/etc. program execution will
                              > continue past
                              > > > current line.
                              > > >
                              > > > - load your program into the pod using srec9s12
                              > > >
                              > > > - running functions on the target using the
                              > print command
                              > > > that take string parameters requires that the
                              > target
                              > > > code have a malloc function. I.E.
                              > > > print printf("hello, world\r\n");
                              > > >
                              > > > - there is no exception handling for when the
                              > pod gets into
                              > > > funny states: Running when it should be
                              > stopped, asking
                              > > > how to handle a target communications
                              > failure, stuck mid
                              > > > upload, etc.
                              > > >
                              > > > - remember that you can run m6811-elf-gdb under
                              > gdb.
                              > > > If there is a segfault, use "where" to do a
                              > stack dump.
                              > > > Also, you can use the "ulimit -c unlimited"
                              > command at the
                              > > > shell prompt to enable core dumps on unix
                              > systems
                              > > > which can be examined with the debugger
                              > later.
                              > > >
                              > > > - If you have trouble on a USB to serial
                              > adapter, try using a
                              > > legacy
                              > > > serial port.
                              > > >
                              > > > If you have programs which take 16 bit pointers to
                              > a particular
                              > > memory
                              > > > section in banked memory (for example, all of a
                              > particular type of
                              > > > readonly data structure has been moved to the same
                              > bank to save
                              > > space in
                              > > > non-paged flash), don't expect things like
                              > > > print *p
                              > > > to work. This is not a problem with this driver.
                              > Limitations
                              > > > in gcc, ld, and gdb prevent this. You will need
                              > to do some
                              > > > fancy arithmatic and casting in your print command
                              > to translate
                              > > > the pointer. If you step through your code until
                              > it sets
                              > > > the appropriate ppage register value, then it
                              > might display
                              > > properly.
                              > > > You could call a function on the target cpu to
                              > print the function
                              > > on the
                              > > > serial port except that such function calls from
                              > the
                              > > > debugger are currently broken. You can use the
                              > addrcalc9s12
                              > > command
                              > > > added to gdb to calculate the address and then
                              > cast that to a
                              > > pointer of
                              > > > the approriate type:
                              > > > i.e. for page=37, pointer=89ab
                              > > > addrcalc9s12 banked 3E89AB
                              > > > print *(foo_t *) 0x1089AB
                              > > >
                              > > > Troubleshooting:
                              > > > - try using control-c to exit any gdb commands
                              > that are hung up
                              > > > and try issuing some commands to the pod such
                              > as "pod rd",
                              > > > "pod stop", "pod nobr", and "pod reset".
                              > > > - set debug remote 1
                              > > > - use a terminal emulator to talk to the pod to
                              > see if
                              > > > it is having problems communicating with
                              > target
                              > > > - Make sure you don't have a terminal emulator
                              > running
                              > > > concurrently with gdb on the same port
                              > > > - make sure you have the same version of the
                              > program loaded
                              > > > in gdb and the target.
                              > > > - exit gdb, reset target cpu and pod, and
                              > restart gdb
                              > > >
                              > > > You may use DDD, KDevelop, etc. as a GUI front
                              > end to gdb.
                              > > >
                              > > > These patches were made against the prerelease
                              > 2.91 version of
                              > > > m6811-elf-gdb.
                              > > >
                              > > > To compile:
                              > > >
                              > > > patch <patchile
                              > > > cd gdb6.0/gdb
                              > > > /configure --target=m6811-elf --prefix=/usr/bin
                              > \
                              > > > --program-prefix=m6811-elf-
                              > --host=i686-pc-linux-gnu
                              > > > make
                              > > > make install
                              > > >
                              > > > srec9s12 is availible from
                              > > >
                              > http://www.freelabs.com/~whitis/software/srec9s12
                              > > >
                              > > > The first parameter is normally passed in the D
                              > register, additional
                              > > > paramters are passed on the stack. The return
                              > value is also passed
                              > > > in the D register.
                              > > >
                              > > > --
                              > > > Mark Whitis http://www.freelabs.com/~whitis/
                              > NO SPAM
                              > > > Author of many open source software packages.
                              > > > Coauthor: Linux Programming Unleashed (1st
                              > Edition)
                              > > >
                              > > >
                              > > >
                              > > > To Post a message, send it to: gnu-m68hc11@e...
                              > > >
                              > > > To Unsubscribe, send a blank message to:
                              > > > gnu-m68hc11-unsubscribe@e...
                              > > > Yahoo! Groups Links
                              > >
                              > >
                              > >
                              > >
                              > > To Post a message, send it to:
                              > gnu-m68hc11@...
                              > >
                              > > To Unsubscribe, send a blank message to:
                              > gnu-m68hc11-unsubscribe@...
                              > > Yahoo! Groups Links
                              > >
                              > >
                              > >
                              > >
                              > >
                              > >
                              >
                              >
                              >
                              > To Post a message, send it to:
                              > gnu-m68hc11@...
                              >
                              > To Unsubscribe, send a blank message to:
                              > gnu-m68hc11-unsubscribe@...
                              >
                              >
                              >
                              > ---------------------------------
                              > Yahoo! Groups Links
                              >
                              > To visit your group on the web, go to:
                              > http://groups.yahoo.com/group/gnu-m68hc11/
                              >
                              > To unsubscribe from this group, send an email to:
                              > gnu-m68hc11-unsubscribe@yahoogroups.com
                              >
                              > Your use of Yahoo! Groups is subject to the Yahoo!
                              > Terms of Service.
                              >
                              >
                              >
                              >
                              >
                              > __________________________________________________________
                              > How much free photo storage do you get? Store your friends 'n family snaps
                              for FREE with Yahoo! Photos http://in.photos.yahoo.com
                              >
                              >
                              > To Post a message, send it to: gnu-m68hc11@...
                              >
                              > To Unsubscribe, send a blank message to:
                              gnu-m68hc11-unsubscribe@...
                              > Yahoo! Groups Links
                              >
                              >
                              >
                              >
                              >
                              >
                            • hebs_s
                              Hi, I could use ddd and debug code.Thanks IP & linux_bud regards, hebs_s ... family snaps for FREE with Yahoo! Photos http://in.photos.yahoo.com
                              Message 14 of 26 , Jun 24, 2005
                              View Source
                              • 0 Attachment
                                Hi,

                                I could use ddd and debug code.Thanks IP & linux_bud

                                regards,
                                hebs_s

                                --- In gnu-m68hc11@yahoogroups.com, puja rani mishra
                                <puja1983_mishra@y...> wrote:
                                > Hi,
                                >
                                > No i am trying to use DDD.Still i am not completely
                                > able to debugg a code.I am still struggling.If u have
                                > any success plz share
                                >
                                > With regards
                                > linux_bud
                                > --- hebs_s <hebs_s@y...> wrote:
                                >
                                >
                                > ---------------------------------
                                > Hi!
                                >
                                > Could u get some break on ddd,insght for
                                > m6811-elf-gdb?
                                >
                                > I am looking for gui for Star12 debugging.
                                >
                                > best wishes,
                                > hebs
                                >
                                > --- In gnu-m68hc11@yahoogroups.com, "puja1983_mishra"
                                > <puja1983_mishra@y...> wrote:
                                > > Hi,
                                > >
                                > > I read this message.You have mentioned we can use
                                > ddd for gui
                                > support
                                > > to M6811-elf-gdb.You have mentioned about some
                                > patch.I will be
                                > > thankful to u if u can clarify on this patch
                                > subject.
                                > >
                                > > i mean how i can get the patch and the complete
                                > procedure how to
                                > > build the m6811-elf-gdb with ddd as gui support/
                                > >
                                > > With regards
                                > >
                                > > linux_bud
                                > >
                                > >
                                > >
                                > > --- In gnu-m68hc11@yahoogroups.com, tburrell@s...
                                > wrote:
                                > > >
                                > > >
                                > > > -----Original Message-----
                                > > > From: whitis [mailto:whitis@f...]
                                > > > Sent: Thursday, February 03, 2005 7:13 AM
                                > > > To: gnu-m68hc11
                                > > > Subject: gdb partially working with D-bug12 bdm
                                > pods
                                > > >
                                > > >
                                > > > I have gdb partially working on the MC9S12DP256
                                > (HCS12 with PPAGE
                                > > > register) with the D-bug12 v4.x based BDM pods.
                                > > >
                                > > > This is not heavily tested but since it is the
                                > first working
                                > remote
                                > > bdm
                                > > > pod driver for gdb that is capable of debugging
                                > programs >64K or
                                > > that
                                > > > use any of the external flash it is important to
                                > make it
                                > availible
                                > > even
                                > > > in is current state. I have tried every gdb
                                > command I normally
                                > use
                                > > and
                                > > > many I don't. They seem to work except as noted
                                > below.
                                > > >
                                > > > My attempts to set the number of registers earlier
                                > in the dbug
                                > pod
                                > > > driver
                                > > > didn't work because the crash actually happened
                                > before it reached
                                > > that
                                > > > point. So, though it is a crude hack, I forced the
                                > bank flag high
                                > > in
                                > > > elf_flags. This could adversely affect those
                                > trying to use older
                                > > HC12
                                > > > cpus with no ppage register; someone needs to fix
                                > the bug in
                                > gcc/ld
                                > > that
                                > > > causes that flag to not be set in the first place
                                > so we can
                                > > eliminate
                                > > > this
                                > > > hack. The code I posted here before worked ok -
                                > it was simply
                                > > > necessary
                                > > > to fix/workaround some existing bugs in gdb.
                                > > >
                                > > > Reading memory properly sets and then restores the
                                > PPAGE
                                > register.
                                > > The
                                > > > disassemble command works for code in bank
                                > switched flash.
                                > Setting
                                > > > breakpoints in flash works.
                                > > >
                                > > > Be aware that there are two versions of the PC
                                > register
                                > > > $pc - synthetic 32 bit register that contains
                                > the gcc/gdb
                                > > address
                                > > > corresponding to the PPAGE:PC if
                                > pointing to external
                                > > > flash.
                                > > > $ppc = processor (raw) PC register. 16 bits.
                                > > > $page = processor PPAGE register 8 bits.
                                > > >
                                > > > I will assume you know enough to replace
                                > "/dev/ttyUSB0" with the
                                > > > appropriate port on your system and the name of
                                > your program.
                                > > >
                                > > > The following commands must be given:
                                > > > # Load program using srec9s12 first.
                                > > > m6811-elf-objcopy --verbose
                                > --output-target=srec
                                > > pintest_load.elf \
                                > > > pintest_intermediate.s19
                                > > > srec9s12 <pintest_intermediate.s19
                                > >pintest_load.s19
                                > > > srec9s12 --send_to_pod --pod_port=/dev/ttyUSB0
                                > \
                                > > > --input_file=pintest_load.s19
                                > --srec_bytes=16 --
                                > > delay_interval=1
                                > > > \
                                > > > --input_map=3
                                > > > m6811-elf-gdb pintest_load.elf
                                > > > (gdb) set architecture m68hc12 (REQUIRED even
                                > if elf file
                                > > loaded)
                                > > > (gdb) set remotebaud 115200
                                > > > (gdb) target dbugS12 /dev/ttyUSB0
                                > > >
                                > > > To start your program (after doing above)
                                > > > (gdb) pod reset
                                > > > (gdb) pod nobr // remove any leftover
                                > breakpoints on
                                > > pod
                                > > > (gdb) delete // remove any leftover
                                > breakpoints
                                > > > // due to gdb bugs
                                > > > (gdb) display/i $pc
                                > > > (gdb) break main
                                > > > (gdb) run
                                > > > (breakpoint reached)
                                > > > (gdb) clear main
                                > > > (gdb) break emstdio_fputc
                                > > > (gdb) cont
                                > > > (breakpoint reached)
                                > > > (gdb) print $ccr |= 0x10 // disable
                                > interrupts
                                > > > (gdb) nexti // singlestep cpu
                                > instructions
                                > > > (gdb) nexti
                                > > > (gdb) nexti
                                > > > (gdb) nexti
                                > > > (gdb0 next // singlestep
                                > source lines
                                > > > (gdb) next
                                > > > (gdb) next
                                > > > n
                                > > > You don't have to stop at main as shown above
                                > before setting a
                                > > > breakpoint somewhere eles.
                                > > >
                                > > > Two commands have been added to gdb: "pod" and
                                > "addrcalc9s12".
                                > > >
                                > > > Some useful commands:
                                > > > set debug remote 1 // print commands sent to
                                > pod and
                                > responses
                                > > > set debug remote 0 // turn back off
                                > > > info program // display information
                                > about program
                                > > > break main // set breakpoint at main()
                                > > > info breakpoints // show breakpoints
                                > > > clear main // clear breakpoint at
                                > main()
                                > > > delete 1 // delete breakpoint 1
                                > > > delete // delete all breakpoints
                                > > > x/i $pc // show current instruction
                                > > > display/i $pc // show current instruction
                                > each time
                                > > program
                                > > > stops
                                > > > print/x $ppc // show hardware PC
                                > register
                                > > > print/x $pc // show synthetic PC
                                > register
                                > > > print/x $page // show PPAGE register
                                > > > print/x $d // show D register
                                > > > print/x $x // show X register
                                > > > print/x $y // show Y register
                                > > > print/x $sp // show SP register
                                > > > print $page=0x37 // set ppage register
                                > > > // similarly for other
                                > registers
                                > > > hex
                                > > >
                                > > > x/xh $x // show 16 bit value
                                > pointed to by X
                                > register
                                > > > x/xw $x // show 32 bit value
                                > pointed to by X
                                > register
                                > > > x/xb $x // show 8 bit value pointed
                                > to by X
                                > register
                                > > > x/10xb $x // show ten 8 bit values
                                > pointed to by X
                                > > register
                                > > > x/256xb 0x4000 // show 256 bytes at
                                > address 0x4000 (in
                                > gcc
                                > > > address
                                > > > space, not banked)
                                > > > cont // start/continue program
                                > > > step // execute next line of
                                > source code
                                > > > next // execute next line of
                                > source code, but
                                > > don't
                                > > > // trace into
                                > subroutine calls
                                > > > stepi // execute next instruction
                                > > > nexti // execute next instruction
                                > but don't
                                > > > // trace into
                                > subroutine calls
                                > > > until // try this at the bottom of
                                > a loop
                                > > > list // show source code near $pc
                                > > > where // stack trace
                                > > > info frame // current stack frame info
                                > > > info locals // show all local variables
                                > in current
                                > > function
                                > > > run // start program over from
                                > begining
                                > > > print $ccr |= 0x10 // disable interrupts
                                > > > print bar // show value of variable
                                > bar
                                > > > print bar=123 // set value of variable
                                > bar
                                > > > print foo(1,2,3) // run subroutine foo --
                                > broken
                                > > > disass foo // disassemble subroutine
                                > foo
                                > > > info target // displays information on
                                > the various
                                > memory
                                > > > // sections
                                > > > where // broken
                                > > > up // broken
                                > > > down // broken
                                > > > set output-radix 16
                                > > > set input-radix 16
                                > > > New command: "pod":
                                > > > pod command // execute command on pod
                                > and print results
                                > > > // up to 1023
                                > characters
                                > > > pod reset // resset target
                                > > > pod rd // display registers in
                                > D-bug12 format
                                > > instead
                                > > > // of gdb format
                                > > > pod help // DON'T DO THIS
                                > > > pod ALTCLK 24000 // set alternate BDM
                                > frequency
                                > > > pod stop // stop program
                                > > > // may want to do "x/i
                                > $pc" afterwards
                                > > >
                                > > > New command: addrcalc9s12:
                                > > > addrcalc9s12 cpu16 4000 // convert
                                > memory address
                                > > > addrcalc9s12 banked 3E8000 // convert
                                > memory address
                                > > > addrcalc9s12 mot_linear F4000 // convert
                                > memory address
                                > > > addrcalc9s12 offset10000 104000 // convert
                                > memory address
                                > > > addrcalc9s12 help
                                > > > For example:
                                > > > (gdb) addrcalc9s12 banked 3E89AB
                                > > > CPU16: 49AB
                                > > > Banked: 3E89AB
                                > > > Motorola Linear:: F89AB
                                > > > Offset10000: : 1089AB
                                > > >
                                > > > Addrcalc9s12 is also availible as a standalone
                                > program as part of
                                > > the
                                > > > srec9s12 package.
                                > > >
                                > > > Macro tricks:
                                > > > The following commands will result in a
                                > register display each
                                > > time
                                > > > the system stops.
                                > > > define hook-stop
                                > > > pod rd
                                > > > end
                                > > > for some reason, "info registers" doesn't work
                                > in that macro
                                > > > Pressing carriage return will repeat the last
                                > command. This is
                                > > > particularly useful for step, next, stepi, nexti.
                                > > >
                                > > > Beware of executing any pod commands that may
                                > interfere with gdb;
                                > > for
                                > > > example, tampering with breakpoints could cause
                                > trouble. Any
                                > > command
                                > > > that does not return to a prompt could cause
                                > trouble. Commands
                                > > such as
                                > > > "pod help" that print what look like prompt
                                > characters can cause
                                > > > trouble.
                                > > >
                                > > > If you are debugging a program that has
                                > interrupts, you may be
                                > > surprised
                                > > > to see next, step, nexti, and stepi proceed into
                                > the interrupt
                                > > service
                                > > > routine instead of the function you were debugging
                                > (at least that
                                > > > happens using the trace instruction when using
                                > > > d-bug12 by itself). After hitting a breakpoint,
                                > you may
                                > > > want to issue the command:
                                > > > print ccr |= 0x10
                                > > > to disable interrupts.
                                > > >
                                > > > The stepi and step commands use the bdm pod trace
                                > command so they
                                > > > do not require a breakpoint. However, next and
                                > nexti sometimes
                                > > > require a breakpoint, depending on whether they
                                > encounter a
                                > > subroutine
                                > > > call. If you are short on breakpoints, try using
                                > step/stepi
                                > > instead of
                                > > > next/nexti where possible.
                                > > >
                                > > > Known Problems:
                                > > > - Can't load programs. Use srec9s12 for that
                                > before starting
                                > gdb.
                                > > > This is an exteremely low priority to fix
                                > since there is
                                > already
                                > > > a means to load programs and it is not trivial
                                > to make loading
                                > > > work given the flow control bugs in all known
                                > USB to serial
                                > > adapters
                                > > >
                                > > > and the small receive buffer in D-bug12.
                                > > >
                                > > > - Printing $a and $b is broken but $d works
                                > > >
                                > > > - pod only supports two breakpoints.
                                > > >
                                > > > - next and nexti may use either trace or
                                > breakpoint commands.
                                > > That
                                > > > means if it needs to jump over a call
                                > instruction, it will use
                                > > > a breakpoint. If both hardware breakpoints
                                > are in use, it
                                > will
                                > > > fail to stop at the appointed line.
                                > > >
                                > > > - If more than two breakpoints are needed
                                > (including those
                                > needed
                                > > > by "next" or "nexti" commands), it will fail
                                > to set one of the
                                > > > breakpoints without reporting an error.
                                > > >
                                > > > - can't modify eeprom (but you can call a
                                > subroutine in the
                                > > > target system that does)
                                > > >
                                > > > - can't modify flash
                                > > >
                                > > > - "where" command only shows current function
                                > many times
                                > instead
                                > > of
                                > > > progressing up the stack. "up" has similar
                                > problems.
                                > > > This is probably a bug in m68hc11-tdep.c.
                                > > > Perhaps it is getting confused by the extra
                                > byte in the return
                                > > > address. It could also be that the target
                                > program was
                                > > compiled
                                > > > -fomit-frame-pointer. Actually, looks like
                                > there is a
                                > similar
                                > > > problem on a program compiled without
                                > omit-frame-pointer.
                                > > >
                                > > > - may not work on older HCS12 cpus that don't
                                > support PPAGE
                                > > > due to forcing
                                > > > elf_flags |= E_M68HC12_BANKS;
                                > > > in m68hc11-tdep.c
                                > > >
                                > > > - gdb will restore certain breakpoints if you
                                > delete them.
                                > > >
                                > > > - do not use the pod command (i.e. "pod reset")
                                > before issuing
                                > > > the target command or gdb will segfault.
                                > > >
                                > > > - "interrupt" does not work.
                                > > >
                                > > > - I did find one place where gdb seemed to get
                                > hung up on a next
                                > > > instruction. It appears that it was confused
                                > by the processor
                                > > > being in the run state. Control-C followed
                                > by "pod stop"
                                > > helped.
                                > > >
                                > > > - calling a function on the target system using
                                > the print
                                > command
                                > > > does not work properly. I think GDB is doing
                                > a near call
                                > > > to far functions. This is not a driver bug,
                                > it is a CPU
                                > support
                                > > > bug. Functions with trampolines will
                                > probably work if you
                                > > > give the name of the trampoline.
                                > > > m68hc11_push_dummy_call looks suspect. It
                                > always pushes
                                > > > 16 bits for the return address. This would
                                > be easy to
                                > correct
                                > > > if I knew how to tell if the called function
                                > was near or far.
                                > > >
                                > > > Before running gdb:
                                > > > - resetting the pod is recommended
                                > > > Existing breakpoints or the
                                > > > processor being in the run state will cause
                                > trouble for gdb.
                                > > >
                                > > > - make sure you don't have any other programs
                                > (such as
                                > > > a terminal emulator) running on the same
                                > serial port.
                                > > > Otherise, gdb will either not be able to open
                                > the port
                                > > > or it will succeed but the other program will
                                > steal messages
                                > > > intended for gdb.
                                > > >
                                > > > - make sure the pod is running D-bug12 v4.x
                                > > >
                                > > > - make sure the pod is in BDM mode
                                > > >
                                > > > - make sure the pod baud rate has been set
                                > permanently to
                                > 115200
                                > > >
                                > > > - make sure the pod has been set to the right
                                > xtal frequency
                                > > > for the the target system. Also, set ALTCLK
                                > if your
                                > > > target uses the PLL.
                                > > >
                                > > > - if you have two breakpoints set and try to
                                > use
                                > > > next/step/etc. program execution will
                                > continue past
                                > > > current line.
                                > > >
                                > > > - load your program into the pod using srec9s12
                                >
                                > > >
                                > > > - running functions on the target using the
                                > print command
                                > > > that take string parameters requires that the
                                > target
                                > > > code have a malloc function. I.E.
                                > > > print printf("hello, world\r\n");
                                > > >
                                > > > - there is no exception handling for when the
                                > pod gets into
                                > > > funny states: Running when it should be
                                > stopped, asking
                                > > > how to handle a target communications
                                > failure, stuck mid
                                > > > upload, etc.
                                > > >
                                > > > - remember that you can run m6811-elf-gdb under
                                > gdb.
                                > > > If there is a segfault, use "where" to do a
                                > stack dump.
                                > > > Also, you can use the "ulimit -c unlimited"
                                > command at the
                                > > > shell prompt to enable core dumps on unix
                                > systems
                                > > > which can be examined with the debugger
                                > later.
                                > > >
                                > > > - If you have trouble on a USB to serial
                                > adapter, try using a
                                > > legacy
                                > > > serial port.
                                > > >
                                > > > If you have programs which take 16 bit pointers to
                                > a particular
                                > > memory
                                > > > section in banked memory (for example, all of a
                                > particular type
                                > of
                                > > > readonly data structure has been moved to the same
                                > bank to save
                                > > space in
                                > > > non-paged flash), don't expect things like
                                > > > print *p
                                > > > to work. This is not a problem with this driver.
                                > Limitations
                                > > > in gcc, ld, and gdb prevent this. You will need
                                > to do some
                                > > > fancy arithmatic and casting in your print command
                                > to translate
                                > > > the pointer. If you step through your code until
                                > it sets
                                > > > the appropriate ppage register value, then it
                                > might display
                                > > properly.
                                > > > You could call a function on the target cpu to
                                > print the function
                                > > on the
                                > > > serial port except that such function calls from
                                > the
                                > > > debugger are currently broken. You can use the
                                > addrcalc9s12
                                > > command
                                > > > added to gdb to calculate the address and then
                                > cast that to a
                                > > pointer of
                                > > > the approriate type:
                                > > > i.e. for page=37, pointer=89ab
                                > > > addrcalc9s12 banked 3E89AB
                                > > > print *(foo_t *) 0x1089AB
                                > > >
                                > > > Troubleshooting:
                                > > > - try using control-c to exit any gdb commands
                                > that are hung up
                                > > > and try issuing some commands to the pod such
                                > as "pod rd",
                                > > > "pod stop", "pod nobr", and "pod reset".
                                > > > - set debug remote 1
                                > > > - use a terminal emulator to talk to the pod to
                                > see if
                                > > > it is having problems communicating with
                                > target
                                > > > - Make sure you don't have a terminal emulator
                                > running
                                > > > concurrently with gdb on the same port
                                > > > - make sure you have the same version of the
                                > program loaded
                                > > > in gdb and the target.
                                > > > - exit gdb, reset target cpu and pod, and
                                > restart gdb
                                > > >
                                > > > You may use DDD, KDevelop, etc. as a GUI front
                                > end to gdb.
                                > > >
                                > > > These patches were made against the prerelease
                                > 2.91 version of
                                > > > m6811-elf-gdb.
                                > > >
                                > > > To compile:
                                > > >
                                > > > patch <patchile
                                > > > cd gdb6.0/gdb
                                > > > /configure --target=m6811-elf --prefix=/usr/bin
                                > \
                                > > > --program-prefix=m6811-elf-
                                > --host=i686-pc-linux-gnu
                                > > > make
                                > > > make install
                                > > >
                                > > > srec9s12 is availible from
                                > > >
                                > http://www.freelabs.com/~whitis/software/srec9s12
                                > > >
                                > > > The first parameter is normally passed in the D
                                > register,
                                > additional
                                > > > paramters are passed on the stack. The return
                                > value is also
                                > passed
                                > > > in the D register.
                                > > >
                                > > > --
                                > > > Mark Whitis http://www.freelabs.com/~whitis/
                                > NO SPAM
                                > > > Author of many open source software packages.
                                > > > Coauthor: Linux Programming Unleashed (1st
                                > Edition)
                                > > >
                                > > >
                                > > >
                                > > > To Post a message, send it to: gnu-m68hc11@e...
                                > > >
                                > > > To Unsubscribe, send a blank message to:
                                > > > gnu-m68hc11-unsubscribe@e...
                                > > > Yahoo! Groups Links
                                >
                                >
                                >
                                >
                                > To Post a message, send it to:
                                > gnu-m68hc11@e...
                                >
                                > To Unsubscribe, send a blank message to:
                                > gnu-m68hc11-unsubscribe@e...
                                >
                                >
                                >
                                > ---------------------------------
                                > Yahoo! Groups Links
                                >
                                > To visit your group on the web, go to:
                                > http://groups.yahoo.com/group/gnu-m68hc11/
                                >
                                > To unsubscribe from this group, send an email to:
                                > gnu-m68hc11-unsubscribe@yahoogroups.com
                                >
                                > Your use of Yahoo! Groups is subject to the Yahoo!
                                > Terms of Service.
                                >
                                >
                                >
                                >
                                >
                                > __________________________________________________________
                                > How much free photo storage do you get? Store your friends 'n
                                family snaps for FREE with Yahoo! Photos http://in.photos.yahoo.com
                              • John E Clymer
                                Andrew, I don t have an answer, but have some insight. I have been programming HC11 for 9 years, I have been playing with motion control with AVR s for about
                                Message 15 of 26 , Jun 24, 2005
                                View Source
                                • 0 Attachment
                                  Andrew,

                                  I don't have an answer, but have some insight. I have been programming
                                  HC11 for 9 years, I have been playing with motion control with AVR's for
                                  about two years.

                                  Depending on the quadrature count speed, you may very well need
                                  semi-custom hardware to count that many axis. I have yet to see any
                                  demo/evaluation/for-sale board with that many quadrature count inputs,
                                  yet alone an HC1x board with support for high-speed quadrature inputs.

                                  For a slower speed quadrature count, you can setup a high speed periodic
                                  timer interrupt, inside the interrupt, poll a given set of I/O pins, and
                                  determine whether or not the associated position count needs to be
                                  bumped up/down.

                                  This should have modest success for slower count speeds on an HC12, as
                                  the higher speed, pipelined architecture allows for a rate of timer
                                  interrupts, thus allowing for a higher quadrature count. Note however,
                                  that this is still limited, 20 KHz would be about the fastest I would
                                  want to go with this method.

                                  The other option would be to find a board with the DAC/ADC combination
                                  you need, along with a good size prototype area. US Digital
                                  (http://www.usdigital.com) makes some fairly nice quadrature decoder
                                  chips that will allow for higher quadrature count speeds.

                                  As far as the DAC's go, you may be better off a PWM and an H-Bridge
                                  design rather than analog and an analog power amp.

                                  Also, in my limited experience, I have never run more than two axis from
                                  a single micro-controller (my final work needs to support quadrature
                                  counts of 250 KHz and higher), so my multi-axis experiments have always
                                  ganged several single/dual axis controllers together with one main
                                  supervisor CPU.


                                  However, if you make this all moot by finding a controller with 4
                                  quadrature inputs, please share it with the list, as I would be
                                  interested in one myself.

                                  John Clymer

                                  Andrew Wilson wrote:
                                  > Hello,
                                  > I'm not quite sure if this is the right group to send
                                  > this question too, but I'm looking for a
                                  > microcontroller board to do 4-axis of servo motion
                                  > (need 4 quadrature encoder inputs, 4 DAC's and 4
                                  > ADC's) I can't seem to find a vendor that provides a
                                  > development system with this setum. Is there a list
                                  > of development board microcontroller vendors anywhere?
                                  > Or if someone can point me to a vendor with a
                                  > solution?
                                  > THanks very much
                                  > Andrew
                                  >
                                  >
                                  >
                                  >
                                  > ____________________________________________________
                                  > Yahoo! Sports
                                  > Rekindle the Rivalries. Sign up for Fantasy Football
                                  > http://football.fantasysports.yahoo.com
                                  >
                                  >
                                  > To Post a message, send it to: gnu-m68hc11@...
                                  >
                                  > To Unsubscribe, send a blank message to:
                                  > gnu-m68hc11-unsubscribe@...
                                  >
                                  >
                                  > ------------------------------------------------------------------------
                                  > *Yahoo! Groups Links*
                                  >
                                  > * To visit your group on the web, go to:
                                  > http://groups.yahoo.com/group/gnu-m68hc11/
                                  >
                                  > * To unsubscribe from this group, send an email to:
                                  > gnu-m68hc11-unsubscribe@yahoogroups.com
                                  > <mailto:gnu-m68hc11-unsubscribe@yahoogroups.com?subject=Unsubscribe>
                                  >
                                  > * Your use of Yahoo! Groups is subject to the Yahoo! Terms of
                                  > Service <http://docs.yahoo.com/info/terms/>.
                                  >
                                  >
                                • Andrew Wilson
                                  Hello John, Thank you very much for your insights. I m new to the microcontroller world and have been used to the standard pci cards that have tons of IO,
                                  Message 16 of 26 , Jun 25, 2005
                                  View Source
                                  • 0 Attachment
                                    Hello John,
                                    Thank you very much for your insights. I'm new to
                                    the microcontroller world and have been used to the
                                    standard pci cards that have tons of IO, ADC's,DAC's,
                                    encoder's etc. The closest thing that I've found
                                    that fits the bill is the AVR ADuC7026, it has
                                    everything but builtin quadrature encoders. I think
                                    if I get a couple of US digital chips I should be set
                                    for 4-axis motion with a 500hz or so bandwidth on each
                                    axis. While this is not an AVR list, I'll keep you
                                    posted on how successful this setup is.
                                    Thanks
                                    Andrew

                                    --- John E Clymer <jclymer@...> wrote:

                                    > Andrew,
                                    >
                                    > I don't have an answer, but have some insight. I
                                    > have been programming
                                    > HC11 for 9 years, I have been playing with motion
                                    > control with AVR's for
                                    > about two years.
                                    >
                                    > Depending on the quadrature count speed, you may
                                    > very well need
                                    > semi-custom hardware to count that many axis. I
                                    > have yet to see any
                                    > demo/evaluation/for-sale board with that many
                                    > quadrature count inputs,
                                    > yet alone an HC1x board with support for high-speed
                                    > quadrature inputs.
                                    >
                                    > For a slower speed quadrature count, you can setup a
                                    > high speed periodic
                                    > timer interrupt, inside the interrupt, poll a given
                                    > set of I/O pins, and
                                    > determine whether or not the associated position
                                    > count needs to be
                                    > bumped up/down.
                                    >
                                    > This should have modest success for slower count
                                    > speeds on an HC12, as
                                    > the higher speed, pipelined architecture allows for
                                    > a rate of timer
                                    > interrupts, thus allowing for a higher quadrature
                                    > count. Note however,
                                    > that this is still limited, 20 KHz would be about
                                    > the fastest I would
                                    > want to go with this method.
                                    >
                                    > The other option would be to find a board with the
                                    > DAC/ADC combination
                                    > you need, along with a good size prototype area. US
                                    > Digital
                                    > (http://www.usdigital.com) makes some fairly nice
                                    > quadrature decoder
                                    > chips that will allow for higher quadrature count
                                    > speeds.
                                    >
                                    > As far as the DAC's go, you may be better off a PWM
                                    > and an H-Bridge
                                    > design rather than analog and an analog power amp.
                                    >
                                    > Also, in my limited experience, I have never run
                                    > more than two axis from
                                    > a single micro-controller (my final work needs to
                                    > support quadrature
                                    > counts of 250 KHz and higher), so my multi-axis
                                    > experiments have always
                                    > ganged several single/dual axis controllers together
                                    > with one main
                                    > supervisor CPU.
                                    >
                                    >
                                    > However, if you make this all moot by finding a
                                    > controller with 4
                                    > quadrature inputs, please share it with the list, as
                                    > I would be
                                    > interested in one myself.
                                    >
                                    > John Clymer
                                    >
                                    > Andrew Wilson wrote:
                                    > > Hello,
                                    > > I'm not quite sure if this is the right group to
                                    > send
                                    > > this question too, but I'm looking for a
                                    > > microcontroller board to do 4-axis of servo motion
                                    > > (need 4 quadrature encoder inputs, 4 DAC's and 4
                                    > > ADC's) I can't seem to find a vendor that
                                    > provides a
                                    > > development system with this setum. Is there a
                                    > list
                                    > > of development board microcontroller vendors
                                    > anywhere?
                                    > > Or if someone can point me to a vendor with a
                                    > > solution?
                                    > > THanks very much
                                    > > Andrew
                                    > >
                                    > >
                                    > >
                                    > >
                                    > >
                                    > ____________________________________________________
                                    > > Yahoo! Sports
                                    > > Rekindle the Rivalries. Sign up for Fantasy
                                    > Football
                                    > > http://football.fantasysports.yahoo.com
                                    > >
                                    > >
                                    > > To Post a message, send it to:
                                    > gnu-m68hc11@...
                                    > >
                                    > > To Unsubscribe, send a blank message to:
                                    > > gnu-m68hc11-unsubscribe@...
                                    > >
                                    > >
                                    > >
                                    >
                                    ------------------------------------------------------------------------
                                    > > *Yahoo! Groups Links*
                                    > >
                                    > > * To visit your group on the web, go to:
                                    > > http://groups.yahoo.com/group/gnu-m68hc11/
                                    > >
                                    > > * To unsubscribe from this group, send an
                                    > email to:
                                    > > gnu-m68hc11-unsubscribe@yahoogroups.com
                                    > >
                                    >
                                    <mailto:gnu-m68hc11-unsubscribe@yahoogroups.com?subject=Unsubscribe>
                                    > >
                                    > > * Your use of Yahoo! Groups is subject to the
                                    > Yahoo! Terms of
                                    > > Service <http://docs.yahoo.com/info/terms/>.
                                    >
                                    > >
                                    > >
                                    >
                                    >


                                    __________________________________________________
                                    Do You Yahoo!?
                                    Tired of spam? Yahoo! Mail has the best spam protection around
                                    http://mail.yahoo.com
                                  Your message has been successfully submitted and would be delivered to recipients shortly.