In AVR1008 they mention a bug affecting Flash accessing for the ATXMEGA256A3B (they state that revision B only is affected).
I'm dealing with a ATXMEGA256A3U micro, and trying to perform a flash page erase operation. For the purpose I'm referring to AVR1316.zip sample code.
I'm using GDB to dump the memory and see the outcome of the operation. I'm observing that GDB shifts all addresses by forcefully adding an offset of size 0x800000 to all of them except address zero (0x00), so I cannot use that to print flash addresses starting above zero.
I'm also seeing that GDB is not able to perform "dump memory" operations (it hangs into the operation forever).
The current solution to print flash memory is to call this command:
x /512bx 0x0
The printed data corresponds to the binary image that I had flashed the micro with.
A) Can I assume that gdb is really inspecting Flash memory on target and is not just returning the loaded elf embedded instruction code locally?
B) If the above assumption holds, I'm not beeing able to erase a flash page with the following asm code:
; Input: ; R25:R24:R23:R22 - Byte address into Flash page. ; ; Returns: ; Nothing. erase_flashpage: in r21, __RAMPZ__ out __RAMPZ__, r24 ldi r20, NVM_CMD_ERASE_APP_PAGE_gc jmp SP_CommonSPM SP_CommonSPM: mov __Z_H__, r23 mov __Z_L__, R22 sts NVM_CMD, r20 ldi r16, CCP_SPM_gc sts CCP, r16 spm out __RAMPZ__, r21 ret
Code comes directly from AVR1316.zip from Atmel website.
Can you address me to some other sample code proved to work?