Adapting Custom Atmega Bootloader for use on Attiny84

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

I did a custom bootloader that used a wireless interface with AES encryption based on app note AVR231. Thanks for this forum for having the app note code ported to GCC!

 

It's currently running on an Atmega328p and depends on the bootloader code being located at 0x3800.  So, it depends on bootrst fuse giving initial control to the bootload code.  The bootload code either jumps to the application or starts listening for a code update depending on contents of a variable in eeprom.

 

I'd like to use the same code with minimal source modifications on the attiny84.  The Attiny84 It doesn't have the bootrst fuse, but I don't see why I couldn't locate the bootload code at the "normal" location near the bottom of memory, then jump to an address that corresponds to the start of the application code.

 

I wouldn't have the same code protection features as on the atmega328p (no Bootloader lock bits).

 

This seems straight forward, so I thought I'd give it a try.  Am I missing something?  Any suggestions on how to structure the source so it can be compiled to run on either the attiny84 or atmega328p with minimal "ifdef'ing" would be appreciated.

 

Thanks!

 

Thanks!

 

This topic has a solution.
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Others have developed a "bootloader" for ATTiny devices not having bootloader support.  A google search turns up several but there is also the Arduino-Tiny effort.

 

Additionally, you might consider the tiny848 that does have bootloader support.

 

As for having code that runs on devices with differing capabilities, conditional code is simply a fact of life.  You could try to develop an abstraction layer and have all of the differences handled in that layer which will, of course, have conditional code.

 

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

This reply has been marked as the solution. 
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Google "tiny safe bootloader". That site shows the issues of bootloaders on non-BOOTRST Tiny's and a solution. 

 

Bear in mind how your app will handle interrupts, the IVT isn't movable in a Tiny. 

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

I have dozens of cards built with the Attiny84, but maybe  a “tiny848” might make sense for future projects.  But, I can find anything about it.

 

Here are the 8 bit processors I see from the Atmel web site:

 

http://www.atmel.com/products/microcontrollers/avr/tinyAVR.aspx

 

The "tiny safe bootloader" link looks interesting.  I'll take a lootk at it!

 

Thanks,

 

Dave THomas

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

It looks like he meant ATtiny841 as a tiny84 replacement.    It does not seem to have a BOOTRST fuse.

 

I am not aware of any Tiny with BOOTRST.

 

David.

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

david.prentice wrote:
I am not aware of any Tiny with BOOTRST.
Sorry, I meant the tiny828 which does, by the way, have the BOOTRST fuse.  The choice of boot section sizes is 256, 512, 1024 and 2048 bytes.

 

http://www.atmel.com/devices/att...

 

They are in stock at various distributors.

 

 

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

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

davethomaspilot wrote:

I have dozens of cards built with the Attiny84, but maybe  a “tiny848” might make sense for future projects.  But, I can find anything about it.

Looking at the data sheet,

http://www.atmel.com/Images/doc8...

the Tiny828 is interesting, but is 32 pin only, and no crystal ability.

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

Who-me wrote:
[...] and no crystal ability.
Not directly but you can feed it a clock derived from an external crystal oscillator to get the same benefits.

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