Go Down

Topic: Optiboot on Attiny84? (Read 2 times) previous topic - next topic


I am aware luminet has it, but am more interested in first hand experience. If anyone has done it, may you please share experience and things to watch out for before I dip myself into this :)



I am interested too, bought some more ATMega8's today because I am familiar with them, but would be nice to have a 'sometimes' cheaper option.

Duane B


I don't think you can put ANY Arduino bootloader on an ATtiny because it has no asynchronous serial port.  You use an ISP device to write programs into the ATtiny.  The "Burn Bootloader" process only sets the fuses to prepare the ATtiny for running the ATtiny core.
Send Bitcoin tips to: 1L3CTDoTgrXNA5WyF77uWqt4gUdye9mezN
Send Litecoin tips to : LVtpaq6JgJAZwvnVq3ftVeHafWkcpmuR1e


Thanks John,
but that is not entirely correct. The Optiboot supports software serial and the makefile has a build option for the attiny84 based Luminet.

My question was not if it is possible (because it is possible and it is done), but rather for practical guidance advices before I jump into it.

Coding Badly

Jun 07, 2012, 08:43 pm Last Edit: Jun 07, 2012, 08:45 pm by Coding Badly Reason: 1

Some things...

• Search the forum.  A few folks have promised a general purpose ATtiny bootloader and have written snippets about the experience.

• It's my understanding that one of the biggest obstacles is the RESET interrupt vector.  I believe ATmega processors help manage it and ATtiny processors do not.

• ATtiny processors do not have a mechanism for protecting the bootloader.  If an application is "too big" there is the possibility of overwriting the bootloader.

• I suspect the Atmel folks intended ATtiny bootloaders to be included with the application so that code (like Serial) could be shared (and other reasons).

• I suggest starting with a specific application.  I believe that's one of the reasons Luminet was a success.


optiboot has "some" support for tiny chips without a separate bootloader space, and with bit-banged serial.  I don't know whether it works any more; I'm not sure it ever did...


Jun 21, 2012, 05:01 pm Last Edit: Jun 21, 2012, 05:08 pm by martin_bg Reason: 1
Here is my 'progress' or at least steps I undertook so far:

I modified the optiboot makefile to change the AVR_FREQ to 8Mhz, as I will be runnint the Attiny on its internal oscillator:

Code: [Select]
luminet: TARGET = luminet
luminet: MCU_TARGET = attiny84
luminet: AVR_FREQ = 8000000L
luminet: LDSECTIONS = -Wl,--section-start=.text=0x1d00 -Wl,--section-start=.version=0x1efe
luminet: $(PROGRAM)_luminet.hex
luminet: $(PROGRAM)_luminet.lst

I burned the OptiBoot bootloader and am able to see the led on PA7 blink three times as expected.

Code: [Select]

avrdude -c usbtiny -p attiny84 -e -u -U lock:w:0x3f:m -U efuse:w:0xFE:m -U hfuse:w:0xDF:m -U lfuse:w:0x62:m
avrdude  -c usbtiny -p attiny84 -U flash:w:optiboot_luminet.hex

I modified my boards.txt to add a new section as follows:
Code: [Select]

attiny84.name=ATtiny84 Optiboot
attiny84.upload.protocol=stk500   //tried 'arduino' as well

I hooked up the FTDI cable, TX and RX as follows:
Code: [Select]
/* Ports for soft UART - left port only for now. TX/RX on PA2/PA3 */
.. and yes, I tried swapping the lines just in case.

I hooked up a 0.1uF ceramic capacitor in series with the RtS line on the FTDI

I try to upload a sketch, but get:
Code: [Select]

        Using Port                    : COM20
        Using Programmer              : stk500v1
        Overriding Baud Rate          : 9600
avrdude: Send: 0 [30]   [20]
avrdude: Send: 0 [30]   [20]
avrdude: Send: 0 [30]   [20]
avrdude: Recv:
avrdude: stk500_getsync(): not in sync: resp=0x00

avrdude done.  Thank you.

Comments are welcome :)


Thanks Coding Badly, I hope I grow to fully understand what you are saying one day  :smiley-roll-blue:

As for the:

• ATtiny processors do not have a mechanism for protecting the bootloader.  If an application is "too big" there is the possibility of overwriting the bootloader.

I think the Optiboot has a build flag for that, called VIRTUAL_BOOT_PARTITION, the bootloader itself can ensure that it won't get self-erased.


The last time I compiled a luminet optiboot ("stock"), it was rather larger than 512 bytes:
avr-size optiboot_luminet.hex
   text    data     bss     dec     hex filename
      0     610       0     610     262 optiboot_luminet.hex

So you'd probably need to change the addresses in this line:
Code: [Select]
luminet: LDSECTIONS = -Wl,--section-start=.text=0x1d00 -Wl,--section-start=.version=0x1efe
Since the tiny84 doesn't have a "real" boot partition, I THINK you can change it to any required value, rather than the fixed sizes (512, 1k, 2k, 4k) that the ATmega cpus require (and it looks like 1d00 is already 8k-768, so that should be OK, but .version looks wrong (should be 1ffe ?)


Here is a good article on Attiny85 bootloader, it talks about the issues Coding Badly mentioned and the solutions to them:


Unfortunately, it requires a modified avrdude to work, whilst I wanted something more available to the general public


Most of those issues seem to be because of his desire to use USB.  A serial bootloader like optiboot is a lot simpler; for instance, optiboot doesn't use any interrupts at all...



please, sorry me (i trying to colaborate).

Go Up