NEWER New Optiboot bootloader

I asked this some time ago, but did NOT got definitive answer. Can be those boatloader used in commercial Products like Arduino UNO "clones"?

Yes. The original author licensed Optiboot under GPL2, and it would certainly be painful to change the license since he disappeared. I'm not sure that it's clearly defined what GPL2 means WRT bootloaders, but I'd put them in the same class as Desktop Operating Systems - of course you can write commercial products that run on open source operating systems! If you make changes to optiboot itself as part of your commercial product, you should be prepared to release those changes as open source as well. Personally, I lean toward less viral licenses (MIT or BSD.)

Which kind of bootloader those boards from China are using as bootloadeR?

How could anyone possibly know that? Reports have ranged from Optiboot (but I don't know what version) (especially for Uno clones), Atmegaboot (especially on Nano clones), Adaboot (on Pro Mini clones, as per Sparkfun?), and "doesn't seem to have any bootloader at all".

Thanks,

I would not going to change anything on the software. But without the software the hardware is useless.

I want to use 328PB under the IDE, but have got some problems here. I have changed the board file and placed the hex file to the correct directory. I also changed the pins_arduino.h file.

optibootxmini328pb.name=Optiboot Xplained Mini 328pb

optibootxmini328pb.upload.tool=arduino:avrdude
optibootxmini328pb.upload.protocol=arduino
optibootxmini328pb.upload.speed=57600

optibootxmini328pb.bootloader.tool=arduino:avrdude
optibootxmini328pb.bootloader.unlock_bits=0x3F
optibootxmini328pb.bootloader.lock_bits=0x2F

optibootxmini328pb.build.f_cpu=16000000L

optibootxmini328pb.build.board=AVR_UNO
optibootxmini328pb.build.core=arduino:arduino
optibootxmini328pb.build.variant=arduino:standard

optibootxmini328pb.upload.maximum_size=32128
optibootxmini328pb.upload.maximum_data_size=1024

optibootxmini328pb.bootloader.low_fuses=0xBF
optibootxmini328pb.bootloader.high_fuses=0xCE
optibootxmini328pb.bootloader.extended_fuses=0xFF
optibootxmini328pb.bootloader.file=optiboot/optiboot_xplained328pb.hex

optibootxmini328pb.build.mcu=atmega328p

I'm still not able to upload anything over IDE.

Any Ideas why?

Regards, Maverick

I get this error:

Warning: Board arduino:avr:atmega328bb doesn't define a 'build.board' preference.
Auto-set to: AVR_ATMEGA328BB

avr-g++: error: unrecognized argument in option '-mmcu=atmega328pb'

avr-g++: note: valid arguments to '-mmcu=' are: at43usb320 at43usb355 ... and so on

Do You know where can I add my board (mmcu) ?

Regards, Maverick

Supported processors are burned into the compiler. You need a newer toolset.

Hello,

Newer toolset?

I made the hex file with atmel studio 7. The IDE is package version 1.6.9

What exactly should I update?

In the past, I have just copied the toolset from Atmel Studio to the correct location in the Arduino IDE directory. I have also copied the entirety of... http://www.atmel.com/tools/ATMELAVRTOOLCHAINFORWINDOWS.aspx ...to the correct location in the Arduino IDE directory. I believe I have even posted detailed instructions on this forum.

Yup... http://forum.arduino.cc/index.php?topic=168152.msg1252235#msg1252235 But that may be out-of-date.

The easiest way to get a PB working is to pretend that it's just a 328P. After that is "working" (bootloader burnt, sketches uploading successfully) you can start to think about how to access the PB features... (in fact, the current optiboot PB support pretends to be a mere P, because of the state of the Arduino IDE compiler/etc.)

(The AS7 (7.0.943) that I installed TODAY does seem to support the 328PB.)

westfw: in fact, the current optiboot PB support pretends to be a mere P, because of the state of the Arduino IDE compiler/etc. (The AS7 (7.0.943) that I installed TODAY does seem to support the 328PB.)

Yes, I saw that line in our code -> optibootxmini328pb.build.mcu=atmega328p

I try to get a solution to get it work under the Arduino IDE.

Regards, Maverick

Hello

I have downloaded the newest Optiboot from github and placed it under 'Documents/Arduino/hardware/'. However whenever I try to burn the bootloader (Optiboot 28pins, 8Mhz) to an atmega328p with an USBasp I get the following error:

java.lang.NullPointerException
    at cc.arduino.packages.uploaders.SerialUploader.burnBootloader(SerialUploader.java:363)
    at processing.app.Editor.lambda$handleBurnBootloader$42(Editor.java:2752)
    at java.lang.Thread.run(Thread.java:745)
Error while burning bootloader.

Also when I try to compile Blink, I get:

panic: runtime error: invalid memory address or nil pointer dereference
[signal 0xc0000005 code=0x1 addr=0x0 pc=0x4b39ba]

goroutine 1 [running]:
arduino.cc/builder.(*SetupBuildProperties).Run(0x692034, 0x12054000, 0x0, 0x0)
    c:/jenkins/workspace/arduino-builder-windows/src/arduino.cc/builder/setup_build_properties.go:86 +0x10ba
arduino.cc/builder.(*ContainerSetupHardwareToolsLibsSketchAndProps).Run(0x692034, 0x12054000, 0x0, 0x0)
    c:/jenkins/workspace/arduino-builder-windows/src/arduino.cc/builder/container_setup.go:59 +0x4e6
arduino.cc/builder.runCommands(0x12054000, 0x12025dc4, 0x3, 0x3, 0x1, 0x0, 0x0)
    c:/jenkins/workspace/arduino-builder-windows/src/arduino.cc/builder/builder.go:181 +0xe2
arduino.cc/builder.(*ParseHardwareAndDumpBuildProperties).Run(0x12025df0, 0x12054000, 0x0, 0x0)
    c:/jenkins/workspace/arduino-builder-windows/src/arduino.cc/builder/builder.go:170 +0x157
arduino.cc/builder.RunParseHardwareAndDumpBuildProperties(0x12054000, 0x0, 0x0)
    c:/jenkins/workspace/arduino-builder-windows/src/arduino.cc/builder/builder.go:217 +0x35
main.main()
    c:/jenkins/workspace/arduino-builder-windows/src/arduino.cc/arduino-builder/main.go:307 +0xfd7
arduino-builder returned 2

Error compiling for board Optiboot on 28-pin cpus.

Obviously the paths are wrong (There is no C:\jenkins\workspace). I'm sure I've missed a huge step during install, how can I fix this?

Did it work for normal platform builds before you tried to add the ne optiboot? What ide version are you using?

westfw: Did it work for normal platform builds before you tried to add the ne optiboot? What ide version are you using?

When "Atmega328 on a breadboard 8Mhz" (from tutorial) is selected I can burn the bootloader and upload sketches without problems, is that what you mean?

I'm using Arduino IDE 1.6.9

@westfw Could You complete optiboot for the 328PB?

@westfw I am using WinAVR-20100110 to compile optiboot. I am now sanity checking my output by comparing the original hex file with my compiled version. They match up except for this line:

Original :087FD000E7DFEE27FF2709940B

Fresh compile 087FD000E7DFE0E0FF27099460

The most important bit being E7DFEE27FF270994 versus E7DFE0E0FF270994 (E27 or 0E0) Is this a relevant difference? And what does it mean?

Does anyone know if there is a version of optiboot for the ATTiny 4313? I went through the old optiboot thread searching for it. No luck. Incidentally, I have 1Kbyte of flash remaining.

The most important bit being E7DF EE27 FF27 0994 versus E7DF E0E0 FF27 0994 (E27 or 0E0)

The original has an instruction:

    7fd0:       e7 df           rcall   .-50            ; 0x7fa0                                                                               
  __asm__ __volatile__ (                                                        
    7fd2:       ee 27           eor     r30, r30                                
    7fd4:       ff 27           eor     r31, r31                                
    7fd6:       09 94           ijmp

With the EE27 instruction being the "eor r30, r30" - an exclusive or with yourself is one way to clear the register. The new version has "e0e0" instead, which is "ldi r30, 0" - which does the same thing (zero the register.) So you should be fine...

version of optiboot for the ATTiny 4313?

Not that I know of. You might check the version mentioned in https://github.com/Optiboot/optiboot/issues/177; it apparently supports 110 chips (but I haven't gotten a chance to look at it at all.)

@westfw Ah, that's why the version wasn't updated: the behavior is the same. Thanks!

@westFW Thanks! 326 bytes... That is tiny.

After some long period on Arduino IDE v1.0.6 with replaced toolchain to v3.4.2 (avr-gcc v4.7.2), I've decided to move to the Atmel AVR Toolchain v3.5.3.1700 with avr-gcc v4.9.2. I had to resolve two simple problems: 1. avr-gcc v4.9.2 doesn't support optimizing option -mshort-calls; there is -mrelax instead 2. problem with eeprom_write_byte and eeprom_read_byte (undefined reference); LIBS = -l$(MCU_TARGER) solves it. As I'm writting this I found in response #75 the same solution for my 2nd problem and also (partially - I'm not satisfied with) for my question. The question is: "How to achieve at least the same size of image without modifying source code?" I have modified optiboot and its size with 4.7.2 is 706B, with 4.9.2 it is 738B. Is there any option for another optimizing step (any switch) or the 4.9.2 simply produces bigger code and this possibility is closed?

EDIT: I tried BareMinimum sketch and the size is the same.

EDIT2: I'm currently working with ATmega1284P but as I see the optiboot for ATmega328P does not fit into 512B. It is 525B now.

First partial success or nearly full success! Going throughout the ASM code I realised that the main harms are caused by optimizing the watchdogConfig(). So the attribute noinline produces smaller code, now it's 708B which is very close to 706B, but for the UNO it is 494B to previous 488B. And as I see the original optiboot code on the GitHub it already has defined as noinline. :( :confused: :) :D 8)