2011-02-28 03:16 AM
Define an array in Flash
2011-05-17 05:26 AM
Just mark it const.
2011-05-17 05:26 AM
int *array = (int *)0x08008000;
It's just memory like anything else for reading. For writing the cell[s] you want to use must be blank/erased, and there is a programming sequence. C is not intrinsically going to be able to write to the memory as it would with RAM, you will need to code routines to do this.2011-05-17 05:26 AM
If the question was, how to allocate memory in flash, there is an application note for this:
AN25942011-05-17 05:26 AM
As Domen Puncer wrote, a const tag before an array declaration forces the compiler/linker to place the array in flash:
const char Message[] = ''Hello, World''; Anywhere in the flash of your STM32Fxxx device (address beginning from 0x8000000) the string above will be placed. It means at the same time, the array cannot be changes at runtime (no assignments allowed). If you do wanna do this, you have to implement the flash modification routines as it's described in application notes.2011-05-17 05:26 AM
''a const tag before an array declaration forces (sic) the compiler/linker to place the array in flash''
No, it does not force it - but the compiler may decide that this allows it to do so. Different compilers may decide differently...2011-05-17 05:26 AM
Hello bap68,
I want to download the application note you are talking about. Just searching An 2594 did not support me. can you give little bit of more information on that. Thanks,2011-05-17 05:26 AM
2011-05-17 05:26 AM
2011-05-17 05:26 AM
''uint16_t* Address = ADDRESS; //it places var Address at flash address 0x0801F800''
No, it does
not
! 'Address' here is a pointer that is being initialised to point to an address in flash.