I am developing a product. I developed every module in the firmware individually. Now I am integrating them but getting memory issues. I am not able to see how the memory is allocated inside the MCU during the runtime.

Can Linux help me debug issues better, using its command than Windows platform?

Thanks in advance.

  • 1
    As I remember the Arduino IDE is the same at Linux or Windows. Doesn't the IDE show you, how much memory is used, at compile time? Or are you using dynamic allocation? (You should ditch those anyway if possible, due to heap fragmentation) – chrisl Jul 14 '18 at 22:37
  • Ide is showing me 54% dynamic allocation leaving 46% for stack I have no track for the stack that where it collapses. I ditched calloc, malloc because of fragmentation in heap. My programme runs nice for some loops but after some time it stucks. I want to track every byte of memory in every function & pin point where memory is getting leaked & program gets stucked. – bandejiya Jul 14 '18 at 22:51
  • #include <MemoryFree.h> Serial.println(freeMemory()); – Juraj Jul 15 '18 at 5:16
  • 1
    Why do you think that you have memory issues? It could be a number of things. The most likely problem is writing beyond a buffer on the stack or a function that returns a pointer to a buffer that was declared in that function on the stack. – Jot Jul 15 '18 at 5:35
  • 46% of RAM for the stack is plenty, unless you are doing recursion or loads of stack allocation. – Edgar Bonet Jul 15 '18 at 12:24

The operating system is irrelevant. If you want to debug the target you need a debugger and a debugging environment. That means a proper hardware debugger interface, not an Arduino's USB serial port, and a proper IDE like Atmel Studio not the Arduino IDE. All are available for both Linux and Windows.

| improve this answer | |
  • I have developed firmware on arduino IDE..! will'nt it will take a lot more efforts to change the IDE..? please suggest any other way if possible to achieve MVP. – bandejiya Jul 14 '18 at 22:58
  • 2
    The Arduino IDE is very easy to program in but almost impossible to debug in. The best you can do is use Serial.print to display information. You cannot do real debugging in the Arduino environment. It's not a professional tool. – Majenko Jul 14 '18 at 23:03

Your Answer

