Topic : Storing program and additional data on STR flash

Forum : ARM

Original Post
Post Information Post
March 21, 2008 - 2:21pm
Guest

Hi friends
I need to put some data with my program inside the STR912FW44 flash.
My program is a little bigger than 32KB and the external data is 128KB long. So, both need to be written on BANK 0.
I guess that there are two possible solutions:

1) To merge the program hex file with my other external hex file and flash them together.
For this method, the questions are:
- how can i do that ? RFLASHER supports writing other hex files on different flash offset addresses ?
- my i change some link script to build a single hex file containing both the code and the external data ?

2) To write the program HEX file as i always did and then receive the external file through a serial port and write it on the fly (in system flash programming) to other BANK0 flash offset.
For this method, the questions are:
- Is it possible to run the program from bank0 and to erase/write on the same bank, even at different flash sectors?
- The flash programming interface needs to be running at low speed (24MHz) in order to write the data ?

Any comments are very well appreciated.
Thanks for reading.
TUDADOCHELL

Replies
Post Information Post
+1
0
-1
March 25, 2008 - 1:24am
Guest

Hi to you all, i realised other method.
I can declare a long enough static const variable to fit all my needed data into.
Then, i can populate it by converting the original binary data to a *very big* header file, initializing it.

The question is: how to declare the variable to be stored inside the flash ?
Using code ?
Using const ?
Using __attribute__((someplace...)) ?

Will this work ?
const char my_great_amount_of_data[128000]={0x01, 0xAA, 0xEE, 0xFF ... \
};
????

I already used things like that in the past with AVR. It worked very well.

Thanks for the attention
TudaDocHell

+1
0
-1
May 28, 2008 - 4:40pm
Guest

Hi,

In order to be able to write to flash, the portion of your application doing this must be located in RAM, since the core can not execute code from flash while writing into it. You can this by adding "__attribute__((section(".data")))" in the prototypes of your functions that are 'running' while you're programming the flash. Note that you will have to compile your code with far calls enabled (compiler option -mlong-calls) in order to access these functions.

regards
Kris