Timeline for Global variables use to much space in the dynamic memory [closed]
Current License: CC BY-SA 3.0
23 events
when toggle format | what | by | license | comment | |
---|---|---|---|---|---|
Dec 13, 2021 at 9:00 | vote | accept | Natjo | ||
Dec 13, 2021 at 9:00 | vote | accept | Natjo | ||
Dec 13, 2021 at 9:00 | |||||
Dec 2, 2021 at 19:42 | history | closed | Juraj ♦ | Needs details or clarity | |
Aug 24, 2020 at 9:02 | comment | added | Natjo | Unfortunately I could not solve the issue. I think I moved to a larger microcontroller that time. Sorry. You could try to use the source code of the autotune library directly and fine tune it? | |
Aug 23, 2020 at 18:39 | comment | added | Mutaz alHawash | have you solved this, I am facing the same exact issue! as I am currently using the autotune library ! and can't optimize the sample code! please help | |
Nov 25, 2019 at 10:33 | answer | added | user61130 | timeline score: 1 | |
Nov 2, 2019 at 18:50 | answer | added | Hans-Jurgen Greiner | timeline score: 2 | |
Feb 7, 2017 at 19:43 | history | bumped | Community Bot | This question has answers that may be good or bad; the system has marked it active so that they can be reviewed. | |
Jan 8, 2017 at 22:26 | comment | added | jfpoilpret |
The first library defines a class PID_ATune which contains a lot of members, including an array of 100 double , i.e. 400 bytes for each instance of PID_ATune . Not sure so many double are needed there, but you could first try to reduce this number.
|
|
Jan 8, 2017 at 20:34 | review | Close votes | |||
Jan 24, 2017 at 3:01 | |||||
Jan 8, 2017 at 18:52 | history | bumped | Community Bot | This question has answers that may be good or bad; the system has marked it active so that they can be reviewed. | |
Dec 9, 2016 at 15:38 | answer | added | LeaPoli | timeline score: 2 | |
Dec 9, 2016 at 14:35 | comment | added | Mali | @Jonas, because on arduino, double and float have the same size : arduino.cc/en/Reference/Float or arduino.cc/en/Reference/Double | |
Dec 9, 2016 at 14:26 | comment | added | Natjo | @EdgarBonet I reduced the number to 80, it helped, thank you! Why does it not change memory consumption if I change the double to float? | |
Dec 9, 2016 at 14:13 | comment | added | Edgar Bonet |
How many of those objects do you instanciate? The most obvious candidate for memory saving is double lastInputs[100]; in class PID_ATune . It takes 400 bytes. If you shorten this array, make sure you don't access it out of bonds.
|
|
Dec 9, 2016 at 14:07 | comment | added | st2000 | This is "off the cuff" advice, hence it is only a comment, not an answer, but, if you are hurting for memory why not switch to an ARM based Arduino. Many ARM based Arduino's have much more memory than, say, an Uno. | |
Dec 9, 2016 at 14:05 | comment | added | st2000 | A very generic description: Variables that hang around (global, static, ect) are assigned their own memory location in RAM, variables that have limited scope are temporarily assigned a memory location in the RAM in an area called the stack & variables that never change can be put into program memory. On an embedded processor this usually means putting variable into flash. | |
Dec 9, 2016 at 14:02 | comment | added | Natjo | I checked and about 75% of global variables are already used by the libraries I use. Since they are open source I was hopping to change those. They are provided in the links I gave in my question. | |
Dec 9, 2016 at 13:56 | comment | added | KIIV | Well, then you should provide your code so we can try it... | |
Dec 9, 2016 at 13:48 | review | First posts | |||
Dec 9, 2016 at 15:17 | |||||
Dec 9, 2016 at 13:48 | comment | added | Natjo | I shortened them down to 1 letter, to see how far it reduces the size, but putting it into flash memory won't solve the problem, since it is not enough. | |
Dec 9, 2016 at 13:47 | comment | added | KIIV | Did you placed your string literals into the flash memory? | |
Dec 9, 2016 at 13:44 | history | asked | Natjo | CC BY-SA 3.0 |