How to setup data array in program flash

For Flowcode users to discuss projects, flowcharts, and any other issues related to Flowcode 4.
To post in this forum you must have a registered copy of Flowcode 4 or higher. To sign up for this forum topic please use the "Online Resources" link in the Flowcode Help Menu.

Moderator: Benj

Post Reply
MarkW
Flowcode v5 User
Posts: 118
Joined: Thu Sep 17, 2009 1:30 pm
Has thanked: 3 times
Been thanked: 11 times
Contact:

How to setup data array in program flash

Post by MarkW »

Hi All,

I am looking at using a 18F25K22 for a project, where i need to setup a block
of reference data in a section of the program flash memory. This data is not to
be written to flash on every power up, but is put there at program time (when
the chip is programmed). How do i setup this array in the code program such that
the compiler / programmer puts it into flash memory without main program control?
Do you have to setup a C code block with directive commands to the compiler to do this?
I would imagine something like declaring a memory area in flash and then the data array
to be put there..........also how does one read data from that program memory flash once
the main program is running?
I have other questions as well regarding this, but i would like to focus on this issue first!

Regards

Mark

medelec35
Matrix Staff
Posts: 9521
Joined: Sat May 05, 2007 2:27 pm
Location: Northamptonshire, UK
Has thanked: 2585 times
Been thanked: 3815 times
Contact:

Re: How to setup data array in program flash

Post by medelec35 »

Hi Mark,
A simular question was asked here:
http://www.matrixmultimedia.com/mmforum ... =31&t=7389

Hope this helps.

Martin
Martin

MarkW
Flowcode v5 User
Posts: 118
Joined: Thu Sep 17, 2009 1:30 pm
Has thanked: 3 times
Been thanked: 11 times
Contact:

Re: How to setup data array in program flash

Post by MarkW »

Hi Martin

Thanx for the link, interesting problem...but not what i am after. That link
was about writing/reading from the main program running in the chip.

My question was how to setup a compiler directive or whatever in the program
code such that at program time(Hex file into chip), the data block is written
into the flash area by the device programmer. This data is to be non-volatile
therefore the need to put permanently into flash, but not under program
control...but by the programmer tool itself when reading the compiled hex file.........

Thanx

Mark

medelec35
Matrix Staff
Posts: 9521
Joined: Sat May 05, 2007 2:27 pm
Location: Northamptonshire, UK
Has thanked: 2585 times
Been thanked: 3815 times
Contact:

Re: How to setup data array in program flash

Post by medelec35 »

Ah I see now.

What I would do is crate the Flowchart you want to use then compile to hex.
load hex in your programmer.
Now where you see the large group FF you can enter your own data. save hexfile then compile to chip

Or if you know an address you want to save data within flowcode use a c block with:
#pragma DATA address, data1, data2, data3 etc.
Or
#pragma DATA address, “abcdefg1”, “abcdefg2”
“abcdefgX” is a character string, th
charcters will be stored as 8 bit value.

Not tried it my self.

But got that information from BoostC manual

Martin
Martin

MarkW
Flowcode v5 User
Posts: 118
Joined: Thu Sep 17, 2009 1:30 pm
Has thanked: 3 times
Been thanked: 11 times
Contact:

Re: How to setup data array in program flash

Post by MarkW »

Thanx Martin!

I did bit of looking up in the datasheet and BoostC manual and yes i think you
are correct. I think there are a few methods one can achieve this taking a closer look
now at the question.....
Does FC4 have any macros etc to do table read/writes? you need these commands to
access and control the flash memory, otherwise it seems i must create c block with some asm
to do the commands.

But yes, the first question was basically sorted (thanx again Martin).

The next question concerns reading that flash data within FC. I am assuming one has to use the
table read commands to put the data in variables etc ?

How about it FC developer guys? (Ben / Steve etc)....lets have some more macros with advanced
functions like this!

Thanx guys

Mark

User avatar
Steve
Matrix Staff
Posts: 3427
Joined: Tue Jan 03, 2006 3:59 pm
Has thanked: 114 times
Been thanked: 422 times
Contact:

Re: How to setup data array in program flash

Post by Steve »

One thing to note is that not all chips allow internal flash R/W. This is one reason it has not been implemented in Flowcode.

But things might change soon. We have big plans for the components and hope to greatly expand support in this area.

Post Reply