Author Topic: undefined interrupt during startup  (Read 8480 times)

Offline rad

  • Newbie
  • *
  • Posts: 18
    • View Profile
undefined interrupt during startup
« on: June 27, 2008, 12:44:26 PM »
Hi all,

some strange thing happends to Me with M52233DEMO. During startup procedure it jumps into static __interrupt__ void undef_int(void) routine (undefined interrupt) but I dont know why. if I test it on real target, watchdog led blink once and then it stops (in undef. int). If I comment out while (1) in this routine (and press F11 aprox. 10 times in debug mode), micro continues without problem and work as expected (but reset led blink once or twice during startup, so it resets during this time). Interesting is, that the same sw in simulator works without problem.

I found out it returns to static __interrupt__ void _RealTimeInterrupt(void) from undef. int. So I put breakpoint in this routine, and check it. When RealTimeInterrupt() is called, it jumps into fnRtmkSystemTick() (its ok), than it looks like RealTimeInterrupt() is called immediatelly again (RealTimeInterrupt() run again, and when its called third time, it jumps into undef. int. routine). I say It looks like its called again, but it actually never returns from RealTimeInterrupt(), just it cycle between { and }. Interesting it that all worked properly till yesterday (I just make some small changes in MyFunc which havent any context with startup code).

Another problem in simulator..when I disconnect simulator and re run it again, it doesnt connect (just 2-3 times from 10). The same problem mention Neil in http://www.utasker.com/forum/index.php?topic=25.0 so Id like to know if someone sort it out...but it isnt so serious problem just now. Id like to know whats wrong with undef. interrupt and how to sort it out (or how to diagnostic it more precise).

Regards, Rad

Offline mark

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 3234
    • View Profile
    • uTasker
Re: undefined interrupt during startup
« Reply #1 on: June 27, 2008, 10:11:15 PM »
Hi Rad

The simulator will not be able to catch all memory releated problems:
eg:
- if the problem is due to RAM limitations it may not be seen (Heap limitations are not 100% accurate since Windows sometimes uses slightly different sized strucs).
- If the file system overwrites code space (due to an overlap) this will also not be seen in the simulator (its code will not be corrupted as on the target).
- If the file system or parameter system accesses non-existing FLASH (due to configuration error) the simulator will probably not know that it is an error (since it uses the configuration to decide).
- Nested interrupts causing stack overflow on the target will not be seen on the simulator - it will not nest interrupts but handle them sequentially.

Exceptions are usually due to illegal accesses. If you believe that this started after a code change it would be interesting to start with the original code again and check exactly what was changed (assuming backups available).

However it may also be just as easy to debug the case. The Coldfire has a very useful exception stack which will often indicate the source of such errors quite well. Use the following as a guide:
http://www.utasker.com/forum/index.php?topic=123.msg468#msg468

If you can identify the problem and correct it using this technique you will never be afraid of such errors again - it is thus a useful experience and good practice.

Good luck

Regards

Mark


Offline rad

  • Newbie
  • *
  • Posts: 18
    • View Profile
Re: undefined interrupt during startup
« Reply #2 on: June 30, 2008, 10:34:19 AM »
Hi Mark,

thank You for Your info, I tried new (empty) project and it works fine as We expected (actually I make some small changes in it, to send some messages by TCPIP, listen at the 2 ports and so on) but as I said It works fine. More interesting is Why is blocked My previous project. I send screenshoot from CW (registers and PC from adress 0). I cannot recognize what happends (I dont know coldfire architecture  too much- still learn it..:)) but in the memory, It looks a bit strange to Me. Anyway I checked SR register during start up, and sequence looks following: first jump into RealTimeInterrupt() is SR 0x2204, when routine ends, it looks like dont leave interrupt, just jump at the first bracket in the interrupt and SR changes to 0x2200, after routine ends, it jumps into unhandled interrupt (as You see at the pic Regs1) with SR 0x2000. This state You see at the pic Regs1 and return adress is set to 0x0004, so I add there screenshoot PC0x0000 for Your reference, but It looks like normal startup code (I dont know motorolas assembler- do You know any good ref. manual where are explained motorola assembly language commands?). If Im right, at adress 0x0000 and 0x0004 are PC and stack, so they are loaded in appropriety regs from this adress after reset..

Have a nice day, Rad

Offline rad

  • Newbie
  • *
  • Posts: 18
    • View Profile
Re: undefined interrupt during startup
« Reply #3 on: June 30, 2008, 10:35:43 AM »
..and second pic, because it didnt allow Me send both in one message..;)

Regards, Rad

Offline mark

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 3234
    • View Profile
    • uTasker
Re: undefined interrupt during startup
« Reply #4 on: June 30, 2008, 11:51:47 AM »
Rad

It is clear form the call stack that the code is crashing in fnGetIP_ARP().
This is possibly because the ARM table hasn't been initialised, which can happen if there is not enough memory available on the heap for its table (unlikely unless you have increased the heap use) or because the initialisation was never called.

See the task configuration of ARP in TaskConfig.h - note that the ARP task must be scheduled before Ethernet or Application so that it is ready to work when needed.

Since this is reproducible I would simply set a break point in the routine fnGetIP_ARP() and step through it to see where it crashes - the reason is probably obvious then.

Regards

Mark