Pages: [1]   Go Down
Author Topic: Arduino MEGA2560: 8K of bootspace, only 4K of flash reserverd  (Read 1188 times)
0 Members and 1 Guest are viewing this topic.
Global Moderator
Italy
Offline Offline
Brattain Member
*****
Karma: 333
Posts: 22938
Logic is my way
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

It seems that there's an issue in the memory reserved for the bootloader on the Arduino MEGA2560 boards.

This is the entry in the boards.txt:
Code:
mega2560.name=Arduino Mega 2560 or Mega ADK

mega2560.upload.protocol=wiring
mega2560.upload.maximum_size=258048
mega2560.upload.speed=115200

mega2560.bootloader.low_fuses=0xFF
mega2560.bootloader.high_fuses=0xD8
mega2560.bootloader.extended_fuses=0xFD
mega2560.bootloader.path=stk500v2
mega2560.bootloader.file=stk500boot_v2_mega2560.hex
mega2560.bootloader.unlock_bits=0x3F
mega2560.bootloader.lock_bits=0x0F

mega2560.build.mcu=atmega2560
mega2560.build.f_cpu=16000000L
mega2560.build.core=arduino
mega2560.build.variant=mega
As you can notice, the entry tells the IDE that it can use up to 252K of Flash for the user's sketches, so that the bootloader space is only 4K:
256K => 262144b
262144 - 258048 => 4096b

But you can also notice that the high fuse, that sets the size of the flash for the bootloader, reserves 4096w (words), that are 8192b (bytes). Its value is $D8 (As you can see using this tool: http://www.engbedded.com/fusecalc/ ). The page for the Arduino MEGA2560 says: "Flash Memory   256 KB of which 8 KB used by bootloader". So the size set by the fuse should be right. So, why the entry tells the IDE that it can use up to 252K?
Logged


SF Bay Area (USA)
Offline Offline
Tesla Member
***
Karma: 135
Posts: 6783
Strongly opinionated, but not official!
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Seems wrong to me.  The 1280 max sketch size is similarly incorrect...
Logged

Forum Administrator
Offline Offline
God Member
*****
Karma: 52
Posts: 646
I find plain exciting
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

HI

thanks for posting here!


this forum is for suggestions, this is most likely a bug.


please add them as issues on Github. it's more efficient than posting them here

m
Logged

Global Moderator
Italy
Offline Offline
Brattain Member
*****
Karma: 333
Posts: 22938
Logic is my way
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Just done:
https://github.com/arduino/Arduino/issues/2277
Logged


Pages: [1]   Go Up
Jump to: