platformIO 在构建时不显示二进制大小

platformIO does not show binary sizes on build

我正在通过一个非常简单的程序将 VsCode 与 PlatformIO 一起使用。 它可以正确编译并生成有效的 elf 和 hex 文件。

但是,除非 pio 声明它检查大小,否则它不会输出任何内容。

我的配置如下

[env:release]
platform = atmelavr
board_build.mcu = atmega168A
board_build.f_cpu = 8000000L

运行 它刚刚输出的构建:

Processing release (platform: atmelavr)
----------------------------------------------------------------------------------------------------------------------------------------------------Verbose mode can be enabled via `-v, --verbose` option
HARDWARE: ATMEGA168A 8MHz,
PACKAGES: 
 - toolchain-atmelavr 1.70300.191015 (7.3.0)
LDF: Library Dependency Finder -> [had to replace link to being allowed to post]
LDF Modes: Finder ~ chain, Compatibility ~ soft
Found 0 compatible libraries
Scanning dependencies...
No dependencies
Building in release mode
Compiling .pio\build\release\src\HMI.o
Compiling .pio\build\release\src\Oled.o
Compiling .pio\build\release\src\Segment.o
Compiling .pio\build\release\src\main.o
Linking .pio\build\release\firmware.elf
Checking size .pio\build\release\firmware.elf
Building .pio\build\release\firmware.hex
=========================================================== [SUCCESS] Took 1.95 seconds ===========================================================


即使 运行 和 -v 也显示不多的信息

Processing release (platform: atmelavr; board_build.mcu: atmega168A; board_build.f_cpu: 8000000L)
----------------------------------------------------------------------------------------------------------------------------------------------------HARDWARE: ATMEGA168A 8MHz,
PACKAGES: 
 - toolchain-atmelavr 1.70300.191015 (7.3.0)
LDF: Library Dependency Finder -> [had to replace link to being allowed to post]
LDF Modes: Finder ~ chain, Compatibility ~ soft
Found 0 compatible libraries
Scanning dependencies...
No dependencies
Building in release mode
avr-gcc -o .pio\build\release\src\HMI.o -c -std=gnu11 -fno-fat-lto-objects -Os -Wall -ffunction-sections -fdata-sections -flto -mmcu=atmega168A -DF_CPU=8000000L -DPLATFORMIO=50101 -Isrc src\HMI.c
avr-gcc -o .pio\build\release\src\Oled.o -c -std=gnu11 -fno-fat-lto-objects -Os -Wall -ffunction-sections -fdata-sections -flto -mmcu=atmega168A -DF_CPU=8000000L -DPLATFORMIO=50101 -Isrc src\Oled.c
avr-gcc -o .pio\build\release\src\Segment.o -c -std=gnu11 -fno-fat-lto-objects -Os -Wall -ffunction-sections -fdata-sections -flto -mmcu=atmega168A 
-DF_CPU=8000000L -DPLATFORMIO=50101 -Isrc src\Segment.c
avr-gcc -o .pio\build\release\src\main.o -c -std=gnu11 -fno-fat-lto-objects -Os -Wall -ffunction-sections -fdata-sections -flto -mmcu=atmega168A -DF_CPU=8000000L -DPLATFORMIO=50101 -Isrc src\main.c
avr-gcc -o .pio\build\release\firmware.elf -Os -mmcu=atmega168A -Wl,--gc-sections -flto -fuse-linker-plugin .pio\build\release\src\HMI.o .pio\build\release\src\Oled.o .pio\build\release\src\Segment.o .pio\build\release\src\main.o -L.pio\build\release -Wl,--start-group -lm -Wl,--end-group        
MethodWrapper(["checkprogsize"], [".pio\build\release\firmware.elf"])
avr-objcopy -O ihex -R .eeprom .pio\build\release\firmware.elf .pio\build\release\firmware.hex
=========================================================== [SUCCESS] Took 1.77 seconds ===========================================================

我正在使用

从下载的包中手动调用 avr-size 可正确显示信息。

有什么解决办法的建议吗?

向配置添加显式 board 配置项似乎可以解决该问题。

[env:release]
platform = atmelavr
board = ATmega168
board_build.mcu = atmega168A
board_build.f_cpu = 8000000L