Pages: [1]   Go Down
Author Topic: Larger binary sketch size?  (Read 623 times)
0 Members and 1 Guest are viewing this topic.
0
Offline Offline
Newbie
*
Karma: 0
Posts: 3
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

What determines the maximum binary sketch size?  How can it be increased?
Logged

Las Vegas, NV
Offline Offline
God Member
*****
Karma: 0
Posts: 507
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

The size of the flash of your MCU determines the maximum sketch size.  The mega168 has 16,384 bytes of flash, so that's the largest program you can fit on there.  The Arduino also has a 2kB bootloader that is used to program the rest of the flash, so in reality, you only have 14,336 bytes of flash for your program.  If you want you can recoup the 2kB of bootloader space by deleting the Arduino bootloader and using ICSP to program your Arduino.  If you do this, you also avoid having to wait for the bootloader delay on power-up and reset.

Other considerations if you want to fit more on your mega168: don't include libraries that you aren't using in your sketch as this is wasted space, and consider writing your program outside the Arduino environment if you need every last byte of flash.  There are things the Arduino environment sets up automatically, like timers and the UART, which will take up some flash space.  If you don't need timers or the UART in your program, this is also wasted space.


- Ben
Logged


Pages: [1]   Go Up
Jump to: