SAM7S256 - easy way to write internal flash without libmem..
I've tried the prebuild libmem at first. But it was a hard way and the documentation and examples are not so handy. There is still the need of a functional example from Rowley - equal to the example from Atmel "basic-internalflash-project-at91sam7s-ek".
Thats why i was looking for a way to get the Atmel "at91lib" version 1.9 working now with the special goal to write and read the internal flash memory of my AT91SAM7S256. It's working for me now with some modifications in the header files. Now i can write and read to the flash from any function of my code.
Please open the corresponding files from Atmel "at91lib": "peripherals/efc.h" + "memories/flash/flashd.h"
Here you must only change the code section of the funtions from the default ".text" to the new RAM location ".fast".
For example i've changed from original:
extern unsigned char FLASHD_Write(
unsigned int address,
const void *pBuffer,
unsigned int size);
to the resulting:
extern unsigned char __attribute__((section(".fast"))) FLASHD_Write(
unsigned int address,
const void *pBuffer,
unsigned int size);
Now you can try the example from Atmel: "basic-internalflash-project-at91sam7s-ek" from the zip-file "at91sam7s-ek.zip"
Please don't forget to change all include path's to your needs and add the corresponding "at91lib" c-files to your projekt.
After successful compiling you can check in the map-file of your project if there is all right with the RAM-section named ".fast". Please look for symbol "FLASHD_Write" in the section ".fast".
I hope this can help all new CrossWorks-user's like me.
Please sign in to leave a comment.
Comments
0 comments