code got too big to fit in the device

Any general or miscellaneous queries that do not fit into the other forum catagories

Moderators: Benj, Mods

hazic
Posts: 24
Joined: Tue Jan 05, 2010 8:59 am
Been thanked: 1 time
Contact:

code got too big to fit in the device

Postby hazic » Sun Jun 26, 2011 8:35 am

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

User avatar
JohnCrow
Valued Contributor
Valued Contributor
Posts: 1367
Joined: Wed Sep 19, 2007 1:21 pm
Location: Lincolnshire
Has thanked: 381 times
Been thanked: 714 times
Contact:

Re: code got too big to fit in the device

Postby JohnCrow » Sun Jun 26, 2011 9:50 am

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.
1 in 10 people understand binary, the other one doesn't !

hazic
Posts: 24
Joined: Tue Jan 05, 2010 8:59 am
Been thanked: 1 time
Contact:

Re: code got too big to fit in the device

Postby hazic » Sun Jun 26, 2011 10:07 am

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.

User avatar
JohnCrow
Valued Contributor
Valued Contributor
Posts: 1367
Joined: Wed Sep 19, 2007 1:21 pm
Location: Lincolnshire
Has thanked: 381 times
Been thanked: 714 times
Contact:

Re: code got too big to fit in the device

Postby JohnCrow » Sun Jun 26, 2011 10:20 am

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.
1 in 10 people understand binary, the other one doesn't !

User avatar
medelec35
Valued Contributor
Valued Contributor
Posts: 8334
Joined: Sat May 05, 2007 2:27 pm
Location: Northamptonshire, UK
Has thanked: 2382 times
Been thanked: 3393 times
Contact:

Re: code got too big to fit in the device

Postby medelec35 » Sun Jun 26, 2011 12:11 pm

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

'
Martin

If you read a post that is useful, please show appreciation by clicking on thumbs up Icon.

Spanish_dude
Posts: 594
Joined: Thu Sep 17, 2009 7:52 am
Location: Belgium
Has thanked: 63 times
Been thanked: 102 times
Contact:

Re: code got too big to fit in the device

Postby Spanish_dude » Sat Jul 02, 2011 1:12 am

You could attach your flowcode program so we can have a look at it and maybe optimize the code a bit.