Skip to content

Conversation

@stefanrueger
Copy link
Collaborator

This PR corrects the apptable sizes for ATmega128A4U and ATmega128A4.

I read in the AVR 1316 AN for XMEGAs that the application table size will always be the same as the boot section size (a fun fact!). I quickly checked:

$ for i in apptable boot; do avrdude -qqp*/PAt | grep $i.size | cut -f1,2,4,5 | sort > /tmp/${i::1}; done
$ diff /tmp/[ab]
6,7c6,7
< .ptmm	ATxmega128A4	size	4096
< .ptmm	ATxmega128A4U	size	4096
---
> .ptmm	ATxmega128A4	size	8192
> .ptmm	ATxmega128A4U	size	8192

Manually checking the respective datasheets, AVRDUDE actually had the apptable size wrong.

@stefanrueger stefanrueger added the bug Something isn't working label Nov 6, 2025
@mcuee
Copy link
Collaborator

mcuee commented Nov 7, 2025

Should be good to go.

@mcuee
Copy link
Collaborator

mcuee commented Nov 7, 2025

I read in the AVR 1316 AN for XMEGAs that the application table size will always be the same as the boot section size (a fun fact!).

Indeed.

Form AVR AN1316
https://ww1.microchip.com/downloads/aemDocuments/documents/OTH/ApplicationNotes/ApplicationNotes/doc8070.pdf

2.4 Application and Boot Sections

The XMEGA Flash memory is divided into two sections, the Application Section and the Boot Section. The Application Section stores ordinary application firmware, while the Boot Section is most often used to store a bootloader application.

The Boot Section can also be used for ordinary application firmware. Since code that executes SPM-based commands can only run from the Boot Section, the section is most often used for bootloaders and/or parts of the application firmware that needs to
update Flash memory or run other SPM-based commands. There are separate lock bits for the Application Section and the Boot Section, so that read and/or write access to the two sections can be individually limited. Also, the upper part of the Application Section has its own set of lock bits, independent from the rest of the section. This upper section is called the Application Table Section, since it is ideal for storing and maintaining larger tables in Flash memory.

A common scenario for using the Application Table Section is as follows:
• Store application firmware in the Application Section and lock it using corresponding lock bits.
• Store and maintain larger tables in the Application Table Section, and leave it unlocks in case it needs updates later.
• Store the parts of the application firmware that maintains the Flash tables (using SPM-based commands) in the Boot Section and lock it using corresponding lock bits.

Note that the size of the Application Table Section will always be equal to the size of the Boot Section.

@stefanrueger stefanrueger merged commit 65a249e into avrdudes:main Nov 12, 2025
15 checks passed
@stefanrueger stefanrueger deleted the 128a4u-apptable branch November 12, 2025 16:09
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