Bootloader Info

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

Hey all,

A while ago I posted a thread entitled "What the hell is a bootloader". Since then I have learnt the basics of what a bootloader actually is. I have a couple more questions:

1) How does a bootloader write to the internal flash? I though only an external programmer could do that?

2) How would I go about writing my own bootloader, so that I can reprogram the device into external (I2C eeprom) to prevent the wearing of the chip's flash, and have a progress bar on an LCD screen?

3) What is the smallest bootloader avaliable (for a AT90S8535 micro)?

4) Would running the program out of an I2C eeprom significantly slow the program down?

Thanks for all/any replies. I am working on a device that uses a commercial minature board with a SM 8535 on it, plus serial chip, power supply, etc. and so cannot use a larger micro, but I want to use programs larger than the internal 8k - hence the want for an external I2C eeprom. Luckily, I happen to have 2 I/O's left. When the device goes commercial, I also want a serial (using the bootloader) programming port to update the firmware of the device while the LCD shows the progress/debug info.

- Dean :twisted:

Make Atmel Studio better with my free extensions. Open source and feedback welcome!

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

abcminiuser wrote:
1) How does a bootloader write to the internal flash? I though only an external programmer could do that?

If the AVR device supports self programming (the AT90S8535 does not), it will include instructions as part of the instruction set that allow the reprogramming of memory. Typically, Flash is organized by pages, where a page is some binary number of bytes such as 128 or 256. The bootloader usually loads a page of new data into a temporary buffer, performs a page erase on the target page, and then writes the new data to the page. This is repeated for each page until some type of "end of data" marker is detected. I probably learned more about bootloaders from looking at real code than I did from application notes. I would suggest downloading Megaload (you can find the link in the tools section) and taking a look at it.

abcminiuser wrote:
2) How would I go about writing my own bootloader, so that I can reprogram the device into external (I2C eeprom) to prevent the wearing of the chip's flash, and have a progress bar on an LCD screen?

The AVR is designed to run out of internal 16-bit wide Flash. It cannot run instructions from internal 8-bit SRAM or or external 8-bit memory; those are for storing data only. Also, I know that 1000 Flash erase/write cycles (the spec for the AT90S8535) doesn't sound like much, but it really is - even during development. Plus, the 1000 number is likely a very conservative minimum number.

abcminiuser wrote:
3) What is the smallest bootloader avaliable (for a AT90S8535 micro)?

As mentioned above, this device does not support self programming. It's really a fairly old device and lacks many of the features that you find in newer devices.

abcminiuser wrote:
4) Would running the program out of an I2C eeprom significantly slow the program down?

If it were possible (which it isn't, see above) then yes, it would slow things down a lot. This is the reason most large, modern processors contain internal cache memory; it can be accessed in a fraction of the time that it would take to load from external memory.

Dave

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

What about the MEGA8535?

Incidentally, what's so different about the MEGA8535 in relation to the 90S8535 (apart from the power saving features)?

I think I could make a program for the 8535 that would interpret and execute code from an I2C eeprom. Timing would not be critical (approx 5ms delay per command) but for normal development this wouldn't be too bad I suppose. I know it can't run the code "straight out", but you just make a semi-bootloader that interprets commands stored in the eeproms in a similar way that the old micro's would.

- Dean

Make Atmel Studio better with my free extensions. Open source and feedback welcome!

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

abcminiuser wrote:
Incidentally, what's so different about the MEGA8535 in relation to the 90S8535 (apart from the power saving features)?

Well, I can think of two things right off the top of my head; first, it does support the self programming feature you need and second, it's not End of Life :) . It's also pin compatible so it should be a drop-in replacement for the 90S8535.

abcminiuser wrote:
I think I could make a program for the 8535 that would interpret and execute code from an I2C eeprom.

This is certainly possible and you might even be able to fit it into the 8K of available Flash, but it will definately be slow.

Dave

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

Oh, well, it's an interesting project anyway! I could probably make the micro cache chunks of it into SRAM or somthing. One for the backburner, anyway.

Make Atmel Studio better with my free extensions. Open source and feedback welcome!

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

Hi,

Here is the easy way to compare the two devices:

Head over to https://www.avrfreaks.net/Devices/ then click on Mega8535 and AT90S8535 and hit the compare button. Presto!

I wouldn't worry at all about FLASH lifetime during development if you are not doing anything crazy (like re-writing a program every second). The Mega AVR devices are specd to 10000 FLASH cycles now, so if you burn out the flash on one of those keep it as a trophy ;-)

Regards,

-Colin