Thursday, February 01, 2018

AVR/Atmel Studio: Specify a smaller program space due to setting BOOTSZ0/BOOTSZ1 fuses

In AVR Studio version 7.0, if you're using the BOOTSZ fuses, you can add something like this to the custom linker flags, adjusting for your size requirements:

-Wl,--defsym=__TEXT_REGION_LENGTH__=30720

There is a symbol used (and defined if not already set) in the default linker script, that sets the size of the text (complied code) section.

For the curious, look in this file to see what's happening (and what else you can tweak):

C:\Program Files (x86)\Atmel\Studio\7.0\toolchain\avr8\avr8-gnu-toolchain\avr\lib\ldscripts\avr5.xn