2

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.

14
  • 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) Commented Jul 14, 2018 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. Commented Jul 14, 2018 at 22:51
  • #include <MemoryFree.h> Serial.println(freeMemory()); Commented Jul 15, 2018 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. Commented Jul 15, 2018 at 5:35
  • 46% of RAM for the stack is plenty, unless you are doing recursion or loads of stack allocation. Commented Jul 15, 2018 at 12:24

1 Answer 1

2

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.

2
  • 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. Commented Jul 14, 2018 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. Commented Jul 14, 2018 at 23:03

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.