Squeeze More Code Into Digisparks Program Storage Space

Introduction: Squeeze More Code Into Digisparks Program Storage Space

About: Arduino addict

You all know the problem. You develop a program for your digispark and one day you see the message:

Sketch uses 6020 bytes (101%) of program storage space. Maximum is 6012 bytes.

And you start looking for hints how to increase program storage size.

Step 1: Use Compiler Flag Lto to Shrink Code Size

The compiler flag lto aka. LinkTimeOptimisation saves about 5% to 15% of program space depending on your program. But the digispark compiler version does not support this flag, and must be changed also.

To get all the benefits including the new bootloader size specification for the v2.5 bootloader, just replace the old Digispark board URL http://digistump.com/package_digistump_index.json (e.g.in Arduino File/Preferences) by the new https://raw.githubusercontent.com/ArminJo/Digistum... and install the Digistump AVR Boards version 1.6.8.

Step 2: Burn Smaller Bootloader

Next step is to replace the old v1.x bootloader with a smaller v2.5 one which gives 6522 instead of 6012 bytes (+9%) of available program space. This can be achieved by using this Instructable or just run the window script
Burn_upgrade-t85_default.cmd or better 1_Burn_upgrade-t85_entry_on_power_on_no_pullup.cmd. This script merely loads a program, which replaces the bootloader by the new one. Therefore no programmer is needed.

Just download the repository go to the utils directory and execute the above script.

You may also test the t85_agressive.hex bootloader. Do not forget to change the upload.maximum_size entry in boards.txt to 6714.

Be the First to Share

    Recommendations

    • Summer Fun: Student Design Challenge

      Summer Fun: Student Design Challenge
    • Maps Challenge

      Maps Challenge
    • Metal Contest

      Metal Contest

    Comments