When disassembling AVRDUDE uses known labels for ldi operations that
initialise a register pair, eg,
ldi r30, lo8(nvm.ctrla) ; 0xcb = 203
ldi r31, hi8(nvm.ctrla) ; 0x01 = 1
out cpu.ccp, r24
st Z, r18
This is meant to illustrate a possible intention of the code. It is not
unusual to see a base register loaded, for example the USARTC0 register
base, into the Y or Z register pair and read write with displacement from
specific USARTC0 register bytes using the ldd and std opcodes.
However, sometimes these labels are misleading when, eg, the register pair
is just initialised as a counter. In particular that can easily happen for
I/O register addresses for which there are fewer use cases to put them
into a register pair as the in/out opcodes are short and no savings would
be made using ldd/std. For example,
ldi r28, lo8(gpio.gpior9) ; 0x09 = 9
ldi r29, hi8(gpio.gpior9) ; 0x00 = 0
is most likely used as a 16-bit counter initialised with 9. This would
better be disassembled as
ldi r28, 0x09 ; 9
ldi r29, 0x00 ; 0
This commit does so by removing the use of registers in I/O space as
symbolic ldi operands when loading a register pair.
LIBAVRDUDE_EXIT was introduced to allow driver function to tell main.c
that all is done and avrdude should exit(0) indicating success. For
example, processing the -x help options in the driver should exit.
There have been increasingly more situations when the driver function
needed to return and suppress error messages from the caller; for these
LIBAVRDUDE_EXIT was used but now avrdude wrongly indicated success to the
shell when it should indicate an error.
This commit replaces LIBAVRDUDE_EXIT with LIBAVRDUDE_EXIT_FAIL or
LIBAVRDUDE_EXIT_OK as appropriate indicating error or success to the
shell, respectively.