Recently, I was talking with Paul, VK3HN, and he mentioned that he had a sketch that, when built for an Uno, was short of RAM.
Paul sent me the code, I compiled it, and didn't get the warning.
This was puzzling of course. I figured it could be one of two things:
- One of the libraries had been improved to use less RAM
- The gcc compiler bundled in the IDE had improved.
Here's the compile output from Paul:
The figure is dynamic memory use:
Quite a big difference if you only have 2048 bytes of RAM.
It turned out that I was on a slightly later version of the IDE 1.8.15 (not even the latest) and Paul was on 1.8.12.
I tried the beta of Arduino IDE 2 and got the same memory use so I think the version of gcc bundled in it is the same.
gcc has lots of options and, while I understand the Arduino IDE wants to keep thinks simple, it would be good if the compile options were exposed.
The lesson out of this is that the tools do get better and it's a good idea to upgrade.
Hi Peter, an interesting result indeed. Have you tried any Teensy boards? They have comparatively huge ram and progmem spaces. And they are seriously fast.
Yes, there are loads of boards with more RAM but the challenge is fitting into these tiny CPUs.
It's great that gcc is being improved so much.
Note that the Flash usage increased by nearly the same amount the RAM decreased (with a discrepancy of only 128 bytes). Certainly looks like a case of libraries being improved with const'ing/PROGMEM'ing.
A way to check is doing a "avr-size program.elf" (where the IDE leaves program.elf from the compiler is an exercise of the reader..) The BSS value, the in-RAM allocation for global variables, would be greatly reduced if the above is true...
Thanks for trying this. As a consequence I updated my IDE and libraries from NT7S (si5351 and JTEncide). It compiled. That gave me the impetus to resume work on the WSPR beacon s riot with GPS, and after a few days of part time play, I'm very happy with it. Thanks for testing on your system Peter.
Post a Comment