Question about errors encountered when using Arduino SDK.

Hi all, I was hoping that I could get your opinions on errors that I have been encountering while developing using the Arduino SDK.

Right now I have a project that sets up provisioning using the WiFiManager library and then sends POST and GET requests to a server using WiFiClientSecure. Now this program is becoming sizeable and as it grows in size, I am running into more and more CPU exceptions such as Exception 3 and Exception 9 when accessing 2D arrays of C strings which according to this table indicates that I am incorrectly accessing memory. I am wondering if this is a user error or just a side effect of creating a larger program.

I have converted most of the instances of arduino/c++ strings to c strings to avoid the heap and allocate on the stack. I am also trying to keep everything out of the global scope and into local function stacks but I am still having some of these error especially when accessing 2D arrays of C strings.

More recently, I am triggering a panic when calling the yield() method.

I should note that I have been modifying the WiFiManager library to reduce memory usage by streaming gzipped files instead of using string literals.

I guess I am wondering if anyone has suggestions on how to approach these problems in terms of determining the root cause and fixing the problems.

If you want the actual code, I can update my git repository with the latest version once I clean things up.

Or if you have some suggestion on a better place to post, I am all ears.

Posted Nov 17, 2016, 5:52 PM UTC

54
ansedd95•

I have no answers, only similar problem. Hope you find your way forward!

1
thewrongstuff95OP•

Thanks. This is my first embedded project I ever did as well as my first time using the Arduino SDK. I do know C pretty well which I thought would help me. I'm thinking about potentially rewriting from scratch and starting small. Maybe find some tutorials on good practice...I don't know. I'll update this thread if I come up with anything substantial.

2
bvguy•

If you have strings on the stack, are you sure you are not popping the stack? Maybe move them to global or make them static.

1
thewrongstuff95OP•

I am positive that I am accessing the variables in scope so they shouldn't be popped from the stack.

I did have a sizeable array of strings in the stack. I will try making it static. When I made it global, I couldn't access anything past the first string when I accessed it as an extern variable and I also had an issue with the CPU throwing a LoadStoreError exception which makes me think we don't have byte level access in the data section although I may be completely off with that.

1