RAM and ROM

For Flowcode users to discuss projects, flowcharts, and any other issues related to Flowcode 2 and 3.

Moderators: Benj, Mods

Post Reply
Ondra
Posts: 325
Joined: Wed Aug 29, 2007 7:33 pm
Been thanked: 2 times

RAM and ROM

Post by Ondra »

Good day all.
I wrote this program using a lot of string manipulations. When I tried to compiled it. My RAM use was way over and my ROM use was 0. Where can I get more information on the effective use of RAM and ROM when building my program. I searched this forum with no luck.

Ondra

User avatar
Benj
Matrix Staff
Posts: 15312
Joined: Mon Oct 16, 2006 10:48 am
Location: Matrix TS Ltd
Has thanked: 4803 times
Been thanked: 4314 times
Contact:

Re: RAM and ROM

Post by Benj »

Hello Ondra

You can create an array or string that goes straight into the program memory by using the rom command.

rom char* ASCII1 = {0x00 , 0x00 , 0x00 , 0x00 , 0x00 , // 32 = <space>
0x00 , 0x06 , 0x5F , 0x06 , 0x00 , // 33 = !
0x07 , 0x03 , 0x00 , 0x07 , 0x03 , // 34 = "
0x24 , 0x7E , 0x24 , 0x7E , 0x24 , // 35 = #
0x24 , 0x2B , 0x6A , 0x12 , 0x00 , // 36 = $
0x63 , 0x13 , 0x08 , 0x64 , 0x63 , // 37 = %
0x36 , 0x49 , 0x56 , 0x20 , 0x50 , // 38 = &
0x00 , 0x07 , 0x03 , 0x00 , 0x00 , // 39 = '
0x00 , 0x3E , 0x41 , 0x00 , 0x00 , // 40 = (
0x00 , 0x41 , 0x3E , 0x00 , 0x00 , // 41 = )
0x08 , 0x3E , 0x1C , 0x3E , 0x08 , // 42 = *
0x08 , 0x08 , 0x3E , 0x08 , 0x08}; // 43 = +

Here it is used to store 60 byte values. I think that there is a maximum size you can use so you can always declare multiple arrays of data.

As the data is a C code variable you will either have to copy the variable a byte at a time into a Flowcode variable.

eg
FCV_TEMP = ASCII1[0];

All of this operation should be detailed in the BoostC manual that is available from the Flowcode V3/BoostC directory.

Ondra
Posts: 325
Joined: Wed Aug 29, 2007 7:33 pm
Been thanked: 2 times

Re: RAM and ROM

Post by Ondra »

Ok Benj. You've raised the bar a little too high too soon. I looked at the BoostC manual. Is there an easier way? Not so much the writing to ROM part, but a more efficient way of putting together a program that saves on RAM use. What if any are the things I should be considering as far as RAM is concerned, when building the program.

Ondra

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

Re: RAM and ROM

Post by Steve »

I've got a few suggestions:

* use BYTEs instead of INTs wherever possible
* keep arrays as small as possible (if you can)
* if using strings, try to allocate a smaller amount of memory to them (e.g. MyString[10])
* don't use variables for constant values
* use hardcoded strings in the program memory

Unfortunately, the current version of Flowcode does not let you use constants as you would variables. This will change.

Ondra
Posts: 325
Joined: Wed Aug 29, 2007 7:33 pm
Been thanked: 2 times

Re: RAM and ROM

Post by Ondra »

Got it. Thanks Steve.

Post Reply