Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Tools/Controller/internal/programmer/libavrdude_adapter.go
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,7 @@ func libavrdudeAdapterArguments(options Options, configuration, programmer strin
switch options.Operation {
case OperationWriteFlash:
if programmer == "urclock" {
args = append(args, "--no-auto-erase")
args = append(args, "--no-auto-erase", "--extended", "nometadata")
}
update = "flash:w:" + options.HexPath + ":i"
case OperationReadFlash:
Expand Down
19 changes: 19 additions & 0 deletions Tools/Controller/internal/programmer/libavrdude_adapter_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -124,3 +124,22 @@ func TestNonDefaultAVRRequiresExplicitGeometry(t *testing.T) {
t.Fatalf("unexpected non-default AVR command: %s", joined)
}
}

// The firmware identity occupies the end of application flash. Urclock metadata
// must not reserve its final byte; this must match the CLI uploader contract.
func TestLibavrdudeUrclockFlashDisablesMetadata(t *testing.T) {
for _, programmer := range []string{"urclock", "usbasp"} {
args, err := libavrdudeAdapterArguments(Options{
MCU: "atmega328p", Operation: OperationWriteFlash,
HexPath: "firmware.hex", BaudRate: 115200,
}, "avrdude.conf", programmer)
if err != nil {
t.Fatal(err)
}
joined := strings.Join(args, " ")
got := strings.Contains(joined, "--extended nometadata")
if got != (programmer == "urclock") {
t.Fatalf("%s metadata policy: %s", programmer, joined)
}
}
}
Loading