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

Fix ATxmega fuses memory sizes #1933

Merged
merged 1 commit into from
Nov 25, 2024
Merged

Conversation

stefanrueger
Copy link
Collaborator

Fixes the following observation in this comment:

the fuse size seems to be set to 7 when it should be 6

@askn37 Please could you review?

@stefanrueger stefanrueger added the bug Something isn't working label Nov 16, 2024
@askn37
Copy link
Contributor

askn37 commented Nov 17, 2024

The results look good.

avrdude_xmega_fuses % ./build_darwin/src/avrdude -p\*/tAP | grep 'fuses\tsize' 
.ptmm	AVR XMEGA-C/D family common values	fuses	size	6
.ptmm	AVR XMEGA-E family common values	fuses	size	7
.ptmm	AVR XMEGA-A/B family common values	fuses	size	6
.ptmm	ATxmega16A4U	fuses	size	6
.ptmm	ATxmega16C4	fuses	size	6
.ptmm	ATxmega16D4	fuses	size	6
.ptmm	ATxmega16A4	fuses	size	6
.ptmm	ATxmega32A4U	fuses	size	6
.ptmm	ATxmega32C4	fuses	size	6
.ptmm	ATxmega32D4	fuses	size	6
.ptmm	ATxmega32A4	fuses	size	6
.ptmm	ATxmega64A4U	fuses	size	6
.ptmm	ATxmega32C3	fuses	size	6
.ptmm	ATxmega32D3	fuses	size	6
.ptmm	ATxmega64C3	fuses	size	6
.ptmm	ATxmega64D3	fuses	size	6
.ptmm	ATxmega64D4	fuses	size	6
.ptmm	ATxmega64A1	fuses	size	6
.ptmm	ATxmega64A1U	fuses	size	6
.ptmm	ATxmega64A3	fuses	size	6
.ptmm	ATxmega64A3U	fuses	size	6
.ptmm	ATxmega64A4	fuses	size	6
.ptmm	ATxmega64B1	fuses	size	6
.ptmm	ATxmega64B3	fuses	size	6
.ptmm	ATxmega128C3	fuses	size	6
.ptmm	ATxmega128D3	fuses	size	6
.ptmm	ATxmega128D4	fuses	size	6
.ptmm	ATxmega128A1	fuses	size	6
.ptmm	ATxmega128A1revD	fuses	size	6
.ptmm	ATxmega128A1U	fuses	size	6
.ptmm	ATxmega128A3	fuses	size	6
.ptmm	ATxmega128A3U	fuses	size	6
.ptmm	ATxmega128A4	fuses	size	6
.ptmm	ATxmega128A4U	fuses	size	6
.ptmm	ATxmega128B1	fuses	size	6
.ptmm	ATxmega128B3	fuses	size	6
.ptmm	ATxmega192C3	fuses	size	6
.ptmm	ATxmega192D3	fuses	size	6
.ptmm	ATxmega192A1	fuses	size	6
.ptmm	ATxmega192A3	fuses	size	6
.ptmm	ATxmega192A3U	fuses	size	6
.ptmm	ATxmega256C3	fuses	size	6
.ptmm	ATxmega256D3	fuses	size	6
.ptmm	ATxmega256A1	fuses	size	6
.ptmm	ATxmega256A3	fuses	size	6
.ptmm	ATxmega256A3U	fuses	size	6
.ptmm	ATxmega256A3B	fuses	size	6
.ptmm	ATxmega256A3BU	fuses	size	6
.ptmm	ATxmega384C3	fuses	size	6
.ptmm	ATxmega384D3	fuses	size	6
.ptmm	ATxmega8E5	fuses	size	7
.ptmm	ATxmega16E5	fuses	size	7
.ptmm	ATxmega32E5	fuses	size	7

The error message for test8 -r1 is gone.

avrdude_xmega_fuses % ./tools/test8 -e./build_darwin/src/avrdude -r1 -a-Pusb:04d8:0b15 jtag3pdi x128a4u
Reading 141642 bytes for multiple memories from input file bak-jtag3pdi-x128a4u.hex
Writing 2048 bytes to eeprom
Writing | ################################################## | 100% 0.71 s 
Reading | ################################################## | 100% 0.26 s 
2048 bytes of eeprom verified
Writing 139264 bytes to flash
Writing | ################################################## | 100% 13.66 s 
Reading | ################################################## | 100% 6.55 s 
139264 bytes of flash verified
Writing 131072 bytes to application
Writing | ################################################## | 100% 12.85 s 
 | ################################################## | 100% 6.28 s 
131072 bytes of application verified
Writing 4096 bytes to apptable
Writing | ################################################## | 100% 0.40 s 
 | ################################################## | 100% 0.19 s 
4096 bytes of apptable verified
Writing 8192 bytes to boot
Writing | ################################################## | 100% 0.81 s 
 | ################################################## | 100% 0.38 s 
8192 bytes of boot verified
Writing 6 bytes to fuses, 6 bytes written, 6 verified
Writing 1 byte (0xFF) to fuse0, 1 byte written, 1 verified
Writing 1 byte (0x00) to fuse1, 1 byte written, 1 verified
Writing 1 byte (0xFF) to fuse2, 1 byte written, 1 verified
Writing 1 byte (0xFE) to fuse4, 1 byte written, 1 verified
Writing 1 byte (0xFF) to fuse5, 1 byte written, 1 verified
Writing 1 byte (0xFF) to lock, 1 byte written, 1 verified
Writing 256 bytes to usersig
Writing | ################################################## | 100% 0.02 s 
 | ################################################## | 100% 0.01 s 
256 bytes of usersig verified

This may be a separate issue, but there is some display distortion.

With -r1

Writing 131072 bytes to application
Writing | ################################################## | 100% 12.85 s 
 | ################################################## | 100% 6.28 s 
^

Without -r1

Writing 131072 bytes to application
Writing | ################################################## | 100% 10.80 s 
0000 | ################################################## | 100% 6.17 s 
^^^^

This message appears in three locations that are PDI-only memory: application, apptable, and boot, and likely indicates an incorrect printf format.

@stefanrueger
Copy link
Collaborator Author

@askn37 Thanks for testing.

display distortion

That kind of problem can be difficult to hunt down. Could you please try

$ ./tools/test8 -e=./build_darwin/src/avrdude -r1 dryrun x128a4u

to see whether the problem is independent of the used -c programmer.

@stefanrueger
Copy link
Collaborator Author

independent of the used -c programmer[?]

@askn37 BTW, I have tried

$ ./tools/test8 -e=./build_darwin/src/avrdude -r1 dryrun x128a4u

under Linux and it does not show the display irregularity below that you found with the -c jtag3pdi programmer:

Writing 131072 bytes to application
Writing | ################################################## | 100% 10.80 s 
0000 | ################################################## | 100% 6.17 s 
^^^^

My conclusion was that the problem either resides in the jtag3pdi programmer or in your MacOS(?) build. Hence, it would be useful to check above test8 line with dryrun on a Mac. But that can be checked by @mcuee or @MCUdude as well.

Anyway, merging the fexed ATxmega fuses memory sizes now...

@stefanrueger stefanrueger merged commit 22efe4f into avrdudes:main Nov 25, 2024
14 checks passed
@stefanrueger stefanrueger deleted the xmega-fuses branch November 25, 2024 12:23
@askn37
Copy link
Contributor

askn37 commented Nov 26, 2024

For reference, here are the results of the dry run. No abnormalities were observed.

% uname -a
Darwin alicia.local 24.1.0 Darwin Kernel Version 24.1.0: Thu Oct 10 21:05:14 PDT 2024; root:xnu-11215.41.3~2/RELEASE_ARM64_T8103 arm64

% ./avrdude_main/tools/test8 -e./avrdude_main/build_darwin/src/avrdude dryrun x128a4u 

Processing -U ALL:r:bak-dryrun-x128a4u.hex:I
Reading multiple memories ...
 - eeprom         | ################################################## | 100% 0.00 s 
 - flash          | ################################################## | 100% 0.00 s 
 - application    | ################################################## | 100% 0.00 s 
 - apptable       | ################################################## | 100% 0.00 s 
 - boot           | ################################################## | 100% 0.00 s 
 - fuses          | ################################################## | 100% 0.00 s 
 - fuse0          | ################################################## | 100% 0.00 s 
 - fuse1          | ################################################## | 100% 0.00 s 
 - fuse2          | ################################################## | 100% 0.00 s 
 - fuse4          | ################################################## | 100% 0.00 s 
 - fuse5          | ################################################## | 100% 0.00 s 
 - lock           | ################################################## | 100% 0.00 s 
 - prodsig/sigrow | ################################################## | 100% 0.00 s 
 - calibration    | ################################################## | 100% 0.00 s 
 - sernum         | ################################################## | 100% 0.00 s 
 - tempsense      | ################################################## | 100% 0.00 s 
 - usersig        | ################################################## | 100% 0.00 s 
 - signature      | ################################################## | 100% 0.00 s 
Writing 285028 bytes to output file bak-dryrun-x128a4u.hex

Processing -T fact reset
performing chip erase; discarded pending writes to flash and EEPROM
Caching | ################################################## | 100% 0.00 s 
Caching | ################################################## | 100% 0.00 s 
Caching | ################################################## | 100% 0.00 s 
Synching cache to device ... done
after the next reset the part will have F_CPU = 2.000 MHz

Processing -U ALL:w:bak-dryrun-x128a4u.hex:I
Reading 141643 bytes for multiple memories from input file bak-dryrun-x128a4u.hex
Writing 2048 bytes to eeprom
Writing | ################################################## | 100% 0.00 s 
Reading | ################################################## | 100% 0.00 s 
2048 bytes of eeprom verified
Writing 139264 bytes to flash
Writing | ################################################## | 100% 0.00 s 
Reading | ################################################## | 100% 0.00 s 
139264 bytes of flash verified
Writing 131072 bytes to application
Writing | ################################################## | 100% 0.00 s 
Reading | ################################################## | 100% 0.00 s 
131072 bytes of application verified
Writing 4096 bytes to apptable
Writing | ################################################## | 100% 0.00 s 
Reading | ################################################## | 100% 0.00 s 
4096 bytes of apptable verified
Writing 8192 bytes to boot
Writing | ################################################## | 100% 0.00 s 
Reading | ################################################## | 100% 0.00 s 
8192 bytes of boot verified
Writing 7 bytes to fuses, 7 bytes written, 7 verified
Writing 1 byte (0xFF) to fuse0, 1 byte written, 1 verified
Writing 1 byte (0x00) to fuse1, 1 byte written, 1 verified
Writing 1 byte (0xFF) to fuse2, 1 byte written, 1 verified
Writing 1 byte (0xFE) to fuse4, 1 byte written, 1 verified
Writing 1 byte (0xFF) to fuse5, 1 byte written, 1 verified
Writing 1 byte (0xFF) to lock, 1 byte written, 1 verified
Writing 256 bytes to usersig
Writing | ################################################## | 100% 0.00 s 
Reading | ################################################## | 100% 0.00 s 
256 bytes of usersig verified

Processing -U ALL:v:bak-dryrun-x128a4u.hex:I
Verifying 141643 bytes of multiple memories against input file bak-dryrun-x128a4u.hex
Reading | ################################################## | 100% 0.00 s 
2048 bytes of eeprom verified
Reading | ################################################## | 100% 0.00 s 
139264 bytes of flash verified
Reading | ################################################## | 100% 0.00 s 
131072 bytes of application verified
Reading | ################################################## | 100% 0.00 s 
4096 bytes of apptable verified
Reading | ################################################## | 100% 0.00 s 
8192 bytes of boot verified
7 bytes of fuses verified
1 byte of fuse0 verified
1 byte of fuse1 verified
1 byte of fuse2 verified
1 byte of fuse4 verified
1 byte of fuse5 verified
1 byte of lock verified
Reading | ################################################## | 100% 0.00 s 
64 bytes of prodsig/sigrow verified
4 bytes of calibration verified
14 bytes of sernum verified
2 bytes of tempsense verified
Reading | ################################################## | 100% 0.00 s 
256 bytes of usersig verified
3 bytes of signature verified

Avrdude done.  Thank you.

Since the display distortion only seems to be visible in very specific circumstances, it's natural to wonder if this is a macOS-specific issue.
Of particular concern are Apple Mx and ARM64, which cannot be considered equivalent to Intel CPUs in many ways, including the fact that division by zero does not return an error, but rather unconditionally returns zero.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants