Flash size only 7680 bytes on barebones ATmega88V

I'm uploading formware to a barebones ATmega88V from PlatformIO, using an Arduino Nano as a bootloader (stk500v1). I've been using this same bootloader to upload hundreds of sketches to an ATTiny85, where flash size is 8192 byes, as it says on the box.

On my ATmega88V, the flash size appears to be only 7680 bytes instead of the specified 8192. That is a very suspicious-looking 512 bytes missing. This is what the upload process logs to the console:

ONFIGURATION: https://docs.platformio.org/page/boards/atmelavr/ATmega88.html
PLATFORM: Atmel AVR (4.0.0) > ATmega88/A
HARDWARE: ATMEGA88 1MHz, 1KB RAM, 8KB Flash
DEBUG: Current (simavr) On-board (simavr)
PACKAGES: 
 - framework-arduino-avr-minicore @ 2.1.3 
 - tool-avrdude @ 1.60300.200527 (6.3.0) 
 - toolchain-atmelavr @ 1.70300.191015 (7.3.0)
LDF: Library Dependency Finder -> https://bit.ly/configure-pio-ldf
LDF Modes: Finder ~ chain, Compatibility ~ soft
Found 8 compatible libraries
Scanning dependencies...
Dependency Graph
|-- Wire @ 1.0
Building in release mode
Checking size .pio/build/ATmega88/firmware.elf
Advanced Memory Usage is available via "PlatformIO Home > Project Inspect"
RAM:   [==        ]  22.3% (used 228 bytes from 1024 bytes)
Flash: [====      ]  39.5% (used 3034 bytes from 7680 bytes)
Configuring upload protocol...
AVAILABLE: stk500v1
CURRENT: upload_protocol = stk500v1
Looking for upload port...
Using manually specified: /dev/tty.usbserial-110
Uploading .pio/build/ATmega88/firmware.hex

Where did those 512 bytes go?
Most importantly: How can I reclaim them for my sketch?

Not sure where it would be on PlatformIO, in the Arduino IDE minicore has an option to select "no bootloader" under Tools, it would seem you have it set to use the bootloader.

Your board is configured to use bootloader. These 512 bytes are reserved for it.

When I use the exact same board to upload firmware to an ATTiny85, the full 8192 bytes are available.

When I use it to upload firmware to the ATmega88V, I have 7680 bytes.

How is this possible?

Can you specify where this option is exactly? Is it supposed to be used when I upload the programmer sketch to my Arduino Nano, or when I upload a sketch to the ATmega using the Nano as the programmer?

You probably forgot something.
You can't use Atmega core to compile the code for Attiny board.

In the Arduino IDE, using Minicore, after selecting the atmega88, the option is under Tools: Bootloader, with either "Yes: UART0" or "No Bootloader".

The option applies when you are compiling/uploading to the atmega88.

Arduino Nano has nothing to do with the issue. This option doesn't depend on which the board are you using as programmer.

I don't know where is it in Platformio, but in Arduino IDE you should look in the boards.txt config file in the AVR package.

Thank you, this was a very useful pointer! I could start Googling along "Minicore" + "bootloader" + "PlatformIO" and found this page that had the info I needed: MiniCore/PlatformIO.md at master · MCUdude/MiniCore · GitHub

For the future, should anyone else come across this, the platformio.ini file below gives me the desired result (no bootloader). The key is this line:

board_hardware.uart = no_bootloader

I've been using a nearly identical version of this file for the ATtiny (with the correct values in board and board_build.mcu under a different [env] heading) and there was no bootloader even with no board_hardware.uart value set. This was confusing.

[env:ATmega88]
platform = atmelavr
board = ATmega88
board_build.mcu = atmega88
board_build.f_cpu = 1000000L
board_hardware.uart = no_bootloader
framework = arduino
build_flags = 
	-DF_CPU=1000000L
upload_protocol = stk500v1
upload_flags = 
	-P$UPLOAD_PORT
	-b$UPLOAD_SPEED
upload_speed = 19200
; To find USB port on mac: ls /dev/tty.*
upload_port = /dev/tty.usbserial-110
board_fuses.lfuse = 0x62
board_fuses.hfuse = 0xDF ; Important: this disables BOD
board_fuses.efuse = 0xF9
lib_deps = 
	Wire

Are you really will be use your board with 10 MHz clock ?

If you count the zeroes you will see that I am using the board at 1MHz. That is the 8Mhz built-in clock with a prescaler of 8, as per the fuses further down.

Thanks
it was important to make sure that you understand the meaning of these settings and did not copy the first thing that came across from the Internet :slight_smile:

Thank you for posting your findings.
most of the people here are unfamiliar with PlatformIO ("Yet another IDE"), so your summary will probably be of significant help to anyone else who comes along and searches the forum.