questions on program memory(flash) limitations (uno)

so, my arduino is being ordered right now, and i'm planning to make a robot/computer with it. 1 of my designs is an operating system, that runs programs and gives them access to displayable dialog boxes, and some basic graphics witch are shown trough cereal on my laptop, and eventually to a screen trough the tellymate sheild. the OS will be more of an application starter, as all it does when the application loop is "running" is check to see if the app is still doing so(via a variable) and to enter the menu again when it closes. these apps will not be external, but stored in the ATmega, so its obvious i might have space problems if I add too mutch apps.

so here are my questions: how much lines of code can you store on the 32Kb? what is the most powerful thing you can do without running out of space? what can U do to "optimize" code, and how effective will that be? how many apps whud you be able to fit on the memory? (the apps I will make are like sensor graphs, a very simple game, data tables, control panel witch sends data according to pressed buttons etc.) have you ever run out of memory, and if yes, what did your code do?

i just want to know if there is anything that might limit my designs, because i have no idea of how big that is because i useually code apps for the computer in java, witch can usually be over 50Kb sorry for tha horrable spelling.

so here are my questions:
how much lines of code can you store on the 32Kb?
what is the most powerful thing you can do without running out of space?
what can U do to “optimize” code, and how effective will that be?
how many apps whud you be able to fit on the memory? (the apps I will make are like sensor graphs, a very simple game, data tables, control panel witch sends data according to pressed buttons etc.)
have you ever run out of memory, and if yes, what did your code do?

You don’t store lines of code on the Arduino, so the first question is meaningless.
Define “powerful”
Lots, sometimes very, sometimes not at all.
One app.
Yes. The program went berserk.

1.You don't store lines of code on the Arduino, so the first question is meaningless. 2.Define "powerful" 3.Lots, sometimes very, sometimes not at all. 4.One app. 5.Yes. The program went berserk.

i think you misunderstood (my fault and my english,sorry) 1. i meant how meany lines of code you give to the compiler to compile and be over the size limit. 2. capable, functional, professional, feature-full, intelegent. 3. how whud you? 4. really? even if its just a very simple one? they get their own setup and loop...things... i'm pretty sure something that you can fit 2 programs that only take data and print it on screen, or something. even an app that just resets it is planned(although that will only need a "setup" or whatever that was called) 5. i meant, what was the program supposed to do, an alternative answer to question 2.

1) is still pretty meaningless - a line of code could be a simple "i++", or a call to a function with twelve parameters. 2) No, still meaningless. 3) It depends on the code - sometimes the compiler is smarter than the programmer, and it just isn't worth it. 4) A sketch has one setup and one loop. Define "app". 5) The sketch was supposed to...no, the flashbacks are too horrible, I'm sorry I just can't...those poor hamsters

1) is still pretty meaningless - a line of code could be a simple "i++", or a call to a function with twelve parameters. 2) No, still meaningless. 3) It depends on the code - sometimes the compiler is smarter than the programmer, and it just isn't worth it. 4) A sketch has one setup and one loop. Define "app". 5) The sketch was supposed to...no, the flashbacks are too horrible, I'm sorry I just can't.

1.generaly speaking, including comments and whatnot 3. yea, that can get very annoying. well, i know one example: instead of multiplying by 2 you carry right 1. i know how this logic works cuz i made a 6-Bit binary CPU in a computer game(and a GPU,the 1st ever in minecraft) 4. look, ill show you some code(this isnt real code, just to show an example)of how apps will run.

void runapp1()
{
boolean app1run=true;
app1setup();
while(app1run==true)
{
app1loop();
}
}
void app1loop()
{
//do stuff
//when its done doing whatever, or when certain button is pressed:
app1run=false;
}

so the OS simply calls runapp1 and there.(o, and tell me if there are errors, i need to start learning C.) 5. oookkkk.

instead of multiplying by 2 you carry right 1.

I don't quite know how to break this to you...

and tell me if there are errors, i need to start learning C.)

void runapp1()
{
boolean app1run=true;
app1setup();
while(app1run==true)
{
app1loop();
}
}

Explain to me how you can ever exit the "while" loop

Explain to me how you can ever exit the "while" loop

when the var app1run==false,or doesnt that work in C?

I don't quite know how to break this to you...

what? sure, you cant multiply by whatever number you wish, but if you need to doubble a number, or halv it, that is what i use. sure, los of precision, big numbers cause probs, or inversion bla bla bla... unless of cource, the chip works in a different way i expect it to carry, or store numbers in binary.

enyhow, this is getting off-topic.

so... i dud some reaserch in my boredom, and it turns out there is something called the 4K java game programming contest. they have 1 main rule: the game must be under 4KB. some entries are actually pretty good, with 8-bit colours, 2.5D engines and retro remakes.

so i think i can fit 2 data-displaying apps on that 32Kb. still, what whud be the biggest piece of code you can fit on that, because java has a lot of code needed for interfacing with a GPU, yet again it may have more commands, meaning you need less code.

when the var app1run==false,or doesnt that work in C?

Yes, of course it works, but how does "app1run" get false?

what? sure, you cant multiply by whatever number you wish, but if you need to doubble a number, or halv it, that is what i use.
sure, los of precision, big numbers cause probs, or inversion bla bla bla...
unless of cource, the chip works in a different way i expect it to carry, or store numbers in binary.

"carry" has a quite specific meaning in computing - I think you mean "shift", and to double a number, it is left shift, not right.

AWOL:

when the var app1run==false,or doesnt that work in C?

Yes, of course it works, but how does "app1run" get false?

what? sure, you cant multiply by whatever number you wish, but if you need to doubble a number, or halv it, that is what i use.
sure, los of precision, big numbers cause probs, or inversion bla bla bla...
unless of cource, the chip works in a different way i expect it to carry, or store numbers in binary.

"carry" has a quite specific meaning in computing - I think you mean "shift", and to double a number, it is left shift, not right.

yay! im a natural coder!(i seriously only looked at examples to get this far in C,quite similar to java, too) when you press/close/quit the application, the application will set it to false, returning to the OS. i will probably make some sort of force close system later, but that is the main concept.

next: oops! i get those confused due to how i actually make them. yea, i meant shift, but for some reason i like to callit carry because i "carry" the data to the right or left.

The biggest piece of code you can fit on that is one that compiles to 32kb. You fail to understand that a) it is not the number of lines that matters b) that different pieces of code compile to completely different constructs c) that the compiler will optimize code where possible, depending on flags you pass the compiler, which can affect the file size in both positive and negative ways.

And the reason you will only ever be able to "fit" one program is that it is a microprocessor, and it only ever runs one program. Running multiple "programs" requires an operating system with a scheduler. While you're free to write one (or use e.g. FreeRTOS), you're technically still writing and uploading a single binary which gets executed.

@OP: would one of the other language forums in the "international" section be better for your native language?

dominikh: The biggest piece of code you can fit on that is one that compiles to 32kb. You fail to understand that a) it is not the number of lines that matters b) that different pieces of code compile to completely different constructs c) that the compiler will optimize code where possible, depending on flags you pass the compiler, which can affect the file size in both positive and negative ways.

And the reason you will only ever be able to "fit" one program is that it is a microprocessor, and it only ever runs one program. Running multiple "programs" requires an operating system with a scheduler. While you're free to write one (or use e.g. FreeRTOS), you're technically still writing and uploading a single binary which gets executed.

that is what i am doing! it just doesnt have multitasking. and i know that the arduio doesnt exept text, i just wish to ask the approxomite lines of code. and i know comments(//like this) dont compile..just..urg. take the biggest program you made for this chip, and look at the line count. i dont know bout you but at school computer club measures code complexity in lines of code, because program size is unfair, due to the size of sound files, images, whatever.

AWOL: @OP: would one of the other language forums in the "international" section be better for your native language?

loong story. quote from my site, http://dudearentstuff.webs.com/usernamespellingquestions.htm :

why my spelling...sucks i was born in europe, and i learnt dutch there. when w were about to learn the advanced words, we moved to South Africa. in SA, i had to learn english, fast. by the time i got the basics we had to learn advanced eng. that is why i can spel electromagnet, but spell the easy words incorrectly.

english is still hard for me, so evend the words i am learning i might not spell right, so dont put this against me.

along with i hate spelling and french.

on the question, none, im best at English.

because program size is unfair, due to the size of sound files, images, whatever

So, measuring LOCs is fair?
Perfectly valid C replacement for “i++”

i
=
i
+
1
;

]:smiley:

i dont know bout you but at school computer club measures code complexity in lines of code

So do unsuccessful employers…

Anyway, if you want to look at a big project, take a look at the Uzebox, a retro game console developed on an ATmega644

AWOL:

because program size is unfair, due to the size of sound files, images, whatever

So, measuring LOCs is fair? Perfectly valid C replacement for "i++"

i
=
i
+
1
;

]:D

not like enyone will use that, and i know. gaah, just forget that question is there!

just tell me about the memory limitations of arduino, because I want to know what the "boundaries" are, so I don't have this plan and not knowing it wont fit. I don't have an idea of what that size is in C, or how much you can store on that, due to the bacicaly infinite amount of space I have an my laptop to store programs. I don't see how this is such a problem!!!

I don't see how this is such a problem!!!

It is a problem because it is a vague stupid question.

AWOL:

I don't see how this is such a problem!!!

It is a problem because it is a vague stupid question.

GGGGGAAAAAAA! OK, new set of questions, witch are less stupid and vague: 1. how much % of memory whud a line following robot,a 2 wheeled,full rotation servo controlled, 2 line sensor 1 IR rangefinder long distance rated to up to 1.5 meters, arduino uno collision detection capable autonomous battery powered, compass used for making 90 degree sketch use? 2. how many binary commands will fit in, say, 1 tenth of a kilobyte? 3. are these questions "understandable"? did i miss something?