megaAVR (JTAG) OCD memtypes

Table 1. megaAVR (JTAG) OCD memtypes
ID Prog access Debug access Usage/rules
MEMTYPE_FLASH_PAGE RW -
  • Used for reading and writing FLASH pages in programming mode

  • Writing it restricted to single full FLASH pages

  • Reading is restricted to multiple full FLASH pages

  • If access is attempted outside of programming mode, an error is returned 1
MEMTYPE_EEPROM_PAGE RW -
  • Used to read and write EEPROM in programming mode

  • Writing is restricted to single full pages

  • Reading is restricted to multiple full pages

  • If access is attempted outside of programming mode, an error is returned 2
MEMTYPE_FUSES RW -
  • Used to read and write FUSES in programming mode

  • Up to 3 fuse bytes can be written/read in one operation. More than 3 results in an error.3
  • Up to address 0x02 can be accessed. Outside of this range results in an error.4
  • If access is attempted outside of programming mode, an error is returned 5
MEMTYPE_LOCKBITS RW -
  • Used to read and write LOCKBITS in programming mode

  • Only a single lockbit byte is available to read, at address 0

  • Violating this results in an error 67
  • If access is attempted outside of programming mode, an error is returned 8
MEMTYPE_SIGNATURE R -
  • Used to read the device SIGNATURE in programming mode

  • Up to 3 signature bytes can be read in one operation. More than 3 results in an error.9
  • Up to address 0x02 can be accessed. Outside of this range results in an error.10
  • If access is attempted outside of programming mode, an error is returned 11
MEMTYPE_OSCCAL R -
  • Used to read the device OSCCAL VALUES in programming mode

  • Up to 4 bytes can be read in one operation. More than 4 results in an error.12
  • Up to address 0x03 can be accessed. Outside of this range results in an error.13
  • If access is attempted outside of programming mode, an error is returned 14
MEMTYPE_SRAM - RW
  • Accesses SRAM and I/O space during debugging

  • If used in programming mode, an error is returned 15
  • If a read attempts to read an area containing the OCDR register, an error is returned 16
  • A masked read must be used in this case

  • Any number of bytes (within payload restrictions) can be written or read in one operation

MEMTYPE_EEPROM - RW
  • Used to read and write EEPROM during a debug session

  • Any number of bytes can be written or read in one operation

  • Uses monitor code heavily - may take some time to complete, depending proportionally upon the number of bytes being accessed

MEMTYPE_SPM - R
  • Used to read FLASH during a debug session

  • If an odd number of bytes is requested, an error is returned 17
  • If a malaligned address is requested, an error is returned 18
  • Software breakpoints are filtered out

MEMTYPE_USER_SIGNATURE RW RW
  • Used to read/write the USER SIGNATURE in programming mode.
    Note: Applies to ATmegaxxxRFR2 devices only!
  • Writing is restricted to single full FLASH pages

  • Reading is restricted to multiple full FLASH pages

1

AVR8_FAILURE_ILLEGAL_STATE

2

AVR8_FAILURE_ILLEGAL_STATE

3

AVR8_FAILURE_INVALID_SIZE

4

AVR8_FAILURE_INVALID_ADDRESS

5

AVR8_FAILURE_ILLEGAL_STATE

6

AVR8_FAILURE_INVALID_SIZE

7

AVR8_FAILURE_INVALID_ADDRESS

8

AVR8_FAILURE_ILLEGAL_STATE

9

AVR8_FAILURE_INVALID_SIZE

10

AVR8_FAILURE_INVALID_ADDRESS

11

AVR8_FAILURE_ILLEGAL_STATE

12

AVR8_FAILURE_INVALID_SIZE

13

AVR8_FAILURE_INVALID_ADDRESS

14

AVR8_FAILURE_ILLEGAL_STATE

15

AVR8_FAILURE_ILLEGAL_STATE

16

AVR8_FAILURE_ILLEGAL_MEMORY_RANGE

17

AVR8_FAILURE_ILLEGAL_MEMORY_RANGE

18

AVR8_FAILURE_INVALID_ALIGNMENT