Changing variable name causes crash

Hello,

I experience exactly the same problem as described in this thread: https://industruino.com/forum/help-1/question/what-are-the-software-limits-on-industruino-159, but on a D21G top board. I have re-written and restructured my code several times but I'm always getting to a point where also the slightest change causes the board to freeze. As an example I added a global int that I just set to a value in a function, no other use. If I set the value to 1 when I declare the variabel and to 0 in the function my code is running. But if I instead set the initial value to 0 and change to a 1 in the function the board will freeze on upload.

I use sloeber and build output is:

section             size        addr
.text              29528       16384
.data                336   536870912
.bss                4492   536871248

As far I have understood this equals to 29528 + 336 = 29864 bytes of Flash, and 336 + 4492 = 4828 bytes of RAM for globals.

I have also used the MemoryFree (https://github.com/mpflaga/Arduino-MemoryFree) library to check free RAM, and at one test point in my main loop the result is 27283 byte of free RAM.

I also moved my projekt to the Arduino IDE 1.8.1 and compiled from there, same result when uploading.

This leads me to think there is nothing wrong with my code, and I have plenty of free memory.

Urgently need advice for what could be done to resolve this issue.

Thanks

Gunnar

Gunnar Strömme
Gunnar Strömme
29
| 3 1 2
Asked on 7/18/18, 10:03 AM
0
vote
2246 Views

Seems this has nothing to do with size of the sketch, it's something else. I have removed a lot of code but still with a very strange behavior, I can toggle crash / no crash by chaning the name of a dummy variable in the main sketch. I have posted a question in the sloeber forum here: https://github.com/Sloeber/arduino-eclipse-plugin/issues/1001

Gunnar Strömme
on 7/20/18, 9:32 AM

Problem most likely resolved. After advice from the Industruino team I have scrutinized my code again focusing on memory leaks and out of bound memory access, and finally I found the error. By mistake an array index could be incremented outside the boundary. Obvious when you see it and it has been there in front of my eyes all the time, but when you get stuck it helps a lot to get a push in the right direction from someone else.

Big thanks to the Industruino team

Gunnar Strömme
Gunnar Strömme
29
| 3 1 2
Answered on 7/20/18, 2:17 PM
1
vote

Your answer

Please try to give a substantial answer. If you wanted to comment on the question or answer, just use the commenting tool. Please remember that you can always revise your answers - no need to answer the same question twice. Also, please don't forget to vote - it really helps to select the best questions and answers!

Ask a Question

Keep Informed

About This Forum

This community is for professionals and enthusiasts of our products and services.

Read Guidelines

Question tools

45 follower(s)

Stats

Asked: 7/18/18, 10:03 AM
Seen: 2246 times
Last updated: 7/24/18, 9:06 PM