Quickly get out of RAM v.0.2.2

Hey!

There has been much talk about RAM use in the new firmware 0.2.2 update. I’ve read all posts related to this but I prefer to ask it directly.

The point is that I developed my app with firmware version 0.2.1 and I could use this strucutre:

typedef struct{
    uint8_t pos;
    char c[10];
    char na[40];
    uint8_t rel;
    uint32_t li;
} DATA;

And then create this array, with a size of 12. And it worked well, no RAM issues.

DATA  myData[12];

Now (with v.0.2.2) only works if the size of myData[] array is 1. If I put a bigger value, the core blinks in red 8 times (RAM issue). I don’t understand why there is such a big difference from 12 to only 1 in the new firmware update. I read the new firmware needs more RAM but in my case the difference is huge.

Any ideas of what could it be or if it is normal in the new firmware update?

Thanks guys.

2 Likes

We have been adding features for the current firmware v.0.2.2 and that caused more ram to be used and less for the user.

The next firmware push will significantly reduce ram usage by the stack so bear with us for a while more! :slight_smile:

IF you are interested to find out more you can read here:

It has been merged into ‘master’ waiting to be pushed to the Web IDE compiler :slight_smile:

2 Likes

Thanks @kennethlimcp for your answer!! The point is that when I verify the code with myData[12] (size of array 12) I get I have used 84% of RAM so in theory I should work, isn’t it?

Output of arm-none-eabi-size:

text	 data	 bss	 dec	 hex
77528	3116	14164	94808	17258

In a nutshell:
Flash used	80644 / 110592	72.9 %
RAM used	17280 / 20480	84.4 %

I can’t comment much since i don’t run your code but it’s 84.4% when compiled but increases due to usage and exceeds it.

That’s what i have been observing so far :wink:

But look at @clex’s example - 2 uint8_t’s, 50 char’s and 1 uint32_t, done 12 times takes at most 700 BYTES of data.

A tiny PIC10F can do this, why can’t a mighty ARM Cortex-M3?

I’m not saying it cannot.

If you take out the stack running on the core for cloud/security/encrypt/decrypt, you can have all the 20KB of SRAM

I said that the current firmware V0.2.2 used up more ram and left lesser for the user.

Since @clex does not explicitly state if his array myData is declared public or within a function, it’s not easy to give a definite answer.
There is a fundamental difference between the two kinds of variables.
Maybe this thread that deals with a similar question might be interesting to read.