I wasn't sure which forum this belongs in, since it's both hardware and software related, but here goes. I'm having problems programming the internal flash memory via software. I'm using Atmel's flash driver, but it doesn't work. The problem is, one page gets programmed, but the processor is crashed or halted after that. After rebooting, I can see my test data has been burned into the page I chose, but only the first page in my test area was programmed.
My understanding is that I should be able to write to the flash as long as the code is running out of the lower region of the flash within the BOOTPROT section, which I have set to the maximum of 64K bytes. The end goal here is a program loader function for loading a larger application (higher in flash) via a serial port.
I am reasonably sure that all of my code and vectors and so on are contained within the bottom 64K. I have altered the linker script in such a way that the flash is limited to 64K (FLASH (rxai!w) : ORIGIN = 0x80000000, LENGTH = 0x00010000). If it gets bigger than that, the linker will complain.
Any ideas? I'm assuming I'm missing something obvious, but what?