3.6.1.8 Fuse-action Option

The -mfuse-action option adjusts the linker's memory allocation, based on the value of certain configuration fuses. The option takes an argument to indicate the required action. At present, the only allowable argument is define-appdata.

Some AVR devices have Flash memory arranged into contiguous BOOT, APPCODE, and APPDATA sections. See your device data sheet to see if this arrangement is relevant for your target device, and how the memory operates. On these devices, the BOOTSIZE and CODESIZE configuration words control the length of the BOOT and APPCODE sections, hence also control the starting address of the APPDATA section.

The linker ordinarily places code and read-only data in any available program Flash memory; however, it is preferable that the linker does not place anything in the APPDATA section unless explicitly requested to do so. With larger programs for example, code might “overflow” from the APPCODE region into the APPDATA section.

The -mfuse-action=define-appdata option has the compiler interpret the BOOTSIZE and CODESIZE configuration words so that it can determine the starting address of the APPDATA section. It then adjusts the linker's options so that code and read-only data will not be linked into the APPDATA section, unless the user explicitly requests to do so (by using absolute addresses and the --section-start option). If no fuse section contents are present, then the default value for those fuse registers is used for these calculations. This is the default action for relevant devices if no option is specified.

The -mno-fuse-action form of this option explicitly disables this feature, allowing placement of code and read-only data in any available Flash memory.