Page 1 of 1

code got too big to fit in the device

Posted: Sun Jun 26, 2011 8:35 am
by hazic
Hi

I use some components like LCD, I2c, switches, RS232, Step motor. is it possible that the compiled code includes also procedures of the components that I dont use in the code? because I cant fit the file in the device (Atmega16)
is there any option to shrink it in some way?

Thanks

Re: code got too big to fit in the device

Posted: Sun Jun 26, 2011 9:50 am
by JohnCrow
Hi Hazic

When you compile your flowchart, it will only include the devices you have chosen.
Looking at your description, the components you have included will need a fair amount of space, you may have no option but to use a larger processor
Had to do this myself on more than one occasion.

Is it a case of only just not fitting or a lot too big?
One way you could make a size reduction (VERY SMALL) is to use shorter variable names, ensure strings are only defined to be as long as nessesary.
i.e dont leave at the default setting.
I tried this on a fairly large program of mine and managed to get about 10 bytes reduction, so not much but it could be enough to make it fit.

Re: code got too big to fit in the device

Posted: Sun Jun 26, 2011 10:07 am
by hazic
its not a lot too big, it was ok but then I just added a few little changes and it didnt fit
not i'm in a position that if I add even one command it will not fit.

Re: code got too big to fit in the device

Posted: Sun Jun 26, 2011 10:20 am
by JohnCrow
Thats a pain. If a program is well over the size limit you tend to think ah well and just use a bigger chip, but when it only just goes over its frustrating.

You will just have to look closely see if you can take anything out.
My other suggestion is if you are using floating point math, can they be changed to byte or integer.

You could try posting your code on the forum (if its not confidential).
Someone who uses that type processers may be able to suggest other ways optimise it for you.
Sorry I only have flowcode for pics.

Re: code got too big to fit in the device

Posted: Sun Jun 26, 2011 12:11 pm
by medelec35
JohnCrow wrote:Hi Hazic

When you compile your flowchart, it will only include the devices you have chosen.
Looking at your description, the components you have included will need a fair amount of space, you may have no option but to use a larger processor
Had to do this myself on more than one occasion.

Is it a case of only just not fitting or a lot too big?
One way you could make a size reduction (VERY SMALL) is to use shorter variable names, ensure strings are only defined to be as long as nessesary.
i.e dont leave at the default setting.
I tried this on a fairly large program of mine and managed to get about 10 bytes reduction, so not much but it could be enough to make it fit.
I agree 99% with what John has said, e.g keeping string lengths to minimum etc.
The only thing I believe won't make a difference is the length of variable names used.
e.g

Code: Select all

my_variable_name_I_want_to_use_byte=20
will use same space on your target device as

Code: Select all

Var_bte=20
This is because the variable name do not get transferred to the chip.
Where variables are concerned, the amount of room used is due to the type of variable. E.g Byte, int, float and string length etc.
Only difference is if you use longer names, it will help to work out how your program works, if you re-open flowchart a few months down the line.

I agree with John, If you can post your flowchart, I can take a look at it for you, as I now have that version of Flowcode (V4 PRO).
What version do you have?

Martin

'

Re: code got too big to fit in the device

Posted: Sat Jul 02, 2011 1:12 am
by Spanish_dude
You could attach your flowcode program so we can have a look at it and maybe optimize the code a bit.