avr gcc编译的optiboot十六进制太大,不适合

avr gcc编译的optiboot十六进制太大,不适合,gcc,arduino,bootloader,avr-gcc,Gcc,Arduino,Bootloader,Avr Gcc,我想修改Arduino Uno的引导加载程序(optiboot),以便将上传命令超时时间从1s增加到8s。所以我需要重新编译引导加载程序并上传它 我能够替换不推荐的'-mshort调用'-mrelax',并且我能够编译它,但是它生成的二进制文件太大: MBA-Anton:optiboot asmirnov$ make atmega328 ../../../../tools/avr/bin/avr-gcc -g -Wall -Os -fno-inline-small-functions -fno-

我想修改Arduino Uno的引导加载程序(optiboot),以便将上传命令超时时间从1s增加到8s。所以我需要重新编译引导加载程序并上传它

我能够替换不推荐的'-mshort调用'-mrelax',并且我能够编译它,但是它生成的二进制文件太大:

MBA-Anton:optiboot asmirnov$ make atmega328
../../../../tools/avr/bin/avr-gcc -g -Wall -Os -fno-inline-small-functions -fno-split-wide-types -mrelax -fno-move-loop-invariants -mmcu=atmega328p -DF_CPU=16000000L  -mrelax '-DLED_START_FLASHES=3' '-DBAUD_RATE=115200'   -c -o optiboot.o optiboot.c
../../../../tools/avr/bin/avr-gcc -g -Wall -Os -fno-inline-small-functions -fno-split-wide-types -mrelax -fno-move-loop-invariants -mmcu=atmega328p -DF_CPU=16000000L  -mrelax '-DLED_START_FLASHES=3' '-DBAUD_RATE=115200' -Wl,--section-start=.text=0x7e00 -Wl,--section-start=.version=0x7ffe -Wl,--relax -Wl,--gc-sections -nostartfiles -nostdlib -o optiboot_atmega328.elf optiboot.o 
../../../../tools/avr/bin/avr-size optiboot_atmega328.elf
   text    data     bss     dec     hex filename
    530       0       0     530     212 optiboot_atmega328.elf
../../../../tools/avr/bin/avr-objcopy -j .text -j .data -j .version --set-section-flags .version=alloc,load -O ihex optiboot_atmega328.elf optiboot_atmega328.hex
../../../../tools/avr/bin/avr-objdump -h -S optiboot_atmega328.elf > optiboot_atmega328.lst
rm optiboot.o optiboot_atmega328.elf
avr gcc版本:

MBA-Anton:optiboot asmirnov$ ../../../../tools/avr/bin/avr-gcc --version
avr-gcc (GCC) 4.8.1
Copyright (C) 2013 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.

MBA-Anton:optiboot asmirnov$

我在谷歌上搜索了更多的内容,发现pretty产生的二进制文件要小得多,那有什么问题吗?

通过使用来自

的相当古老(2012年)的avr gcc解决了问题。您是否尝试使用
-fffunction sections
-fdata sections
进行编译?当链接到
--gc sections
时,应该删除未使用的部分。如果这对当前的GCC版本有帮助,那将是很有趣的。