I had a look to the Keil\ARM\Flash\AT91SAM7_64 and it looks this code was design to never run.
1. The example finishes with error 2. ProgramPage should be at least in RAM 3. *Flash++ = *((unsigned long *)buf); -> buf should be aligned before get Data abort exception.
Did someone has some working example with Keil AT91SAM7xx and data flash?
As answered: The code you have is expected to be downloaded into RAM through the JTAG interface when you download applications to the unit.
The code is _not_ intended for inclusion in your own applications.
So, if you want to copy the code for use in your own application, then you must create a project where the code will be run in an identical way as when downloaded run using the JTAG interface.
You must make sure that the code runs from RAM - either by manually copying the code, or getting the linker to see it basically as initialized RAM, and decompressing/copying the function to a suitable address in RAM.
And _you_ have to make sure that the function is supplied with aligned data blocks.
When you take sample code intended for one problem, and want to use it for a completely different problem, then it is up to you to figure out the needed changes.
One more: The key flash algorithms are not intended to be run from any main() - but you could possibly modify them for that use.
Hi Per,
Thanks for you reply. It clarifies a lot of things. Can you deliver some tutorial sources where flash it's possible from application? So far I found a lot of complaining all over the sites and no real examples/solution for this problem (it looks not so easy to make). No sources deliver from Keil and so far I spend 2 days of debugging and the results are so far not very positive.
I'm not sure I understand you, but if you are trying to do IAP you can look at http://www.st.com, STR9 samples.