Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add fuses, calibration, sernum and tempsense memories to XMEGAs #1829

Merged
merged 34 commits into from
Jul 15, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
34 commits
Select commit Hold shift + click to select a range
59cda4a
Parent XMEGA parts from common family sub-group
stefanrueger Jun 19, 2024
9576aec
Fix boot_section_size of ATxmega128A4
stefanrueger Jun 19, 2024
5d322eb
Add calibration, sernum and tempsense sub-memories to XMEGAs
stefanrueger Jun 19, 2024
2373b0a
Fix access for XMEGA sernum and tempsense
stefanrueger Jun 19, 2024
ebe370a
Document XMEGA calibration, sernum and tempsense memories
stefanrueger Jun 19, 2024
cde5d3e
Add sernum memory to m324pb, m328pb, t102 and t104
stefanrueger Jun 19, 2024
110c7f9
Add collective fuses memory for XMEGAs
stefanrueger Jun 20, 2024
d184b10
Fix access to sigrow submemories in jtag3.c
stefanrueger Jun 21, 2024
56e6535
Document the new fuses memory for XMEGAs
stefanrueger Jun 21, 2024
808457e
Fix flash size of x128a4
stefanrueger Jul 4, 2024
5f5f081
Merge branch 'main' into additional-memories
stefanrueger Jul 4, 2024
dbb2fc3
Adapt dryrun.c to new XMEGA memories
stefanrueger Jul 4, 2024
ff35f53
Prevent warnings for incomplete stump XMEGA family entries
stefanrueger Jul 4, 2024
6de1cd9
Place classic prodsig submemories into flat address model
stefanrueger Jul 4, 2024
09d4dbb
Merge branch 'avrdudes:main' into additional-memories
stefanrueger Jul 7, 2024
6979fce
Fix sernum entries for classic parts
stefanrueger Jul 12, 2024
8d1ea38
Fix plural in message
stefanrueger Jul 12, 2024
be63435
Copy sernum into prodsig for classic parts in dryrun.c
stefanrueger Jul 12, 2024
8a4c00f
Add ability to read classic sernum mem to avr_read_byte_default()
stefanrueger Jul 12, 2024
45d1bea
Enable classic sernum read for ISP/HVPP/HVSP/JTAG in stk500v2.c
stefanrueger Jul 12, 2024
1ce9154
Review sigrow sub-memory treatment in jtag*.c
stefanrueger Jul 12, 2024
b23370a
Enable sigrow sub-memory reading for avrftdi_jtag
stefanrueger Jul 12, 2024
6f92e18
Enable sigrow sub-memory reading for butterfly
stefanrueger Jul 12, 2024
6ca23bd
Utilise PM_Classic in code
stefanrueger Jul 12, 2024
71029c5
Fix write delays for some classic parts
stefanrueger Jul 13, 2024
8f71607
Correct comments
stefanrueger Jul 13, 2024
90a4a54
Map x-bits to 0 for SPI opcode comparison
stefanrueger Jul 13, 2024
7fbd963
Rearrange classic parts and parenting in avrdude.conf
stefanrueger Jul 13, 2024
96e92ba
Extend prodsig and sernum to virtually all classic parts
stefanrueger Jul 14, 2024
44104df
Add missing space
stefanrueger Jul 14, 2024
d8836d3
Fix jtag3 access to prodsig sub-memories
stefanrueger Jul 14, 2024
0c71043
Update term command usage
stefanrueger Jul 14, 2024
dbb1cef
Fix jtag3 access to UPDI sigrow sub-memories
stefanrueger Jul 14, 2024
ca4534a
Remove unnecessary empty lines in avrdude.conf
stefanrueger Jul 15, 2024
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
18 changes: 17 additions & 1 deletion src/avr.c
Original file line number Diff line number Diff line change
Expand Up @@ -181,6 +181,22 @@ static int avr_tpi_setup_rw(const PROGRAMMER *pgm, const AVRMEM *mem,
return 0;
}

// If mem is a sub-memory of sigrow return its offset within sigrow, 0 otherwise
int avr_sigrow_offset(const AVRPART *p, const AVRMEM *mem, int addr) {
int offset = 0;

if(mem_is_in_sigrow(mem)) {
AVRMEM *m = avr_locate_sigrow(p);
if(m) {
int off = mem->offset - m->offset;
if(off >= 0 && off + addr < m->size)
offset = off;
}
}

return offset;
}

int avr_read_byte_default(const PROGRAMMER *pgm, const AVRPART *p, const AVRMEM *mem,
unsigned long addr, unsigned char * value)
{
Expand Down Expand Up @@ -258,7 +274,7 @@ int avr_read_byte_default(const PROGRAMMER *pgm, const AVRPART *p, const AVRMEM
memset(cmd, 0, sizeof(cmd));

avr_set_bits(readop, cmd);
avr_set_addr(readop, cmd, addr);
avr_set_addr(readop, cmd, addr + avr_sigrow_offset(p, mem, addr));
rc = pgm->cmd(pgm, cmd, res);
if(rc < 0)
goto rcerror;
Expand Down
32 changes: 25 additions & 7 deletions src/avrdude.1
Original file line number Diff line number Diff line change
Expand Up @@ -847,11 +847,17 @@ Low fuse byte
.It lock
Lock byte
.It prodsig
Signature, calibration byte and serial number in a small read-only memory,
Signature, calibration byte(s) and serial number in a small read-only memory,
which is only documented to be available for ATmega324PB, ATmega328PB,
ATtiny102 and ATtiny104; programmers may or may not be able to read this memory
ATtiny102 and ATtiny104;
.Nm
generally tries to make this memory available, also for parts where it is
not documented, but not all programmers may be able to read this memory
.It sigrow
Memory alias for prodsig
.It sernum
The serial number part of prodsig; owing to scarce documentation this may not
actually turn out to be a serial number or be readable by some programmers
.It usersig
Three extra flash pages for firmware settings; this memory is not erased
during a chip erase. Only some classic parts,
Expand Down Expand Up @@ -880,6 +886,13 @@ Application flash area
Application table flash area
.It boot
Boot flash area
.It calibration
An area of 4 (ATxmega-A series) or 5 bytes (ATxmega-B/C/D/E) with
oscillator calibration values; this is a sub-memory of prodsig
.It fuses
A logical memory of 7 bytes containing all fuseX of a part, which can be
used to program all fuses at the same time; note that some fuse bytes will
be reserved, though
.It fuse0
A.k.a. jtaguid: JTAG user ID for some devices
.It fuse1
Expand All @@ -892,12 +905,17 @@ Other fuse bytes of ATxmega devices, where
is 2, 4 or 5, for system configuration
.It prodsig
The production signature row is a read-only memory section for factory
programmed data such as the signature and calibration values for
oscillators or analogue modules; it also contains a serial number that
consists of the production lot number, wafer number and wafer coordinates
for the part
programmed data such as the calibration values for oscillators or analogue
modules; it also contains a serial number that consists of the production
lot number, wafer number and wafer coordinates for the part
.It sernum
Serial number with a unique ID for the part consisting of 10 bytes; these
are part of the prodsig memory above
.It sigrow
Memory alias for prodsig
.It tempsense
A two-byte memory, which is located within prodsig; it contains a 12-bit
temperature sensor calibration value
.It usersig
Additional flash memory page that can be used for firmware settings; this
memory is not erased during a chip erase
Expand Down Expand Up @@ -930,7 +948,7 @@ A.k.a. bootend or bootsize: end of the boot section or the boot size in blocks o
.It fusea
A.k.a. pdicfg: configures/locks updi access; it is the only fuse that consists of two bytes
.It fuses
A "logical" memory of up to 16 bytes containing all fuseX of a part, which can be
A logical memory of up to 16 bytes containing all fuseX of a part, which can be
used to program all fuses at the same time
.It osc16err
Two bytes typically describing the 16 MHz oscillator frequency error at 3 V and 5 V, respectively
Expand Down
Loading
Loading