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.
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?
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
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
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.