[Pkg-electronics-devel] Bug#985578: arduino-core-avr: Flashing bootloader fails due to invalid size

Alexander Buzin al37919 at gmail.com
Sat Nov 13 23:18:21 GMT 2021


al at legion:~/src$ git clone https://github.com/Optiboot/optiboot.git optiboot.git
Cloning into 'optiboot.git'...
remote: Enumerating objects: 1965, done.
remote: Counting objects: 100% (240/240), done.
remote: Compressing objects: 100% (127/127), done.
remote: Total 1965 (delta 137), reused 178 (delta 86), pack-reused 1725
Receiving objects: 100% (1965/1965), 1.40 MiB | 4.93 MiB/s, done.
Resolving deltas: 100% (1048/1048), done.
al at legion:~/src$ cd optiboot.git/optiboot/bootloaders/optiboot/
al at legion:~/src/optiboot.git/optiboot/bootloaders/optiboot$ mv
optiboot_atmega328.hex optiboot_atmega328.hex.orig
al at legion:~/src/optiboot.git/optiboot/bootloaders/optiboot$ make clean
rm -rf *.o *.elf *.lst *.map *.sym *.lss *.eep *.srec *.bin *.hex *.tmp.sh
al at legion:~/src/optiboot.git/optiboot/bootloaders/optiboot$ make atmega328
avr-gcc (GCC) 5.4.0
Copyright (C) 2015 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

BAUD RATE CHECK: Desired: 115200, Real: 117647, UBRRL = 16, Difference=2.1%
avr-gcc -g -Wall -Os -fno-split-wide-types -mrelax -mmcu=atmega328p
-DF_CPU=16000000L  -DBAUD_RATE=115200 -DLED_START_FLASHES=3
     -c -o optiboot.o optiboot.c
optiboot.c:429:2: warning: #warning BAUD_RATE off by greater than 2% [-Wcpp]
 #warning BAUD_RATE off by greater than 2%
  ^
avr-gcc -g -Wall -Os -fno-split-wide-types -mrelax -mmcu=atmega328p
-DF_CPU=16000000L  -DBAUD_RATE=115200 -DLED_START_FLASHES=3
   -Wl,-Tlink_optiboot.ld -Wl,--relax -nostartfiles -o
optiboot_atmega328.elf optiboot.o
avr-size optiboot_atmega328.elf
   text       data        bss        dec        hex    filename
    474          0          0        474        1da    optiboot_atmega328.elf
avr-objcopy -j .text -j .data -j .version --set-section-flags
.version=alloc,load -O ihex optiboot_atmega328.elf
optiboot_atmega328.hex
avr-objdump -h -S optiboot_atmega328.elf > optiboot_atmega328.lst
rm optiboot.o
al at legion:~/src/optiboot.git/optiboot/bootloaders/optiboot$ diff -u
optiboot_atmega328.hex.orig optiboot_atmega328.hex
al at legion:~/src/optiboot.git/optiboot/bootloaders/optiboot$ cat
optiboot_atmega328.hex | awk -v FS="" '/^:027FFE00/{print $13 "."
$11}'
8.3

al at legion:~/src/optiboot.git/optiboot/bootloaders/optiboot$ cd
/usr/share/arduino/hardware/arduino/avr/bootloaders/optiboot
al at legion:/usr/share/arduino/hardware/arduino/avr/bootloaders/optiboot$
avr-size optiboot_atmega328.hex
   text       data        bss        dec        hex    filename
      0        534          0        534        216    optiboot_atmega328.hex
al at legion:/usr/share/arduino/hardware/arduino/avr/bootloaders/optiboot$
cat optiboot_atmega328.hex | awk -v FS="" '/^:027FFE00/{print $13 "."
$11}'
4.4

My system is Debian bullseye+backports. No foreign apps.
It seems that Debian includes an ancient version of optiboot (v.4.4 of
January 2012). It is unusable because the size of the resulting
bootloader is too big. Current version (v.8.3) can be compiled with
our default toolchain and produces a hex file which has correct size
and is identical to the one on the optiboot github (see the line above
with diff).
Maybe this information will be of some use, because the current
situation with non working bootloader is quite inconvenient.

Kind regards,
Alex.



More information about the Pkg-electronics-devel mailing list