Yahoo Groups archive

AVR-Chat

Index last updated: 2026-04-28 22:41 UTC

Thread

Debugging Bootloaders

Debugging Bootloaders

2007-07-09 by Dave VanHorn

Anyone have tips/experience to share on debugging bootloaders with the 
Jtag ice on a M128?

Re: Debugging Bootloaders

2007-07-09 by Dave VanHorn

> Why re-invent the wheel?

:)  I need a slightly differently shaped wheel.

Source in ASM, and I need to talk to a linux embedded system, so PC 
apps that speak odd protocols won't work. So I'm doing xmodem protocol 
since we can get command line utils in linux to send the file.

Re: Debugging Bootloaders

2007-07-09 by Don Kinzer

--- In AVR-Chat@yahoogroups.com, "Dave VanHorn" <microbrix@...> 
wrote:
> Anyone have tips/experience to share on debugging
> bootloaders with the Jtag ice on a M128?

I've done it - not particularly difficult.  I combined the 
bootloader and main application .hex files into a single file and 
had AVR Studio download that to the device.

Generally, you'll want to temporarily disable the timeout detecting 
mechanism on, if such exists, on both ends of the comm channel.  
With that done, you're free to set breakpoints, single step, etc. on 
either or both ends.

You may also want to employ a serial channel "monitor" - either a 
standalone instrument or software running on a PC.  I've used the 
free HHD Serial Port Monitor (http://www.serial-port-
monitor.com/index.html) on a Windows box.  There may be something 
similar for Linux.

Don Kinzer
ZBasic Microcontrollers
http://www.zbasic.net

Re: [AVR-Chat] Debugging Bootloaders

2007-07-09 by Ralph Hilton

On Mon, 09 Jul 2007 21:33:56 -0000 you wrote:

>
>Anyone have tips/experience to share on debugging bootloaders with the 
>Jtag ice on a M128?

http://www.cmeter.org/CVmegaload/index.html gives working code for an M128
bootloader. Why re-invent the wheel?
--
Ralph Hilton
http://www.ralphhilton.org
C-Meter: http://www.cmeter.org
FZAOINT http://www.fzaoint.net

Re: [AVR-Chat] Debugging Bootloaders

2007-07-09 by Dave Hylands

Hi Dave,

On 7/9/07, Dave VanHorn <microbrix@gmail.com> wrote:
>
> Anyone have tips/experience to share on debugging bootloaders with the
> Jtag ice on a M128?

I don't use a JTAG. I tend to prefer using print statements and a
serial port. This comes from working with RTOSes (admittedly mostly on
non-AVRs) and I find that debugging realtime stuff with a JTAG just
doesn't work very well.

What I do is log to a circular buffer and have the main loop just read
from the buffer and print stuff. That way I can print from an ISR and
reduce the amount of delays.

I also usually try to write the bootloader as a standalone app and get
the basics of the algorithim working that way before trying to get it
to work as a bootloader proper. So I like to get the protocol working
and stub out the flash routines with code that just prints that a
flash write was called.

For many things, like the xmodem protocol that you mentioned in
another email, you can debug your version of the code on a PC as well.

-- 
Dave Hylands
Vancouver, BC, Canada
http://www.DaveHylands.com/

Re: Debugging Bootloaders

2007-07-10 by Mike

--- In AVR-Chat@yahoogroups.com, "Dave VanHorn" <microbrix@...> wrote:
>
> > Why re-invent the wheel?
>
> :)  I need a slightly differently shaped wheel.
>
> Source in ASM, and I need to talk to a linux embedded system, so PC
> apps that speak odd protocols won't work. So I'm doing xmodem protocol
> since we can get command line utils in linux to send the file.
>

Like Dave Hylands I prefer to use print statements if I need them. I
usually start from a known place and then incrementally update and add
to the code, testing as I go. Each increment is small and I always have
working code at hand. It helps to have an overall plan so you know where
you are going and don't leave all of the "hard stuff" to the end. If you
break up the hard struff into small enough chunks, it isn't so hard
anymore. A local CVS server can be useful for keeping track of the code
levels as you make changes.

You may have found this already. Piconomic Design already have an
ATmega128 bootloader that uses the xmodem protocol - see
http://www.piconomic.co.za/download/avr_bootloader_4.zip
<http://www.piconomic.co.za/download/avr_bootloader_4.zip>  . The source
is shipped under the "Modified BSD" open source license which is not too
restrictive.

Mike
oakmicros.com <http://oakmicros.com/>
AVR, BasicX and ZBasic Microcontrollers



[Non-text portions of this message have been removed]

Re: [AVR-Chat] Debugging Bootloaders

2007-07-10 by David VanHorn

> I don't use a JTAG. I tend to prefer using print statements and a
> serial port. This comes from working with RTOSes (admittedly mostly on
> non-AVRs) and I find that debugging realtime stuff with a JTAG just
> doesn't work very well.

Once the system is up and running, it's a cooperative multitasker, but
I didn't see any reason for the bootloader to go that way :)


> For many things, like the xmodem protocol that you mentioned in
> another email, you can debug your version of the code on a PC as well.

AVR emulator on the PC?  I'm writing in ASM.

Re: [AVR-Chat] Debugging Bootloaders

2007-07-10 by Dave Hylands

HI David,

> > For many things, like the xmodem protocol that you mentioned in
> > another email, you can debug your version of the code on a PC as well.
>
> AVR emulator on the PC?  I'm writing in ASM.

Sorry - I think in C. I realized after I sent it that you were working in ASM.

-- 
Dave Hylands
Vancouver, BC, Canada
http://www.DaveHylands.com/

Re: [AVR-Chat] Debugging Bootloaders

2007-07-10 by David VanHorn

> Sorry - I think in C. I realized after I sent it that you were working in ASM.

That's ok, I can use C code for algorithms anyway.
I think I have it together now, just need to do some testing.

Move to quarantaine

This moves the raw source file on disk only. The archive index is not changed automatically, so you still need to run a manual refresh afterward.