Question on ISP and bootloader installation

Go To Last Post
8 posts / 0 new
Author
Message
#1
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

ATmega8
Atmel ISP (serial)

I create and install a bootloader (< 512 bytes). Works fine. Can download using AVRprog et al.

Using the ISP again, can I erase the non-boot part of Flash and install a program while preserving the previously installed bootloader?

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Why not just use the bootloader? If all you're doing is updateing the non-bootloader portion of the flash that is exactly what the bootloader is there for in the first place...

-Curiosity may have killed the cat
-But that's why they have nine lives

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

because I have the bootloader setup for 19.2Kbps via a WiFi telnet connection and it's a lot slower than the ISP direct. This WiFi connection is how the application will run if I can stop fiddling with the code.

Also not sure of an easy way to launch a program like AVRProg.exe from an IDE for GCC so I don't have to click on things to do a bootloader type download.

also - just generally wanted to know.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

If you are using AVRStudio uncheck the "Erase Before Programming" box.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

eejay wrote:
uncheck the "Erase Before Programming" box.

Almost... That will result in a logical AND-ing of each byte in the original application section with the corresponding byte in your new application section.

If you do a full Chip Erase followed by programming only the bootloader,
Then inhibit the Chip Erase, followed by programming the application section,
Then things will work.

If you're using AVR-GCC, then you likely have the WinAVR destribution installed. If that's the case, then you can use the included SRecord utility to generate a merged Intel Hex file, consisting of the concatenation of your intended application hex file with your bootloader hex file.
Then, you can program the merged hex file through AVR Studio in one step.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

let me play this back. If I wish to repeatedly program the application into flash, using the ISP (SPI), I must chip erase, of course. Doing so will erase the bootloader. That is, there is no "erase flash but preserve the boot pages", if I understand this.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

When you erase the Flash using ISP, you erase everything. You cannot selectively erase some pages but leave others intact.

However, you can choose erase NOTHING. That's where eejay's suggestion comes from...
1) Program the bootloader only. (Original bootloader and application will both be erased due to automatic chip erase.)
2) Inhibit auto-erase.
3) Re-program the application only. (Bootloader will be preserved because Chip Erase was inhibited.)

Again, another option would be to merge the two hex files (bootloader and application) into one before programming, so that everything happens in one step. This can be automated as part of your WinAVR makefile, so that it happens every time you re-build the project.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

I get it. Automate reflashing both boot and application after chip erase.

thanks