Author Topic: software to write a bootloader  (Read 5385 times)

0 Members and 1 Guest are viewing this topic.

Offline AdminTopic starter

  • Administrator
  • Supreme Robot
  • *****
  • Posts: 11,703
  • Helpful? 173
    • Society of Robots
software to write a bootloader
« on: November 27, 2007, 10:26:24 AM »
I'm having trouble writing a bootloader for the ATmega2560 . . .

I found source code here (took me hours to find it):
http://www.bipom.com/support/mmavr/bootloader_atmega2560.zip
but it doesn't actually compile as is . . . tons of errors . . . and so I gave up. It has a .hex already, but I need to change the frequency, baud rate, and uart pins to what I'm using.

I also heard of a program called 'ICC' that supposedly writes a custom bootloader for you. Google'ing turned up nothing, only the attached pic.

Anyone know about it or have other ideas?

Offline benji

  • Supreme Robot
  • *****
  • Posts: 830
  • Helpful? 0
Re: software to write a bootloader
« Reply #1 on: November 27, 2007, 11:23:53 AM »
maybe you should check CodeVisionAVR ,, i think there is a wizard that supports the bootloader
good ol' BeNNy

Offline AdminTopic starter

  • Administrator
  • Supreme Robot
  • *****
  • Posts: 11,703
  • Helpful? 173
    • Society of Robots
Re: software to write a bootloader
« Reply #2 on: November 27, 2007, 12:29:29 PM »
I just found the ICC software

http://www.imagecraft.com/devtools_AVR.html

http://www.imagecraft.com/assets/images/Screen_AVR_2.gif

but it costs $200 . . . I just want a bootloader! :-\
hmmmm it has a 45 day trial . . .

Offline AdminTopic starter

  • Administrator
  • Supreme Robot
  • *****
  • Posts: 11,703
  • Helpful? 173
    • Society of Robots
Re: software to write a bootloader
« Reply #3 on: November 30, 2007, 01:17:29 PM »
So I think I have a working bootloader (it compiles), but I have a question with respect to the reset pin.

Tell me if I'm understanding this right . . .
I install the bootloader using the normal programmer method.
I toggle the reset pin.
Then I upload a new .hex file using serial (I have X seconds to do this).

Is that right?

Is there any way the bootloader could just detect a new program being uploaded without having to push the reset button?

Can my bootloader toggle the reset pin in software whenever I power up my AVR, meaning I don't need a hardware button?

I'm using a modified version (to use for the ATmega644) of the AVR Universal Bootloader using this method:
http://www.scienceprog.com/testing-avr-universal-bootloader-on-atmega128/

Offline bens

  • Expert Roboticist
  • Supreme Robot
  • *****
  • Posts: 335
  • Helpful? 3
Re: software to write a bootloader
« Reply #4 on: November 30, 2007, 02:31:18 PM »
So I think I have a working bootloader (it compiles), but I have a question with respect to the reset pin.

Tell me if I'm understanding this right . . .
I install the bootloader using the normal programmer method.
I toggle the reset pin.
Then I upload a new .hex file using serial (I have X seconds to do this).

Is that right?

Your bootloader works however you program your bootloader to work.  You can have your main application jump to the start of the bootloader section whenever you want using a function pointer.  I guess typically bootloaders give you X seconds after reset to provide the appropriate input sequence that will keep execution in the bootloader section, but I've written bootloaders that behave differently (e.g. if the program starts with a certain button pressed or other external input in a predetermined state, remain in the bootloader, otherwise jump to the main application).  You could just as easily write a bootloader that won't execute the main application until a certain input is received.

Quote
Is there any way the bootloader could just detect a new program being uploaded without having to push the reset button?

The bootloader can't detect anything while your main application is running since your main application is running, though you can program your AVR so the UART is constantly monitoring for a special byte sequence.  When that sequence is received, call your function pointer that jumps you to start of the bootloader section.

Quote
Can my bootloader toggle the reset pin in software whenever I power up my AVR, meaning I don't need a hardware button?

Yes, if you tied one of your I/O lines to your reset line, you could reset your device by pulling that I/O line low.  You would need to use EEPROM to avoid the situation where your program restarts, jumps to the bootloader, and resets itself again.  One thing you should note is that if your bootloader is the only thing in your AVR's flash, when it jumps to the application section after X seconds, it almost immediately automatically reenters the bootloader (the AVR looks through the flash for the first instruction sequence, which it encounters when it gets to the bootloader section).
« Last Edit: November 30, 2007, 02:33:44 PM by bens »

 


Get Your Ad Here