Arduino Due Memory Usage

Hello,

Someone knows a way to measure the SRAM used by the code in various point?

Thanks in advance.

This link should help - Arduino Playground - AvailableMemory

electricteardown:
This link should help - Arduino Playground - HomePage

Seems that methods listed in the link are useful for AVR, Arduino DUE has an ARM architecture. I've tested that methods some months ago with bad results and compilation error. Thanks anyway for the suggestion.

Help with this someone ?
I'm having issues in my program and I'm thinking might be memory related, basically I do:

int Temperature = 50;
int realTemperature = 60;
float Calibration;
Calibration = Temperature / realTemperature

and Calibration is equal to 0, or if I change Temperatura to 70 then Calibration equals 1. Its behaving as a integer while declared as a float. The weird thing is that earlier in the code I have the exact same thing but with Humidity variables and it works fine.
I suspect some memory overflow or something like it ? I'm at a loss...

Try to declare Temperature as float, or cast to (float) at calculation time

I tried , same thing...
It gets even weirder...
Now I tried:

float Calibration = 5/4;
Serial.print (Calibration);

and I get 1.00

C is quite strict about types. it will perform calculations in the type of the arguments, depending on certain rules.

So if you use integer parameters it will do an integer divide, even if the result is going to be stored in a float. If you include an integer variable or constant in an expression which you want to assign to a float, either cast or declare all the arguments as a float type, or a shortcut that often works is to make the first one a float, then the whole expression is done as a float.

To make an integer constant a float constant, add a "f", or ensure there is a decimal point.
The cast "(float)" works for variables.

The following should all produce 1.25 :

float Calibration = 5f/4f;
float Calibration = 5f/4;
float Calibration = 5.0/4.0;
float Calibration = 5.0/4;

And this should fix the first example:

int Temperature = 50;
int realTemperature = 60;
float Calibration;
Calibration = (float)Temperature / realTemperature

In general, best to stick to floats throughout, although some functions might return an integer for example which you may still need to cast to float.

/usr/local/arduino/arduino-1.5.5/hardware/tools/g++_arm_none_eabi/bin/arm-none-eabi-size --format=SysV my.elf

doors666:
/usr/local/arduino/arduino-1.5.5/hardware/tools/g++_arm_none_eabi/bin/arm-none-eabi-size --format=SysV my.elf

Thanks doors666. Good suggestion....and congruent to the title of the topic.

Well I had no idea. Thank you so much for the replies. I'll try it as soon as I get home and report back.

bobcousins and magician thank you guys, it was exactly that, I never have thought that could be the problem, this bug drove me crazy for days... Anyway, I'm not very good at C programming but I'm getting better little by little and help like you guys give is awesome, I find arduino reference very scarce and sometimes get stuck with stupid things like these. But I'm getting better, its a lot of fun, just that I keep forgetting to put those damn ;;; at the end of every line...