Domanda

I am working on a simple MSP430 application, which communicates over radio with similar other devices and logs data to flash. I am using wake on radio to save power. I am using mspgcc and mspdebug for programming in C.

My issue is following: My timer stops working after some time, however device keep receiving data.i.e. receive interrupt keeps working,but timer stops and so does everything as main loop depends on timer.

I understand that my stack might be getting corrupted. as when device gets stuck and when I print current register values, they are always the same :

    pc/r0: 8092  sp/r1: 053e  sr/r2: 0059  r3: 0000  
    fp/r4: ffff  r5: 5a08     r6: ffff     r7: ffff  
    r8: ffff     r9: ffff     r10: ffff    r11: 0000  
    r12: 0009    r13: 000c    r14: 0009    r15: 0001 

a simple backtrace shows nothing on stack.. just main() I always get same value for SP and SR. I have current stack, however I have little knowledge of assembly, is there any way I can understand what is going on, rather than learn assembly and manually backtrace everything. If further information is needed please let me know. I am really sorry for asking such a question, however google was of little help. Is there any way I can backtrace(not manually) if I have whole memory dump with me?

È stato utile?

Soluzione

You may have a case of stack overflow. The real one, not the site :)

0x0530 is very low for your stack pointer. In the memory map for my device, its for peripherals.

Why it gets this value? I can only speculate.

  1. Do you initialize SP at start-up? Your compiler may do it for you. If you don't know, check in the debugger what the value of SP is before running (at program start). Run a couple of seconds, stop, and check again.
  2. Search for "stack" in the listing or map file generated at compile time. Can you find any information about the location and size of your stack?
  3. Do you have recursive functions?
  4. Are you declaring big local arrays in functions?
  5. Anything else that might be taking a lot of RAM?
Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top