cancel
Showing results for 
Search instead for 
Did you mean: 

pointer or stack problem?

Maddi.Mike
Associate II
Posted on September 23, 2014 at 17:41

I'm not even sure what to ask so I'll explain the problem as best I can. I did search everywhere for an answer. Anyway, I have an embedded project with a STM8S208C8 micro. I developed the project in C using ST Visual Develop Version 4.3.5. Down load and debug is via ST-LINK/V2 which I have been doing for a very long time on multiple projects so I do not think this is a trivial problem. The project basically receives GPS serial messages via the UART then translates the data into NMEA 2000 formatted messages and sends out the CAN bus. This is very similar to many many projects I have done over the years. Nothing special to me. Now the problem is that at random times (minutes to hours) the program will fly off to never never land. At that point, interrupts still come in but the program execution is way out somewhere. This looks like your standard everyday pointer corruption or stack overflow problem but I have been unsuccessful in finding the root cause. I would love someone to suggest a good technique in locating this problem. Any details you need, just ask. Thank you very much in advance for any help at all.

5 REPLIES 5
luca239955_stm1_st
Senior II
Posted on September 23, 2014 at 22:12

what compiler?

Are you using long or float in interrupt routines?

Maddi.Mike
Associate II
Posted on September 23, 2014 at 22:20

No float but some long assignments. No math.

luca239955_stm1_st
Senior II
Posted on September 24, 2014 at 08:35

you still don't say what compiler, but, if it's Cosmic, make sure you use the @svlreg keyword on all interrupt functions where long are used.

Regards,

Luca

Maddi.Mike
Associate II
Posted on September 24, 2014 at 13:31

It is Cosmic and I will try that.

Maddi.Mike
Associate II
Posted on September 24, 2014 at 15:28

The missing @svlreg seems to have been the problem. Embarrassingly I knew about the @svlreg and have used it in the past. Somehow I completely forgot about it this time around. It just never dawned on me. Sometimes a fresh pair of eyes is all it takes. Thanks.