Skip to content

avrdude upload error when fuses are present in the elf file (AVR Dx) #71

@kiiv-cz

Description

@kiiv-cz

I'm getting error:

avrdude error: address 0x820009 out of range at line 665 of .pio\build\test_fuses_in_elf\firmware.hex

caused by having C source file containing FUSES setting (src/fuses.c):

#include <avr/io.h>

#ifdef MVIO_ENABLED
  #define MVIO_SETTING MVSYSCFG_DUAL_gc
#else
  #define MVIO_SETTING MVSYSCFG_SINGLE_gc
#endif

FUSES = {
    .WDTCFG   = WINDOW_OFF_gc | PERIOD_OFF_gc,
    .BODCFG   = LVL_BODLEVEL0_gc | SAMPFREQ_128Hz_gc | ACTIVE_DISABLE_gc | SLEEP_DISABLE_gc,
    .OSCCFG   = CLKSEL_OSCHF_gc,
    .SYSCFG0  = CRCSRC_NOCRC_gc | CRCSEL_CRC16_gc | RSTPINCFG_RST_gc | FUSE_EESAVE_bm,
    .SYSCFG1  = MVIO_SETTING | SUT_16MS_gc,
    .CODESIZE = 0x00,
    .BOOTSIZE = 0x00,
};

Fix is adding "-R" ".fuse" into ElfToHex Builder builder/main.py#L129:

        ElfToHex=Builder(
            action=env.VerboseAction(" ".join([
                "$OBJCOPY",
                "-O",
                "ihex",
                "-R",
                ".eeprom",
                "-R",
                ".fuse",
                "$SOURCES",
                "$TARGET"
            ]), "Building $TARGET"),
            suffix=".hex"
        )

Another workaround is using custom upload protocol and just copy hex file to CURIOSITY NANO drive:

upload_protocol = custom
upload_command = copy $SOURCE d:\

Board: Curiosity Nano DB / AVRxDB (but should be valid for any supported MCU)
Plaform version: 1.9.0

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions